mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
Remove `module.register()` (DEP0205), the `--experimental-loader` and `--loader` flags, and the machinery that supported them: the loader hooks worker thread, the hooks proxy, the async module customization hook chains for resolving and loading, the internal worker class used to run the loader thread, and the asynchronous module job linking. Module customization is now provided only by `module.registerHooks()`, which runs synchronously on the thread that loads the modules. As the loader thread no longer exists, the ES module loader always loads and links modules synchronously, so the code that handled promises and the re-invented `require()` for imported CommonJS customized by the async module customization hooks is removed too. `import()` still defers evaluation of the module to a later microtask, as before. `worker_threads.isInternalThread` is kept for compatibility and is now always `false`; removing it is left for a future semver-major change. The `ERR_ASYNC_LOADER_REQUEST_NEVER_SETTLED` and `ERR_LOADER_CHAIN_INCOMPLETE` error codes are no longer used and are documented as removed. Tests that exist only to exercise the async module customization hooks are removed. Assisted-by: Claude Signed-off-by: Geoffrey Booth <webadmin@geoffreybooth.com> PR-URL: https://github.com/nodejs/node/pull/67090 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ilyas Shabi <ilyasshabi94@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
findSourceMap,
|
|
getSourceMapsSupport,
|
|
setSourceMapsSupport,
|
|
} = require('internal/source_map/source_map_cache');
|
|
const { Module } = require('internal/modules/cjs/loader');
|
|
const {
|
|
SourceMap,
|
|
} = require('internal/source_map/source_map');
|
|
const {
|
|
constants,
|
|
enableCompileCache,
|
|
flushCompileCache,
|
|
getCompileCacheDir,
|
|
} = require('internal/modules/helpers');
|
|
const {
|
|
findPackageJSON,
|
|
} = require('internal/modules/package_json_reader');
|
|
const { stripTypeScriptTypes } = require('internal/modules/typescript');
|
|
|
|
Module.constants = constants;
|
|
Module.enableCompileCache = enableCompileCache;
|
|
Module.findPackageJSON = findPackageJSON;
|
|
Module.flushCompileCache = flushCompileCache;
|
|
Module.getCompileCacheDir = getCompileCacheDir;
|
|
Module.stripTypeScriptTypes = stripTypeScriptTypes;
|
|
|
|
// SourceMap APIs
|
|
Module.findSourceMap = findSourceMap;
|
|
Module.SourceMap = SourceMap;
|
|
Module.getSourceMapsSupport = getSourceMapsSupport;
|
|
Module.setSourceMapsSupport = setSourceMapsSupport;
|
|
|
|
module.exports = Module;
|