mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
c2b01881dc
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>
18 lines
371 B
JavaScript
18 lines
371 B
JavaScript
'use strict';
|
|
// Flags: --expose-internals
|
|
|
|
// This test ensures that search throws errors appropriately
|
|
|
|
const common = require('../common');
|
|
|
|
const { search } = require('internal/modules/esm/DefaultResolve');
|
|
|
|
common.expectsError(
|
|
() => search('target', undefined),
|
|
{
|
|
code: 'ERR_MISSING_MODULE',
|
|
type: Error,
|
|
message: 'Cannot find module target'
|
|
}
|
|
);
|