Skip to content

Instantly share code, notes, and snippets.

Avatar

Myles Borins MylesBorins

View GitHub Profile
@MylesBorins
MylesBorins / index.mjs
Created Feb 21, 2021
No more CJS `$ node --experimental-loader ./no-cjs.mjs index.mjs`
View index.mjs
import './no-more.cjs';
View index.js
const namespace = require('./wrapper');
console.log(namespace);
@MylesBorins
MylesBorins / maybe-simple.md
Created Jan 8, 2021
An attempt to document exports
View maybe-simple.md

The "exports" field allows defining the entry points of a package. Through the use of conditional exports loader specific entries can be defined.

It can be a string an object or an array

If package.exports is a string an import or require of your package will always resolve to that string

If package.exports is an object you can define two types of fields.

@MylesBorins
MylesBorins / 15.x-commits.md
Created Jan 5, 2021
branch-diff v15.x-staging upstream/master --exclude-label semver-major,dont-land-on-v15.x,backport-requested-v15.x,backported-to-v15.x,backport-blocked-v15.x,backport-open-v15.x --filter-release
View 15.x-commits.md
View fs-promises-polyfill.js
try {
require('fs/promises');
} catch (e) {
const {join} = require('path');
const {promises} = require('fs');
const polyfillRoot = join(__dirname, 'node_modules', 'fs')
const polyfillPath = join(polyfillRoot, 'promises.js');
require.cache[polyfillPath] = {
id: polyfillPath,
path: polyfillRoot,
@MylesBorins
MylesBorins / v14.x-diff.md
Last active Dec 11, 2020
branch-diff v14.x-staging upstream/v15.x --exclude-label semver-major,semver-minor,dont-land-on-v14.x,backport-requested-v14.x,backported-to-v14.x,backport-blocked-v14.x,backport-open-v14.x,baking-for-lts --filter-release
View v14.x-diff.md
View gist:95ea3eff7271415131348ae9494d6838
diff --git a/lib/npm.js b/lib/npm.js
index 79d276722..7fb234cc9 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -3,6 +3,30 @@
// we define and instantiate the singleton ahead of loading any modules
// required for its methods.
+/* istanbul ignore next */ {
+ const timers = {}
@MylesBorins
MylesBorins / v12.x-backport.md
Last active Nov 3, 2020
branch-diff v12.x-staging upstream/v14.x --exclude-label semver-major,dont-land-on-v12.x,backport-requested-v12.x,backported-to-v12.x,backport-blocked-v12.x,backport-open-v12.x --filter-release
View v12.x-backport.md
View backtrace
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007fff7180933a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff718c5e60 libsystem_pthread.dylib`pthread_kill + 430
frame #2: 0x00007fff71790808 libsystem_c.dylib`abort + 120
frame #3: 0x00007fff7178fac6 libsystem_c.dylib`__assert_rtn + 314
frame #4: 0x00000001011d7ee3 node`uv_close.cold.1 + 35
frame #5: 0x00000001009363d8 node`uv_close(handle=<unavailable>, close_cb=<unavailable>) at core.c:178:5 [opt]
frame #6: 0x0000000102de1065 fse.node`fse::FSEvents::Stop(Nan::FunctionCallbackInfo<v8::Value> const&) [inlined] fse::FSEvents::asyncStop(this=<unavailable>) at async.cc:42:3 [opt]
frame #7: 0x0000000102de104a fse.node`fse::FSEvents::Stop(info=0x00007ffeefbfe968) at methods.cc:33 [opt]
frame #8: 0x0000000102de238d fse.node`Nan::imp::FunctionCallbackWrapper(info=0x00007ffeefbfe9f0) at nan_callbacks_12_inl.h:176:3 [opt]
@MylesBorins
MylesBorins / changes.md
Last active Aug 17, 2020
branch-diff v14.x-staging upstream/master --exclude-label semver-major,dont-land-on-v14.x,backport-requested-v14.x,backported-to-v14.x,backport-blocked-v14.x,backport-open-v14.x --filter-release
View changes.md