Antoine du Hamel
a596af0819
tools: add lint rule to keep primordials in ASCII order
...
PR-URL: https://github.com/nodejs/node/pull/52592
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2024-04-21 16:53:08 +00:00
James Sumners
3daa0a6c04
esm: add import.meta.dirname and import.meta.filename
...
PR-URL: https://github.com/nodejs/node/pull/48740
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-10-31 21:11:15 +00:00
Guy Bedford
ee8b7f1f18
esm: unflag import.meta.resolve
...
PR-URL: https://github.com/nodejs/node/pull/49028
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-08-13 05:42:25 +00:00
Guy Bedford
569267d048
esm: import.meta.resolve exact module not found errors should return
...
PR-URL: https://github.com/nodejs/node/pull/49038
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-08-13 00:02:03 +00:00
Antoine du Hamel
5c65565108
esm: fix typo parentUrl -> parentURL
...
PR-URL: https://github.com/nodejs/node/pull/48999
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-08-02 20:27:39 +00:00
Izaak Schroeder
a2fc4a383e
esm: unflag Module.register and allow nested loader import()
...
Major functional changes:
- Allow `import()` to work within loaders that require other loaders,
- Unflag the use of `Module.register`.
A new interface `Customizations` has been created in order to unify
`ModuleLoader` (previously `DefaultModuleLoader`), `Hooks` and
`CustomizedModuleLoader` all of which now implement it:
```ts
interface LoadResult {
format: ModuleFormat;
source: ModuleSource;
}
interface ResolveResult {
format: string;
url: URL['href'];
}
interface Customizations {
allowImportMetaResolve: boolean;
load(url: string, context: object): Promise<LoadResult>
resolve(
originalSpecifier:
string, parentURL: string,
importAssertions: Record<string, string>
): Promise<ResolveResult>
resolveSync(
originalSpecifier:
string, parentURL: string,
importAssertions: Record<string, string>
) ResolveResult;
register(specifier: string, parentUrl: string): any;
forceLoadHooks(): void;
importMetaInitialize(meta, context, loader): void;
}
```
The `ModuleLoader` class now has `setCustomizations` which takes an
object of this shape and delegates its responsibilities to this object
if present.
Note that two properties `allowImportMetaResolve` and `resolveSync`
exist now as a mechanism for `import.meta.resolve` – since `Hooks`
does not implement `resolveSync` other loaders cannot use
`import.meta.resolve`; `allowImportMetaResolve` is a way of checking
for that case instead of invoking `resolveSync` and erroring.
Fixes https://github.com/nodejs/node/issues/48515
Closes https://github.com/nodejs/node/pull/48439
PR-URL: https://github.com/nodejs/node/pull/48559
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-07-19 10:33:47 +00:00
4667b07cd2
esm: move hook execution to separate thread
...
PR-URL: https://github.com/nodejs/node/pull/44710
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com >
Co-authored-by: Michaël Zasso <targos@protonmail.com >
2023-04-13 09:35:17 +02:00
Antoine du Hamel
ab8942848b
lib: enforce use of trailing commas
...
PR-URL: https://github.com/nodejs/node/pull/46881
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-03-06 10:44:14 +01:00
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
...
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-02-14 18:45:16 +01:00
Jacob Smith
3c040348fe
Revert "esm: convert resolve hook to synchronous"
...
This reverts commit 90b634a5a5 .
PR-URL: https://github.com/nodejs/node/pull/43526
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2022-06-22 08:13:36 +01:00
Jacob Smith
90b634a5a5
esm: convert resolve hook to synchronous
...
PR-URL: https://github.com/nodejs/node/pull/43363
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-06-18 18:22:57 +01:00
Guy Bedford
dfa896f926
esm: refactor responseURL handling
...
PR-URL: https://github.com/nodejs/node/pull/43164
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2022-06-03 14:29:09 -07:00
Bradley Farias
acc11c9873
esm: fix base URL for network imports
...
PR-URL: https://github.com/nodejs/node/pull/42131
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-03-04 15:40:38 -06:00
ceadb473e6
esm: support https remotely and http locally under flag
...
Co-authored-by: Jacob Smith <3012099+JakobJingleheimer@users.noreply.github.com >
Co-authored-by: James M Snell <jasnell@gmail.com >
Co-authored-by: Jordan Harband <ljharb@gmail.com >
Co-authored-by: James Sumners <james@sumners.email >
PR-URL: https://github.com/nodejs/node/pull/36328
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-02-09 19:47:12 -08:00
Bradley Farias
1998e83983
esm: working mock test
...
PR-URL: https://github.com/nodejs/node/pull/39240
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2021-11-29 14:54:01 -06:00