Michaël Zasso
7e5bf80fd1
lib: enforce use of Promise from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30936
Refs: https://github.com/nodejs/node/issues/30697
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-12-16 08:40:14 +01:00
qualitymanifest
7ab21b2f57
lib: add parent to ERR_UNKNOWN_FILE_EXTENSION
...
- default_resolve updated to pass parentURL into error
- ERR_UNKNOWN_FILE_EXTENSION updated to include parentURL
- test added to check for import message in error
PR-URL: https://github.com/nodejs/node/pull/30728
Fixes: https://github.com/nodejs/node/issues/30721
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-12-06 23:59:39 -05:00
Corey Farrell
4ec02d5afd
module: fix dynamic import from eval
...
This allows dynamic import to work from CLI `--eval` with or without
`--input-type=module`.
Fixes: https://github.com/nodejs/node/issues/30591
PR-URL: https://github.com/nodejs/node/pull/30624
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com >
Reviewed-By: Ben Coe <bencoe@gmail.com >
2019-12-06 17:55:02 -08:00
Rongjian Zhang
aa4c57ae7e
module: add warnings for experimental flags
...
PR-URL: https://github.com/nodejs/node/pull/30617
Fixes: https://github.com/nodejs/node/issues/30600
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-12-04 22:36:37 -05:00
Myles Borins
ee953d813b
esm: make specifier flag clearly experimental
...
`--es-module-specifier-resolution` is the only flagged portion of the
ESM implementation that does not have the word experimental in the flag
name. This commit changes the flag to:
`--experimental-specifier-resolution`
`--es-module-specifier-resolution` remains as an alias for backwards
compatibility but it is no longer documented.
PR-URL: https://github.com/nodejs/node/pull/30678
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-12-04 13:21:41 -08:00
Bradley Farias
568968e39b
esm: data URLs should ignore unknown parameters
...
PR-URL: https://github.com/nodejs/node/pull/30593
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-11-26 11:00:33 -06:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
...
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-25 10:28:15 +01:00
Guy Bedford
250a995656
esm: disable non-js exts outside package scopes
...
PR-URL: https://github.com/nodejs/node/pull/30501
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2019-11-16 23:26:49 -08:00
Myles Borins
1e5ed9a5db
esm: modify resolution order for specifier flag
...
Currently `--es-module-specifier-resolution=node` has an alternative
resolution order than the default in common.js, this causes
inconsistencies. As discussed in @nodejs/modules we want to preserve
resolution order between implementations.
PR-URL: https://github.com/nodejs/node/pull/29974
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-10-16 22:01:19 -04:00
Bradley Farias
a6b030d5ac
module: refactor modules bootstrap
...
PR-URL: https://github.com/nodejs/node/pull/29937
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-10-16 21:50:05 -04:00
Gus Caplan
f9caee986c
vm: add Synthetic modules
...
- Refactor vm.SourceTextModule (again)
- Add vm.Module abstract superclass
- Add vm.SyntheticModule
Refs: https://heycam.github.io/webidl/#synthetic-module-records
PR-URL: https://github.com/nodejs/node/pull/29864
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-10-14 14:25:38 -07:00
Guy Bedford
c0437d2633
Revert "esm: remove experimental status from JSON modules"
...
This reverts commit ec8776da6f .
PR-URL: https://github.com/nodejs/node/pull/29754
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2019-10-08 21:18:04 -07:00
Guy Bedford
ffd22e8198
module: use v8 synthetic modules
...
PR-URL: https://github.com/nodejs/node/pull/29846
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
2019-10-06 13:30:11 -04:00
Bradley Farias
0b495a899b
esm: remove proxy for builtin exports
...
PR-URL: https://github.com/nodejs/node/pull/29737
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2019-10-05 20:11:15 -04:00
bcoe
e1e2f669f6
process: add source-map support to stack traces
...
PR-URL: https://github.com/nodejs/node/pull/29564
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-10-05 17:08:00 -07:00
Gus Caplan and Michaël Zasso
5e7946fe79
vm: refactor SourceTextModule
...
- Removes redundant `instantiate` method
- Refactors `link` to match the spec linking steps more accurately
- Removes URL validation from SourceTextModule specifiers
- DRYs some dynamic import logic
Closes: https://github.com/nodejs/node/issues/29030
Co-Authored-By: Michaël Zasso <targos@protonmail.com >
PR-URL: https://github.com/nodejs/node/pull/29776
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
2019-10-02 15:54:35 -07:00
Benjamin Coe
8f06773a8c
process: initial SourceMap support via NODE_V8_COVERAGE
...
PR-URL: https://github.com/nodejs/node/pull/28960
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
2019-09-22 00:39:41 +02:00
Bradley Farias and Jan Olaf Krems
9fd9efa492
esm: support loading data URLs
...
Co-Authored-By: Jan Olaf Krems <jan.krems@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/28614
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2019-08-20 09:34:18 -05:00
Bradley Farias
7e8ad9bad8
policy: add dependencies map for resources
...
Adds a "dependencies" field to resources in policy manifest files.
In order to ease development and testing while using manifests,
wildcard values for both "dependencies" and "integrity" have been
added using the boolean value "true" in the policy manifest.
PR-URL: https://github.com/nodejs/node/pull/28767
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-07-26 15:13:53 -05:00
Guy Bedford
4565292a77
esm: ensure cwd-relative imports for module --eval
...
PR-URL: https://github.com/nodejs/node/pull/28389
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-06-30 13:21:09 -04:00
Ruben Bridgewater
9939762322
module: prevent race condition while combining import and require
...
This checks if any require calls have happened to the same file
during the file read. If that was the case, it'll return the same
module instead of creating a new instance.
PR-URL: https://github.com/nodejs/node/pull/27674
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-06-15 11:23:03 +02:00
Gus Caplan
e2c0c0c680
lib: rework logic of stripping BOM+Shebang from commonjs
...
Fixes https://github.com/nodejs/node/issues/27767
PR-URL: https://github.com/nodejs/node/pull/27768
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2019-05-26 13:04:29 -05:00
cjihrig
3293bbf77a
esm: refactor createDynamicModule()
...
This commit refactors createDynamicModule() for readability:
- The map() callback functions are named and moved to a higher
scope.
- The two export map() loops are combined.
- JSON.stringify() is only called once per import.
PR-URL: https://github.com/nodejs/node/pull/27809
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-05-24 08:33:53 -04:00
Myles Borins
c3f72510c8
esm: remove experimental status from JSON modules
...
The HTML spec has officially landed JSON Modules and as such I think
we can move them out of the "experimental" status. They will still
be behind the `--experimental-modules` flag until the entire esm
implementation moves out of experimental.
Refs: https://html.spec.whatwg.org/#creating-a-json-module-script
PR-URL: https://github.com/nodejs/node/pull/27752
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-05-22 04:06:34 -04:00
cjihrig
873c372e67
esm: use correct error arguments
...
ERR_UNKNOWN_FILE_EXTENSION expects a single argument. This
commit fixes the argument count.
PR-URL: https://github.com/nodejs/node/pull/27763
Fixes: https://github.com/nodejs/node/issues/27761
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
2019-05-20 10:26:23 -04:00
Myles Borins
bbc254db5d
esm: --experimental-wasm-modules integration support
...
PR-URL: https://github.com/nodejs/node/pull/27659
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2019-05-17 02:25:20 +02:00
Joyee Cheung
80c0b89bbb
module: initialize module_wrap.callbackMap during pre-execution
...
Since the bootstrap does not actually use ESM at all, there
is no need to create this map so early. This patch moves
the initialization of the map to pre-execution,
so that the only binding loaded in loaders is native_module.
In addition, switch to SafeWeakMap.
PR-URL: https://github.com/nodejs/node/pull/27323
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-04-25 12:11:10 +08:00
Joyee Cheung
49ee010005
lib: use getOptionValue instead of process underscore aliases
...
This patch reduce usage of `process._breakFirstLine` and
`process._eval` in the internals and use
`getOptionValue('--inspect-brk')` and `getOptionValue('--eval')`
instead wherever possible.
PR-URL: https://github.com/nodejs/node/pull/27278
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-04-20 00:20:37 +08:00
Geoffrey Booth
96e46d37c4
esm: replace --entry-type with --input-type
...
New flag is for string input only
PR-URL: https://github.com/nodejs/node/pull/27184
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2019-04-16 12:41:59 -04:00
Michaël Zasso
908292cf1f
lib: enforce the use of Object from primordials
...
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2019-04-12 05:38:45 +02:00
dnlup
d6317d0a45
module: remove usage of require('util')
...
Use `require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` in
`lib/internal/modules/esm/create_dynamic_module.js`.
PR-URL: https://github.com/nodejs/node/pull/26803
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-04-10 23:21:59 +02:00
Michaël Zasso
112cc7c275
lib: use safe methods from primordials
...
This changes the primordials to expose built-in prototypes with their
methods already uncurried.
The uncurryThis function is therefore moved to the primordials.
All uses of uncurryThis on built-ins are changed to import the relevant
prototypes from primordials.
All uses of Function.call.bind are also changed to use primordials.
PR-URL: https://github.com/nodejs/node/pull/27096
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-04-08 11:23:09 +02:00
Myles Borins
7a547098d5
esm: use primordials
...
Converted uses of Object and Map to use frozen built
in primordials.
PR-URL: https://github.com/nodejs/node/pull/26954
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-03-30 13:02:33 +01:00
b1094dbe19
esm: phase two of new esm implementation
...
This PR updates the current `--experimental-modules` implementation
based on the work of the modules team and reflects Phase 2 of our
new modules plan.
The largest differences from the current implementation include
* `packge.type` which can be either `module` or `commonjs`
- `type: "commonjs"`:
- `.js` is parsed as commonjs
- default for entry point without an extension is commonjs
- `type: "module"`:
- `.js` is parsed as esm
- does not support loading JSON or Native Module by default
- default for entry point without an extension is esm
* `--entry-type=[mode]`
- allows you set the type on entry point.
* A new file extension `.cjs`.
- this is specifically to support importing commonjs in the
`module` mode.
- this is only in the esm loader, the commonjs loader remains
untouched, but the extension will work in the old loader if you use
the full file path.
* `--es-module-specifier-resolution=[type]`
- options are `explicit` (default) and `node`
- by default our loader will not allow for optional extensions in
the import, the path for a module must include the extension if
there is one
- by default our loader will not allow for importing directories that
have an index file
- developers can use `--es-module-specifier-resolution=node` to
enable the commonjs specifier resolution algorithm
- This is not a “feature” but rather an implementation for
experimentation. It is expected to change before the flag is
removed
* `--experimental-json-loader`
- the only way to import json when `"type": "module"`
- when enable all `import 'thing.json'` will go through the
experimental loader independent of mode
- based on https://github.com/whatwg/html/issues/4315
* You can use `package.main` to set an entry point for a module
- the file extensions used in main will be resolved based on the
`type` of the module
Refs: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
Refs: https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal
Refs: https://github.com/nodejs/modules/pull/180
Refs: https://github.com/nodejs/ecmascript-modules/pull/6
Refs: https://github.com/nodejs/ecmascript-modules/pull/12
Refs: https://github.com/nodejs/ecmascript-modules/pull/28
Refs: https://github.com/nodejs/modules/issues/255
Refs: https://github.com/whatwg/html/issues/4315
Refs: https://github.com/w3c/webcomponents/issues/770
Co-authored-by: Myles Borins <MylesBorins@google.com >
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com >
Co-authored-by: Evan Plaice <evanplaice@gmail.com >
Co-authored-by: Geoffrey Booth <webmaster@geoffreybooth.com >
Co-authored-by: Michaël Zasso <targos@protonmail.com >
PR-URL: https://github.com/nodejs/node/pull/26745
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Ben Coe <bencoe@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
2019-03-27 15:52:11 -04:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
...
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
2019-03-27 17:20:06 +01:00
dnlup
0f2bf72604
module: remove usage of require('util') in esm/translators.js
...
Use `require('internal/util/debuglog').debuglog` and
`require('internal/util').promisify`
instead of `require('util').debuglog` and `require('util').promisify` in
`lib/internal/modules/translators.js`.
PR-URL: https://github.com/nodejs/node/pull/26806
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-25 00:34:17 +01:00
dnlup
ad661ca209
module: remove usage of require('util') in esm/loader.js
...
Use `require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` in `lib/internal/modules/esm/loader.js`.
PR-URL: https://github.com/nodejs/node/pull/26804
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-25 00:33:06 +01:00
dnlup
25b78c0940
module: remove usage of require('util')
...
Use `require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` in `lib/internal/modules/esm/module_map.js`.
Refs: https://github.com/nodejs/node/issues/26546
PR-URL: https://github.com/nodejs/node/pull/26805
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-03-24 21:45:39 +08:00
Joyee Cheung
84156cf10e
module: do not share the internal require function with public loaders
...
This patch removes `NativeModule.require` and
`NativeModule.requireWithFallbackInDeps`. The public loaders now
have to use a special method
`NativeModule.prototype.compileForPublicLoader()` to compile native
modules. In addition this patch moves the decisions of proxifying
exports and throwing unknown builtin errors entirely to public
loaders, and skip those during internal use - therefore `loaders.js`,
which is compiled during bootstrap, no longer needs to be aware of
the value of `--experimental-modules`.
PR-URL: https://github.com/nodejs/node/pull/26549
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-19 04:05:38 +08:00
Ali Ijaz Sheikh
05cd1a0929
lib: requireStack property for MODULE_NOT_FOUND
...
Include the stack of requires that led to a MODULE_NOT_FOUND error.
PR-URL: https://github.com/nodejs/node/pull/25690
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-15 12:51:53 -08:00
Rich Trott
62942e9ad7
lib: replace 'assert' with 'internal/assert' for many built-ins
...
Replace large 'assert' module with tiny 'internal/assert' module for
many built-in uses.
PR-URL: https://github.com/nodejs/node/pull/25956
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
2019-02-08 00:01:12 -08:00
Joyee Cheung
39d922123c
lib: save primordials during bootstrap and use it in builtins
...
This patches changes the `safe_globals` internal module into a
script that gets run during bootstrap and saves JavaScript builtins
(primordials) into an object that is available for all other builtin
modules to access lexically later.
PR-URL: https://github.com/nodejs/node/pull/25816
Refs: https://github.com/nodejs/node/issues/18795
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
2019-02-02 05:40:47 +08:00
Anna Henningsen
94ebf3f0a7
module: silence ModuleJob unhandled rejection warnings
...
This could otherwise print unhandled rejection warnings
if the process does not exit immediately inside an earlier
`.catch()` handler.
PR-URL: https://github.com/nodejs/node/pull/25769
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-01-30 18:17:06 +01:00
Joyee Cheung
92e95f17b6
src: simplify NativeModule caching and remove redundant data
...
- Remove `NativeModule._source` - the compilation is now entirely
done in C++ and `process.binding('natives')` is implemented
directly in the binding loader so there is no need to store
additional source code strings.
- Instead of using an object as `NativeModule._cached` and insert
into it after compilation of each native module, simply prebuild
a JS map filled with all the native modules and infer the
state of compilation through `mod.loading`/`mod.loaded`.
- Rename `NativeModule.nonInternalExists` to
`NativeModule.canBeRequiredByUsers` and precompute that
property for all the native modules during bootstrap instead
of branching in every require call during runtime. This also fixes
the bug where `worker_threads` can be made available with
`--expose-internals`.
- Rename `NativeModule.requireForDeps` to
`NativeModule.requireWithFallbackInDeps`.
- Add a test to make sure we do not accidentally leak any module
to the global namespace.
PR-URL: https://github.com/nodejs/node/pull/25352
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-01-12 22:56:02 +08:00
cjihrig
69470c87cc
lib: simplify several debug() calls
...
Avoid calling Array.prototype.join() in debug() calls. These
are evaluated on every call, even if the debug() call is a
no-op. This commit replaces the join() calls with the %j
placeholder.
PR-URL: https://github.com/nodejs/node/pull/25241
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-29 13:51:35 -05:00
Ruben Bridgewater
50dd555910
doc,lib,test: capitalize comment sentences
...
This activates the eslint capitalize comment rule for comments
above 50 characters.
PR-URL: https://github.com/nodejs/node/pull/24996
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-17 17:14:35 +01:00
Beni von Cheni
0500237317
inspector: move process.binding to internalBinding
...
In places of process.binding('inspector'), migrate code to adapt
internalBinding.
PR-URL: https://github.com/nodejs/node/pull/24931
Refs: https://github.com/nodejs/node/issues/22160
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-12-13 05:30:51 +01:00
ZYSzys
d695a019ae
module: use validateString in modules/esm
...
PR-URL: https://github.com/nodejs/node/pull/24868
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2018-12-10 09:48:49 -08:00
Ruben Bridgewater
1f85ea979c
tools: capitalize sentences
...
This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.
PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-12-10 17:07:18 +01:00
Myles Borins
2931c50a42
esm: refactor dynamic modules
...
This is a change from the ecmascript-modules fork.
There is no change to behavior and we would like to
upstream to reduce the delta between our repos.
Refs: https://github.com/nodejs/ecmascript-modules#9
PR-URL: https://github.com/nodejs/node/pull/24560
Refs: https://github.com/nodejs/ecmascript-modules/pull/9
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2018-11-30 16:38:57 -05:00