Joyee Cheung
c7c566023f
module: reduce circular dependency of internal/modules/cjs/loader
...
Previously `internal/bootstrap/pre_execution.js` requires
`internal/modules/cjs/loader.js` which in turn requires
`internal/bootstrap/pre_execution.js`. This patch moves the
entry point execution logic out of `pre_execution.js` and
puts it into `internal/modules/run_main.js`. It also tests
that `Module.runMain` can be monkey-patched before further
deprecation/refactoring can be done.
Also added an internal assertion `hasLoadedAnyUserCJSModule`
for documentation purposes.
PR-URL: https://github.com/nodejs/node/pull/30349
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-11-19 14:46:07 +01:00
Kenza Houmani
3ce6e15844
lib: replace var with let/const
...
PR-URL: https://github.com/nodejs/node/pull/30440
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-19 14:45:56 +01:00
Guy Bedford
f9eab48dd0
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-17 00:40:00 -08:00
Guy Bedford
3d8cdf191d
esm: unflag --experimental-modules
...
PR-URL: https://github.com/nodejs/node/pull/29866
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2019-11-17 00:39:55 -08:00
Guy Bedford
e98d89cef9
module: conditional exports with flagged conditions
...
PR-URL: https://github.com/nodejs/node/pull/29978
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2019-11-17 00:28:54 -08:00
Jan Krems
edfbee3727
module: resolve self-references
...
Adds the ability to `import` or `require` a package from within its
own source code. This allows tests and examples to be written using
the package name, making them easier to reuse by consumers of the
package.
Assuming the `name` field in `package.json` is set to `my-pkg`, its
test could use `require('my-pkg')` or `import 'my-pkg'` even if
there's no `node_modules/my-pkg` while testing the package itself.
An important difference between this and relative specifiers like
`require('../')` is that self-references use the public interface
of the package as defined in the `exports` field while relative
specifiers don't.
This behavior is guarded by a new experimental flag
(`--experimental-resolve-self`).
PR-URL: https://github.com/nodejs/node/pull/29327
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-10-28 07:08:02 +01:00
Myles Borins
9729c5da8a
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-23 03:32:53 -04:00
Bradley Farias
cfd45ebf94
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-23 03:32:53 -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
aca1c283bd
module: warn on require of .js inside type: module
...
PR-URL: https://github.com/nodejs/node/pull/29909
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-10-11 17:37:46 -04:00
Guy Bedford
b798f64566
esm: unflag --experimental-exports
...
PR-URL: https://github.com/nodejs/node/pull/29867
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-10-10 16:29:08 -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
ZYSzys
739f113ba6
lib: introduce no-mixed-operators eslint rule to lib
...
PR-URL: https://github.com/nodejs/node/pull/29834
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-10-05 13:59:32 -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
Guy Bedford
c42ab995c1
module: pass full URL to loader for top-level load
...
PR-URL: https://github.com/nodejs/node/pull/29736
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
2019-09-29 20:12:24 -07:00
Guy Bedford
2825e1183d
module: move cjs type check behind flag
...
PR-URL: https://github.com/nodejs/node/pull/29732
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2019-09-28 11:56:39 -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
Guy Bedford
4396bebfe1
module: error for CJS .js load within type: module
...
PR-URL: https://github.com/nodejs/node/pull/29492
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2019-09-19 15:24:50 -07:00
Guy Bedford and Geoffrey Booth
3f3ad38c87
module: reintroduce package exports dot main
...
This reintroduces the dot main in exports as discussed in the previous
Node.js modules meeting.
The implementation includes both CommonJS and ES module resolution with
the associated documentation and resolver specification changes.
In addition to the dot main, "exports" as a string or direct fallback
array is supported as well.
Co-Authored-By: Geoffrey Booth <GeoffreyBooth@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/29494
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2019-09-17 18:54:44 -07:00
Bradley Farias
6ce87c027d
policy: minor perf opts and cleanup
...
PR-URL: https://github.com/nodejs/node/pull/29322
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-09-03 11:12:05 -05: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
Michaël Zasso
5746769d68
lib,test: fix error message check after V8 update
...
PR-URL: https://github.com/nodejs/node/pull/28918
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-19 09:26:13 +02:00
Giorgos Ntemiris
427e5348a2
module: add warning when import,export is detected in CJS context
...
This will allow users to know how to change their project to support
ES modules.
PR-URL: https://github.com/nodejs/node/pull/28950
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-08-13 11:19:48 -07:00
Guy Bedford
2103ae4835
module: pkg exports validations and fallbacks
...
PR-URL: https://github.com/nodejs/node/pull/28949
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2019-08-12 06:24:28 -04:00
Guy Bedford
0e03c449e3
module: refine package name validation
...
PR-URL: https://github.com/nodejs/node/pull/28965
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-07 19:56:11 -07:00
Guy Bedford
452b393c1f
module: exports error as MODULE_NOT_FOUND
...
PR-URL: https://github.com/nodejs/node/pull/28905
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-08-01 20:36:27 -07: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
Jan Krems
dcb6929183
module: implement "exports" proposal for CommonJS
...
Refs: https://github.com/jkrems/proposal-pkg-exports/issues/36
Refs: https://github.com/nodejs/node/pull/28568
PR-URL: https://github.com/nodejs/node/pull/28759
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
2019-07-23 16:11:20 -07:00
Gus Caplan
68c83f962e
vm: fix gc bug with modules and compiled functions
...
PR-URL: https://github.com/nodejs/node/pull/28671
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2019-07-19 16:45:46 -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
Joyee Cheung
a33c3c6d33
src: refactor uncaught exception handling
...
The C++ land `node::FatalException()` is not in fact fatal anymore.
It gives the user a chance to handle the uncaught exception
globally by listening to the `uncaughtException` event. This patch
renames it to `TriggerUncaughtException` in C++ to avoid the confusion.
In addition rename the JS land handler to `onGlobalUncaughtException`
to reflect its purpose - we have to keep the alias
`process._fatalException` and use that for now since it has been
monkey-patchable in the user land.
This patch also
- Adds more comments to the global uncaught exception handling routine
- Puts a few other C++ error handling functions into the `errors`
namespace
- Moves error-handling-related bindings to the `errors` binding.
Refs: https://github.com/nodejs/node/commit/2b252acea47af3ebeac3d7e68277f015667264cc
PR-URL: https://github.com/nodejs/node/pull/28257
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2019-06-19 16:16:37 +08: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
cjihrig
58fc168807
module: handle empty require.resolve() options
...
If require.resolve() is passed an options object, but
the paths option is not present, then use the default
require.resolve() paths.
PR-URL: https://github.com/nodejs/node/pull/28078
Fixes: https://github.com/nodejs/node/issues/28077
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-06-11 10:20:31 -07:00
Refael Ackermann
702331be90
lib: no need to strip BOM or shebang for scripts
...
PR-URL: https://github.com/nodejs/node/pull/27375
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-06-01 10:01:15 -04:00
cjihrig
14701e539c
module: runtime deprecate createRequireFromPath()
...
This commit moves DEP0130 to a runtime deprecation.
PR-URL: https://github.com/nodejs/node/pull/27951
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-05-31 11:09:53 -04: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
ZYSzys
6fe369286a
esm: fix esm load bug
...
Fixes: https://github.com/nodejs/node/issues/25482
PR-URL: https://github.com/nodejs/node/pull/25491
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-14 16:15:28 +08:00
cjihrig
ef51cc8ac9
module: fix createRequireFromPath() slash logic
...
The trailing slash detection logic in createRequireFromPath()
seemed slightly incorrect. This commit reworks the logic.
PR-URL: https://github.com/nodejs/node/pull/27634
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-13 13:07:52 -04:00
cjihrig
9c5ded3189
module: add missing space in error message
...
PR-URL: https://github.com/nodejs/node/pull/27627
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-13 12:40:56 -04:00
cjihrig
639b85950b
module: simplify createRequire() validation
...
PR-URL: https://github.com/nodejs/node/pull/27629
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-05-13 05:41:25 +02:00
cjihrig
a608caa5ff
module: improve resolve paths validation
...
This commit adds input validation to require.resolve()'s
paths option. Prior to this change, passing in a non-array
value lead to a misleading 'module not found' error.
Refs: https://github.com/nodejs/node/issues/27583
PR-URL: https://github.com/nodejs/node/pull/27613
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-05-10 11:26:26 -07:00
cjihrig
dac1143fc8
module: handle relative paths in resolve paths
...
This commit adds support for relative paths in
require.resolve()'s paths option.
PR-URL: https://github.com/nodejs/node/pull/27598
Fixes: https://github.com/nodejs/node/issues/27583
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-05-09 14:16:05 -04:00
Myles Borins
d370d126c3
module: throw on require('./path.mjs');
...
This is an extremely important part of the ESM implementation
that should have been unflagged as a breaking change in v12.0.0
to allow us to unflag ESM in Node.js 12.x before LTS. Assuming we
can get consensus on this behavior I would argue that this Semver-Major
behavior change could be viewed as a Semver-Patch fix in v12.0.1
PR-URL: https://github.com/nodejs/node/pull/27417
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2019-05-03 12:14:36 -07:00