mirror of https://github.com/nodejs/node.git
module: fix builtin reexport tracing
PR-URL: https://github.com/nodejs/node/pull/35500 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
db4e70141d
commit
5e605c0dd9
|
@ -24,7 +24,7 @@ function lazyTypes() {
|
|||
}
|
||||
|
||||
const { readFileSync } = require('fs');
|
||||
const { extname } = require('path');
|
||||
const { extname, isAbsolute } = require('path');
|
||||
const {
|
||||
stripBOM,
|
||||
loadNativeModule
|
||||
|
@ -244,7 +244,8 @@ function cjsPreparseModuleExports(filename) {
|
|||
continue;
|
||||
}
|
||||
const ext = extname(resolved);
|
||||
if (ext === '.js' || ext === '.cjs' || !CJSModule._extensions[ext]) {
|
||||
if ((ext === '.js' || ext === '.cjs' || !CJSModule._extensions[ext]) &&
|
||||
isAbsolute(resolved)) {
|
||||
const { exportNames: reexportNames } = cjsPreparseModuleExports(resolved);
|
||||
for (const name of reexportNames)
|
||||
exportNames.add(name);
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const fixtures = require('../common/fixtures');
|
||||
const { spawn } = require('child_process');
|
||||
const assert = require('assert');
|
||||
|
||||
const entry = fixtures.path('/es-modules/builtin-imports-case.mjs');
|
||||
|
||||
const child = spawn(process.execPath, [entry]);
|
||||
child.stderr.setEncoding('utf8');
|
||||
let stdout = '';
|
||||
child.stdout.setEncoding('utf8');
|
||||
child.stdout.on('data', (data) => {
|
||||
stdout += data;
|
||||
});
|
||||
child.on('close', common.mustCall((code, signal) => {
|
||||
assert.strictEqual(code, 0);
|
||||
assert.strictEqual(signal, null);
|
||||
assert.strictEqual(stdout, 'ok\n');
|
||||
}));
|
|
@ -0,0 +1,5 @@
|
|||
import { strictEqual } from 'assert';
|
||||
import './dep1.js';
|
||||
import { assert as depAssert } from './dep2.js';
|
||||
strictEqual(depAssert.strictEqual, strictEqual);
|
||||
console.log('ok');
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('assert');
|
|
@ -0,0 +1 @@
|
|||
exports.assert = require('assert');
|
Loading…
Reference in New Issue