2024-05-08 10:20:48 +08:00
|
|
|
import { isMainThread } from '../../common/index.mjs';
|
2023-09-05 03:00:11 +08:00
|
|
|
import * as fixtures from '../../common/fixtures.mjs';
|
|
|
|
import { createRequire, register } from 'node:module';
|
|
|
|
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
|
|
|
|
const GET_BUILTIN = `$__get_builtin_hole_${Date.now()}`;
|
|
|
|
Object.defineProperty(globalThis, GET_BUILTIN, {
|
|
|
|
value: builtinName => require(builtinName),
|
|
|
|
enumerable: false,
|
|
|
|
configurable: false,
|
|
|
|
});
|
|
|
|
|
2024-05-08 10:20:48 +08:00
|
|
|
if (isMainThread) {
|
|
|
|
register(fixtures.fileURL('es-module-loaders/builtin-named-exports-loader.mjs'), {
|
|
|
|
data: {
|
|
|
|
GET_BUILTIN,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|