Age | Commit message (Collapse) | Author |
|
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>
|
|
This makes sure that errors that shut down the application are
inspected with `util.inspect()`. That makes sure that all extra
properties on the error will be visible and also that the stack trace
is highlighted (Node.js internal frames will be grey and node modules
are underlined).
PR-URL: https://github.com/nodejs/node/pull/27243
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
|
|
Moving `try / catch` into separate functions is not necessary
anymore due to V8 optimizations.
PR-URL: https://github.com/nodejs/node/pull/26970
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
|
|
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>
|
|
PR-URL: https://github.com/nodejs/node/pull/18378
Fixes: https://github.com/nodejs/node/issues/18377
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
|
|
It is hard to know where ifError is actually triggered due to the
original error being thrown.
This changes it by wrapping the original error in a AssertionError.
This has the positive effect of also making clear that it is indeed
a assertion function that triggered that error.
The original stack can still be accessed by checking the `actual`
property.
PR-URL: https://github.com/nodejs/node/pull/18247
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
|