@expo/require-utils 57.0.4 → 57.0.6
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/codeframe.d.ts +8 -2
- package/build/codeframe.js +6 -15
- package/build/codeframe.js.map +1 -1
- package/build/load.js +28 -59
- package/build/load.js.map +1 -1
- package/build/transform.d.ts +1 -1
- package/build/transform.js +4 -8
- package/build/transform.js.map +1 -1
- package/build/typescript.d.ts +7 -0
- package/build/typescript.js +91 -0
- package/build/typescript.js.map +1 -0
- package/package.json +2 -2
package/build/codeframe.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export interface Diagnostic {
|
|
2
|
+
message: string;
|
|
3
|
+
loc?: {
|
|
4
|
+
line: number;
|
|
5
|
+
column: number;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare function formatDiagnostic(code: string, diagnostic: Diagnostic | undefined): (SyntaxError & {
|
|
3
9
|
codeFrame: string;
|
|
4
10
|
}) | null;
|
|
5
11
|
export declare function annotateError(code: string | null, filename: string, error: Error): (Error & {
|
package/build/codeframe.js
CHANGED
|
@@ -26,33 +26,24 @@ function errorToLoc(filename, error) {
|
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
-
function formatDiagnostic(diagnostic) {
|
|
29
|
+
function formatDiagnostic(code, diagnostic) {
|
|
30
30
|
if (!diagnostic) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
const {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
messageText
|
|
34
|
+
loc,
|
|
35
|
+
message
|
|
37
36
|
} = diagnostic;
|
|
38
|
-
if (
|
|
37
|
+
if (loc && message) {
|
|
39
38
|
const {
|
|
40
39
|
codeFrameColumns
|
|
41
40
|
} = require('@babel/code-frame');
|
|
42
|
-
const {
|
|
43
|
-
line,
|
|
44
|
-
character
|
|
45
|
-
} = file.getLineAndCharacterOfPosition(start);
|
|
46
|
-
const loc = {
|
|
47
|
-
line: line + 1,
|
|
48
|
-
column: character + 1
|
|
49
|
-
};
|
|
50
|
-
const codeFrame = codeFrameColumns(file.getText(), {
|
|
41
|
+
const codeFrame = codeFrameColumns(code, {
|
|
51
42
|
start: loc
|
|
52
43
|
}, {
|
|
53
44
|
highlightCode: true
|
|
54
45
|
});
|
|
55
|
-
const annotatedError = new SyntaxError(`${
|
|
46
|
+
const annotatedError = new SyntaxError(`${message}\n${codeFrame}`);
|
|
56
47
|
annotatedError.codeFrame = codeFrame;
|
|
57
48
|
delete annotatedError.stack;
|
|
58
49
|
return annotatedError;
|
package/build/codeframe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeframe.js","names":["_nodeUrl","data","_interopRequireDefault","require","e","__esModule","default","errorToLoc","filename","error","name","stack","slice","length","message","trace","match","url","pathToFileURL","href","line","Number","isSafeInteger","column","undefined","formatDiagnostic","
|
|
1
|
+
{"version":3,"file":"codeframe.js","names":["_nodeUrl","data","_interopRequireDefault","require","e","__esModule","default","errorToLoc","filename","error","name","stack","slice","length","message","trace","match","url","pathToFileURL","href","line","Number","isSafeInteger","column","undefined","formatDiagnostic","code","diagnostic","loc","codeFrameColumns","codeFrame","start","highlightCode","annotatedError","SyntaxError","annotateError"],"sources":["../src/codeframe.ts"],"sourcesContent":["import url from 'node:url';\n\nexport interface Diagnostic {\n message: string;\n loc?: { line: number; column: number };\n}\n\nfunction errorToLoc(filename: string, error: Error) {\n if (typeof error.name === 'string' && typeof error.stack === 'string') {\n let stack = error.stack.slice(error.name.length + 2 /* '${name}: ' prefix */);\n stack = stack.slice(error.message.length);\n const trace = stack.match(/at ([^\\n]+):(\\d+):(\\d+)/m);\n if (url.pathToFileURL(filename).href === trace?.[1]) {\n const line = Number(trace[2]);\n return Number.isSafeInteger(line) ? { line, column: Number(trace[3]) || undefined } : null;\n }\n }\n return null;\n}\n\nexport function formatDiagnostic(code: string, diagnostic: Diagnostic | undefined) {\n if (!diagnostic) {\n return null;\n }\n const { loc, message } = diagnostic;\n if (loc && message) {\n const { codeFrameColumns }: typeof import('@babel/code-frame') = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(code, { start: loc }, { highlightCode: true });\n const annotatedError = new SyntaxError(`${message}\\n${codeFrame}`) as SyntaxError & {\n codeFrame: string;\n };\n annotatedError.codeFrame = codeFrame;\n delete annotatedError.stack;\n return annotatedError;\n }\n return null;\n}\n\nexport function annotateError(code: string | null, filename: string, error: Error) {\n if (typeof error !== 'object' || error == null) {\n return null;\n }\n if (code) {\n const loc = errorToLoc(filename, error);\n if (loc) {\n const { codeFrameColumns }: typeof import('@babel/code-frame') = require('@babel/code-frame');\n const codeFrame = codeFrameColumns(code, { start: loc }, { highlightCode: true });\n const annotatedError = error as Error & { codeFrame: string };\n annotatedError.codeFrame = codeFrame;\n annotatedError.message += `\\n${codeFrame}`;\n delete annotatedError.stack;\n return annotatedError;\n }\n }\n return null;\n}\n"],"mappings":";;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAO3B,SAASG,UAAUA,CAACC,QAAgB,EAAEC,KAAY,EAAE;EAClD,IAAI,OAAOA,KAAK,CAACC,IAAI,KAAK,QAAQ,IAAI,OAAOD,KAAK,CAACE,KAAK,KAAK,QAAQ,EAAE;IACrE,IAAIA,KAAK,GAAGF,KAAK,CAACE,KAAK,CAACC,KAAK,CAACH,KAAK,CAACC,IAAI,CAACG,MAAM,GAAG,CAAC,CAAC,wBAAwB,CAAC;IAC7EF,KAAK,GAAGA,KAAK,CAACC,KAAK,CAACH,KAAK,CAACK,OAAO,CA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,EAAE;IACR,MAAME,GAAG,GAAGrB,UAAU,CAACC,QAAQ,EAAEC,KAAK,CAAC;IACvC,IAAImB,GAAG,EAAE;MACP,MAAM;QAAEC;MAAqD,CAAC,GAAG1B,OAAO,CAAC,mBAAmB,CAAC;MAC7F,MAAM2B,SAAS,GAAGD,gBAAgB,CAACH,IAAI,EAAE;QAAEK,KAAK,EAAEH;MAAI,CAAC,EAAE;QAAEI,aAAa,EAAE;MAAK,CAAC,CAAC;MACjF,MAAMC,cAAc,GAAGxB,KAAsC;MAC7DwB,cAAc,CAACH,SAAS,GAAGA,SAAS;MACpCG,cAAc,CAACnB,OAAO,IAAI,KAAKgB,SAAS,EAAE;MAC1C,OAAOG,cAAc,CAACtB,KAAK;MAC3B,OAAOsB,cAAc;IACvB;EACF;EACA,OAAO,IAAI;AACb","ignoreList":[]}
|
package/build/load.js
CHANGED
|
@@ -67,29 +67,15 @@ function _transform() {
|
|
|
67
67
|
};
|
|
68
68
|
return data;
|
|
69
69
|
}
|
|
70
|
+
function _typescript() {
|
|
71
|
+
const data = require("./typescript");
|
|
72
|
+
_typescript = function () {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
70
77
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
71
78
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
72
|
-
let _ts;
|
|
73
|
-
function loadTypescript() {
|
|
74
|
-
if (_ts === undefined) {
|
|
75
|
-
try {
|
|
76
|
-
_ts = require('typescript');
|
|
77
|
-
// NOTE(@kitten): typescript v7 ships without the necessary compiler/public APIs to use it
|
|
78
|
-
// for transpilation or other purposes
|
|
79
|
-
if (typeof _ts?.transpileModule !== 'function') {
|
|
80
|
-
_ts = null;
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
if (error.code !== 'MODULE_NOT_FOUND') {
|
|
85
|
-
throw error;
|
|
86
|
-
} else {
|
|
87
|
-
_ts = null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return _ts;
|
|
92
|
-
}
|
|
93
79
|
const parent = module;
|
|
94
80
|
const tsExtensionMapping = {
|
|
95
81
|
'.ts': '.js',
|
|
@@ -280,53 +266,36 @@ function containsModuleSyntax(code) {
|
|
|
280
266
|
}
|
|
281
267
|
}
|
|
282
268
|
const hasStripTypeScriptTypes = typeof nodeModule().stripTypeScriptTypes === 'function';
|
|
269
|
+
function supportsStripTypeScriptTypesTransform() {
|
|
270
|
+
const nodeVersion = process.versions.node.split('.', 1).map(Number);
|
|
271
|
+
return nodeVersion[0] < 26;
|
|
272
|
+
}
|
|
273
|
+
function stripTypeScriptTypes(code) {
|
|
274
|
+
if (!supportsStripTypeScriptTypesTransform()) {
|
|
275
|
+
return nodeModule().stripTypeScriptTypes(code);
|
|
276
|
+
}
|
|
277
|
+
return nodeModule().stripTypeScriptTypes(code, {
|
|
278
|
+
mode: 'transform',
|
|
279
|
+
sourceMap: true
|
|
280
|
+
});
|
|
281
|
+
}
|
|
283
282
|
function evalModule(code, filename, opts = {}, format = toFormat(filename, true)) {
|
|
284
283
|
const shouldCache = opts.cache ?? true;
|
|
285
284
|
let inputCode = code;
|
|
286
285
|
let inputFilename = filename;
|
|
287
286
|
let diagnostic;
|
|
288
287
|
if (format.mode === 'typescript' || format.mode === 'module-typescript' || format.mode === 'commonjs-typescript') {
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
module = ts.ModuleKind.CommonJS;
|
|
294
|
-
} else if (format.mode === 'module-typescript') {
|
|
295
|
-
module = ts.ModuleKind.ESNext;
|
|
296
|
-
} else {
|
|
297
|
-
// NOTE(@kitten): We can "preserve" the output, meaning, it can either be ESM or CJS
|
|
298
|
-
// and stop TypeScript from either transpiling it to CommonJS or adding an `export {}`
|
|
299
|
-
// if no exports are used. This allows the user to choose if this file is CJS or ESM
|
|
300
|
-
// (but not to mix both)
|
|
301
|
-
module = ts.ModuleKind.Preserve;
|
|
302
|
-
}
|
|
303
|
-
const output = ts.transpileModule(code, {
|
|
304
|
-
fileName: filename,
|
|
305
|
-
reportDiagnostics: true,
|
|
306
|
-
compilerOptions: {
|
|
307
|
-
module,
|
|
308
|
-
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
309
|
-
// `verbatimModuleSyntax` needs to be off, to erase as many imports as possible
|
|
310
|
-
verbatimModuleSyntax: false,
|
|
311
|
-
target: ts.ScriptTarget.ESNext,
|
|
312
|
-
newLine: ts.NewLineKind.LineFeed,
|
|
313
|
-
inlineSourceMap: true,
|
|
314
|
-
esModuleInterop: true
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
inputCode = output?.outputText || inputCode;
|
|
318
|
-
if (output?.diagnostics?.length) {
|
|
319
|
-
diagnostic = output.diagnostics[0];
|
|
320
|
-
}
|
|
288
|
+
const output = (0, _typescript().transpile)(code, filename, format.mode);
|
|
289
|
+
if (output) {
|
|
290
|
+
inputCode = output.outputText;
|
|
291
|
+
diagnostic = output.diagnostic;
|
|
321
292
|
}
|
|
322
293
|
if (hasStripTypeScriptTypes && inputCode === code) {
|
|
323
294
|
// This may throw its own error, but this contains a code-frame already
|
|
324
|
-
inputCode =
|
|
325
|
-
mode: 'transform',
|
|
326
|
-
sourceMap: true
|
|
327
|
-
});
|
|
295
|
+
inputCode = stripTypeScriptTypes(code);
|
|
328
296
|
if (format.mode === 'commonjs-typescript') {
|
|
329
|
-
|
|
297
|
+
// NOTE(@kitten): Match TypeScript's CommonJS emit with esModuleInterop enabled.
|
|
298
|
+
inputCode = (0, _transform().toCommonJS)(filename, inputCode, 'babel');
|
|
330
299
|
}
|
|
331
300
|
}
|
|
332
301
|
if (inputCode !== code) {
|
|
@@ -356,7 +325,7 @@ function evalModule(code, filename, opts = {}, format = toFormat(filename, true)
|
|
|
356
325
|
} catch (error) {
|
|
357
326
|
// If we have a diagnostic from TypeScript, we issue its error with a codeframe first,
|
|
358
327
|
// since it's likely more useful than the eval error
|
|
359
|
-
const diagnosticError = (0, _codeframe().formatDiagnostic)(diagnostic);
|
|
328
|
+
const diagnosticError = (0, _codeframe().formatDiagnostic)(code, diagnostic);
|
|
360
329
|
if (diagnosticError) {
|
|
361
330
|
throw diagnosticError;
|
|
362
331
|
}
|
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","importFilename","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 const importFilename = path.isAbsolute(filename)\n ? url.pathToFileURL(filename).toString()\n : filename;\n return await import(importFilename);\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,GAAAE,O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YAAY,GAChBlF,MAAM,CAACnC,IAAI,KAAK,mBAAmB,IACnCmC,MAAM,CAACnC,IAAI,KAAK,qBAAqB,IACrCmC,MAAM,CAACnC,IAAI,KAAK,YAAY;EAC9B,IAAI;IACF,IAAImC,MAAM,CAACnC,IAAI,KAAK,QAAQ,IAAI,CAACqH,YAAY,EAAE;MAC7C,OAAOjK,OAAO,CAACuC,QAAQ,CAAC;IAC1B;EACF,CAAC,CAAC,OAAON,KAAU,EAAE;IACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,kBAAkB,EAAE;MACrC,MAAMD,KAAK;IACb,CAAC,MAAM,IAAI8C,MAAM,CAACnC,IAAI,IAAI,IAAI,EAAE;MAC9B,MAAMV,IAAI,GAAGI,iBAAiB,CAACC,QAAQ,CAAC;MACxC,MAAM,IAAAkH,0BAAa,EAACvH,IAAI,EAAEK,QAAQ,EAAEN,KAAK,CAAC,IAAIA,KAAK;IACrD;IACA;IACA;IACA;EACF;;EAEA;EACA;EACA,IAAIjC,OAAO,CAACiF,KAAK,CAAC1C,QAAQ,CAAC,EAAE+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","_typescript","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","parent","module","tsExtensionMapping","maybeReadFileSync","filename","fs","readFileSync","error","code","toFormat","isLegacy","mode","legacy","endsWith","undefined","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","output","transpile","outputText","toCommonJS","ext","extname","inputExt","exports","diagnosticError","formatDiagnostic","annotateError","requireOrImport","importFilename","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';\n\nimport { annotateError, formatDiagnostic, type Diagnostic } from './codeframe';\nimport { installSourceMapStackTrace } from './stacktrace';\nimport { toCommonJS } from './transform';\nimport { transpile } from './typescript';\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\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: Diagnostic | undefined;\n if (\n format.mode === 'typescript' ||\n format.mode === 'module-typescript' ||\n format.mode === 'commonjs-typescript'\n ) {\n const output = transpile(code, filename, format.mode);\n if (output) {\n inputCode = output.outputText;\n diagnostic = output.diagnostic;\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 // NOTE(@kitten): Match TypeScript's CommonJS emit with esModuleInterop enabled.\n inputCode = toCommonJS(filename, inputCode, 'babel');\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(code, 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 const importFilename = path.isAbsolute(filename)\n ? url.pathToFileURL(filename).toString()\n : filename;\n return await import(importFilename);\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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EAAE,MAAM,CAAC;EAC9C,OAAO2F,UAAU,CAACvF,IAAI,EAAEJ,QAAQ,EAAE,CAAC,CAAC,EAAE2C,MAAM,CAAC;AAC/C","ignoreList":[]}
|
package/build/transform.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function toCommonJS(filename: string, code: string): string;
|
|
1
|
+
export declare function toCommonJS(filename: string, code: string, importInterop?: 'node' | 'babel'): string;
|
package/build/transform.js
CHANGED
|
@@ -9,19 +9,15 @@ function _core() {
|
|
|
9
9
|
};
|
|
10
10
|
return data;
|
|
11
11
|
}
|
|
12
|
-
function toCommonJS(filename, code) {
|
|
12
|
+
function toCommonJS(filename, code, importInterop = 'node') {
|
|
13
13
|
const result = (0, _core().transformSync)(code, {
|
|
14
14
|
filename,
|
|
15
15
|
babelrc: false,
|
|
16
16
|
configFile: false,
|
|
17
17
|
plugins: [[require('@babel/plugin-transform-modules-commonjs'), {
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
// Node ESM loading. In Babel, this is the "node" flag (although
|
|
22
|
-
// node behaviour is explicitly different from this). This skips
|
|
23
|
-
// the `__esModule -> default` wrapper
|
|
24
|
-
importInterop: 'node',
|
|
18
|
+
// Preserve legacy JavaScript imports of the whole CommonJS exports object.
|
|
19
|
+
// TypeScript's stripping fallback opts into Babel's __esModule interop.
|
|
20
|
+
importInterop,
|
|
25
21
|
loose: true
|
|
26
22
|
}]]
|
|
27
23
|
});
|
package/build/transform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","names":["_core","data","require","toCommonJS","filename","code","result","transformSync","babelrc","configFile","plugins","
|
|
1
|
+
{"version":3,"file":"transform.js","names":["_core","data","require","toCommonJS","filename","code","importInterop","result","transformSync","babelrc","configFile","plugins","loose"],"sources":["../src/transform.ts"],"sourcesContent":["import { transformSync } from '@babel/core';\n\nexport function toCommonJS(\n filename: string,\n code: string,\n importInterop: 'node' | 'babel' = 'node'\n) {\n const result = transformSync(code, {\n filename,\n babelrc: false,\n configFile: false,\n plugins: [\n [\n require('@babel/plugin-transform-modules-commonjs'),\n {\n // Preserve legacy JavaScript imports of the whole CommonJS exports object.\n // TypeScript's stripping fallback opts into Babel's __esModule interop.\n importInterop,\n loose: true,\n },\n ],\n ],\n });\n return result?.code ?? code;\n}\n"],"mappings":";;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASE,UAAUA,CACxBC,QAAgB,EAChBC,IAAY,EACZC,aAA+B,GAAG,MAAM,EACxC;EACA,MAAMC,MAAM,GAAG,IAAAC,qBAAa,EAACH,IAAI,EAAE;IACjCD,QAAQ;IACRK,OAAO,EAAE,KAAK;IACdC,UAAU,EAAE,KAAK;IACjBC,OAAO,EAAE,CACP,CACET,OAAO,CAAC,0CAA0C,CAAC,EACnD;MACE;MACA;MACAI,aAAa;MACbM,KAAK,EAAE;IACT,CAAC,CACF;EAEL,CAAC,CAAC;EACF,OAAOL,MAAM,EAAEF,IAAI,IAAIA,IAAI;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Diagnostic } from './codeframe';
|
|
2
|
+
type ModuleFormat = 'commonjs-typescript' | 'module-typescript' | 'typescript';
|
|
3
|
+
export declare function transpile(code: string, filename: string, format: ModuleFormat): {
|
|
4
|
+
outputText: string;
|
|
5
|
+
diagnostic?: Diagnostic;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.transpile = transpile;
|
|
5
|
+
function compilerOptions(enums, newLine, format) {
|
|
6
|
+
return {
|
|
7
|
+
module: format === 'commonjs-typescript' ? enums.ModuleKind.CommonJS : format === 'module-typescript' ? enums.ModuleKind.ESNext : enums.ModuleKind.Preserve,
|
|
8
|
+
moduleResolution: enums.ModuleResolutionKind.Bundler,
|
|
9
|
+
// Erase unused imports, and preserve the user's choice of CJS or ESM in preserve mode.
|
|
10
|
+
verbatimModuleSyntax: false,
|
|
11
|
+
target: enums.ScriptTarget.ESNext,
|
|
12
|
+
newLine,
|
|
13
|
+
inlineSourceMap: true,
|
|
14
|
+
esModuleInterop: true
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function requireOptional(id) {
|
|
18
|
+
try {
|
|
19
|
+
return require(id);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function flattenNativeDiagnostic(diagnostic) {
|
|
28
|
+
return [diagnostic.text, ...(diagnostic.messageChain?.map(flattenNativeDiagnostic) ?? [])].join('\n');
|
|
29
|
+
}
|
|
30
|
+
function loadTranspiler() {
|
|
31
|
+
const legacy = requireOptional('typescript');
|
|
32
|
+
if (!legacy) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (typeof legacy.transpileModule === 'function') {
|
|
36
|
+
return (code, filename, format) => {
|
|
37
|
+
const output = legacy.transpileModule(code, {
|
|
38
|
+
fileName: filename,
|
|
39
|
+
reportDiagnostics: true,
|
|
40
|
+
compilerOptions: compilerOptions(legacy, legacy.NewLineKind.LineFeed, format)
|
|
41
|
+
});
|
|
42
|
+
const diagnostic = output.diagnostics?.[0];
|
|
43
|
+
const position = diagnostic?.file && diagnostic.start != null ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : undefined;
|
|
44
|
+
return {
|
|
45
|
+
outputText: output.outputText,
|
|
46
|
+
diagnostic: diagnostic && {
|
|
47
|
+
message: legacy.flattenDiagnosticMessageText(diagnostic.messageText, '\n'),
|
|
48
|
+
loc: position && {
|
|
49
|
+
line: position.line + 1,
|
|
50
|
+
column: position.character + 1
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// NOTE(@kitten): Typescript 7.1+ API shape
|
|
58
|
+
const native = requireOptional('typescript/unstable/sync');
|
|
59
|
+
if (typeof native?.API !== 'function' || !('transpileModule' in native.API.prototype)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const enums = require('typescript/unstable/proto');
|
|
63
|
+
const api = new native.API();
|
|
64
|
+
return (code, filename, format) => {
|
|
65
|
+
const output = api.transpileModule(code, {
|
|
66
|
+
fileName: filename,
|
|
67
|
+
reportDiagnostics: true,
|
|
68
|
+
compilerOptions: compilerOptions(enums, enums.NewLineKind.LF, format)
|
|
69
|
+
});
|
|
70
|
+
const diagnostic = output.diagnostics?.[0];
|
|
71
|
+
const position = diagnostic?.startPosition;
|
|
72
|
+
return {
|
|
73
|
+
outputText: output.outputText,
|
|
74
|
+
diagnostic: diagnostic && {
|
|
75
|
+
message: flattenNativeDiagnostic(diagnostic),
|
|
76
|
+
loc: position && {
|
|
77
|
+
line: position.line + 1,
|
|
78
|
+
column: position.character + 1
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
let transpiler;
|
|
85
|
+
function transpile(code, filename, format) {
|
|
86
|
+
if (transpiler === undefined) {
|
|
87
|
+
transpiler = loadTranspiler();
|
|
88
|
+
}
|
|
89
|
+
return transpiler?.(code, filename, format);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","names":["compilerOptions","enums","newLine","format","module","ModuleKind","CommonJS","ESNext","Preserve","moduleResolution","ModuleResolutionKind","Bundler","verbatimModuleSyntax","target","ScriptTarget","inlineSourceMap","esModuleInterop","requireOptional","id","require","error","code","flattenNativeDiagnostic","diagnostic","text","messageChain","map","join","loadTranspiler","legacy","transpileModule","filename","output","fileName","reportDiagnostics","NewLineKind","LineFeed","diagnostics","position","file","start","getLineAndCharacterOfPosition","undefined","outputText","message","flattenDiagnosticMessageText","messageText","loc","line","column","character","native","API","prototype","api","LF","startPosition","transpiler","transpile"],"sources":["../src/typescript.ts"],"sourcesContent":["import type * as ts from 'typescript';\n\nimport type { Diagnostic } from './codeframe';\n\ntype ModuleFormat = 'commonjs-typescript' | 'module-typescript' | 'typescript';\ntype CompilerEnums = Pick<typeof ts, 'ModuleKind' | 'ModuleResolutionKind' | 'ScriptTarget'>;\n\ninterface NativeDiagnostic {\n text: string;\n startPosition?: { line: number; character: number };\n messageChain?: NativeDiagnostic[];\n}\n\ninterface NativeAPI {\n transpileModule(\n code: string,\n options: ts.TranspileOptions\n ): { outputText: string; diagnostics?: readonly NativeDiagnostic[] };\n}\n\nfunction compilerOptions(\n enums: CompilerEnums,\n newLine: number,\n format: ModuleFormat\n): ts.CompilerOptions {\n return {\n module:\n format === 'commonjs-typescript'\n ? enums.ModuleKind.CommonJS\n : format === 'module-typescript'\n ? enums.ModuleKind.ESNext\n : enums.ModuleKind.Preserve,\n moduleResolution: enums.ModuleResolutionKind.Bundler,\n // Erase unused imports, and preserve the user's choice of CJS or ESM in preserve mode.\n verbatimModuleSyntax: false,\n target: enums.ScriptTarget.ESNext,\n newLine,\n inlineSourceMap: true,\n esModuleInterop: true,\n };\n}\n\nfunction requireOptional<T>(id: string): T | null {\n try {\n return require(id);\n } catch (error: any) {\n if (error.code === 'MODULE_NOT_FOUND' || error.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {\n return null;\n }\n throw error;\n }\n}\n\nfunction flattenNativeDiagnostic(diagnostic: NativeDiagnostic): string {\n return [diagnostic.text, ...(diagnostic.messageChain?.map(flattenNativeDiagnostic) ?? [])].join(\n '\\n'\n );\n}\n\ntype Transpiler = (\n code: string,\n filename: string,\n format: ModuleFormat\n) => { outputText: string; diagnostic?: Diagnostic };\n\nfunction loadTranspiler(): Transpiler | null {\n const legacy = requireOptional<typeof ts>('typescript');\n if (!legacy) {\n return null;\n }\n\n if (typeof legacy.transpileModule === 'function') {\n return (code, filename, format) => {\n const output = legacy.transpileModule(code, {\n fileName: filename,\n reportDiagnostics: true,\n compilerOptions: compilerOptions(legacy, legacy.NewLineKind.LineFeed, format),\n });\n const diagnostic = output.diagnostics?.[0];\n const position =\n diagnostic?.file && diagnostic.start != null\n ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start)\n : undefined;\n return {\n outputText: output.outputText,\n diagnostic: diagnostic && {\n message: legacy.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'),\n loc: position && { line: position.line + 1, column: position.character + 1 },\n },\n };\n };\n }\n\n // NOTE(@kitten): Typescript 7.1+ API shape\n const native = requireOptional<{ API?: new () => NativeAPI }>('typescript/unstable/sync');\n if (typeof native?.API !== 'function' || !('transpileModule' in native.API.prototype)) {\n return null;\n }\n\n const enums: CompilerEnums & {\n NewLineKind: { LF: number };\n } = require('typescript/unstable/proto');\n const api = new native.API();\n\n return (code, filename, format) => {\n const output = api.transpileModule(code, {\n fileName: filename,\n reportDiagnostics: true,\n compilerOptions: compilerOptions(enums, enums.NewLineKind.LF, format),\n });\n const diagnostic = output.diagnostics?.[0];\n const position = diagnostic?.startPosition;\n return {\n outputText: output.outputText,\n diagnostic: diagnostic && {\n message: flattenNativeDiagnostic(diagnostic),\n loc: position && { line: position.line + 1, column: position.character + 1 },\n },\n };\n };\n}\n\nlet transpiler: Transpiler | null | undefined;\n\nexport function transpile(code: string, filename: string, format: ModuleFormat) {\n if (transpiler === undefined) {\n transpiler = loadTranspiler();\n }\n return transpiler?.(code, filename, format);\n}\n"],"mappings":";;;;AAoBA,SAASA,eAAeA,CACtBC,KAAoB,EACpBC,OAAe,EACfC,MAAoB,EACA;EACpB,OAAO;IACLC,MAAM,EACJD,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EA,KAAK,CAACkC,WAAW,CAACoB,EAAE,EAAEpD,MAAM;IACtE,CAAC,CAAC;IACF,MAAMoB,UAAU,GAAGS,MAAM,CAACK,WAAW,GAAG,CAAC,CAAC;IAC1C,MAAMC,QAAQ,GAAGf,UAAU,EAAEiC,aAAa;IAC1C,OAAO;MACLb,UAAU,EAAEX,MAAM,CAACW,UAAU;MAC7BpB,UAAU,EAAEA,UAAU,IAAI;QACxBqB,OAAO,EAAEtB,uBAAuB,CAACC,UAAU,CAAC;QAC5CwB,GAAG,EAAET,QAAQ,IAAI;UAAEU,IAAI,EAAEV,QAAQ,CAACU,IAAI,GAAG,CAAC;UAAEC,MAAM,EAAEX,QAAQ,CAACY,SAAS,GAAG;QAAE;MAC7E;IACF,CAAC;EACH,CAAC;AACH;AAEA,IAAIO,UAAyC;AAEtC,SAASC,SAASA,CAACrC,IAAY,EAAEU,QAAgB,EAAE5B,MAAoB,EAAE;EAC9E,IAAIsD,UAAU,KAAKf,SAAS,EAAE;IAC5Be,UAAU,GAAG7B,cAAc,CAAC,CAAC;EAC/B;EACA,OAAO6B,UAAU,GAAGpC,IAAI,EAAEU,QAAQ,EAAE5B,MAAM,CAAC;AAC7C","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/require-utils",
|
|
3
|
-
"version": "57.0.
|
|
3
|
+
"version": "57.0.6",
|
|
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": "50ac74f1ab5682c8e32b24da6e5e97dd4dbbb80f",
|
|
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",
|