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

47
node_modules/@expo/log-box/build/Data/Types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
import { type StackFrame as UpstreamStackFrame } from 'stacktrace-parser';
export type Message = {
content: string;
substitutions: {
length: number;
offset: number;
}[];
};
export type Category = string;
export type CodeFrame = {
content: string;
location?: {
row: number;
column: number;
[key: string]: any;
} | null;
fileName: string;
collapse?: boolean;
};
export type SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';
export type LogLevel = 'error' | 'fatal' | 'syntax' | 'resolution' | 'static';
export type StackType = 'stack' | 'component';
export type LogBoxLogData = {
level: LogLevel;
type?: string;
message: Message;
stack: MetroStackFrame[];
category: string;
componentStack: MetroStackFrame[];
codeFrame: Partial<Record<StackType, CodeFrame>>;
isComponentError: boolean;
isMissingModuleError?: string;
extraData?: Record<string, unknown>;
};
export type LogBoxLogDataLegacy = {
level: LogLevel;
type?: string;
message: Message;
stack: MetroStackFrame[];
category: string;
componentStack: CodeFrame[];
codeFrame?: CodeFrame;
isComponentError: boolean;
};
export type MetroStackFrame = Omit<UpstreamStackFrame, 'arguments'> & {
collapse?: boolean;
};

2
node_modules/@expo/log-box/build/Data/Types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

2
node_modules/@expo/log-box/build/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { parseWebBuildErrors } from './utils/parseWebBuildErrors';
export { withoutANSIColorStyles } from './utils/withoutANSIStyles';

9
node_modules/@expo/log-box/build/utils.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
// This is the main export for `@expo/log-box/utils` used in the `@expo/cli` and `expo/async-require/hmr`
// This needs to be transpiled to CJS for use in the Expo CLI
Object.defineProperty(exports, "__esModule", { value: true });
exports.withoutANSIColorStyles = exports.parseWebBuildErrors = void 0;
var parseWebBuildErrors_1 = require("./utils/parseWebBuildErrors");
Object.defineProperty(exports, "parseWebBuildErrors", { enumerable: true, get: function () { return parseWebBuildErrors_1.parseWebBuildErrors; } });
var withoutANSIStyles_1 = require("./utils/withoutANSIStyles");
Object.defineProperty(exports, "withoutANSIColorStyles", { enumerable: true, get: function () { return withoutANSIStyles_1.withoutANSIColorStyles; } });

View File

@@ -0,0 +1,11 @@
export type ParsedBuildError = {
content: string;
fileName: string;
row: number;
column: number;
codeFrame: string;
missingModule?: string;
};
export declare function parseMetroError(message: string): ParsedBuildError | null;
export declare function parseBabelTransformError(message: string): ParsedBuildError | null;
export declare function parseBabelCodeFrameError(message: string): ParsedBuildError | null;

View File

@@ -0,0 +1,63 @@
"use strict";
// Related Metro error's formatting (for the portion of the function parsing Metro errors)
// https://github.com/facebook/metro/blob/34bb8913ec4b5b02690b39d2246599faf094f721/packages/metro/src/lib/formatBundlingError.js#L36
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseMetroError = parseMetroError;
exports.parseBabelTransformError = parseBabelTransformError;
exports.parseBabelCodeFrameError = parseBabelCodeFrameError;
const BABEL_TRANSFORM_ERROR_FORMAT = /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/;
const BABEL_CODE_FRAME_ERROR_FORMAT =
// Adjusted from original to not capture import stack a part of the code frame
/^(?:TransformError )?(?:.*):? (?:.*?)([/|\\].*): ([\s\S]+?)\n((?:[ >]*\d+[\s|]+[^\n]*\n?)+|\u{001b}\[[0-9;]*m(?:.*\n?)+?(?=\n\n|\n[^\u{001b}\s]|$))/mu;
const METRO_ERROR_FORMAT = /^(?:(?:InternalError )?Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u;
const UNABLE_TO_RESOLVE_MODULE_ERROR_FORMAT = /(?:\w )?Unable to resolve module (.*) from/;
function parseMetroError(message) {
const e = message.match(METRO_ERROR_FORMAT);
if (!e) {
return null;
}
const [, content, fileName, row, column, codeFrame] = e;
return {
content,
fileName,
row: parseInt(row, 10),
column: parseInt(column, 10),
codeFrame,
};
}
function parseBabelTransformError(message) {
const e = message.match(BABEL_TRANSFORM_ERROR_FORMAT);
if (!e) {
return null;
}
// Transform errors are thrown from inside the Babel transformer.
const [, fileName, content, row, column, codeFrame] = e;
return {
content,
fileName,
row: parseInt(row, 10),
column: parseInt(column, 10),
codeFrame,
};
}
function parseBabelCodeFrameError(message) {
const e = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);
if (!e) {
return null;
}
// Codeframe errors are thrown from any use of buildCodeFrameError.
const [, fileName, content, codeFrame] = e;
//TODO: In the future we should send metadata from @expo/cli, but at the moment
// parsing the message is the only way that work across all LogBox scenarios
// (build web, build ios, build android, hmr web, hmr native).
const [, missingModule] = message.match(UNABLE_TO_RESOLVE_MODULE_ERROR_FORMAT) || [];
const messageContent = missingModule ? `Unable to resolve module ${missingModule}` : content;
return {
content: messageContent,
fileName,
row: -1,
column: -1,
codeFrame,
missingModule,
};
}

View File

@@ -0,0 +1,14 @@
import { LogBoxLogDataLegacy, MetroStackFrame } from '../Data/Types';
/**
* Called in expo/cli, the return value is injected into the static error page which is bundled
* instead of the app when the web build fails.
*/
export declare function parseWebBuildErrors({ error, projectRoot, parseErrorStack, }: {
error: Error & {
type?: unknown;
};
projectRoot: string;
parseErrorStack: (projectRoot: string, stack?: string) => (MetroStackFrame & {
collapse?: boolean;
})[];
}): LogBoxLogDataLegacy;

View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseWebBuildErrors = parseWebBuildErrors;
const metroBuildErrorsFormat_1 = require("./metroBuildErrorsFormat");
/**
* Called in expo/cli, the return value is injected into the static error page which is bundled
* instead of the app when the web build fails.
*/
function parseWebBuildErrors({ error, projectRoot, parseErrorStack, }) {
// NOTE: Ideally this will be merged with the parseWebHmrBuildErrors function
// Remap direct Metro Node.js errors to a format that will appear more client-friendly in the logbox UI.
let stack;
if (isTransformError(error) && error.filename) {
// Syntax errors in static rendering.
stack = [
{
// Avoid using node:path to be compatible with web and RN runtime.
file: `${projectRoot}/${error.filename}`,
methodName: '<unknown>',
// TODO: Import stack
lineNumber: error.lineNumber,
column: error.column,
},
];
}
else if ('originModulePath' in error &&
typeof error.originModulePath === 'string' &&
'targetModuleName' in error &&
typeof error.targetModuleName === 'string' &&
'cause' in error) {
const { codeFrame } = (0, metroBuildErrorsFormat_1.parseBabelCodeFrameError)(error.message) || {};
// We are purposely not using the parsed fileName or content here
// because we have the original data in the error object.
const content = `Unable to resolve module ${error.targetModuleName}`;
return {
level: 'resolution',
// TODO: Add import stacks
stack: [],
isComponentError: false,
componentStack: [],
codeFrame: codeFrame
? {
fileName: error.originModulePath,
location: null, // We are not given the location.
content: codeFrame,
}
: undefined,
message: {
content,
substitutions: [],
},
category: `${error.originModulePath}-${1}-${1}`,
};
}
else {
stack = parseErrorStack(projectRoot, error.stack);
}
return {
level: 'static',
message: {
content: error.message,
substitutions: [],
},
isComponentError: false,
stack,
category: 'static',
componentStack: [],
};
}
function isTransformError(error) {
return error.type === 'TransformError';
}

View File

@@ -0,0 +1 @@
export declare function withoutANSIColorStyles(message: any): any;

View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.withoutANSIColorStyles = withoutANSIColorStyles;
function withoutANSIColorStyles(message) {
if (typeof message !== 'string') {
return message;
}
return message.replace(
// eslint-disable-next-line no-control-regex
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
}