Antoine du Hamel
afb61786b9
module: fix legacy node specifier resolution to resolve "main" field
...
PR-URL: https://github.com/nodejs/node/pull/38979
Fixes: https://github.com/nodejs/node/issues/32103
Fixes: https://github.com/nodejs/node/issues/38739
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2021-07-20 07:11:35 -04:00
Antoine du Hamel
bd0d9647ca
module: clarify CJS global-like variables not defined error message
...
Fixes: https://github.com/nodejs/node/issues/33741
PR-URL: https://github.com/nodejs/node/pull/37852
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2021-06-11 09:30:03 +02:00
Antoine du Hamel
77c7d979b6
module: simplify tryStatSync with throwIfNoEntry option
...
PR-URL: https://github.com/nodejs/node/pull/36971
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-06-11 09:29:57 +02:00
Antoine du Hamel
8d672b8e53
esm: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36019
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-15 20:15:20 +00:00
Guy Bedford
91b820e939
esm: use "node:" namespace for builtins
...
PR-URL: https://github.com/nodejs/node/pull/35387
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-10-06 08:20:02 -04:00
Guy Bedford
505731871e
module: exports pattern support
...
PR-URL: https://github.com/nodejs/node/pull/34718
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-09-24 14:58:34 -04:00
Guy Bedford
6e622d6337
esm: better package.json parser errors
...
PR-URL: https://github.com/nodejs/node/pull/35117
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-09-17 10:36:40 -04:00
Bradley Farias
18b04ab4c8
policy: implement scopes field
...
PR-URL: https://github.com/nodejs/node/pull/34552
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-09-01 11:15:46 -04:00
Denys Otrishko
8f38c19c08
esm: improve error message of ERR_UNSUPPORTED_ESM_URL_SCHEME
...
Refs: https://github.com/nodejs/node/issues/34765
PR-URL: https://github.com/nodejs/node/pull/34795
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-20 15:05:22 +01:00
Bradley Farias
84031183bc
policy: support conditions for redirects
...
PR-URL: https://github.com/nodejs/node/pull/34414
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2020-08-20 15:05:14 +01:00
Guy Bedford
698cae7625
module: share CJS/ESM resolver fns, refactoring
...
PR-URL: https://github.com/nodejs/node/pull/34744
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-08-20 15:05:14 +01:00
Guy Bedford
6929649793
module: custom --conditions flag option
...
PR-URL: https://github.com/nodejs/node/pull/34637
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2020-08-20 15:05:12 +01:00
Daniele Belardi
e1199af50a
module: self referential modules in repl or -r
...
Load self referential modules from the repl and using the preload flag
`-r`. In both cases the base path used for resolution is the current
`process.cwd()`. Also fixes an internal cycle bug in the REPL exports
resolution.
PR-URL: https://github.com/nodejs/node/pull/32261
Fixes: https://github.com/nodejs/node/issues/31595
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2020-07-27 18:23:43 -04:00
Guy Bedford
1ae76bd075
module: package "imports" field
...
PR-URL: https://github.com/nodejs/node/pull/34117
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
2020-07-16 17:09:07 -04:00
Kirill Shatskiy
3d2e7e74f0
esm: share package.json cache between ESM and CJS loaders
...
Refs: https://github.com/nodejs/node/issues/30674
PR-URL: https://github.com/nodejs/node/pull/33229
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2020-06-30 09:33:43 -07:00
Luigi Pinca
91193447fb
tools: enable no-else-return lint rule
...
Refs: https://github.com/nodejs/node/pull/32644
Refs: https://github.com/nodejs/node/pull/32662
PR-URL: https://github.com/nodejs/node/pull/32667
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-05-16 12:52:06 -07:00
Antoine du Hamel
e53de96a89
esm: improve commonjs hint on module not found
...
Adds hint when module specifier is a file URL.
PR-URL: https://github.com/nodejs/node/pull/33220
Fixes: https://github.com/nodejs/node/issues/33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2020-05-16 12:52:03 -07:00
Antoine du HAMEL
35aae31968
module: add specific error for dir import
...
PR-URL: https://github.com/nodejs/node/pull/33220
Fixes: https://github.com/nodejs/node/issues/33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2020-05-16 12:51:59 -07:00
Daniele Belardi
2174159598
esm: improve commonjs hint on module not found
...
Run CommonJS resolver only if `error.code` is ERR_MODULE_NOT_FOUND.
Avoid using absolute paths in hint by:
* using a parent-relative path if the specifier is a relative path
* using a `pkg/x.js` format if the specifier is bare (e.g. `pkg/x`)
PR-URL: https://github.com/nodejs/node/pull/31906
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-05-04 14:24:03 +02:00
Guy Bedford
5eccf1e9ad
module: no type module resolver side effects
...
PR-URL: https://github.com/nodejs/node/pull/33086
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2020-05-04 14:23:27 +02:00
Guy Bedford
21d314e7fc
module: exports not exported for null resolutions
...
PR-URL: https://github.com/nodejs/node/pull/32838
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2020-04-27 20:40:47 +01:00
Jan Krems
0800b17ec9
module: expose exports conditions to loaders
...
PR-URL: https://github.com/nodejs/node/pull/31303
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
2020-04-07 16:28:20 +01:00
Anna Henningsen
605615e5f3
esm: port loader code to JS
...
There is no reason for this to be in C++. Using JavaScript means that
the code is more accessible to more developers, which is important
for any Node.js feature. This also simplifies the code significantly
in some areas. On the technical side, this potentially also enables
making some of the file system operations that are involved
asynchronous.
PR-URL: https://github.com/nodejs/node/pull/32201
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2020-03-13 17:34:43 +01:00
Guy Bedford
0f96dc266f
esm: import.meta.resolve with nodejs: builtins
...
PR-URL: https://github.com/nodejs/node/pull/31032
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-02-03 18:31:02 +02:00
Geoffrey Booth
2551a21553
module: loader getSource, getFormat, transform hooks
...
PR-URL: https://github.com/nodejs/node/pull/30986
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
2020-01-07 01:31:05 +02:00