Antoine du Hamel
45f98fc60d
module: add some typings to internal/modules/esm/resolve
...
PR-URL: https://github.com/nodejs/node/pull/39504
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-08-02 10:21:30 +02:00
Antoine du Hamel
4e17ffc793
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-06-13 16:22:34 +02:00
Antoine du Hamel
7b2bad4005
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-04-13 19:06:48 +02:00
Antoine du Hamel
3cc9aec988
module: runtime deprecate subpath folder mappings
...
PR-URL: https://github.com/nodejs/node/pull/37215
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2021-03-20 19:14:14 +01:00
Antoine du Hamel
9fab73c73b
module: runtime deprecate "main" index and extension lookups
...
PR-URL: https://github.com/nodejs/node/pull/37206
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-03-19 12:38:20 +01:00
cjihrig
d0a92e2c32
esm: update to correct deprecation code
...
https://github.com/nodejs/node/pull/36918 landed with references
to DEP0150, which is already used for a different deprecation.
This commit updates the code to use DEP0151.
PR-URL: https://github.com/nodejs/node/pull/37147
Refs: https://github.com/nodejs/node/pull/36918
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-30 11:37:22 -05:00
Guy Bedford
255d6337cd
esm: deprecate legacy main lookup for modules
...
PR-URL: https://github.com/nodejs/node/pull/36918
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-01-30 16:31:49 +02:00
Antoine du Hamel
88153dc175
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-01-18 11:04:14 -08:00
Guy Bedford
2e909c4fcc
module: fix Windows folder exports deprecation warning
...
PR-URL: https://github.com/nodejs/node/pull/36859
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2021-01-12 14:45:51 +01:00
Antoine du Hamel
829786088a
esm: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36019
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-11-14 14:46:06 +00:00
Guy Bedford
c9acb9e5b3
module: runtime deprecate subpath folder mappings
...
PR-URL: https://github.com/nodejs/node/pull/35747
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-10-30 12:12:56 -04:00
Guy Bedford
ee9e3e75aa
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-09-29 18:20:28 -07:00
Guy Bedford
2d868fe822
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-17 18:56:17 -07:00
Guy Bedford
3fb7fcd821
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-11 05:09:44 -07:00
Bradley Farias
4234904232
policy: implement scopes field
...
PR-URL: https://github.com/nodejs/node/pull/34552
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-08-26 14:35:34 -05:00
Denys Otrishko
a0846326dd
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-18 17:56:47 -07:00
Bradley Farias
e155d96014
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-13 13:17:40 -05:00
Guy Bedford
f8976a76bb
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-13 11:04:24 -07:00
Guy Bedford
77a515c31a
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-11 14:35:44 -07:00
Daniele Belardi
ec2ffd6b9d
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-23 07:50:01 -07:00
Guy Bedford
1237955d41
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-09 19:19:35 -07:00
Kirill Shatskiy
8f10bb2da5
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-05-24 16:22:31 -07:00
Luigi Pinca
b533fb3508
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 06:42:16 +02:00
Antoine du Hamel
1cb80d1e05
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-15 19:09:01 -07:00
Antoine du HAMEL
985e9c5fe5
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-15 19:08:39 -07:00
Daniele Belardi
8f87d252fa
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-03 11:29:09 -07:00
Guy Bedford
2496db8e09
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-04-29 22:10:35 -07:00
Guy Bedford
e767ed0558
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-22 15:48:44 -07:00
Jan Krems
9129ab1996
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-03 01:29:39 +02: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