first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
import type { Diagnostic } from 'typescript';
export declare function formatDiagnostic(diagnostic: Diagnostic | undefined): (SyntaxError & {
codeFrame: string;
}) | null;
export declare function annotateError(code: string | null, filename: string, error: Error): (Error & {
codeFrame: string;
}) | null;

89
node_modules/@expo/require-utils/build/codeframe.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.annotateError = annotateError;
exports.formatDiagnostic = formatDiagnostic;
function _nodeUrl() {
const data = _interopRequireDefault(require("node:url"));
_nodeUrl = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function errorToLoc(filename, error) {
if (error.name === 'ReferenceError' || error.name === 'SyntaxError') {
let stack = `${error.stack || ''}`;
stack = stack.slice(error.name.length + 2 /* '${name}: ' prefix */);
stack = stack.slice(error.message.length);
const trace = stack.match(/at ([^\n]+):(\d+):(\d+)/m);
if (_nodeUrl().default.pathToFileURL(filename).href === trace?.[1]) {
const line = Number(trace[2]);
return Number.isSafeInteger(line) ? {
line,
column: Number(trace[3]) || undefined
} : null;
}
}
return null;
}
function formatDiagnostic(diagnostic) {
if (!diagnostic) {
return null;
}
const {
start,
file,
messageText
} = diagnostic;
if (file && messageText && start != null) {
const {
codeFrameColumns
} = require('@babel/code-frame');
const {
line,
character
} = file.getLineAndCharacterOfPosition(start);
const loc = {
line: line + 1,
column: character + 1
};
const codeFrame = codeFrameColumns(file.getText(), {
start: loc
}, {
highlightCode: true
});
const annotatedError = new SyntaxError(`${messageText}\n${codeFrame}`);
annotatedError.codeFrame = codeFrame;
delete annotatedError.stack;
return annotatedError;
}
return null;
}
function annotateError(code, filename, error) {
if (typeof error !== 'object' || error == null) {
return null;
}
if (code) {
const loc = errorToLoc(filename, error);
if (loc) {
const {
codeFrameColumns
} = require('@babel/code-frame');
const codeFrame = codeFrameColumns(code, {
start: loc
}, {
highlightCode: true
});
const annotatedError = error;
annotatedError.codeFrame = codeFrame;
annotatedError.message += `\n${codeFrame}`;
delete annotatedError.stack;
return annotatedError;
}
}
return null;
}
//# sourceMappingURL=codeframe.js.map

File diff suppressed because one or more lines are too long

1
node_modules/@expo/require-utils/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export * from './load';

17
node_modules/@expo/require-utils/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _load = require("./load");
Object.keys(_load).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _load[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _load[key];
}
});
});
//# sourceMappingURL=index.js.map

1
node_modules/@expo/require-utils/build/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["_load","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../src/index.ts"],"sourcesContent":["export * from './load';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}

21
node_modules/@expo/require-utils/build/load.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
declare module 'node:module' {
function _nodeModulePaths(base: string): readonly string[];
}
declare global {
namespace NodeJS {
interface Module {
_compile(code: string, filename: string, format?: 'module' | 'commonjs' | 'commonjs-typescript' | 'module-typescript' | 'typescript'): unknown;
}
}
}
type Format = 'commonjs' | 'module' | 'module-typescript' | 'commonjs-typescript' | 'typescript';
export interface ModuleOptions {
paths?: string[];
}
declare function evalModule(code: string, filename: string, opts?: ModuleOptions, format?: Format): any;
declare function loadModule(filename: string): Promise<any>;
/** Require module or evaluate with TypeScript
* NOTE: Requiring ESM has been added in all LTS versions (Node 20.19+, 22.12+, 24).
* This already forms the minimum required Node version as of Expo SDK 54 */
declare function loadModuleSync(filename: string): any;
export { evalModule, loadModule, loadModuleSync };

243
node_modules/@expo/require-utils/build/load.js generated vendored Normal file
View File

@@ -0,0 +1,243 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.evalModule = evalModule;
exports.loadModule = loadModule;
exports.loadModuleSync = loadModuleSync;
function _nodeFs() {
const data = _interopRequireDefault(require("node:fs"));
_nodeFs = function () {
return data;
};
return data;
}
function nodeModule() {
const data = _interopRequireWildcard(require("node:module"));
nodeModule = function () {
return data;
};
return data;
}
function _nodePath() {
const data = _interopRequireDefault(require("node:path"));
_nodePath = function () {
return data;
};
return data;
}
function _nodeUrl() {
const data = _interopRequireDefault(require("node:url"));
_nodeUrl = function () {
return data;
};
return data;
}
function _codeframe() {
const data = require("./codeframe");
_codeframe = function () {
return data;
};
return data;
}
function _transform() {
const data = require("./transform");
_transform = function () {
return data;
};
return data;
}
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
let _ts;
function loadTypescript() {
if (_ts === undefined) {
try {
_ts = require('typescript');
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') {
throw error;
} else {
_ts = null;
}
}
}
return _ts;
}
const parent = module;
const tsExtensionMapping = {
'.ts': '.js',
'.cts': '.cjs',
'.mts': '.mjs'
};
function maybeReadFileSync(filename) {
try {
return _nodeFs().default.readFileSync(filename, 'utf8');
} catch (error) {
if (error.code === 'ENOENT') {
return null;
}
throw error;
}
}
function toFormat(filename, isLegacy) {
if (filename.endsWith('.cjs')) {
return 'commonjs';
} else if (filename.endsWith('.mjs')) {
return 'module';
} else if (filename.endsWith('.js')) {
return isLegacy ? 'commonjs' : null;
} else if (filename.endsWith('.mts')) {
return 'module-typescript';
} else if (filename.endsWith('.cts')) {
return 'commonjs-typescript';
} else if (filename.endsWith('.ts')) {
return isLegacy ? 'commonjs-typescript' : 'typescript';
} else {
return null;
}
}
function compileModule(code, filename, opts) {
const format = toFormat(filename, false);
const prependPaths = opts.paths ?? [];
const nodeModulePaths = nodeModule()._nodeModulePaths(_nodePath().default.dirname(filename));
const paths = [...prependPaths, ...nodeModulePaths];
try {
const mod = Object.assign(new (nodeModule().Module)(filename, parent), {
filename,
paths
});
mod._compile(code, filename, format != null ? format : undefined);
mod.loaded = true;
require.cache[filename] = mod;
parent?.children?.splice(parent.children.indexOf(mod), 1);
return mod;
} catch (error) {
delete require.cache[filename];
throw error;
}
}
const hasStripTypeScriptTypes = typeof nodeModule().stripTypeScriptTypes === 'function';
function evalModule(code, filename, opts = {}, format = toFormat(filename, true)) {
let inputCode = code;
let inputFilename = filename;
let diagnostic;
if (format === 'typescript' || format === 'module-typescript' || format === 'commonjs-typescript') {
const ts = loadTypescript();
if (ts) {
let module;
if (format === 'commonjs-typescript') {
module = ts.ModuleKind.CommonJS;
} else if (format === 'module-typescript') {
module = ts.ModuleKind.ESNext;
} else {
// NOTE(@kitten): We can "preserve" the output, meaning, it can either be ESM or CJS
// and stop TypeScript from either transpiling it to CommonJS or adding an `export {}`
// if no exports are used. This allows the user to choose if this file is CJS or ESM
// (but not to mix both)
module = ts.ModuleKind.Preserve;
}
const output = ts.transpileModule(code, {
fileName: filename,
reportDiagnostics: true,
compilerOptions: {
module,
moduleResolution: ts.ModuleResolutionKind.Bundler,
// `verbatimModuleSyntax` needs to be off, to erase as many imports as possible
verbatimModuleSyntax: false,
target: ts.ScriptTarget.ESNext,
newLine: ts.NewLineKind.LineFeed,
inlineSourceMap: true,
esModuleInterop: true
}
});
inputCode = output?.outputText || inputCode;
if (output?.diagnostics?.length) {
diagnostic = output.diagnostics[0];
}
}
if (hasStripTypeScriptTypes && inputCode === code) {
// This may throw its own error, but this contains a code-frame already
inputCode = nodeModule().stripTypeScriptTypes(code, {
mode: 'transform',
sourceMap: true
});
}
if (inputCode !== code) {
const ext = _nodePath().default.extname(filename);
const inputExt = tsExtensionMapping[ext] ?? ext;
if (inputExt !== ext) {
inputFilename = _nodePath().default.join(_nodePath().default.dirname(filename), _nodePath().default.basename(filename, ext) + inputExt);
}
}
} else if (format === 'commonjs') {
inputCode = (0, _transform().toCommonJS)(filename, code);
}
try {
const mod = compileModule(inputCode, inputFilename, opts);
if (inputFilename !== filename) {
require.cache[filename] = mod;
}
return mod.exports;
} catch (error) {
// If we have a diagnostic from TypeScript, we issue its error with a codeframe first,
// since it's likely more useful than the eval error
const diagnosticError = (0, _codeframe().formatDiagnostic)(diagnostic);
if (diagnosticError) {
throw diagnosticError;
}
throw (0, _codeframe().annotateError)(code, filename, error) ?? error;
}
}
async function requireOrImport(filename) {
try {
return require(filename);
} catch {
return await Promise.resolve(`${_nodePath().default.isAbsolute(filename) ? _nodeUrl().default.pathToFileURL(filename).toString() : filename}`).then(s => _interopRequireWildcard(require(s)));
}
}
async function loadModule(filename) {
try {
return await requireOrImport(filename);
} catch (error) {
if (error.code === 'ERR_UNKNOWN_FILE_EXTENSION' || error.code === 'MODULE_NOT_FOUND') {
return loadModuleSync(filename);
} else {
throw error;
}
}
}
/** Require module or evaluate with TypeScript
* NOTE: Requiring ESM has been added in all LTS versions (Node 20.19+, 22.12+, 24).
* This already forms the minimum required Node version as of Expo SDK 54 */
function loadModuleSync(filename) {
const format = toFormat(filename, true);
const isTypeScript = format === 'module-typescript' || format === 'commonjs-typescript' || format === 'typescript';
try {
if (format !== 'module' && !isTypeScript) {
return require(filename);
}
} catch (error) {
if (error.code === 'MODULE_NOT_FOUND') {
throw error;
} else if (format == null) {
const code = maybeReadFileSync(filename);
throw (0, _codeframe().annotateError)(code, filename, error) || error;
}
// We fallback to always evaluating the entrypoint module
// This is out of safety, since we're not trusting the requiring ESM feature
// and evaluating the module manually bypasses the error when it's flagged off
}
// Load from cache manually, if `loaded` is set and exports are defined, to avoid
// double transform or double evaluation
if (require.cache[filename]?.exports && require.cache[filename].loaded) {
return require.cache[filename].exports;
}
const code = _nodeFs().default.readFileSync(filename, 'utf8');
return evalModule(code, filename, {}, format);
}
//# sourceMappingURL=load.js.map

1
node_modules/@expo/require-utils/build/load.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare function toCommonJS(filename: string, code: string): string;

31
node_modules/@expo/require-utils/build/transform.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.toCommonJS = toCommonJS;
function _core() {
const data = require("@babel/core");
_core = function () {
return data;
};
return data;
}
function toCommonJS(filename, code) {
const result = (0, _core().transformSync)(code, {
filename,
babelrc: false,
plugins: [[require('@babel/plugin-transform-modules-commonjs'), {
// NOTE(@kitten): We used to use sucrase to transform, which is why
// we're doing this CJS-to-ESM transform in the first place. Our
// previous transformation isn't 100% compatible with the standard
// Node ESM loading. In Babel, this is the "node" flag (although
// node behaviour is explicitly different from this). This skips
// the `__esModule -> default` wrapper
importInterop: 'node',
loose: true
}]]
});
return result?.code ?? code;
}
//# sourceMappingURL=transform.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"transform.js","names":["_core","data","require","toCommonJS","filename","code","result","transformSync","babelrc","plugins","importInterop","loose"],"sources":["../src/transform.ts"],"sourcesContent":["import { transformSync } from '@babel/core';\n\nexport function toCommonJS(filename: string, code: string) {\n const result = transformSync(code, {\n filename,\n babelrc: false,\n plugins: [\n [\n require('@babel/plugin-transform-modules-commonjs'),\n {\n // NOTE(@kitten): We used to use sucrase to transform, which is why\n // we're doing this CJS-to-ESM transform in the first place. Our\n // previous transformation isn't 100% compatible with the standard\n // Node ESM loading. In Babel, this is the \"node\" flag (although\n // node behaviour is explicitly different from this). This skips\n // the `__esModule -> default` wrapper\n importInterop: 'node',\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,CAACC,QAAgB,EAAEC,IAAY,EAAE;EACzD,MAAMC,MAAM,GAAG,IAAAC,qBAAa,EAACF,IAAI,EAAE;IACjCD,QAAQ;IACRI,OAAO,EAAE,KAAK;IACdC,OAAO,EAAE,CACP,CACEP,OAAO,CAAC,0CAA0C,CAAC,EACnD;MACE;MACA;MACA;MACA;MACA;MACA;MACAQ,aAAa,EAAE,MAAM;MACrBC,KAAK,EAAE;IACT,CAAC,CACF;EAEL,CAAC,CAAC;EACF,OAAOL,MAAM,EAAED,IAAI,IAAIA,IAAI;AAC7B","ignoreList":[]}