@expo/require-utils 56.0.1 → 56.1.0
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.d.ts +5 -0
- package/build/load.js +114 -9
- package/build/load.js.map +1 -1
- package/build/stacktrace.d.ts +42 -0
- package/build/stacktrace.js +246 -0
- package/build/stacktrace.js.map +1 -0
- package/package.json +3 -3
package/build/load.d.ts
CHANGED
|
@@ -6,11 +6,16 @@ declare global {
|
|
|
6
6
|
interface Module {
|
|
7
7
|
_compile(code: string, filename: string, format?: 'module' | 'commonjs' | 'commonjs-typescript' | 'module-typescript' | 'typescript'): unknown;
|
|
8
8
|
}
|
|
9
|
+
interface Process {
|
|
10
|
+
isBun?: boolean;
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
type Format = 'commonjs' | 'module' | 'module-typescript' | 'commonjs-typescript' | 'typescript';
|
|
12
15
|
export interface ModuleOptions {
|
|
13
16
|
paths?: string[];
|
|
17
|
+
sourceMap?: string;
|
|
18
|
+
cache?: boolean;
|
|
14
19
|
}
|
|
15
20
|
declare function evalModule(code: string, filename: string, opts?: ModuleOptions, format?: Format): any;
|
|
16
21
|
declare function loadModule(filename: string): Promise<any>;
|
package/build/load.js
CHANGED
|
@@ -20,6 +20,13 @@ function nodeModule() {
|
|
|
20
20
|
};
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
|
+
function _nodeOs() {
|
|
24
|
+
const data = _interopRequireDefault(require("node:os"));
|
|
25
|
+
_nodeOs = function () {
|
|
26
|
+
return data;
|
|
27
|
+
};
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
23
30
|
function _nodePath() {
|
|
24
31
|
const data = _interopRequireDefault(require("node:path"));
|
|
25
32
|
_nodePath = function () {
|
|
@@ -41,6 +48,13 @@ function _codeframe() {
|
|
|
41
48
|
};
|
|
42
49
|
return data;
|
|
43
50
|
}
|
|
51
|
+
function _stacktrace() {
|
|
52
|
+
const data = require("./stacktrace");
|
|
53
|
+
_stacktrace = function () {
|
|
54
|
+
return data;
|
|
55
|
+
};
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
44
58
|
function _transform() {
|
|
45
59
|
const data = require("./transform");
|
|
46
60
|
_transform = function () {
|
|
@@ -118,31 +132,122 @@ function toRealDirname(filePath) {
|
|
|
118
132
|
return normalized;
|
|
119
133
|
}
|
|
120
134
|
}
|
|
135
|
+
const hasModuleSourceMapsSupport = typeof nodeModule().setSourceMapsSupport === 'function';
|
|
136
|
+
function getSourceMapsState() {
|
|
137
|
+
return typeof nodeModule().getSourceMapsSupport === 'function' ? nodeModule().getSourceMapsSupport() : {
|
|
138
|
+
enabled: !!process.sourceMapsEnabled
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function setSourceMapsState(state) {
|
|
142
|
+
if (hasModuleSourceMapsSupport) {
|
|
143
|
+
nodeModule().setSourceMapsSupport(state.enabled, {
|
|
144
|
+
nodeModules: state.nodeModules ?? false,
|
|
145
|
+
generatedCode: state.generatedCode ?? false
|
|
146
|
+
});
|
|
147
|
+
} else {
|
|
148
|
+
process.setSourceMapsEnabled(state.enabled);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function makeSourceMapTempPath(filename) {
|
|
152
|
+
let basename = _nodePath().default.basename(filename);
|
|
153
|
+
const queryIdx = basename.search(/[?#]/);
|
|
154
|
+
if (queryIdx >= 0) {
|
|
155
|
+
basename = basename.slice(0, queryIdx);
|
|
156
|
+
}
|
|
157
|
+
return _nodePath().default.join(_nodeOs().default.tmpdir(), `require-utils-${process.pid}-${basename}.map`);
|
|
158
|
+
}
|
|
159
|
+
function stripSourceMappingURL(code) {
|
|
160
|
+
return code.replace(/^[ \t]*\/\/[#@][ \t]+sourceMappingURL=.*$/gm, '');
|
|
161
|
+
}
|
|
121
162
|
function compileModule(code, filename, opts) {
|
|
122
163
|
const format = toFormat(filename, false);
|
|
164
|
+
const shouldCache = opts.cache ?? true;
|
|
123
165
|
const prependPaths = opts.paths ?? [];
|
|
124
166
|
// See: https://github.com/nodejs/node/blob/ff080948666f28fbd767548d26bea034d30bc277/lib/internal/modules/cjs/loader.js#L767
|
|
125
167
|
// If we get a symlinked path instead of the realpath, we assume the realpath is needed for Node module resolution
|
|
126
168
|
const basePath = toRealDirname(filename);
|
|
127
169
|
const nodeModulePaths = nodeModule()._nodeModulePaths(basePath);
|
|
128
170
|
const paths = [...prependPaths, ...nodeModulePaths];
|
|
171
|
+
let inputCode = code;
|
|
172
|
+
|
|
173
|
+
// We may get a Metro SSR relative path here, which isn't a valid absolute path, and we need to normalize
|
|
174
|
+
// the filename before proceeding
|
|
175
|
+
let compileFilename = filename;
|
|
176
|
+
if (opts.sourceMap) {
|
|
177
|
+
const queryIdx = filename.search(/[?#]/);
|
|
178
|
+
const basePart = queryIdx >= 0 ? filename.slice(0, queryIdx) : filename;
|
|
179
|
+
const queryPart = queryIdx >= 0 ? filename.slice(queryIdx) : '';
|
|
180
|
+
if (!_nodePath().default.isAbsolute(basePart)) {
|
|
181
|
+
compileFilename = _nodePath().default.resolve(basePart) + queryPart;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
let mapPath;
|
|
185
|
+
let priorSourceMapsState;
|
|
186
|
+
if (opts.sourceMap && !process.isBun) {
|
|
187
|
+
try {
|
|
188
|
+
mapPath = makeSourceMapTempPath(compileFilename);
|
|
189
|
+
_nodeFs().default.writeFileSync(mapPath, opts.sourceMap);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
mapPath = undefined;
|
|
192
|
+
// If we fail to write the source map, we can still continue without it, but log a warning since it's likely a misconfiguration
|
|
193
|
+
console.warn(`Warning: Failed to write source map for ${filename} to ${mapPath}. Source maps will be unavailable for this module.\n${error?.message || error}`);
|
|
194
|
+
}
|
|
195
|
+
if (mapPath) {
|
|
196
|
+
inputCode = stripSourceMappingURL(code);
|
|
197
|
+
// NOTE This needs to be a plain absolute path because Node rejects file: URLs
|
|
198
|
+
inputCode += `\n//# sourceMappingURL=${mapPath}`;
|
|
199
|
+
priorSourceMapsState = getSourceMapsState();
|
|
200
|
+
(0, _stacktrace().installSourceMapStackTrace)();
|
|
201
|
+
setSourceMapsState({
|
|
202
|
+
enabled: true,
|
|
203
|
+
nodeModules: true
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const mod = Object.assign(new (nodeModule().Module)(compileFilename, parent), {
|
|
208
|
+
filename: compileFilename,
|
|
209
|
+
paths
|
|
210
|
+
});
|
|
211
|
+
const childIdx = parent?.children?.indexOf(mod) ?? -1;
|
|
212
|
+
if (childIdx >= 0) {
|
|
213
|
+
parent.children.splice(childIdx, 1);
|
|
214
|
+
}
|
|
129
215
|
try {
|
|
130
|
-
|
|
131
|
-
filename,
|
|
132
|
-
paths
|
|
133
|
-
});
|
|
134
|
-
mod._compile(code, filename, format != null ? format : undefined);
|
|
216
|
+
mod._compile(inputCode, compileFilename, format != null ? format : undefined);
|
|
135
217
|
mod.loaded = true;
|
|
136
|
-
|
|
137
|
-
|
|
218
|
+
if (shouldCache) {
|
|
219
|
+
require.cache[compileFilename] = mod;
|
|
220
|
+
if (compileFilename !== filename) {
|
|
221
|
+
require.cache[filename] = mod;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
138
224
|
return mod;
|
|
139
225
|
} catch (error) {
|
|
140
|
-
|
|
226
|
+
if (shouldCache) {
|
|
227
|
+
delete require.cache[compileFilename];
|
|
228
|
+
if (compileFilename !== filename) {
|
|
229
|
+
delete require.cache[filename];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
141
232
|
throw error;
|
|
233
|
+
} finally {
|
|
234
|
+
if (mapPath) {
|
|
235
|
+
// Restore, so subsequent requires of node_modules won't have their source-maps read
|
|
236
|
+
setSourceMapsState(priorSourceMapsState ?? {
|
|
237
|
+
enabled: false
|
|
238
|
+
});
|
|
239
|
+
// Node parses source maps eagerly during _compile, so the file can be removed now.
|
|
240
|
+
try {
|
|
241
|
+
_nodeFs().default.unlinkSync(mapPath);
|
|
242
|
+
} catch {
|
|
243
|
+
/* noop */
|
|
244
|
+
}
|
|
245
|
+
}
|
|
142
246
|
}
|
|
143
247
|
}
|
|
144
248
|
const hasStripTypeScriptTypes = typeof nodeModule().stripTypeScriptTypes === 'function';
|
|
145
249
|
function evalModule(code, filename, opts = {}, format = toFormat(filename, true)) {
|
|
250
|
+
const shouldCache = opts.cache ?? true;
|
|
146
251
|
let inputCode = code;
|
|
147
252
|
let inputFilename = filename;
|
|
148
253
|
let diagnostic;
|
|
@@ -199,7 +304,7 @@ function evalModule(code, filename, opts = {}, format = toFormat(filename, true)
|
|
|
199
304
|
}
|
|
200
305
|
try {
|
|
201
306
|
const mod = compileModule(inputCode, inputFilename, opts);
|
|
202
|
-
if (inputFilename !== filename) {
|
|
307
|
+
if (shouldCache && inputFilename !== filename) {
|
|
203
308
|
require.cache[filename] = mod;
|
|
204
309
|
}
|
|
205
310
|
return mod.exports;
|
package/build/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","names":["_nodeFs","data","_interopRequireDefault","require","nodeModule","_interopRequireWildcard","_nodePath","_nodeUrl","_codeframe","_transform","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_ts","loadTypescript","undefined","error","code","parent","module","tsExtensionMapping","maybeReadFileSync","filename","fs","readFileSync","toFormat","isLegacy","endsWith","toRealDirname","filePath","normalized","path","resolve","realpathSync","dirname","compileModule","opts","format","prependPaths","paths","basePath","nodeModulePaths","_nodeModulePaths","mod","assign","Module","_compile","loaded","cache","children","splice","indexOf","hasStripTypeScriptTypes","stripTypeScriptTypes","evalModule","inputCode","inputFilename","diagnostic","ts","ModuleKind","CommonJS","ESNext","Preserve","output","transpileModule","fileName","reportDiagnostics","compilerOptions","moduleResolution","ModuleResolutionKind","Bundler","verbatimModuleSyntax","target","ScriptTarget","newLine","NewLineKind","LineFeed","inlineSourceMap","esModuleInterop","outputText","diagnostics","length","mode","sourceMap","ext","extname","inputExt","join","basename","toCommonJS","exports","diagnosticError","formatDiagnostic","annotateError","requireOrImport","Promise","isAbsolute","url","pathToFileURL","toString","then","s","loadModule","loadModuleSync","isTypeScript"],"sources":["../src/load.ts"],"sourcesContent":["import fs from 'node:fs';\nimport * as nodeModule from 'node:module';\nimport path from 'node:path';\nimport url from 'node:url';\nimport type * as ts from 'typescript';\n\nimport { annotateError, formatDiagnostic } from './codeframe';\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 }\n}\n\nlet _ts: typeof import('typescript') | null | undefined;\nfunction loadTypescript() {\n if (_ts === undefined) {\n try {\n _ts = require('typescript');\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\ntype Format = 'commonjs' | 'module' | 'module-typescript' | 'commonjs-typescript' | 'typescript';\n\nfunction toFormat(filename: string, isLegacy: true): Format;\nfunction toFormat(filename: string, isLegacy: false): Format | null;\nfunction toFormat(filename: string, isLegacy: boolean): Format | null {\n if (filename.endsWith('.cjs')) {\n return 'commonjs';\n } else if (filename.endsWith('.mjs')) {\n return 'module';\n } else if (filename.endsWith('.js')) {\n return isLegacy ? 'commonjs' : null;\n } else if (filename.endsWith('.mts')) {\n return 'module-typescript';\n } else if (filename.endsWith('.cts')) {\n return 'commonjs-typescript';\n } else if (filename.endsWith('.ts')) {\n return isLegacy ? 'commonjs-typescript' : 'typescript';\n } else {\n return null;\n }\n}\n\nexport interface ModuleOptions {\n paths?: string[];\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\nfunction compileModule(code: string, filename: string, opts: ModuleOptions) {\n const format = toFormat(filename, false);\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 try {\n const mod = Object.assign(new nodeModule.Module(filename, parent), { filename, paths });\n mod._compile(code, filename, format != null ? format : undefined);\n mod.loaded = true;\n require.cache[filename] = mod;\n parent?.children?.splice(parent.children.indexOf(mod), 1);\n return mod;\n } catch (error: any) {\n delete require.cache[filename];\n throw error;\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 let inputCode = code;\n let inputFilename = filename;\n let diagnostic: ts.Diagnostic | undefined;\n if (\n format === 'typescript' ||\n format === 'module-typescript' ||\n format === 'commonjs-typescript'\n ) {\n const ts = loadTypescript();\n\n if (ts) {\n let module: ts.ModuleKind;\n if (format === 'commonjs-typescript') {\n module = ts.ModuleKind.CommonJS;\n } else if (format === '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 }\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 === 'commonjs') {\n inputCode = toCommonJS(filename, code);\n }\n\n try {\n const mod = compileModule(inputCode, inputFilename, opts);\n if (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 === 'module-typescript' || format === 'commonjs-typescript' || format === 'typescript';\n try {\n if (format !== '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 == 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,UAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA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AC,CAACyB,MAAM,EAAE;IACtE,OAAO5D,OAAO,CAAC6D,KAAK,CAAC1B,QAAQ,CAAC,CAACoE,OAAO;EACxC;EAEA,MAAMzE,IAAI,GAAGM,iBAAE,CAACC,YAAY,CAACF,QAAQ,EAAE,MAAM,CAAC;EAC9C,OAAOgC,UAAU,CAACrC,IAAI,EAAEK,QAAQ,EAAE,CAAC,CAAC,EAAEe,MAAM,CAAC;AAC/C","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"load.js","names":["_nodeFs","data","_interopRequireDefault","require","nodeModule","_interopRequireWildcard","_nodeOs","_nodePath","_nodeUrl","_codeframe","_stacktrace","_transform","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_ts","loadTypescript","undefined","error","code","parent","module","tsExtensionMapping","maybeReadFileSync","filename","fs","readFileSync","toFormat","isLegacy","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","installSourceMapStackTrace","mod","assign","Module","childIdx","children","indexOf","splice","_compile","loaded","unlinkSync","hasStripTypeScriptTypes","stripTypeScriptTypes","evalModule","inputFilename","diagnostic","ts","ModuleKind","CommonJS","ESNext","Preserve","output","transpileModule","fileName","reportDiagnostics","compilerOptions","moduleResolution","ModuleResolutionKind","Bundler","verbatimModuleSyntax","target","ScriptTarget","newLine","NewLineKind","LineFeed","inlineSourceMap","esModuleInterop","outputText","diagnostics","length","mode","ext","extname","inputExt","toCommonJS","exports","diagnosticError","formatDiagnostic","annotateError","requireOrImport","Promise","url","pathToFileURL","toString","then","s","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 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 } 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\ntype Format = 'commonjs' | 'module' | 'module-typescript' | 'commonjs-typescript' | 'typescript';\n\nfunction toFormat(filename: string, isLegacy: true): Format;\nfunction toFormat(filename: string, isLegacy: false): Format | null;\nfunction toFormat(filename: string, isLegacy: boolean): Format | null {\n if (filename.endsWith('.cjs')) {\n return 'commonjs';\n } else if (filename.endsWith('.mjs')) {\n return 'module';\n } else if (filename.endsWith('.js')) {\n return isLegacy ? 'commonjs' : null;\n } else if (filename.endsWith('.mts')) {\n return 'module-typescript';\n } else if (filename.endsWith('.cts')) {\n return 'commonjs-typescript';\n } else if (filename.endsWith('.ts')) {\n return isLegacy ? 'commonjs-typescript' : 'typescript';\n } else {\n return null;\n }\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 This needs to be a plain absolute path because Node rejects file: URLs\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 != null ? format : undefined);\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\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 === 'typescript' ||\n format === 'module-typescript' ||\n format === 'commonjs-typescript'\n ) {\n const ts = loadTypescript();\n\n if (ts) {\n let module: ts.ModuleKind;\n if (format === 'commonjs-typescript') {\n module = ts.ModuleKind.CommonJS;\n } else if (format === '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 }\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 === 'commonjs') {\n inputCode = toCommonJS(filename, code);\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 === 'module-typescript' || format === 'commonjs-typescript' || format === 'typescript';\n try {\n if (format !== '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 == 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;AAGA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,YAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EAAAO,WAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAU,WAAA;EAAA,MAAAV,IAAA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YAAY,EAAE;MACxC,OAAO1J,OAAO,CAACqC,QAAQ,CAAC;IAC1B;EACF,CAAC,CAAC,OAAON,KAAU,EAAE;IACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,kBAAkB,EAAE;MACrC,MAAMD,KAAK;IACb,CAAC,MAAM,IAAI4C,MAAM,IAAI,IAAI,EAAE;MACzB,MAAM3C,IAAI,GAAGI,iBAAiB,CAACC,QAAQ,CAAC;MACxC,MAAM,IAAA2G,0BAAa,EAAChH,IAAI,EAAEK,QAAQ,EAAEN,KAAK,CAAC,IAAIA,KAAK;IACrD;IACA;IACA;IACA;EACF;;EAEA;EACA;EACA,IAAI/B,OAAO,CAAC6E,KAAK,CAACxC,QAAQ,CAAC,EAAEwG,OAAO,IAAI7I,OAAO,CAAC6E,KAAK,CAACxC,QAAQ,CAAC,CAACoE,MAAM,EAAE;IACtE,OAAOzG,OAAO,CAAC6E,KAAK,CAACxC,QAAQ,CAAC,CAACwG,OAAO;EACxC;EAEA,MAAM7G,IAAI,GAAGM,iBAAE,CAACC,YAAY,CAACF,QAAQ,EAAE,MAAM,CAAC;EAC9C,OAAOwE,UAAU,CAAC7E,IAAI,EAAEK,QAAQ,EAAE,CAAC,CAAC,EAAEsC,MAAM,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install a JS-level `Error.prepareStackTrace` that symbolicates frames using Node's
|
|
3
|
+
* source map cache (`module.findSourceMap`). Idempotent — calling more than once is a no-op.
|
|
4
|
+
*
|
|
5
|
+
* Background: Node's automatic stack symbolication is gated on source maps being enabled.
|
|
6
|
+
* `compileModule` toggles source maps on only during `_compile` (to keep the cache scoped
|
|
7
|
+
* to our bundles rather than every `require()`'d package), so by the time an error from
|
|
8
|
+
* the bundle is formatted, automatic symbolication is off. This shim restores it.
|
|
9
|
+
*
|
|
10
|
+
* Implementation closely follows
|
|
11
|
+
* https://github.com/evanw/node-source-map-support/blob/master/source-map-support.js,
|
|
12
|
+
* the canonical reference for this kind of `prepareStackTrace` shim:
|
|
13
|
+
*
|
|
14
|
+
* - Source-mapped frames are wrapped in cloned plain-object call sites that override
|
|
15
|
+
* `getFileName`, `getLineNumber`, `getColumnNumber`, `getFunctionName`,
|
|
16
|
+
* `getScriptNameOrSourceURL`, and `toString`. V8's native
|
|
17
|
+
* `CallSite.prototype.toString` is implemented in C++ and reads internal slots
|
|
18
|
+
* directly, ignoring overridden JS getters; so we reimplement `toString` in JS
|
|
19
|
+
* (`callSiteToString`) on the clone, which consults the overridden getters.
|
|
20
|
+
*
|
|
21
|
+
* - The stack is processed in reverse so we can use the source map's `name` from the
|
|
22
|
+
* *next* frame (the caller side) when overriding the *current* frame's function
|
|
23
|
+
* name. Source map V3's `name` at a position identifies the symbol being *called*
|
|
24
|
+
* at that position — i.e. the function whose body lives at the next-out frame —
|
|
25
|
+
* which is more accurate than V8's `getFunctionName()` for that frame.
|
|
26
|
+
*
|
|
27
|
+
* - Non-source-mapped frames pass through unchanged; their native
|
|
28
|
+
* `CallSite.prototype.toString` is invoked via template-literal coercion in
|
|
29
|
+
* `prepareStackTrace`. This preserves V8's canonical formatting for every frame
|
|
30
|
+
* variant we don't symbolicate (top-level `at file:line:col`, `at TypeName.method`,
|
|
31
|
+
* `at new Class`, `at fn [as alias]`, native frames, eval frames, etc.).
|
|
32
|
+
*/
|
|
33
|
+
export declare function installSourceMapStackTrace(): void;
|
|
34
|
+
/**
|
|
35
|
+
* V8's `CallSite.prototype.toString`, reimplemented in JS so it consults overridden
|
|
36
|
+
* getters on a cloned call site. Mirrors the C++ implementation in V8's `messages.cc`
|
|
37
|
+
* (which is also what `evanw/node-source-map-support` ports).
|
|
38
|
+
*
|
|
39
|
+
* Exported for tests, which need a working `toString` on mock plain-object call sites
|
|
40
|
+
* (real V8 CallSites have one natively; plain objects don't).
|
|
41
|
+
*/
|
|
42
|
+
export declare function callSiteToString(this: NodeJS.CallSite): string;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.callSiteToString = callSiteToString;
|
|
7
|
+
exports.installSourceMapStackTrace = installSourceMapStackTrace;
|
|
8
|
+
function nodeModule() {
|
|
9
|
+
const data = _interopRequireWildcard(require("node:module"));
|
|
10
|
+
nodeModule = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _nodeUrl() {
|
|
16
|
+
const data = _interopRequireDefault(require("node:url"));
|
|
17
|
+
_nodeUrl = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
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); }
|
|
24
|
+
// MIT License, Copyright (c) 2014 Evan Wallace
|
|
25
|
+
// Derived from: https://github.com/evanw/node-source-map-support/blob/7b5b81e/source-map-support.js
|
|
26
|
+
|
|
27
|
+
let stackTraceInstalled = false;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Install a JS-level `Error.prepareStackTrace` that symbolicates frames using Node's
|
|
31
|
+
* source map cache (`module.findSourceMap`). Idempotent — calling more than once is a no-op.
|
|
32
|
+
*
|
|
33
|
+
* Background: Node's automatic stack symbolication is gated on source maps being enabled.
|
|
34
|
+
* `compileModule` toggles source maps on only during `_compile` (to keep the cache scoped
|
|
35
|
+
* to our bundles rather than every `require()`'d package), so by the time an error from
|
|
36
|
+
* the bundle is formatted, automatic symbolication is off. This shim restores it.
|
|
37
|
+
*
|
|
38
|
+
* Implementation closely follows
|
|
39
|
+
* https://github.com/evanw/node-source-map-support/blob/master/source-map-support.js,
|
|
40
|
+
* the canonical reference for this kind of `prepareStackTrace` shim:
|
|
41
|
+
*
|
|
42
|
+
* - Source-mapped frames are wrapped in cloned plain-object call sites that override
|
|
43
|
+
* `getFileName`, `getLineNumber`, `getColumnNumber`, `getFunctionName`,
|
|
44
|
+
* `getScriptNameOrSourceURL`, and `toString`. V8's native
|
|
45
|
+
* `CallSite.prototype.toString` is implemented in C++ and reads internal slots
|
|
46
|
+
* directly, ignoring overridden JS getters; so we reimplement `toString` in JS
|
|
47
|
+
* (`callSiteToString`) on the clone, which consults the overridden getters.
|
|
48
|
+
*
|
|
49
|
+
* - The stack is processed in reverse so we can use the source map's `name` from the
|
|
50
|
+
* *next* frame (the caller side) when overriding the *current* frame's function
|
|
51
|
+
* name. Source map V3's `name` at a position identifies the symbol being *called*
|
|
52
|
+
* at that position — i.e. the function whose body lives at the next-out frame —
|
|
53
|
+
* which is more accurate than V8's `getFunctionName()` for that frame.
|
|
54
|
+
*
|
|
55
|
+
* - Non-source-mapped frames pass through unchanged; their native
|
|
56
|
+
* `CallSite.prototype.toString` is invoked via template-literal coercion in
|
|
57
|
+
* `prepareStackTrace`. This preserves V8's canonical formatting for every frame
|
|
58
|
+
* variant we don't symbolicate (top-level `at file:line:col`, `at TypeName.method`,
|
|
59
|
+
* `at new Class`, `at fn [as alias]`, native frames, eval frames, etc.).
|
|
60
|
+
*/
|
|
61
|
+
function installSourceMapStackTrace() {
|
|
62
|
+
if (stackTraceInstalled) {
|
|
63
|
+
return;
|
|
64
|
+
} else {
|
|
65
|
+
stackTraceInstalled = true;
|
|
66
|
+
}
|
|
67
|
+
Error.prepareStackTrace = (error, callSites) => {
|
|
68
|
+
const errorString = formatErrorHeader(error);
|
|
69
|
+
if (callSites.length === 0) {
|
|
70
|
+
return errorString;
|
|
71
|
+
}
|
|
72
|
+
const state = {
|
|
73
|
+
nextPosition: null,
|
|
74
|
+
curPosition: null
|
|
75
|
+
};
|
|
76
|
+
const lines = [];
|
|
77
|
+
for (let i = callSites.length - 1; i >= 0; i--) {
|
|
78
|
+
lines.push('\n at ' + wrapCallSite(callSites[i], state));
|
|
79
|
+
state.nextPosition = state.curPosition;
|
|
80
|
+
}
|
|
81
|
+
lines.reverse();
|
|
82
|
+
return errorString + lines.join('');
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function formatErrorHeader(error) {
|
|
86
|
+
// Match V8's default `Error.prototype.toString` semantics. We can't call it directly
|
|
87
|
+
// because `error` may not actually be an Error instance.
|
|
88
|
+
const name = error?.name === undefined ? 'Error' : String(error.name);
|
|
89
|
+
const message = error?.message === undefined ? '' : String(error.message);
|
|
90
|
+
if (!name) return message;
|
|
91
|
+
if (!message) return name;
|
|
92
|
+
return `${name}: ${message}`;
|
|
93
|
+
}
|
|
94
|
+
function wrapCallSite(site, state) {
|
|
95
|
+
if (site.isNative()) {
|
|
96
|
+
state.curPosition = null;
|
|
97
|
+
return String(site);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Most call sites surface their script identity via `getFileName()`. Code passed to
|
|
101
|
+
// `eval()` (or otherwise compiled with a `//# sourceURL=...` directive) only exposes
|
|
102
|
+
// it via `getScriptNameOrSourceURL()` — falling through to that catches those cases.
|
|
103
|
+
const scriptName = site.getFileName() ?? site.getScriptNameOrSourceURL();
|
|
104
|
+
if (!scriptName) {
|
|
105
|
+
state.curPosition = null;
|
|
106
|
+
return String(site);
|
|
107
|
+
}
|
|
108
|
+
const lineNumber = site.getLineNumber();
|
|
109
|
+
const columnNumber = site.getColumnNumber();
|
|
110
|
+
if (lineNumber == null || columnNumber == null) {
|
|
111
|
+
state.curPosition = null;
|
|
112
|
+
return String(site);
|
|
113
|
+
}
|
|
114
|
+
const sm = nodeModule().findSourceMap(scriptName);
|
|
115
|
+
if (!sm) {
|
|
116
|
+
state.curPosition = null;
|
|
117
|
+
return String(site);
|
|
118
|
+
}
|
|
119
|
+
const entry = sm.findEntry(lineNumber - 1, columnNumber - 1);
|
|
120
|
+
if (!entry || !('originalSource' in entry) || !entry.originalSource) {
|
|
121
|
+
state.curPosition = null;
|
|
122
|
+
return String(site);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// `originalSource` is a `file://` URL. `fileURLToPath` correctly handles drive letters
|
|
126
|
+
// and percent-encoded characters; a naive `file://` strip would yield `/C:/foo/bar.ts`
|
|
127
|
+
// on Windows.
|
|
128
|
+
const originalSource = entry.originalSource.startsWith('file://') ? _nodeUrl().default.fileURLToPath(entry.originalSource) : entry.originalSource;
|
|
129
|
+
|
|
130
|
+
// Node's runtime exposes a `name` field on the source map entry even though
|
|
131
|
+
// `@types/node` omits it from `SourceMapping`. Read it defensively.
|
|
132
|
+
const mappedName = entry.name ?? null;
|
|
133
|
+
const position = {
|
|
134
|
+
source: originalSource,
|
|
135
|
+
line: entry.originalLine + 1,
|
|
136
|
+
column: entry.originalColumn + 1,
|
|
137
|
+
name: mappedName
|
|
138
|
+
};
|
|
139
|
+
state.curPosition = position;
|
|
140
|
+
|
|
141
|
+
// Build a wrapped call site whose JS getters and `toString` agree on the mapped
|
|
142
|
+
// position. The function-name override consults `state.nextPosition` first because
|
|
143
|
+
// a source map's `name` at a position names the symbol being *called*, which lives
|
|
144
|
+
// one frame outward.
|
|
145
|
+
const wrapped = cloneCallSite(site);
|
|
146
|
+
const originalGetFunctionName = wrapped.getFunctionName;
|
|
147
|
+
wrapped.getFunctionName = function () {
|
|
148
|
+
const nameFromNext = state.nextPosition?.name;
|
|
149
|
+
if (nameFromNext) return nameFromNext;
|
|
150
|
+
return originalGetFunctionName();
|
|
151
|
+
};
|
|
152
|
+
wrapped.getFileName = () => position.source;
|
|
153
|
+
wrapped.getLineNumber = () => position.line;
|
|
154
|
+
wrapped.getColumnNumber = () => position.column;
|
|
155
|
+
wrapped.getScriptNameOrSourceURL = () => position.source;
|
|
156
|
+
return String(wrapped);
|
|
157
|
+
}
|
|
158
|
+
function cloneCallSite(site) {
|
|
159
|
+
// We need a plain object whose JS getters mirror the original site's, but whose
|
|
160
|
+
// `toString` we can replace. Subclassing or proxying the native `CallSite` doesn't
|
|
161
|
+
// work: `CallSite.prototype.toString` is implemented in C++ and rejects any receiver
|
|
162
|
+
// that isn't the original V8-tagged object (`Method toString called on incompatible
|
|
163
|
+
// receiver`). The only working approach is to build a plain object that re-exposes
|
|
164
|
+
// the `is*`/`get*` methods (bound to the original) and carries our JS toString.
|
|
165
|
+
const clone = {};
|
|
166
|
+
const proto = Object.getPrototypeOf(site);
|
|
167
|
+
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
168
|
+
const value = site[name];
|
|
169
|
+
if (/^(?:is|get)/.test(name) && typeof value === 'function') {
|
|
170
|
+
clone[name] = value.bind(site);
|
|
171
|
+
} else {
|
|
172
|
+
clone[name] = value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
clone.toString = callSiteToString;
|
|
176
|
+
return clone;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* V8's `CallSite.prototype.toString`, reimplemented in JS so it consults overridden
|
|
181
|
+
* getters on a cloned call site. Mirrors the C++ implementation in V8's `messages.cc`
|
|
182
|
+
* (which is also what `evanw/node-source-map-support` ports).
|
|
183
|
+
*
|
|
184
|
+
* Exported for tests, which need a working `toString` on mock plain-object call sites
|
|
185
|
+
* (real V8 CallSites have one natively; plain objects don't).
|
|
186
|
+
*/
|
|
187
|
+
function callSiteToString() {
|
|
188
|
+
let fileLocation = '';
|
|
189
|
+
if (this.isNative()) {
|
|
190
|
+
fileLocation = 'native';
|
|
191
|
+
} else {
|
|
192
|
+
const scriptName = this.getScriptNameOrSourceURL();
|
|
193
|
+
if (!scriptName && this.isEval()) {
|
|
194
|
+
fileLocation = (this.getEvalOrigin() ?? '') + ', ';
|
|
195
|
+
}
|
|
196
|
+
if (scriptName) {
|
|
197
|
+
fileLocation += scriptName;
|
|
198
|
+
} else {
|
|
199
|
+
fileLocation += '<anonymous>';
|
|
200
|
+
}
|
|
201
|
+
const lineNumber = this.getLineNumber();
|
|
202
|
+
if (lineNumber != null) {
|
|
203
|
+
fileLocation += ':' + lineNumber;
|
|
204
|
+
const columnNumber = this.getColumnNumber();
|
|
205
|
+
if (columnNumber) {
|
|
206
|
+
fileLocation += ':' + columnNumber;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
let line = '';
|
|
211
|
+
const functionName = this.getFunctionName();
|
|
212
|
+
let addSuffix = true;
|
|
213
|
+
const isConstructor = this.isConstructor();
|
|
214
|
+
const isMethodCall = !(this.isToplevel() || isConstructor);
|
|
215
|
+
if (isMethodCall) {
|
|
216
|
+
let typeName = this.getTypeName();
|
|
217
|
+
// Older Node versions can return `[object Object]` here; normalize to `null`.
|
|
218
|
+
if (typeName === '[object Object]') {
|
|
219
|
+
typeName = 'null';
|
|
220
|
+
}
|
|
221
|
+
const methodName = this.getMethodName();
|
|
222
|
+
if (functionName) {
|
|
223
|
+
if (typeName && functionName.indexOf(typeName) !== 0) {
|
|
224
|
+
line += typeName + '.';
|
|
225
|
+
}
|
|
226
|
+
line += functionName;
|
|
227
|
+
if (methodName && functionName.indexOf('.' + methodName) !== functionName.length - methodName.length - 1) {
|
|
228
|
+
line += ' [as ' + methodName + ']';
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
line += typeName + '.' + (methodName ?? '<anonymous>');
|
|
232
|
+
}
|
|
233
|
+
} else if (isConstructor) {
|
|
234
|
+
line += 'new ' + (functionName ?? '<anonymous>');
|
|
235
|
+
} else if (functionName) {
|
|
236
|
+
line += functionName;
|
|
237
|
+
} else {
|
|
238
|
+
line += fileLocation;
|
|
239
|
+
addSuffix = false;
|
|
240
|
+
}
|
|
241
|
+
if (addSuffix) {
|
|
242
|
+
line += ' (' + fileLocation + ')';
|
|
243
|
+
}
|
|
244
|
+
return line;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=stacktrace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stacktrace.js","names":["nodeModule","data","_interopRequireWildcard","require","_nodeUrl","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","stackTraceInstalled","installSourceMapStackTrace","Error","prepareStackTrace","error","callSites","errorString","formatErrorHeader","length","state","nextPosition","curPosition","lines","push","wrapCallSite","reverse","join","name","undefined","String","message","site","isNative","scriptName","getFileName","getScriptNameOrSourceURL","lineNumber","getLineNumber","columnNumber","getColumnNumber","sm","findSourceMap","entry","findEntry","originalSource","startsWith","url","fileURLToPath","mappedName","position","source","line","originalLine","column","originalColumn","wrapped","cloneCallSite","originalGetFunctionName","getFunctionName","nameFromNext","clone","proto","getPrototypeOf","getOwnPropertyNames","value","test","bind","toString","callSiteToString","fileLocation","isEval","getEvalOrigin","functionName","addSuffix","isConstructor","isMethodCall","isToplevel","typeName","getTypeName","methodName","getMethodName","indexOf"],"sources":["../src/stacktrace.ts"],"sourcesContent":["// MIT License, Copyright (c) 2014 Evan Wallace\n// Derived from: https://github.com/evanw/node-source-map-support/blob/7b5b81e/source-map-support.js\n\nimport * as nodeModule from 'node:module';\nimport url from 'node:url';\n\nlet stackTraceInstalled = false;\n\n/**\n * Install a JS-level `Error.prepareStackTrace` that symbolicates frames using Node's\n * source map cache (`module.findSourceMap`). Idempotent — calling more than once is a no-op.\n *\n * Background: Node's automatic stack symbolication is gated on source maps being enabled.\n * `compileModule` toggles source maps on only during `_compile` (to keep the cache scoped\n * to our bundles rather than every `require()`'d package), so by the time an error from\n * the bundle is formatted, automatic symbolication is off. This shim restores it.\n *\n * Implementation closely follows\n * https://github.com/evanw/node-source-map-support/blob/master/source-map-support.js,\n * the canonical reference for this kind of `prepareStackTrace` shim:\n *\n * - Source-mapped frames are wrapped in cloned plain-object call sites that override\n * `getFileName`, `getLineNumber`, `getColumnNumber`, `getFunctionName`,\n * `getScriptNameOrSourceURL`, and `toString`. V8's native\n * `CallSite.prototype.toString` is implemented in C++ and reads internal slots\n * directly, ignoring overridden JS getters; so we reimplement `toString` in JS\n * (`callSiteToString`) on the clone, which consults the overridden getters.\n *\n * - The stack is processed in reverse so we can use the source map's `name` from the\n * *next* frame (the caller side) when overriding the *current* frame's function\n * name. Source map V3's `name` at a position identifies the symbol being *called*\n * at that position — i.e. the function whose body lives at the next-out frame —\n * which is more accurate than V8's `getFunctionName()` for that frame.\n *\n * - Non-source-mapped frames pass through unchanged; their native\n * `CallSite.prototype.toString` is invoked via template-literal coercion in\n * `prepareStackTrace`. This preserves V8's canonical formatting for every frame\n * variant we don't symbolicate (top-level `at file:line:col`, `at TypeName.method`,\n * `at new Class`, `at fn [as alias]`, native frames, eval frames, etc.).\n */\nexport function installSourceMapStackTrace(): void {\n if (stackTraceInstalled) {\n return;\n } else {\n stackTraceInstalled = true;\n }\n Error.prepareStackTrace = (error, callSites) => {\n const errorString = formatErrorHeader(error);\n if (callSites.length === 0) {\n return errorString;\n }\n const state: WalkState = { nextPosition: null, curPosition: null };\n const lines: string[] = [];\n for (let i = callSites.length - 1; i >= 0; i--) {\n lines.push('\\n at ' + wrapCallSite(callSites[i]!, state));\n state.nextPosition = state.curPosition;\n }\n lines.reverse();\n return errorString + lines.join('');\n };\n}\n\nfunction formatErrorHeader(error: unknown): string {\n // Match V8's default `Error.prototype.toString` semantics. We can't call it directly\n // because `error` may not actually be an Error instance.\n const name =\n (error as { name?: unknown })?.name === undefined\n ? 'Error'\n : String((error as { name: unknown }).name);\n const message =\n (error as { message?: unknown })?.message === undefined\n ? ''\n : String((error as { message: unknown }).message);\n if (!name) return message;\n if (!message) return name;\n return `${name}: ${message}`;\n}\n\ninterface MappedPosition {\n source: string;\n line: number;\n column: number; // 1-based\n name: string | null;\n}\n\ninterface WalkState {\n nextPosition: MappedPosition | null;\n curPosition: MappedPosition | null;\n}\n\nfunction wrapCallSite(site: NodeJS.CallSite, state: WalkState): string {\n if (site.isNative()) {\n state.curPosition = null;\n return String(site);\n }\n\n // Most call sites surface their script identity via `getFileName()`. Code passed to\n // `eval()` (or otherwise compiled with a `//# sourceURL=...` directive) only exposes\n // it via `getScriptNameOrSourceURL()` — falling through to that catches those cases.\n const scriptName = site.getFileName() ?? site.getScriptNameOrSourceURL();\n if (!scriptName) {\n state.curPosition = null;\n return String(site);\n }\n\n const lineNumber = site.getLineNumber();\n const columnNumber = site.getColumnNumber();\n if (lineNumber == null || columnNumber == null) {\n state.curPosition = null;\n return String(site);\n }\n\n const sm = nodeModule.findSourceMap(scriptName);\n if (!sm) {\n state.curPosition = null;\n return String(site);\n }\n\n const entry = sm.findEntry(lineNumber - 1, columnNumber - 1);\n if (!entry || !('originalSource' in entry) || !entry.originalSource) {\n state.curPosition = null;\n return String(site);\n }\n\n // `originalSource` is a `file://` URL. `fileURLToPath` correctly handles drive letters\n // and percent-encoded characters; a naive `file://` strip would yield `/C:/foo/bar.ts`\n // on Windows.\n const originalSource = entry.originalSource.startsWith('file://')\n ? url.fileURLToPath(entry.originalSource)\n : entry.originalSource;\n\n // Node's runtime exposes a `name` field on the source map entry even though\n // `@types/node` omits it from `SourceMapping`. Read it defensively.\n const mappedName = (entry as { name?: string }).name ?? null;\n\n const position: MappedPosition = {\n source: originalSource,\n line: entry.originalLine + 1,\n column: entry.originalColumn + 1,\n name: mappedName,\n };\n state.curPosition = position;\n\n // Build a wrapped call site whose JS getters and `toString` agree on the mapped\n // position. The function-name override consults `state.nextPosition` first because\n // a source map's `name` at a position names the symbol being *called*, which lives\n // one frame outward.\n const wrapped = cloneCallSite(site);\n const originalGetFunctionName = wrapped.getFunctionName;\n wrapped.getFunctionName = function () {\n const nameFromNext = state.nextPosition?.name;\n if (nameFromNext) return nameFromNext;\n return originalGetFunctionName();\n };\n wrapped.getFileName = () => position.source;\n wrapped.getLineNumber = () => position.line;\n wrapped.getColumnNumber = () => position.column;\n wrapped.getScriptNameOrSourceURL = () => position.source;\n return String(wrapped);\n}\n\ninterface ClonedCallSite extends NodeJS.CallSite {\n toString(): string;\n}\n\nfunction cloneCallSite(site: NodeJS.CallSite): ClonedCallSite {\n // We need a plain object whose JS getters mirror the original site's, but whose\n // `toString` we can replace. Subclassing or proxying the native `CallSite` doesn't\n // work: `CallSite.prototype.toString` is implemented in C++ and rejects any receiver\n // that isn't the original V8-tagged object (`Method toString called on incompatible\n // receiver`). The only working approach is to build a plain object that re-exposes\n // the `is*`/`get*` methods (bound to the original) and carries our JS toString.\n const clone = {} as Record<string, unknown>;\n const proto = Object.getPrototypeOf(site) as Record<string, unknown>;\n for (const name of Object.getOwnPropertyNames(proto)) {\n const value = (site as unknown as Record<string, unknown>)[name];\n if (/^(?:is|get)/.test(name) && typeof value === 'function') {\n clone[name] = (value as (...args: unknown[]) => unknown).bind(site);\n } else {\n clone[name] = value;\n }\n }\n clone.toString = callSiteToString;\n return clone as unknown as ClonedCallSite;\n}\n\n/**\n * V8's `CallSite.prototype.toString`, reimplemented in JS so it consults overridden\n * getters on a cloned call site. Mirrors the C++ implementation in V8's `messages.cc`\n * (which is also what `evanw/node-source-map-support` ports).\n *\n * Exported for tests, which need a working `toString` on mock plain-object call sites\n * (real V8 CallSites have one natively; plain objects don't).\n */\nexport function callSiteToString(this: NodeJS.CallSite): string {\n let fileLocation = '';\n if (this.isNative()) {\n fileLocation = 'native';\n } else {\n const scriptName = this.getScriptNameOrSourceURL();\n if (!scriptName && this.isEval()) {\n fileLocation = (this.getEvalOrigin() ?? '') + ', ';\n }\n if (scriptName) {\n fileLocation += scriptName;\n } else {\n fileLocation += '<anonymous>';\n }\n const lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += ':' + lineNumber;\n const columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += ':' + columnNumber;\n }\n }\n }\n\n let line = '';\n const functionName = this.getFunctionName();\n let addSuffix = true;\n const isConstructor = this.isConstructor();\n const isMethodCall = !(this.isToplevel() || isConstructor);\n\n if (isMethodCall) {\n let typeName: string | null = this.getTypeName();\n // Older Node versions can return `[object Object]` here; normalize to `null`.\n if (typeName === '[object Object]') {\n typeName = 'null';\n }\n const methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) !== 0) {\n line += typeName + '.';\n }\n line += functionName;\n if (\n methodName &&\n functionName.indexOf('.' + methodName) !== functionName.length - methodName.length - 1\n ) {\n line += ' [as ' + methodName + ']';\n }\n } else {\n line += typeName + '.' + (methodName ?? '<anonymous>');\n }\n } else if (isConstructor) {\n line += 'new ' + (functionName ?? '<anonymous>');\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n\n if (addSuffix) {\n line += ' (' + fileLocation + ')';\n }\n return line;\n}\n"],"mappings":";;;;;;;AAGA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAI,sBAAA,CAAAF,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA2B,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAI,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,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G,IAAI,CAACC,WAAW,CAAC,CAAC;IAChD;IACA,IAAID,QAAQ,KAAK,iBAAiB,EAAE;MAClCA,QAAQ,GAAG,MAAM;IACnB;IACA,MAAME,UAAU,GAAG,IAAI,CAACC,aAAa,CAAC,CAAC;IACvC,IAAIR,YAAY,EAAE;MAChB,IAAIK,QAAQ,IAAIL,YAAY,CAACS,OAAO,CAACJ,QAAQ,CAAC,KAAK,CAAC,EAAE;QACpD1B,IAAI,IAAI0B,QAAQ,GAAG,GAAG;MACxB;MACA1B,IAAI,IAAIqB,YAAY;MACpB,IACEO,UAAU,IACVP,YAAY,CAACS,OAAO,CAAC,GAAG,GAAGF,UAAU,CAAC,KAAKP,YAAY,CAACtD,MAAM,GAAG6D,UAAU,CAAC7D,MAAM,GAAG,CAAC,EACtF;QACAiC,IAAI,IAAI,OAAO,GAAG4B,UAAU,GAAG,GAAG;MACpC;IACF,CAAC,MAAM;MACL5B,IAAI,IAAI0B,QAAQ,GAAG,GAAG,IAAIE,UAAU,IAAI,aAAa,CAAC;IACxD;EACF,CAAC,MAAM,IAAIL,aAAa,EAAE;IACxBvB,IAAI,IAAI,MAAM,IAAIqB,YAAY,IAAI,aAAa,CAAC;EAClD,CAAC,MAAM,IAAIA,YAAY,EAAE;IACvBrB,IAAI,IAAIqB,YAAY;EACtB,CAAC,MAAM;IACLrB,IAAI,IAAIkB,YAAY;IACpBI,SAAS,GAAG,KAAK;EACnB;EAEA,IAAIA,SAAS,EAAE;IACbtB,IAAI,IAAI,IAAI,GAAGkB,YAAY,GAAG,GAAG;EACnC;EACA,OAAOlB,IAAI;AACb","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/require-utils",
|
|
3
|
-
"version": "56.0
|
|
3
|
+
"version": "56.1.0",
|
|
4
4
|
"description": "Reusable require and Node resolution utilities library for Expo",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"@types/babel__code-frame": "^7.27.0",
|
|
37
37
|
"@types/node": "^22.14.0",
|
|
38
38
|
"memfs": "^3.2.0",
|
|
39
|
-
"expo-module-scripts": "56.0.
|
|
39
|
+
"expo-module-scripts": "56.0.2"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a30353e69ca0d72b9fac5830abc631feda1ba3ae",
|
|
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",
|