Skip to content

Commit 4938fec

Browse files
committed
esm: remove .node support
Refs: nodejs/modules#180 PR-URL: nodejs/ecmascript-modules#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent e1544cc commit 4938fec

8 files changed

Lines changed: 1 addition & 66 deletions

File tree

doc/api/esm.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ module. This can be one of the following:
176176
| `'esm'` | Load a standard JavaScript module |
177177
| `'cjs'` | Load a node-style CommonJS module |
178178
| `'builtin'` | Load a node builtin CommonJS module |
179-
| `'addon'` | Load a [C++ Addon][addons] |
180179
| `'dynamic'` | Use a [dynamic instantiate hook][] |
181180

182181
For example, a dummy loader to load JavaScript restricted to browser resolution
@@ -253,5 +252,4 @@ then be called at the exact point of module evaluation order for that module
253252
in the import tree.
254253

255254
[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
256-
[addons]: addons.html
257255
[dynamic instantiate hook]: #esm_dynamic_instantiate_hook

lib/internal/modules/esm/default_resolve.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function search(target, base) {
4747
const extensionFormatMap = {
4848
'__proto__': null,
4949
'.mjs': 'esm',
50-
'.node': 'addon',
5150
'.js': 'cjs'
5251
};
5352

lib/internal/modules/esm/translators.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const internalURLModule = require('internal/url');
1010
const createDynamicModule = require(
1111
'internal/modules/esm/create_dynamic_module');
1212
const fs = require('fs');
13-
const { _makeLong } = require('path');
1413
const { SafeMap } = require('internal/safe_globals');
1514
const { URL } = require('url');
1615
const { debuglog, promisify } = require('util');
@@ -87,15 +86,3 @@ translators.set('builtin', async (url) => {
8786
reflect.exports.default.set(module.exports);
8887
});
8988
});
90-
91-
// Strategy for loading a node native module
92-
translators.set('addon', async (url) => {
93-
debug(`Translating NativeModule ${url}`);
94-
return createDynamicModule(['default'], url, (reflect) => {
95-
debug(`Loading NativeModule ${url}`);
96-
const module = { exports: {} };
97-
const pathname = internalURLModule.fileURLToPath(new URL(url));
98-
process.dlopen(module, _makeLong(pathname));
99-
reflect.exports.default.set(module.exports);
100-
});
101-
});

src/module_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ using v8::TryCatch;
4444
using v8::Undefined;
4545
using v8::Value;
4646

47-
static const char* const EXTENSIONS[] = {".mjs", ".js", ".node"};
47+
static const char* const EXTENSIONS[] = {".mjs", ".js"};
4848

4949
ModuleWrap::ModuleWrap(Environment* env,
5050
Local<Object> object,

test/addons/hello-world-esm/binding.cc

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/addons/hello-world-esm/binding.gyp

Lines changed: 0 additions & 9 deletions
This file was deleted.

test/addons/hello-world-esm/test.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/addons/hello-world-esm/test.mjs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)