- A package (
react-dom
) has a dedicated entrypoint `react-dom/server for code that isn't compatible with a browser environment. - A package (
angular
) exposes multiple independent APIs, modeled via import paths likeangular/common/http
. - A package (
lodash
) allows to import individual functions, e.g.lodash/map
. - A package is exclusively exposing an ESM interface.
- A package is exclusively exposing a CJS interface.
- A package is exposing both an ESM and a CJS interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client.mjs: | |
import "fs"; | |
[A]: | |
parentResolve() | |
[B]: | |
parentResolve() | |
[native]: | |
'fs' -> 'node:fs' | |
'fs' -> $BWRAP = 'data:import "node:fs";' | |
'fs' -> $AWRAP = 'data:import "$BWRAP";' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> make -j4 | |
/Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -C out BUILDTYPE=Release V=0 | |
LD_LIBRARY_PATH=/Users/jkrems/Projects/node/node/out/Release/lib.host:/Users/jkrems/Projects/node/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /Users/jkrems/Projects/node/node/out/Release/obj/gen; python tools/js2c.py lib/internal/bootstrap/environment.js lib/internal/bootstrap/loaders.js lib/internal/bootstrap/node.js lib/internal/bootstrap/pre_execution.js lib/internal/per_context/primordials.js lib/internal/per_context/setup.js lib/internal/per_context/domexception.js lib/async_hooks.js lib/assert.js lib/buffer.js lib/child_process.js lib/console.js lib/constants.js lib/crypto.js lib/cluster.js lib/dgram.js lib/dns.js lib/domain.js lib/events.js lib/fs.js lib/http.js lib/http2.js lib/_http_agent.js lib/_http_client.js lib/_http_common.js lib/_http_incoming.js lib/_http_outgoing.js lib/_http_server.js lib/https.js lib/inspector.js lib/module.js lib/net.js lib/os.j |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function calculate(expression) { | |
// [...] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const ivm = require('isolated-vm'); | |
function handleParseJob(code) { | |
return new ivm.ExternalCopy(JSON.parse(code), { transferOut: true }); | |
} | |
function transferInExternalCopy(copy) { | |
return copy.copy({ transferIn: true }); |
- Early work by Ihab Awad (Google) and Kris Kowal (FastSoft)
- 2009-09: 2nd draft of module strawman, still very close to "closures as modules",
export x = 42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// V8 6.2 required | |
'use strict'; | |
const fs = require('fs'); | |
const { Session } = require('inspector'); | |
const { promisify } = require('util'); | |
const session = new Session(); | |
if (session != null) { | |
session.connect(); |