| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0a87084 commit 05aa3a1
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + { | ||
| 2 | + 'targets': [ | ||
| 3 | + { | ||
| 4 | + 'target_name': 'binding-export-default', | ||
| 5 | + 'sources': [ 'binding-export-default.cc' ], | ||
| 6 | + 'includes': ['../common.gypi'], | ||
| 7 | + }, | ||
| 8 | + ] | ||
| 9 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,14 +24,4 @@ export async function run() { | |||
| 24 | 24 | assert.strictEqual(ns.default, ns['module.exports']); | |
| 25 | 25 | assert.strictEqual(ns.default.default(), 'hello world'); | |
| 26 | 26 | } | |
| 27 | - | ||
| 28 | - // binding-export-primitive.node | ||
| 29 | - { | ||
| 30 | - const bindingPath = require.resolve(`./build/${buildType}/binding-export-primitive.node`); | ||
| 31 | - const ns = await import(pathToFileURL(bindingPath)); | ||
| 32 | - | ||
| 33 | - // As same as ESM-import-CJS, the default export is the value of `module.exports`. | ||
| 34 | - assert.strictEqual(ns.default, ns['module.exports']); | ||
| 35 | - assert.strictEqual(ns.default, 'hello world'); | ||
| 36 | - } | ||
| 37 | 27 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,5 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | 'targets': [ | |
| 3 | - { | ||
| 4 | - 'target_name': 'binding-export-default', | ||
| 5 | - 'sources': [ 'binding-export-default.cc' ], | ||
| 6 | - 'includes': ['../common.gypi'], | ||
| 7 | - }, | ||
| 8 | 3 | { | |
| 9 | 4 | 'target_name': 'binding-export-primitive', | |
| 10 | 5 | 'sources': [ 'binding-export-primitive.cc' ], | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 1 | + /** | ||
| 2 | + * This file is supposed to be loaded by `test-import.js` and `test-require.js` | ||
| 3 | + * to verify that `import('*.node')` is working properly either been loaded with | ||
| 4 | + * the ESM loader or the CJS loader. | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | + import { buildType } from '../../common/index.mjs'; | ||
| 8 | + import assert from 'node:assert'; | ||
| 9 | + import { createRequire } from 'node:module'; | ||
| 10 | + import { pathToFileURL } from 'node:url'; | ||
| 11 | + | ||
| 12 | + const require = createRequire(import.meta.url); | ||
| 13 | + | ||
| 14 | + export async function run() { | ||
| 15 | + // binding-export-primitive.node | ||
| 16 | + { | ||
| 17 | + const bindingPath = require.resolve(`./build/${buildType}/binding-export-primitive.node`); | ||
| 18 | + const ns = await import(pathToFileURL(bindingPath)); | ||
| 19 | + | ||
| 20 | + // As same as ESM-import-CJS, the default export is the value of `module.exports`. | ||
| 21 | + assert.strictEqual(ns.default, ns['module.exports']); | ||
| 22 | + assert.strictEqual(ns.default, 'hello world'); | ||
| 23 | + } | ||
| 24 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,6 @@ | |||
| 1 | + // Flags: --experimental-addon-modules | ||
| 2 | + 'use strict'; | ||
| 3 | + const common = require('../../common'); | ||
| 4 | + | ||
| 5 | + require('./test-esm.mjs') | ||
| 6 | + .run().then(common.mustCall()); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + { | ||
| 2 | + 'targets': [ | ||
| 3 | + { | ||
| 4 | + 'target_name': 'binding', | ||
| 5 | + 'sources': [ 'binding.cc' ], | ||
| 6 | + 'includes': ['../common.gypi'], | ||
| 7 | + }, | ||
| 8 | + ] | ||
| 9 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments