Gus Caplan
8cae9b2ff8
tools: add no-duplicate-requires rule
...
PR-URL: https://github.com/nodejs/node/pull/21712
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
2018-07-12 16:11:11 -05:00
cjihrig
573744caae
lib: consolidate redundant require() calls
...
PR-URL: https://github.com/nodejs/node/pull/21699
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Jon Moss <me@jonathanmoss.me >
2018-07-09 22:50:37 -04:00
Сковорода Никита Андреевич
7bdc694267
errors: fix ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK
...
This restores a broken and erroneously removed error, which was
accidentially renamed to ERR_MISSING_DYNAMIC_INTSTANTIATE_HOOK (notice
the "INTST" vs "INST") in 921fb84687
(PR #16874 ) and then had documentation and implementation removed under
the old name in 6e1c25c456 (PR #18857 ),
as it appeared unused.
This error code never worked or was documented under the mistyped name
ERR_MISSING_DYNAMIC_INTSTANTIATE_HOOK, so renaming it back to
ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK is a semver-patch fix.
Refs: https://github.com/nodejs/node/issues/21440
Refs: https://github.com/nodejs/node/pull/21470
Refs: https://github.com/nodejs/node/pull/16874
Refs: https://github.com/nodejs/node/pull/18857
PR-URL: https://github.com/nodejs/node/pull/21493
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ron Korving <ron@ronkorving.nl >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-06-30 23:48:59 +02:00
guybedford
1bf42f4777
esm: loader hook URL validation and error messages
...
PR-URL: https://github.com/nodejs/node/pull/21352
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-06-30 02:07:51 +02:00
Gus Caplan
8fa640e2db
loader: remove unused error code in module_job
...
PR-URL: https://github.com/nodejs/node/pull/21354
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-06-18 09:41:44 -05:00
Guy Bedford
8ee604ca71
esm: ensure require.main for CJS top-level loads
...
PR-URL: https://github.com/nodejs/node/pull/21150
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-06-13 17:58:11 +02:00
David Goldstein
236596590c
module: add --preserve-symlinks-main
...
Add `--preserve-symlinks-main` option which behaves like
`--preserve-symlinks` but for `require.main`.
PR-URL: https://github.com/nodejs/node/pull/19911
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-05-13 00:28:16 +03:00
Gus Caplan
f074612b74
esm: provide named exports for builtin libs
...
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.
PR-URL: https://github.com/nodejs/node/pull/20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2018-05-11 12:06:18 -05:00
cjihrig
975f6c1f70
fs: move fs/promises to fs.promises
...
PR-URL: https://github.com/nodejs/node/pull/20504
Refs: https://github.com/nodejs/TSC/issues/389
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com >
2018-05-07 19:47:42 -04:00
Zhenzhen Zhan
b34a1e1785
module: fix e.stack error when throwing undefined or null
...
Adds a test for module loading when throwing undefined or null.
PR-URL: https://github.com/nodejs/node/pull/19282
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-04-10 00:47:12 +02:00
Michaël Zasso
77b52fd58f
module: move options checks from C++ to JS
...
PR-URL: https://github.com/nodejs/node/pull/19822
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-07 15:10:27 +02:00
Guy Bedford
141be923f3
module: skip preserveSymlinks for main
...
PR-URL: https://github.com/nodejs/node/pull/19388
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-04-01 17:32:26 +02:00
Daniel Bevenius
f2b10799ef
lib: rename js source to lower snake_case
...
This commit renames all JavaScript source files in lib to lower
snake_case.
PR-URL: https://github.com/nodejs/node/pull/19556
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
2018-03-28 08:09:16 +02:00
Ruben Bridgewater
c6b6c92185
lib: always show ERR_INVALID_ARG_TYPE received part
...
This makes a effort to make sure all of these errors will actually
also show the received input.
On top of that it refactors a few tests for better maintainability.
It will also change the returned type to always be a simple typeof
instead of special handling null.
PR-URL: https://github.com/nodejs/node/pull/19445
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2018-03-25 01:45:37 +01:00
Joyee Cheung
c2b01881dc
lib: restructure cjs and esm loaders
...
Create `lib/internal/modules` and restructure the module loaders
to make the purpose of those files clearer.
Also make it clear in the code that the object exported by
`lib/internal/modules/cjs/loader.js` is `CJSModule` instead of the
ambiguous `Module`.
Before:
```
lib
├── ...
├── internal
│ ├── loaders
│ │ ├── CreateDynamicModule.js
│ │ ├── DefaultResolve.js
│ │ ├── Loader.js
│ │ ├── ModuleJob.js
│ │ ├── ModuleMap.js
│ │ └── Translators.js
│ └── module.js
└── module.js
```
After:
```
lib
├── ...
├── internal
│ ├── ...
│ └── modules
│ ├── cjs
│ │ ├── helpers.js
│ │ └── loader.js
│ └── esm
│ ├── CreateDynamicModule.js
│ ├── DefaultResolve.js
│ ├── Loader.js
│ ├── ModuleJob.js
│ ├── ModuleMap.js
│ └── Translators.js
└── module.js # deleted in this commit to work with git file mode
```
PR-URL: https://github.com/nodejs/node/pull/19177
Refs: https://github.com/nodejs/node/pull/19112
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2018-03-15 20:50:35 +08:00