@expo/require-utils 56.1.6 → 56.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/load.js +14 -4
- package/build/load.js.map +1 -1
- package/package.json +2 -2
package/build/load.js
CHANGED
|
@@ -280,6 +280,19 @@ function containsModuleSyntax(code) {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
const hasStripTypeScriptTypes = typeof nodeModule().stripTypeScriptTypes === 'function';
|
|
283
|
+
function supportsStripTypeScriptTypesTransform() {
|
|
284
|
+
const nodeVersion = process.versions.node.split('.', 1).map(Number);
|
|
285
|
+
return nodeVersion[0] < 26;
|
|
286
|
+
}
|
|
287
|
+
function stripTypeScriptTypes(code) {
|
|
288
|
+
if (!supportsStripTypeScriptTypesTransform()) {
|
|
289
|
+
return nodeModule().stripTypeScriptTypes(code);
|
|
290
|
+
}
|
|
291
|
+
return nodeModule().stripTypeScriptTypes(code, {
|
|
292
|
+
mode: 'transform',
|
|
293
|
+
sourceMap: true
|
|
294
|
+
});
|
|
295
|
+
}
|
|
283
296
|
function evalModule(code, filename, opts = {}, format = toFormat(filename, true)) {
|
|
284
297
|
const shouldCache = opts.cache ?? true;
|
|
285
298
|
let inputCode = code;
|
|
@@ -321,10 +334,7 @@ function evalModule(code, filename, opts = {}, format = toFormat(filename, true)
|
|
|
321
334
|
}
|
|
322
335
|
if (hasStripTypeScriptTypes && inputCode === code) {
|
|
323
336
|
// This may throw its own error, but this contains a code-frame already
|
|
324
|
-
inputCode =
|
|
325
|
-
mode: 'transform',
|
|
326
|
-
sourceMap: true
|
|
327
|
-
});
|
|
337
|
+
inputCode = stripTypeScriptTypes(code);
|
|
328
338
|
if (format.mode === 'commonjs-typescript') {
|
|
329
339
|
inputCode = (0, _transform().toCommonJS)(filename, inputCode);
|
|
330
340
|
}
|
package/build/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","names":["_nodeFs","data","_interopRequireDefault","require","nodeModule","_interopRequireWildcard","_nodeOs","_nodePath","_nodeUrl","_nodeVm","_codeframe","_stacktrace","_transform","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_ts","loadTypescript","undefined","transpileModule","error","code","parent","module","tsExtensionMapping","maybeReadFileSync","filename","fs","readFileSync","toFormat","isLegacy","mode","legacy","endsWith","toRealDirname","filePath","normalized","path","resolve","realpathSync","dirname","hasModuleSourceMapsSupport","setSourceMapsSupport","getSourceMapsState","getSourceMapsSupport","enabled","process","sourceMapsEnabled","setSourceMapsState","state","nodeModules","generatedCode","setSourceMapsEnabled","makeSourceMapTempPath","basename","queryIdx","search","slice","join","os","tmpdir","pid","stripSourceMappingURL","replace","compileModule","opts","format","shouldCache","cache","prependPaths","paths","basePath","nodeModulePaths","_nodeModulePaths","inputCode","compileFilename","sourceMap","basePart","queryPart","isAbsolute","mapPath","priorSourceMapsState","isBun","writeFileSync","console","warn","message","sep","replaceAll","installSourceMapStackTrace","mod","assign","Module","childIdx","children","indexOf","splice","_compile","loaded","unlinkSync","containsModuleSyntax","test","CJS_WRAP_PARAMS","vm","compileFunction","hasStripTypeScriptTypes","stripTypeScriptTypes","evalModule","inputFilename","diagnostic","ts","ModuleKind","CommonJS","ESNext","Preserve","output","fileName","reportDiagnostics","compilerOptions","moduleResolution","ModuleResolutionKind","Bundler","verbatimModuleSyntax","target","ScriptTarget","newLine","NewLineKind","LineFeed","inlineSourceMap","esModuleInterop","outputText","diagnostics","length","toCommonJS","ext","extname","inputExt","exports","diagnosticError","formatDiagnostic","annotateError","requireOrImport","url","pathToFileURL","toString","loadModule","loadModuleSync","isTypeScript"],"sources":["../src/load.ts"],"sourcesContent":["import fs from 'node:fs';\nimport * as nodeModule from 'node:module';\nimport os from 'node:os';\nimport path from 'node:path';\nimport url from 'node:url';\nimport vm from 'node:vm';\nimport type * as ts from 'typescript';\n\nimport { annotateError, formatDiagnostic } from './codeframe';\nimport { installSourceMapStackTrace } from './stacktrace';\nimport { toCommonJS } from './transform';\n\ndeclare module 'node:module' {\n export function _nodeModulePaths(base: string): readonly string[];\n}\n\ndeclare global {\n namespace NodeJS {\n export interface Module {\n _compile(\n code: string,\n filename: string,\n format?: 'module' | 'commonjs' | 'commonjs-typescript' | 'module-typescript' | 'typescript'\n ): unknown;\n }\n export interface Process {\n isBun?: boolean;\n }\n }\n}\n\nlet _ts: typeof import('typescript') | null | undefined;\nfunction loadTypescript() {\n if (_ts === undefined) {\n try {\n _ts = require('typescript');\n // NOTE(@kitten): typescript v7 ships without the necessary compiler/public APIs to use it\n // for transpilation or other purposes\n if (typeof _ts?.transpileModule !== 'function') {\n _ts = null;\n return null;\n }\n } catch (error: any) {\n if (error.code !== 'MODULE_NOT_FOUND') {\n throw error;\n } else {\n _ts = null;\n }\n }\n }\n return _ts;\n}\n\nconst parent = module;\n\nconst tsExtensionMapping: Record<string, string | undefined> = {\n '.ts': '.js',\n '.cts': '.cjs',\n '.mts': '.mjs',\n};\n\nfunction maybeReadFileSync(filename: string) {\n try {\n return fs.readFileSync(filename, 'utf8');\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n return null;\n }\n throw error;\n }\n}\n\ninterface Format {\n mode:\n | 'commonjs'\n | 'module'\n | 'module-typescript'\n | 'commonjs-typescript'\n | 'typescript'\n | undefined;\n legacy: boolean;\n}\n\nfunction toFormat(filename: string, isLegacy: boolean): Format {\n let mode: Format['mode'];\n let legacy = false;\n if (filename.endsWith('.cjs')) {\n mode = 'commonjs';\n } else if (filename.endsWith('.mjs')) {\n mode = 'module';\n } else if (filename.endsWith('.js')) {\n legacy = isLegacy;\n mode = isLegacy ? 'commonjs' : undefined;\n } else if (filename.endsWith('.mts')) {\n mode = 'module-typescript';\n } else if (filename.endsWith('.cts')) {\n mode = 'commonjs-typescript';\n } else if (filename.endsWith('.ts')) {\n legacy = isLegacy;\n mode = isLegacy ? 'commonjs-typescript' : 'typescript';\n }\n return { mode, legacy };\n}\n\nexport interface ModuleOptions {\n paths?: string[];\n sourceMap?: string;\n cache?: boolean;\n}\n\nfunction toRealDirname(filePath: string): string {\n let normalized = path.resolve(filePath);\n // Try resolving the filename itself first\n try {\n normalized = fs.realpathSync(normalized);\n return path.dirname(normalized);\n } catch (error: any) {\n normalized = path.dirname(normalized);\n // If we're getting another error than an ENOENT, return the dirname unchanged\n if (error?.code !== 'ENOENT') {\n return normalized;\n }\n }\n // Alternatively, if it's a fake path, resolve the directory directly instead\n try {\n return fs.realpathSync(normalized);\n } catch {\n return normalized;\n }\n}\n\nconst hasModuleSourceMapsSupport = typeof nodeModule.setSourceMapsSupport === 'function';\n\ninterface SourceMapsState {\n enabled: boolean;\n nodeModules?: boolean;\n generatedCode?: boolean;\n}\n\nfunction getSourceMapsState(): SourceMapsState {\n return typeof nodeModule.getSourceMapsSupport === 'function'\n ? nodeModule.getSourceMapsSupport()\n : { enabled: !!process.sourceMapsEnabled };\n}\n\nfunction setSourceMapsState(state: SourceMapsState): void {\n if (hasModuleSourceMapsSupport) {\n nodeModule.setSourceMapsSupport(state.enabled, {\n nodeModules: state.nodeModules ?? false,\n generatedCode: state.generatedCode ?? false,\n });\n } else {\n process.setSourceMapsEnabled(state.enabled);\n }\n}\n\nfunction makeSourceMapTempPath(filename: string) {\n let basename = path.basename(filename);\n const queryIdx = basename.search(/[?#]/);\n if (queryIdx >= 0) {\n basename = basename.slice(0, queryIdx);\n }\n return path.join(os.tmpdir(), `require-utils-${process.pid}-${basename}.map`);\n}\n\nfunction stripSourceMappingURL(code: string): string {\n return code.replace(/^[ \\t]*\\/\\/[#@][ \\t]+sourceMappingURL=.*$/gm, '');\n}\n\nfunction compileModule(code: string, filename: string, opts: ModuleOptions) {\n const format = toFormat(filename, false);\n const shouldCache = opts.cache ?? true;\n const prependPaths = opts.paths ?? [];\n // See: https://github.com/nodejs/node/blob/ff080948666f28fbd767548d26bea034d30bc277/lib/internal/modules/cjs/loader.js#L767\n // If we get a symlinked path instead of the realpath, we assume the realpath is needed for Node module resolution\n const basePath = toRealDirname(filename);\n const nodeModulePaths = nodeModule._nodeModulePaths(basePath);\n const paths = [...prependPaths, ...nodeModulePaths];\n\n let inputCode = code;\n\n // We may get a Metro SSR relative path here, which isn't a valid absolute path, and we need to normalize\n // the filename before proceeding\n let compileFilename = filename;\n if (opts.sourceMap) {\n const queryIdx = filename.search(/[?#]/);\n const basePart = queryIdx >= 0 ? filename.slice(0, queryIdx) : filename;\n const queryPart = queryIdx >= 0 ? filename.slice(queryIdx) : '';\n if (!path.isAbsolute(basePart)) {\n compileFilename = path.resolve(basePart) + queryPart;\n }\n }\n\n let mapPath: string | undefined;\n let priorSourceMapsState: SourceMapsState | undefined;\n if (opts.sourceMap && !process.isBun) {\n try {\n mapPath = makeSourceMapTempPath(compileFilename);\n fs.writeFileSync(mapPath, opts.sourceMap);\n } catch (error: any) {\n mapPath = undefined;\n // If we fail to write the source map, we can still continue without it, but log a warning since it's likely a misconfiguration\n console.warn(\n `Warning: Failed to write source map for ${filename} to ${mapPath}. Source maps will be unavailable for this module.\\n${error?.message || error}`\n );\n }\n\n if (mapPath) {\n inputCode = stripSourceMappingURL(code);\n // NOTE(@kitten): This needs to be a plain absolute path because Node rejects file: URLs\n // On Windows, it additionally needs to be a URL.pathname-like format (POSIX with a leading slash)\n if (path.sep !== '/') {\n mapPath = `/${mapPath.replaceAll(path.sep, '/')}`;\n }\n inputCode += `\\n//# sourceMappingURL=${mapPath}`;\n\n priorSourceMapsState = getSourceMapsState();\n installSourceMapStackTrace();\n setSourceMapsState({ enabled: true, nodeModules: true });\n }\n }\n\n const mod = Object.assign(new nodeModule.Module(compileFilename, parent), {\n filename: compileFilename,\n paths,\n });\n\n const childIdx = parent?.children?.indexOf(mod) ?? -1;\n if (childIdx >= 0) {\n parent.children!.splice(childIdx, 1);\n }\n\n try {\n mod._compile(inputCode, compileFilename, format.mode);\n mod.loaded = true;\n if (shouldCache) {\n require.cache[compileFilename] = mod;\n if (compileFilename !== filename) {\n require.cache[filename] = mod;\n }\n }\n return mod;\n } catch (error: any) {\n if (shouldCache) {\n delete require.cache[compileFilename];\n if (compileFilename !== filename) {\n delete require.cache[filename];\n }\n }\n throw error;\n } finally {\n if (mapPath) {\n // Restore, so subsequent requires of node_modules won't have their source-maps read\n setSourceMapsState(priorSourceMapsState ?? { enabled: false });\n // Node parses source maps eagerly during _compile, so the file can be removed now.\n try {\n fs.unlinkSync(mapPath);\n } catch {\n /* noop */\n }\n }\n }\n}\n\nfunction containsModuleSyntax(code: string): boolean {\n // Fast-path: We can assume that if there's no ESM keyword, we don't need to check at all\n if (!/\\b(?:import|export|await)\\b/.test(code)) {\n return false;\n }\n try {\n const CJS_WRAP_PARAMS = ['exports', 'require', 'module', '__filename', '__dirname'];\n vm.compileFunction(code, CJS_WRAP_PARAMS);\n return false;\n } catch {\n return true;\n }\n}\n\nconst hasStripTypeScriptTypes = typeof nodeModule.stripTypeScriptTypes === 'function';\n\nfunction evalModule(\n code: string,\n filename: string,\n opts: ModuleOptions = {},\n format: Format = toFormat(filename, true)\n) {\n const shouldCache = opts.cache ?? true;\n\n let inputCode = code;\n let inputFilename = filename;\n let diagnostic: ts.Diagnostic | undefined;\n if (\n format.mode === 'typescript' ||\n format.mode === 'module-typescript' ||\n format.mode === 'commonjs-typescript'\n ) {\n const ts = loadTypescript();\n\n if (ts) {\n let module: ts.ModuleKind;\n if (format.mode === 'commonjs-typescript') {\n module = ts.ModuleKind.CommonJS;\n } else if (format.mode === 'module-typescript') {\n module = ts.ModuleKind.ESNext;\n } else {\n // NOTE(@kitten): We can \"preserve\" the output, meaning, it can either be ESM or CJS\n // and stop TypeScript from either transpiling it to CommonJS or adding an `export {}`\n // if no exports are used. This allows the user to choose if this file is CJS or ESM\n // (but not to mix both)\n module = ts.ModuleKind.Preserve;\n }\n const output = ts.transpileModule(code, {\n fileName: filename,\n reportDiagnostics: true,\n compilerOptions: {\n module,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n // `verbatimModuleSyntax` needs to be off, to erase as many imports as possible\n verbatimModuleSyntax: false,\n target: ts.ScriptTarget.ESNext,\n newLine: ts.NewLineKind.LineFeed,\n inlineSourceMap: true,\n esModuleInterop: true,\n },\n });\n inputCode = output?.outputText || inputCode;\n if (output?.diagnostics?.length) {\n diagnostic = output.diagnostics[0];\n }\n }\n\n if (hasStripTypeScriptTypes && inputCode === code) {\n // This may throw its own error, but this contains a code-frame already\n inputCode = nodeModule.stripTypeScriptTypes(code, {\n mode: 'transform',\n sourceMap: true,\n });\n if (format.mode === 'commonjs-typescript') {\n inputCode = toCommonJS(filename, inputCode);\n }\n }\n\n if (inputCode !== code) {\n const ext = path.extname(filename);\n const inputExt = tsExtensionMapping[ext] ?? ext;\n if (inputExt !== ext) {\n inputFilename = path.join(path.dirname(filename), path.basename(filename, ext) + inputExt);\n }\n }\n } else if (format.mode === 'commonjs') {\n inputCode = toCommonJS(filename, code);\n }\n\n // NOTE(@kitten): If we've transpiling to CommonJS ourselves above, we should check if\n // the output contains module syntax, which prevents us from loading this file as CommonJS.\n // If it does, we run the non-legacy ESM code path instead\n if (\n format.legacy &&\n (format.mode === 'commonjs' || format.mode === 'commonjs-typescript') &&\n containsModuleSyntax(inputCode)\n ) {\n format = toFormat(filename, false);\n return evalModule(code, filename, opts, format);\n }\n\n try {\n const mod = compileModule(inputCode, inputFilename, opts);\n if (shouldCache && inputFilename !== filename) {\n require.cache[filename] = mod;\n }\n return mod.exports;\n } catch (error: any) {\n // If we have a diagnostic from TypeScript, we issue its error with a codeframe first,\n // since it's likely more useful than the eval error\n const diagnosticError = formatDiagnostic(diagnostic);\n if (diagnosticError) {\n throw diagnosticError;\n }\n throw annotateError(code, filename, error) ?? error;\n }\n}\n\nasync function requireOrImport(filename: string) {\n try {\n return require(filename);\n } catch {\n return await import(\n path.isAbsolute(filename) ? url.pathToFileURL(filename).toString() : filename\n );\n }\n}\n\nasync function loadModule(filename: string) {\n try {\n return await requireOrImport(filename);\n } catch (error: any) {\n if (error.code === 'ERR_UNKNOWN_FILE_EXTENSION' || error.code === 'MODULE_NOT_FOUND') {\n return loadModuleSync(filename);\n } else {\n throw error;\n }\n }\n}\n\n/** Require module or evaluate with TypeScript\n * NOTE: Requiring ESM has been added in all LTS versions (Node 20.19+, 22.12+, 24).\n * This already forms the minimum required Node version as of Expo SDK 54 */\nfunction loadModuleSync(filename: string) {\n const format = toFormat(filename, true);\n const isTypeScript =\n format.mode === 'module-typescript' ||\n format.mode === 'commonjs-typescript' ||\n format.mode === 'typescript';\n try {\n if (format.mode !== 'module' && !isTypeScript) {\n return require(filename);\n }\n } catch (error: any) {\n if (error.code === 'MODULE_NOT_FOUND') {\n throw error;\n } else if (format.mode == null) {\n const code = maybeReadFileSync(filename);\n throw annotateError(code, filename, error) || error;\n }\n // We fallback to always evaluating the entrypoint module\n // This is out of safety, since we're not trusting the requiring ESM feature\n // and evaluating the module manually bypasses the error when it's flagged off\n }\n\n // Load from cache manually, if `loaded` is set and exports are defined, to avoid\n // double transform or double evaluation\n if (require.cache[filename]?.exports && require.cache[filename].loaded) {\n return require.cache[filename].exports;\n }\n\n const code = fs.readFileSync(filename, 'utf8');\n return evalModule(code, filename, {}, format);\n}\n\nexport { evalModule, loadModule, loadModuleSync };\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA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AAE+G,OAAO,IAAItJ,OAAO,CAACiF,KAAK,CAAC1C,QAAQ,CAAC,CAACwE,MAAM,EAAE;IACtE,OAAO/G,OAAO,CAACiF,KAAK,CAAC1C,QAAQ,CAAC,CAAC+G,OAAO;EACxC;EAEA,MAAMpH,IAAI,GAAGM,iBAAE,CAACC,YAAY,CAACF,QAAQ,EAAE,MAAM,CAAC;EAC9C,OAAOiF,UAAU,CAACtF,IAAI,EAAEK,QAAQ,EAAE,CAAC,CAAC,EAAEwC,MAAM,CAAC;AAC/C","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"load.js","names":["_nodeFs","data","_interopRequireDefault","require","nodeModule","_interopRequireWildcard","_nodeOs","_nodePath","_nodeUrl","_nodeVm","_codeframe","_stacktrace","_transform","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_ts","loadTypescript","undefined","transpileModule","error","code","parent","module","tsExtensionMapping","maybeReadFileSync","filename","fs","readFileSync","toFormat","isLegacy","mode","legacy","endsWith","toRealDirname","filePath","normalized","path","resolve","realpathSync","dirname","hasModuleSourceMapsSupport","setSourceMapsSupport","getSourceMapsState","getSourceMapsSupport","enabled","process","sourceMapsEnabled","setSourceMapsState","state","nodeModules","generatedCode","setSourceMapsEnabled","makeSourceMapTempPath","basename","queryIdx","search","slice","join","os","tmpdir","pid","stripSourceMappingURL","replace","compileModule","opts","format","shouldCache","cache","prependPaths","paths","basePath","nodeModulePaths","_nodeModulePaths","inputCode","compileFilename","sourceMap","basePart","queryPart","isAbsolute","mapPath","priorSourceMapsState","isBun","writeFileSync","console","warn","message","sep","replaceAll","installSourceMapStackTrace","mod","assign","Module","childIdx","children","indexOf","splice","_compile","loaded","unlinkSync","containsModuleSyntax","test","CJS_WRAP_PARAMS","vm","compileFunction","hasStripTypeScriptTypes","stripTypeScriptTypes","supportsStripTypeScriptTypesTransform","nodeVersion","versions","node","split","map","Number","evalModule","inputFilename","diagnostic","ts","ModuleKind","CommonJS","ESNext","Preserve","output","fileName","reportDiagnostics","compilerOptions","moduleResolution","ModuleResolutionKind","Bundler","verbatimModuleSyntax","target","ScriptTarget","newLine","NewLineKind","LineFeed","inlineSourceMap","esModuleInterop","outputText","diagnostics","length","toCommonJS","ext","extname","inputExt","exports","diagnosticError","formatDiagnostic","annotateError","requireOrImport","url","pathToFileURL","toString","loadModule","loadModuleSync","isTypeScript"],"sources":["../src/load.ts"],"sourcesContent":["import fs from 'node:fs';\nimport * as nodeModule from 'node:module';\nimport os from 'node:os';\nimport path from 'node:path';\nimport url from 'node:url';\nimport vm from 'node:vm';\nimport type * as ts from 'typescript';\n\nimport { annotateError, formatDiagnostic } from './codeframe';\nimport { installSourceMapStackTrace } from './stacktrace';\nimport { toCommonJS } from './transform';\n\ndeclare module 'node:module' {\n export function _nodeModulePaths(base: string): readonly string[];\n}\n\ndeclare global {\n namespace NodeJS {\n export interface Module {\n _compile(\n code: string,\n filename: string,\n format?: 'module' | 'commonjs' | 'commonjs-typescript' | 'module-typescript' | 'typescript'\n ): unknown;\n }\n export interface Process {\n isBun?: boolean;\n }\n }\n}\n\nlet _ts: typeof import('typescript') | null | undefined;\nfunction loadTypescript() {\n if (_ts === undefined) {\n try {\n _ts = require('typescript');\n // NOTE(@kitten): typescript v7 ships without the necessary compiler/public APIs to use it\n // for transpilation or other purposes\n if (typeof _ts?.transpileModule !== 'function') {\n _ts = null;\n return null;\n }\n } catch (error: any) {\n if (error.code !== 'MODULE_NOT_FOUND') {\n throw error;\n } else {\n _ts = null;\n }\n }\n }\n return _ts;\n}\n\nconst parent = module;\n\nconst tsExtensionMapping: Record<string, string | undefined> = {\n '.ts': '.js',\n '.cts': '.cjs',\n '.mts': '.mjs',\n};\n\nfunction maybeReadFileSync(filename: string) {\n try {\n return fs.readFileSync(filename, 'utf8');\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n return null;\n }\n throw error;\n }\n}\n\ninterface Format {\n mode:\n | 'commonjs'\n | 'module'\n | 'module-typescript'\n | 'commonjs-typescript'\n | 'typescript'\n | undefined;\n legacy: boolean;\n}\n\nfunction toFormat(filename: string, isLegacy: boolean): Format {\n let mode: Format['mode'];\n let legacy = false;\n if (filename.endsWith('.cjs')) {\n mode = 'commonjs';\n } else if (filename.endsWith('.mjs')) {\n mode = 'module';\n } else if (filename.endsWith('.js')) {\n legacy = isLegacy;\n mode = isLegacy ? 'commonjs' : undefined;\n } else if (filename.endsWith('.mts')) {\n mode = 'module-typescript';\n } else if (filename.endsWith('.cts')) {\n mode = 'commonjs-typescript';\n } else if (filename.endsWith('.ts')) {\n legacy = isLegacy;\n mode = isLegacy ? 'commonjs-typescript' : 'typescript';\n }\n return { mode, legacy };\n}\n\nexport interface ModuleOptions {\n paths?: string[];\n sourceMap?: string;\n cache?: boolean;\n}\n\nfunction toRealDirname(filePath: string): string {\n let normalized = path.resolve(filePath);\n // Try resolving the filename itself first\n try {\n normalized = fs.realpathSync(normalized);\n return path.dirname(normalized);\n } catch (error: any) {\n normalized = path.dirname(normalized);\n // If we're getting another error than an ENOENT, return the dirname unchanged\n if (error?.code !== 'ENOENT') {\n return normalized;\n }\n }\n // Alternatively, if it's a fake path, resolve the directory directly instead\n try {\n return fs.realpathSync(normalized);\n } catch {\n return normalized;\n }\n}\n\nconst hasModuleSourceMapsSupport = typeof nodeModule.setSourceMapsSupport === 'function';\n\ninterface SourceMapsState {\n enabled: boolean;\n nodeModules?: boolean;\n generatedCode?: boolean;\n}\n\nfunction getSourceMapsState(): SourceMapsState {\n return typeof nodeModule.getSourceMapsSupport === 'function'\n ? nodeModule.getSourceMapsSupport()\n : { enabled: !!process.sourceMapsEnabled };\n}\n\nfunction setSourceMapsState(state: SourceMapsState): void {\n if (hasModuleSourceMapsSupport) {\n nodeModule.setSourceMapsSupport(state.enabled, {\n nodeModules: state.nodeModules ?? false,\n generatedCode: state.generatedCode ?? false,\n });\n } else {\n process.setSourceMapsEnabled(state.enabled);\n }\n}\n\nfunction makeSourceMapTempPath(filename: string) {\n let basename = path.basename(filename);\n const queryIdx = basename.search(/[?#]/);\n if (queryIdx >= 0) {\n basename = basename.slice(0, queryIdx);\n }\n return path.join(os.tmpdir(), `require-utils-${process.pid}-${basename}.map`);\n}\n\nfunction stripSourceMappingURL(code: string): string {\n return code.replace(/^[ \\t]*\\/\\/[#@][ \\t]+sourceMappingURL=.*$/gm, '');\n}\n\nfunction compileModule(code: string, filename: string, opts: ModuleOptions) {\n const format = toFormat(filename, false);\n const shouldCache = opts.cache ?? true;\n const prependPaths = opts.paths ?? [];\n // See: https://github.com/nodejs/node/blob/ff080948666f28fbd767548d26bea034d30bc277/lib/internal/modules/cjs/loader.js#L767\n // If we get a symlinked path instead of the realpath, we assume the realpath is needed for Node module resolution\n const basePath = toRealDirname(filename);\n const nodeModulePaths = nodeModule._nodeModulePaths(basePath);\n const paths = [...prependPaths, ...nodeModulePaths];\n\n let inputCode = code;\n\n // We may get a Metro SSR relative path here, which isn't a valid absolute path, and we need to normalize\n // the filename before proceeding\n let compileFilename = filename;\n if (opts.sourceMap) {\n const queryIdx = filename.search(/[?#]/);\n const basePart = queryIdx >= 0 ? filename.slice(0, queryIdx) : filename;\n const queryPart = queryIdx >= 0 ? filename.slice(queryIdx) : '';\n if (!path.isAbsolute(basePart)) {\n compileFilename = path.resolve(basePart) + queryPart;\n }\n }\n\n let mapPath: string | undefined;\n let priorSourceMapsState: SourceMapsState | undefined;\n if (opts.sourceMap && !process.isBun) {\n try {\n mapPath = makeSourceMapTempPath(compileFilename);\n fs.writeFileSync(mapPath, opts.sourceMap);\n } catch (error: any) {\n mapPath = undefined;\n // If we fail to write the source map, we can still continue without it, but log a warning since it's likely a misconfiguration\n console.warn(\n `Warning: Failed to write source map for ${filename} to ${mapPath}. Source maps will be unavailable for this module.\\n${error?.message || error}`\n );\n }\n\n if (mapPath) {\n inputCode = stripSourceMappingURL(code);\n // NOTE(@kitten): This needs to be a plain absolute path because Node rejects file: URLs\n // On Windows, it additionally needs to be a URL.pathname-like format (POSIX with a leading slash)\n if (path.sep !== '/') {\n mapPath = `/${mapPath.replaceAll(path.sep, '/')}`;\n }\n inputCode += `\\n//# sourceMappingURL=${mapPath}`;\n\n priorSourceMapsState = getSourceMapsState();\n installSourceMapStackTrace();\n setSourceMapsState({ enabled: true, nodeModules: true });\n }\n }\n\n const mod = Object.assign(new nodeModule.Module(compileFilename, parent), {\n filename: compileFilename,\n paths,\n });\n\n const childIdx = parent?.children?.indexOf(mod) ?? -1;\n if (childIdx >= 0) {\n parent.children!.splice(childIdx, 1);\n }\n\n try {\n mod._compile(inputCode, compileFilename, format.mode);\n mod.loaded = true;\n if (shouldCache) {\n require.cache[compileFilename] = mod;\n if (compileFilename !== filename) {\n require.cache[filename] = mod;\n }\n }\n return mod;\n } catch (error: any) {\n if (shouldCache) {\n delete require.cache[compileFilename];\n if (compileFilename !== filename) {\n delete require.cache[filename];\n }\n }\n throw error;\n } finally {\n if (mapPath) {\n // Restore, so subsequent requires of node_modules won't have their source-maps read\n setSourceMapsState(priorSourceMapsState ?? { enabled: false });\n // Node parses source maps eagerly during _compile, so the file can be removed now.\n try {\n fs.unlinkSync(mapPath);\n } catch {\n /* noop */\n }\n }\n }\n}\n\nfunction containsModuleSyntax(code: string): boolean {\n // Fast-path: We can assume that if there's no ESM keyword, we don't need to check at all\n if (!/\\b(?:import|export|await)\\b/.test(code)) {\n return false;\n }\n try {\n const CJS_WRAP_PARAMS = ['exports', 'require', 'module', '__filename', '__dirname'];\n vm.compileFunction(code, CJS_WRAP_PARAMS);\n return false;\n } catch {\n return true;\n }\n}\n\nconst hasStripTypeScriptTypes = typeof nodeModule.stripTypeScriptTypes === 'function';\n\nfunction supportsStripTypeScriptTypesTransform(): boolean {\n const nodeVersion = process.versions.node.split('.', 1).map(Number);\n return nodeVersion[0]! < 26;\n}\n\nfunction stripTypeScriptTypes(code: string): string {\n if (!supportsStripTypeScriptTypesTransform()) {\n return nodeModule.stripTypeScriptTypes(code);\n }\n return nodeModule.stripTypeScriptTypes(code, {\n mode: 'transform',\n sourceMap: true,\n });\n}\n\nfunction evalModule(\n code: string,\n filename: string,\n opts: ModuleOptions = {},\n format: Format = toFormat(filename, true)\n) {\n const shouldCache = opts.cache ?? true;\n\n let inputCode = code;\n let inputFilename = filename;\n let diagnostic: ts.Diagnostic | undefined;\n if (\n format.mode === 'typescript' ||\n format.mode === 'module-typescript' ||\n format.mode === 'commonjs-typescript'\n ) {\n const ts = loadTypescript();\n\n if (ts) {\n let module: ts.ModuleKind;\n if (format.mode === 'commonjs-typescript') {\n module = ts.ModuleKind.CommonJS;\n } else if (format.mode === 'module-typescript') {\n module = ts.ModuleKind.ESNext;\n } else {\n // NOTE(@kitten): We can \"preserve\" the output, meaning, it can either be ESM or CJS\n // and stop TypeScript from either transpiling it to CommonJS or adding an `export {}`\n // if no exports are used. This allows the user to choose if this file is CJS or ESM\n // (but not to mix both)\n module = ts.ModuleKind.Preserve;\n }\n const output = ts.transpileModule(code, {\n fileName: filename,\n reportDiagnostics: true,\n compilerOptions: {\n module,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n // `verbatimModuleSyntax` needs to be off, to erase as many imports as possible\n verbatimModuleSyntax: false,\n target: ts.ScriptTarget.ESNext,\n newLine: ts.NewLineKind.LineFeed,\n inlineSourceMap: true,\n esModuleInterop: true,\n },\n });\n inputCode = output?.outputText || inputCode;\n if (output?.diagnostics?.length) {\n diagnostic = output.diagnostics[0];\n }\n }\n\n if (hasStripTypeScriptTypes && inputCode === code) {\n // This may throw its own error, but this contains a code-frame already\n inputCode = stripTypeScriptTypes(code);\n if (format.mode === 'commonjs-typescript') {\n inputCode = toCommonJS(filename, inputCode);\n }\n }\n\n if (inputCode !== code) {\n const ext = path.extname(filename);\n const inputExt = tsExtensionMapping[ext] ?? ext;\n if (inputExt !== ext) {\n inputFilename = path.join(path.dirname(filename), path.basename(filename, ext) + inputExt);\n }\n }\n } else if (format.mode === 'commonjs') {\n inputCode = toCommonJS(filename, code);\n }\n\n // NOTE(@kitten): If we've transpiling to CommonJS ourselves above, we should check if\n // the output contains module syntax, which prevents us from loading this file as CommonJS.\n // If it does, we run the non-legacy ESM code path instead\n if (\n format.legacy &&\n (format.mode === 'commonjs' || format.mode === 'commonjs-typescript') &&\n containsModuleSyntax(inputCode)\n ) {\n format = toFormat(filename, false);\n return evalModule(code, filename, opts, format);\n }\n\n try {\n const mod = compileModule(inputCode, inputFilename, opts);\n if (shouldCache && inputFilename !== filename) {\n require.cache[filename] = mod;\n }\n return mod.exports;\n } catch (error: any) {\n // If we have a diagnostic from TypeScript, we issue its error with a codeframe first,\n // since it's likely more useful than the eval error\n const diagnosticError = formatDiagnostic(diagnostic);\n if (diagnosticError) {\n throw diagnosticError;\n }\n throw annotateError(code, filename, error) ?? error;\n }\n}\n\nasync function requireOrImport(filename: string) {\n try {\n return require(filename);\n } catch {\n return await import(\n path.isAbsolute(filename) ? url.pathToFileURL(filename).toString() : filename\n );\n }\n}\n\nasync function loadModule(filename: string) {\n try {\n return await requireOrImport(filename);\n } catch (error: any) {\n if (error.code === 'ERR_UNKNOWN_FILE_EXTENSION' || error.code === 'MODULE_NOT_FOUND') {\n return loadModuleSync(filename);\n } else {\n throw error;\n }\n }\n}\n\n/** Require module or evaluate with TypeScript\n * NOTE: Requiring ESM has been added in all LTS versions (Node 20.19+, 22.12+, 24).\n * This already forms the minimum required Node version as of Expo SDK 54 */\nfunction loadModuleSync(filename: string) {\n const format = toFormat(filename, true);\n const isTypeScript =\n format.mode === 'module-typescript' ||\n format.mode === 'commonjs-typescript' ||\n format.mode === 'typescript';\n try {\n if (format.mode !== 'module' && !isTypeScript) {\n return require(filename);\n }\n } catch (error: any) {\n if (error.code === 'MODULE_NOT_FOUND') {\n throw error;\n } else if (format.mode == null) {\n const code = maybeReadFileSync(filename);\n throw annotateError(code, filename, error) || error;\n }\n // We fallback to always evaluating the entrypoint module\n // This is out of safety, since we're not trusting the requiring ESM feature\n // and evaluating the module manually bypasses the error when it's flagged off\n }\n\n // Load from cache manually, if `loaded` is set and exports are defined, to avoid\n // double transform or double evaluation\n if (require.cache[filename]?.exports && require.cache[filename].loaded) {\n return require.cache[filename].exports;\n }\n\n const code = fs.readFileSync(filename, 'utf8');\n return evalModule(code, filename, {}, format);\n}\n\nexport { evalModule, loadModule, loadModuleSync };\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAF,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,UAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,SAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,QAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,OAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAS,WAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,UAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,YAAA;EAAA,MAAAV,IAAA,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C;EAEA,MAAM3H,IAAI,GAAGM,iBAAE,CAACC,YAAY,CAACF,QAAQ,EAAE,MAAM,CAAC;EAC9C,OAAOwF,UAAU,CAAC7F,IAAI,EAAEK,QAAQ,EAAE,CAAC,CAAC,EAAEwC,MAAM,CAAC;AAC/C","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/require-utils",
|
|
3
|
-
"version": "56.1.
|
|
3
|
+
"version": "56.1.7",
|
|
4
4
|
"description": "Reusable require and Node resolution utilities library for Expo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "1b8eb0e13635d3ef52c1c11d305ff927d01390ae",
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsc --emitDeclarationOnly && babel src --out-dir build --extensions \".ts\" --source-maps --ignore \"src/**/__mocks__/*\",\"src/**/__tests__/*\"",
|
|
47
47
|
"clean": "expo-module clean",
|