import "./global.ts";
import nodeAssert from "./assert.ts";import nodeAssertStrict from "./assert/strict.ts";import nodeBuffer from "./buffer.ts";import nodeCrypto from "./crypto.ts";import nodeConsole from "./console.ts";import nodeConstants from "./constants.ts";import nodeChildProcess from "./child_process.ts";import nodeEvents from "./events.ts";import nodeFS from "./fs.ts";import nodeFSPromises from "./fs/promises.ts";import nodeOs from "./os.ts";import nodePath from "./path.ts";import nodePerfHooks from "./perf_hooks.ts";import nodeQueryString from "./querystring.ts";import nodeStream from "./stream.ts";import nodeStringDecoder from "./string_decoder.ts";import nodeTimers from "./timers.ts";import nodeTty from "./tty.ts";import nodeUrl from "./url.ts";import nodeUtil from "./util.ts";
import * as path from "../path/mod.ts";import { assert } from "../_util/assert.ts";import { fileURLToPath, pathToFileURL } from "./url.ts";import { isWindows } from "../_util/os.ts";
const { hasOwn } = Object;const CHAR_FORWARD_SLASH = "/".charCodeAt(0);const CHAR_BACKWARD_SLASH = "\\".charCodeAt(0);const CHAR_COLON = ":".charCodeAt(0);
const relativeResolveCache = Object.create(null);
let requireDepth = 0;let statCache: Map<string, StatResult> | null = null;
type StatResult = -1 | 0 | 1;function stat(filename: string): StatResult { filename = path.toNamespacedPath(filename); if (statCache !== null) { const result = statCache.get(filename); if (result !== undefined) return result; } try { const info = Deno.statSync(filename); const result = info.isFile ? 0 : 1; if (statCache !== null) statCache.set(filename, result); return result; } catch (e) { if (e instanceof Deno.errors.PermissionDenied) { throw new Error("CJS loader requires --allow-read."); } return -1; }}
function updateChildren( parent: Module | null, child: Module, scan: boolean,): void { const children = parent && parent.children; if (children && !(scan && children.includes(child))) { children.push(child); }}
class Module { id: string; exports: any; parent: Module | null; filename: string | null; loaded: boolean; children: Module[]; paths: string[]; path: string; constructor(id = "", parent?: Module | null) { this.id = id; this.exports = {}; this.parent = parent || null; updateChildren(parent || null, this, false); this.filename = null; this.loaded = false; this.children = []; this.paths = []; this.path = path.dirname(id); } static builtinModules: string[] = []; static _extensions: { [key: string]: (module: Module, filename: string) => any; } = Object.create(null); static _cache: { [key: string]: Module } = Object.create(null); static _pathCache = Object.create(null); static globalPaths: string[] = []; static wrapper = [ "(function (exports, require, module, __filename, __dirname) { ", "\n});", ];
require(id: string): any { if (id === "") { throw new Error(`id '${id}' must be a non-empty string`); } requireDepth++; try { return Module._load(id, this, false); } finally { requireDepth--; } }
load(filename: string): void { assert(!this.loaded); this.filename = filename; this.paths = Module._nodeModulePaths(path.dirname(filename));
const extension = findLongestRegisteredExtension(filename); Module._extensions[extension](this, filename); this.loaded = true; }
_compile(content: string, filename: string): any { const compiledWrapper = wrapSafe(filename, content); const dirname = path.dirname(filename); const require = makeRequireFunction(this); const exports = this.exports; const thisValue = exports; if (requireDepth === 0) { statCache = new Map(); } const result = compiledWrapper.call( thisValue, exports, require, this, filename, dirname, ); if (requireDepth === 0) { statCache = null; } return result; }
static _resolveLookupPaths( request: string, parent: Module | null, ): string[] | null { if ( request.charAt(0) !== "." || (request.length > 1 && request.charAt(1) !== "." && request.charAt(1) !== "/" && (!isWindows || request.charAt(1) !== "\\")) ) { let paths = modulePaths; if (parent !== null && parent.paths && parent.paths.length) { paths = parent.paths.concat(paths); }
return paths.length > 0 ? paths : null; }
if (!parent || !parent.id || !parent.filename) { return ["."].concat(Module._nodeModulePaths("."), modulePaths); } return [path.dirname(parent.filename)]; }
static _resolveFilename( request: string, parent: Module, isMain: boolean, options?: { paths: string[] }, ): string { if (nativeModuleCanBeRequiredByUsers(request)) { return request; }
let paths: string[];
if (typeof options === "object" && options !== null) { if (Array.isArray(options.paths)) { const isRelative = request.startsWith("./") || request.startsWith("../") || (isWindows && request.startsWith(".\\")) || request.startsWith("..\\");
if (isRelative) { paths = options.paths; } else { const fakeParent = new Module("", null);
paths = [];
for (let i = 0; i < options.paths.length; i++) { const path = options.paths[i]; fakeParent.paths = Module._nodeModulePaths(path); const lookupPaths = Module._resolveLookupPaths(request, fakeParent);
for (let j = 0; j < lookupPaths!.length; j++) { if (!paths.includes(lookupPaths![j])) { paths.push(lookupPaths![j]); } } } } } else if (options.paths === undefined) { paths = Module._resolveLookupPaths(request, parent)!; } else { throw new Error("options.paths is invalid"); } } else { paths = Module._resolveLookupPaths(request, parent)!; }
const filename = Module._findPath(request, paths, isMain); if (!filename) { const requireStack = []; for (let cursor: Module | null = parent; cursor; cursor = cursor.parent) { requireStack.push(cursor.filename || cursor.id); } let message = `Cannot find module '${request}'`; if (requireStack.length > 0) { message = message + "\nRequire stack:\n- " + requireStack.join("\n- "); } const err = new Error(message) as Error & { code: string; requireStack: string[]; }; err.code = "MODULE_NOT_FOUND"; err.requireStack = requireStack; throw err; } return filename as string; }
static _findPath( request: string, paths: string[], isMain: boolean, ): string | boolean { const absoluteRequest = path.isAbsolute(request); if (absoluteRequest) { paths = [""]; } else if (!paths || paths.length === 0) { return false; }
const cacheKey = request + "\x00" + (paths.length === 1 ? paths[0] : paths.join("\x00")); const entry = Module._pathCache[cacheKey]; if (entry) { return entry; }
let exts; let trailingSlash = request.length > 0 && request.charCodeAt(request.length - 1) === CHAR_FORWARD_SLASH; if (!trailingSlash) { trailingSlash = /(?:^|\/)\.?\.$/.test(request); }
for (let i = 0; i < paths.length; i++) { const curPath = paths[i];
if (curPath && stat(curPath) < 1) continue; const basePath = resolveExports(curPath, request, absoluteRequest); let filename;
const rc = stat(basePath); if (!trailingSlash) { if (rc === 0) { filename = toRealPath(basePath); }
if (!filename) { if (exts === undefined) exts = Object.keys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } }
if (!filename && rc === 1) { if (exts === undefined) exts = Object.keys(Module._extensions); filename = tryPackage(basePath, exts, isMain, request); }
if (filename) { Module._pathCache[cacheKey] = filename; return filename; } }
return false; }
static _load(request: string, parent: Module, isMain: boolean): any { let relResolveCacheIdentifier: string | undefined; if (parent) { relResolveCacheIdentifier = `${parent.path}\x00${request}`; const filename = relativeResolveCache[relResolveCacheIdentifier]; if (filename !== undefined) { const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) { return getExportsForCircularRequire(cachedModule); } return cachedModule.exports; } delete relativeResolveCache[relResolveCacheIdentifier]; } }
const filename = Module._resolveFilename(request, parent, isMain);
const cachedModule = Module._cache[filename]; if (cachedModule !== undefined) { updateChildren(parent, cachedModule, true); if (!cachedModule.loaded) { return getExportsForCircularRequire(cachedModule); } return cachedModule.exports; }
const mod = loadNativeModule(filename, request); if (mod) return mod.exports;
const module = new Module(filename, parent);
if (isMain) { module.id = "."; }
Module._cache[filename] = module; if (parent !== undefined) { assert(relResolveCacheIdentifier); relativeResolveCache[relResolveCacheIdentifier] = filename; }
let threw = true; try { module.load(filename); threw = false; } finally { if (threw) { delete Module._cache[filename]; if (parent !== undefined) { assert(relResolveCacheIdentifier); delete relativeResolveCache[relResolveCacheIdentifier]; } } else if ( module.exports && Object.getPrototypeOf(module.exports) === CircularRequirePrototypeWarningProxy ) { Object.setPrototypeOf(module.exports, PublicObjectPrototype); } }
return module.exports; }
static wrap(script: string): string { script = script.replace(/^#!.*?\n/, ""); return `${Module.wrapper[0]}${script}${Module.wrapper[1]}`; }
static _nodeModulePaths(from: string): string[] { if (isWindows) { from = path.resolve(from);
if ( from.charCodeAt(from.length - 1) === CHAR_BACKWARD_SLASH && from.charCodeAt(from.length - 2) === CHAR_COLON ) { return [from + "node_modules"]; }
const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = from.charCodeAt(i); if ( code === CHAR_BACKWARD_SLASH || code === CHAR_FORWARD_SLASH || code === CHAR_COLON ) { if (p !== nmLen) paths.push(from.slice(0, last) + "\\node_modules"); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } }
return paths; } else { from = path.resolve(from); if (from === "/") return ["/node_modules"];
const paths = []; for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) { const code = from.charCodeAt(i); if (code === CHAR_FORWARD_SLASH) { if (p !== nmLen) paths.push(from.slice(0, last) + "/node_modules"); last = i; p = 0; } else if (p !== -1) { if (nmChars[p] === code) { ++p; } else { p = -1; } } }
paths.push("/node_modules");
return paths; } }
static createRequire(filename: string | URL): RequireFunction { let filepath: string; if ( filename instanceof URL || (typeof filename === "string" && !path.isAbsolute(filename)) ) { try { filepath = fileURLToPath(filename); } catch (err) { if ( err instanceof Deno.errors.InvalidData && err.message.includes("invalid url scheme") ) { throw new Error( `${createRequire.name} only supports 'file://' URLs for the 'filename' parameter`, ); } else { throw err; } } } else if (typeof filename !== "string") { throw new Error("filename should be a string"); } else { filepath = filename; } return createRequireFromPath(filepath); }
static _initPaths(): void { const homeDir = Deno.env.get("HOME"); const nodePath = Deno.env.get("NODE_PATH");
let paths = [];
if (homeDir) { paths.unshift(path.resolve(homeDir, ".node_libraries")); paths.unshift(path.resolve(homeDir, ".node_modules")); }
if (nodePath) { paths = nodePath .split(path.delimiter) .filter(function pathsFilterCB(path) { return !!path; }) .concat(paths); }
modulePaths = paths;
Module.globalPaths = modulePaths.slice(0); }
static _preloadModules(requests: string[]): void { if (!Array.isArray(requests)) { return; }
const parent = new Module("internal/preload", null); try { parent.paths = Module._nodeModulePaths(Deno.cwd()); } catch (e) { if ( !(e instanceof Error) || (e as Error & { code?: string }).code !== "ENOENT" ) { throw e; } } for (let n = 0; n < requests.length; n++) { parent.require(requests[n]); } }}
const nativeModulePolyfill = new Map<string, Module>();function createNativeModule(id: string, exports: any): Module { const mod = new Module(id); mod.exports = exports; mod.loaded = true; return mod;}
nativeModulePolyfill.set("assert", createNativeModule("assert", nodeAssert));nativeModulePolyfill.set( "assert/strict", createNativeModule("assert/strict", nodeAssertStrict),);nativeModulePolyfill.set("buffer", createNativeModule("buffer", nodeBuffer));nativeModulePolyfill.set( "constants", createNativeModule("constants", nodeConstants),);nativeModulePolyfill.set( "child_process", createNativeModule("child_process", nodeChildProcess),);nativeModulePolyfill.set("crypto", createNativeModule("crypto", nodeCrypto));nativeModulePolyfill.set( "events", createNativeModule("events", nodeEvents),);nativeModulePolyfill.set("fs", createNativeModule("fs", nodeFS));nativeModulePolyfill.set( "fs/promises", createNativeModule("fs/promises", nodeFSPromises),);nativeModulePolyfill.set("module", createNativeModule("module", Module));nativeModulePolyfill.set("os", createNativeModule("os", nodeOs));nativeModulePolyfill.set("path", createNativeModule("path", nodePath));nativeModulePolyfill.set( "perf_hooks", createNativeModule("perf_hooks", nodePerfHooks),);nativeModulePolyfill.set( "querystring", createNativeModule("querystring", nodeQueryString),);nativeModulePolyfill.set( "stream", createNativeModule("stream", nodeStream),);nativeModulePolyfill.set( "string_decoder", createNativeModule("string_decoder", nodeStringDecoder),);nativeModulePolyfill.set("timers", createNativeModule("timers", nodeTimers));nativeModulePolyfill.set("tty", createNativeModule("tty", nodeTty));nativeModulePolyfill.set("url", createNativeModule("url", nodeUrl));nativeModulePolyfill.set("util", createNativeModule("util", nodeUtil));nativeModulePolyfill.set("console", createNativeModule("console", nodeConsole));
function loadNativeModule( _filename: string, request: string,): Module | undefined { return nativeModulePolyfill.get(request);}function nativeModuleCanBeRequiredByUsers(request: string): boolean { return nativeModulePolyfill.has(request);}for (const id of nativeModulePolyfill.keys()) { Module.builtinModules.push(id);}
let modulePaths: string[] = [];
const packageJsonCache = new Map<string, PackageInfo | null>();
interface PackageInfo { name?: string; main?: string; exports?: any; type?: any;}
function readPackage(requestPath: string): PackageInfo | null { const jsonPath = path.resolve(requestPath, "package.json");
const existing = packageJsonCache.get(jsonPath); if (existing !== undefined) { return existing; }
let json: string | undefined; try { json = new TextDecoder().decode( Deno.readFileSync(path.toNamespacedPath(jsonPath)), ); } catch { }
if (json === undefined) { packageJsonCache.set(jsonPath, null); return null; }
try { const parsed = JSON.parse(json); const filtered = { name: parsed.name, main: parsed.main, exports: parsed.exports, type: parsed.type, }; packageJsonCache.set(jsonPath, filtered); return filtered; } catch (e) { const err = (e instanceof Error ? e : new Error("[non-error thrown]")) as & Error & { path?: string }; err.path = jsonPath; err.message = "Error parsing " + jsonPath + ": " + err.message; throw e; }}
function readPackageScope( checkPath: string,): { path: string; data: PackageInfo } | false { const rootSeparatorIndex = checkPath.indexOf(path.sep); let separatorIndex; while ( (separatorIndex = checkPath.lastIndexOf(path.sep)) > rootSeparatorIndex ) { checkPath = checkPath.slice(0, separatorIndex); if (checkPath.endsWith(path.sep + "node_modules")) return false; const pjson = readPackage(checkPath); if (pjson) { return { path: checkPath, data: pjson, }; } } return false;}
function readPackageMain(requestPath: string): string | undefined { const pkg = readPackage(requestPath); return pkg ? pkg.main : undefined;}
function readPackageExports(requestPath: string): any | undefined { const pkg = readPackage(requestPath); return pkg ? pkg.exports : undefined;}
function tryPackage( requestPath: string, exts: string[], isMain: boolean, _originalPath: string,): string | false { const pkg = readPackageMain(requestPath);
if (!pkg) { return tryExtensions(path.resolve(requestPath, "index"), exts, isMain); }
const filename = path.resolve(requestPath, pkg); let actual = tryFile(filename, isMain) || tryExtensions(filename, exts, isMain) || tryExtensions(path.resolve(filename, "index"), exts, isMain); if (actual === false) { actual = tryExtensions(path.resolve(requestPath, "index"), exts, isMain); if (!actual) { const err = new Error( `Cannot find module '${filename}'. ` + 'Please verify that the package.json has a valid "main" entry', ) as Error & { code: string }; err.code = "MODULE_NOT_FOUND"; throw err; } } return actual;}
function tryFile(requestPath: string, _isMain: boolean): string | false { const rc = stat(requestPath); return rc === 0 && toRealPath(requestPath);}
function toRealPath(requestPath: string): string { return Deno.realPathSync(requestPath);}
function tryExtensions( p: string, exts: string[], isMain: boolean,): string | false { for (let i = 0; i < exts.length; i++) { const filename = tryFile(p + exts[i], isMain);
if (filename) { return filename; } } return false;}
function findLongestRegisteredExtension(filename: string): string { const name = path.basename(filename); let currentExtension; let index; let startIndex = 0; while ((index = name.indexOf(".", startIndex)) !== -1) { startIndex = index + 1; if (index === 0) continue; currentExtension = name.slice(index); if (Module._extensions[currentExtension]) return currentExtension; } return ".js";}
function isConditionalDotExportSugar(exports: any, _basePath: string): boolean { if (typeof exports === "string") return true; if (Array.isArray(exports)) return true; if (typeof exports !== "object") return false; let isConditional = false; let firstCheck = true; for (const key of Object.keys(exports)) { const curIsConditional = key[0] !== "."; if (firstCheck) { firstCheck = false; isConditional = curIsConditional; } else if (isConditional !== curIsConditional) { throw new Error( '"exports" cannot ' + "contain some keys starting with '.' and some not. The exports " + "object must either be an object of package subpath keys or an " + "object of main entry condition name keys only.", ); } } return isConditional;}
function applyExports(basePath: string, expansion: string): string { const mappingKey = `.${expansion}`;
let pkgExports = readPackageExports(basePath); if (pkgExports === undefined || pkgExports === null) { return path.resolve(basePath, mappingKey); }
if (isConditionalDotExportSugar(pkgExports, basePath)) { pkgExports = { ".": pkgExports }; }
if (typeof pkgExports === "object") { if (hasOwn(pkgExports, mappingKey)) { const mapping = pkgExports[mappingKey]; return resolveExportsTarget( pathToFileURL(basePath + "/"), mapping, "", basePath, mappingKey, ); }
if (mappingKey === ".") return basePath;
let dirMatch = ""; for (const candidateKey of Object.keys(pkgExports)) { if (candidateKey[candidateKey.length - 1] !== "/") continue; if ( candidateKey.length > dirMatch.length && mappingKey.startsWith(candidateKey) ) { dirMatch = candidateKey; } }
if (dirMatch !== "") { const mapping = pkgExports[dirMatch]; const subpath = mappingKey.slice(dirMatch.length); return resolveExportsTarget( pathToFileURL(basePath + "/"), mapping, subpath, basePath, mappingKey, ); } } if (mappingKey === ".") return basePath;
const e = new Error( `Package exports for '${basePath}' do not define ` + `a '${mappingKey}' subpath`, ) as Error & { code?: string }; e.code = "MODULE_NOT_FOUND"; throw e;}
const EXPORTS_PATTERN = /^((?:@[^/\\%]+\/)?[^./\\%][^/\\%]*)(\/.*)?$/;function resolveExports( nmPath: string, request: string, absoluteRequest: boolean,): string { if (!absoluteRequest) { const [, name, expansion = ""] = request.match(EXPORTS_PATTERN) || []; if (!name) { return path.resolve(nmPath, request); }
const basePath = path.resolve(nmPath, name); return applyExports(basePath, expansion); }
return path.resolve(nmPath, request);}
const cjsConditions = new Set(["require", "node"]);
function resolveExportsTarget( pkgPath: URL, target: any, subpath: string, basePath: string, mappingKey: string,): string { if (typeof target === "string") { if ( target.startsWith("./") && (subpath.length === 0 || target.endsWith("/")) ) { const resolvedTarget = new URL(target, pkgPath); const pkgPathPath = pkgPath.pathname; const resolvedTargetPath = resolvedTarget.pathname; if ( resolvedTargetPath.startsWith(pkgPathPath) && resolvedTargetPath.indexOf("/node_modules/", pkgPathPath.length - 1) === -1 ) { const resolved = new URL(subpath, resolvedTarget); const resolvedPath = resolved.pathname; if ( resolvedPath.startsWith(resolvedTargetPath) && resolvedPath.indexOf("/node_modules/", pkgPathPath.length - 1) === -1 ) { return fileURLToPath(resolved); } } } } else if (Array.isArray(target)) { for (const targetValue of target) { if (Array.isArray(targetValue)) continue; try { return resolveExportsTarget( pkgPath, targetValue, subpath, basePath, mappingKey, ); } catch (e) { if ( !(e instanceof Error) || (e as Error & { code?: string }).code !== "MODULE_NOT_FOUND" ) { throw e; } } } } else if (typeof target === "object" && target !== null) { for (const key of Object.keys(target)) { if (key !== "default" && !cjsConditions.has(key)) { continue; } if (hasOwn(target, key)) { try { return resolveExportsTarget( pkgPath, target[key], subpath, basePath, mappingKey, ); } catch (e) { if ( !(e instanceof Error) || (e as Error & { code?: string }).code !== "MODULE_NOT_FOUND" ) { throw e; } } } } } let e: Error & { code?: string }; if (mappingKey !== ".") { e = new Error( `Package exports for '${basePath}' do not define a ` + `valid '${mappingKey}' target${subpath ? " for " + subpath : ""}`, ); } else { e = new Error(`No valid exports main found for '${basePath}'`); } e.code = "MODULE_NOT_FOUND"; throw e;}
const nmChars = [115, 101, 108, 117, 100, 111, 109, 95, 101, 100, 111, 110];const nmLen = nmChars.length;
function emitCircularRequireWarning(prop: any): void { console.error( `Accessing non-existent property '${ String(prop) }' of module exports inside circular dependency`, );}
const CircularRequirePrototypeWarningProxy = new Proxy( {}, { get(target: Record<string, any>, prop: string): any { if (prop in target) return target[prop]; emitCircularRequireWarning(prop); return undefined; },
getOwnPropertyDescriptor(target, prop): PropertyDescriptor | undefined { if (hasOwn(target, prop)) { return Object.getOwnPropertyDescriptor(target, prop); } emitCircularRequireWarning(prop); return undefined; }, },);
const PublicObjectPrototype = globalThis.Object.prototype;
function getExportsForCircularRequire(module: Module): any { if ( module.exports && Object.getPrototypeOf(module.exports) === PublicObjectPrototype && !module.exports.__esModule ) { Object.setPrototypeOf(module.exports, CircularRequirePrototypeWarningProxy); }
return module.exports;}
type RequireWrapper = ( exports: any, require: any, module: Module, __filename: string, __dirname: string,) => void;
function wrapSafe(filename: string, content: string): RequireWrapper { const wrapper = Module.wrap(content); const [f, err] = (Deno as any).core.evalContext(wrapper, filename); if (err) { throw err; } return f; }
Module._extensions[".js"] = (module: Module, filename: string): void => { if (filename.endsWith(".js")) { const pkg = readPackageScope(filename); if (pkg !== false && pkg.data && pkg.data.type === "module") { throw new Error("Importing ESM module"); } } const content = new TextDecoder().decode(Deno.readFileSync(filename)); module._compile(content, filename);};
Module._extensions[".json"] = (module: Module, filename: string): void => { const content = new TextDecoder().decode(Deno.readFileSync(filename)); try { module.exports = JSON.parse(stripBOM(content)); } catch (err) { const e = err instanceof Error ? err : new Error("[non-error thrown]"); e.message = `${filename}: ${e.message}`; throw e; }};
function createRequireFromPath(filename: string): RequireFunction { const trailingSlash = filename.endsWith("/") || (isWindows && filename.endsWith("\\"));
const proxyPath = trailingSlash ? path.join(filename, "noop.js") : filename;
const m = new Module(proxyPath); m.filename = proxyPath;
m.paths = Module._nodeModulePaths(m.path); return makeRequireFunction(m);}
type Require = (id: string) => any;type RequireResolve = (request: string, options: any) => string;interface RequireResolveFunction extends RequireResolve { paths: (request: string) => string[] | null;}
interface RequireFunction extends Require { resolve: RequireResolveFunction; extensions: { [key: string]: (module: Module, filename: string) => any }; cache: { [key: string]: Module };}
function makeRequireFunction(mod: Module): RequireFunction { const require = function require(path: string): any { return mod.require(path); };
function resolve(request: string, options?: { paths: string[] }): string { return Module._resolveFilename(request, mod, false, options); }
require.resolve = resolve;
function paths(request: string): string[] | null { return Module._resolveLookupPaths(request, mod); }
resolve.paths = paths;
require.extensions = Module._extensions;
require.cache = Module._cache;
return require;}
function stripBOM(content: string): string { if (content.charCodeAt(0) === 0xfeff) { content = content.slice(1); } return content;}
export const builtinModules = Module.builtinModules;export const createRequire = Module.createRequire;export default Module;