@expo/cli 0.22.8 → 0.22.10
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/bin/cli +1 -1
- package/build/src/api/rest/client.js +2 -0
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +3 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +13 -9
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/index.js +4 -0
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +2 -1
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +1 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +27 -12
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +18 -2
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/publicFolder.js +6 -1
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/saveAssets.js +1 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +2 -1
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +14 -6
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js +2 -0
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/serve/serveAsync.js +4 -2
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +4 -0
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +2 -1
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +105 -55
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +15 -5
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +28 -4
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +5 -1
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +2 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +6 -3
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +1 -1
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/startAsync.js +1 -1
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/env.js +9 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/ip.js +8 -1
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +16 -16
|
@@ -126,11 +126,21 @@ const _default = defaultResolver;
|
|
|
126
126
|
if (closestPackageJson) {
|
|
127
127
|
const pkg = options.readPackageSync(options.readFileSync, closestPackageJson);
|
|
128
128
|
(0, _assert().default)(pkg, "package.json should be read by `readPackageSync`");
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
// Added support for the package.json "imports" field (#-prefixed paths)
|
|
130
|
+
if (path.startsWith("#")) {
|
|
131
|
+
const resolved = _resolveExports().imports(pkg, path, createResolveOptions(options.conditions));
|
|
131
132
|
if (resolved) {
|
|
133
|
+
// TODO: Should we attempt to resolve every path in the array?
|
|
132
134
|
return (0, _path().resolve)((0, _path().dirname)(closestPackageJson), resolved[0]);
|
|
133
135
|
}
|
|
136
|
+
// NOTE: resolve.imports would have thrown by this point.
|
|
137
|
+
return path;
|
|
138
|
+
}
|
|
139
|
+
if (pkg.name === moduleName) {
|
|
140
|
+
const resolved1 = _resolveExports().exports(pkg, segments.join("/") || ".", createResolveOptions(options.conditions));
|
|
141
|
+
if (resolved1) {
|
|
142
|
+
return (0, _path().resolve)((0, _path().dirname)(closestPackageJson), resolved1[0]);
|
|
143
|
+
}
|
|
134
144
|
if (pkg.exports) {
|
|
135
145
|
throw new Error("`exports` exists, but no results - this is a bug in Expo CLI's Metro resolver. Please report an issue");
|
|
136
146
|
}
|
|
@@ -147,9 +157,9 @@ const _default = defaultResolver;
|
|
|
147
157
|
}
|
|
148
158
|
const pkg1 = options.readPackageSync(options.readFileSync, packageJsonPath);
|
|
149
159
|
(0, _assert().default)(pkg1, "package.json should be read by `readPackageSync`");
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
return (0, _path().resolve)((0, _path().dirname)(packageJsonPath),
|
|
160
|
+
const resolved2 = _resolveExports().exports(pkg1, segments.join("/") || ".", createResolveOptions(options.conditions));
|
|
161
|
+
if (resolved2) {
|
|
162
|
+
return (0, _path().resolve)((0, _path().dirname)(packageJsonPath), resolved2[0]);
|
|
153
163
|
}
|
|
154
164
|
if (pkg1.exports) {
|
|
155
165
|
throw new Error("`exports` exists, but no results - this is a bug in Expo CLI's Metro resolver. Please report an issue");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/createJResolver.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Fork of the jest resolver but with additional settings for Metro and pnp removed.\n * https://github.com/jestjs/jest/blob/d1a2ed7fea4bdc19836274cd810c8360e3ab62f3/packages/jest-resolve/src/defaultResolver.ts#L1\n */\nimport type { JSONObject as PackageJSON } from '@expo/json-file';\nimport assert from 'assert';\nimport { dirname, isAbsolute, resolve as pathResolve } from 'path';\nimport { sync as resolveSync, SyncOpts as UpstreamResolveOptions } from 'resolve';\nimport * as resolve from 'resolve.exports';\n\n/**\n * Allows transforming parsed `package.json` contents.\n *\n * @param pkg - Parsed `package.json` contents.\n * @param file - Path to `package.json` file.\n * @param dir - Directory that contains the `package.json`.\n *\n * @returns Transformed `package.json` contents.\n */\ntype PackageFilter = (pkg: PackageJSON, file: string, dir: string) => PackageJSON;\n\n/**\n * Allows transforming a path within a package.\n *\n * @param pkg - Parsed `package.json` contents.\n * @param path - Path being resolved.\n * @param relativePath - Path relative from the `package.json` location.\n *\n * @returns Relative path that will be joined from the `package.json` location.\n */\ntype PathFilter = (pkg: PackageJSON, path: string, relativePath: string) => string;\n\ntype ResolverOptions = {\n /** Directory to begin resolving from. */\n basedir: string;\n /** List of export conditions. */\n conditions?: string[];\n /** Instance of default resolver. */\n defaultResolver: typeof defaultResolver;\n /** List of file extensions to search in order. */\n extensions?: string[];\n /**\n * List of directory names to be looked up for modules recursively.\n *\n * @defaultValue\n * The default is `['node_modules']`.\n */\n moduleDirectory?: string[];\n /**\n * List of `require.paths` to use if nothing is found in `node_modules`.\n *\n * @defaultValue\n * The default is `undefined`.\n */\n paths?: string[];\n /** Allows transforming parsed `package.json` contents. */\n packageFilter?: PackageFilter;\n /** Allows transforms a path within a package. */\n pathFilter?: PathFilter;\n /** Current root directory. */\n rootDir?: string;\n\n enablePackageExports?: boolean;\n\n blockList: RegExp[];\n\n getPackageForModule: import('metro-resolver').CustomResolutionContext['getPackageForModule'];\n} & Pick<\n UpstreamResolveOptions,\n | 'readPackageSync'\n | 'realpathSync'\n | 'moduleDirectory'\n | 'extensions'\n | 'preserveSymlinks'\n | 'includeCoreModules'\n>;\n\ntype UpstreamResolveOptionsWithConditions = UpstreamResolveOptions &\n ResolverOptions & {\n pathExists: (file: string) => boolean;\n };\n\nconst defaultResolver = (\n path: string,\n {\n enablePackageExports,\n blockList = [],\n ...options\n }: Omit<ResolverOptions, 'defaultResolver' | 'getPackageForModule'> & {\n isDirectory: (file: string) => boolean;\n isFile: (file: string) => boolean;\n pathExists: (file: string) => boolean;\n }\n): string => {\n // @ts-expect-error\n const resolveOptions: UpstreamResolveOptionsWithConditions = {\n ...options,\n preserveSymlinks: options.preserveSymlinks,\n defaultResolver,\n };\n\n // resolveSync dereferences symlinks to ensure we don't create a separate\n // module instance depending on how it was referenced.\n const result = resolveSync(enablePackageExports ? getPathInModule(path, resolveOptions) : path, {\n ...resolveOptions,\n preserveSymlinks: !options.preserveSymlinks,\n });\n\n return result;\n};\n\nexport default defaultResolver;\n\n/*\n * helper functions\n */\n\nfunction getPathInModule(path: string, options: UpstreamResolveOptionsWithConditions): string {\n if (shouldIgnoreRequestForExports(path)) {\n return path;\n }\n\n const segments = path.split('/');\n\n let moduleName = segments.shift();\n\n if (!moduleName) {\n return path;\n }\n\n if (moduleName.startsWith('@')) {\n moduleName = `${moduleName}/${segments.shift()}`;\n }\n\n // Disable package exports for babel/runtime for https://github.com/facebook/metro/issues/984/\n if (moduleName === '@babel/runtime') {\n return path;\n }\n\n // self-reference\n const closestPackageJson = findClosestPackageJson(options.basedir, options);\n if (closestPackageJson) {\n const pkg = options.readPackageSync!(options.readFileSync!, closestPackageJson);\n assert(pkg, 'package.json should be read by `readPackageSync`');\n\n if (pkg.name === moduleName) {\n const resolved = resolve.exports(\n pkg,\n (segments.join('/') || '.') as resolve.Exports.Entry,\n createResolveOptions(options.conditions)\n );\n\n if (resolved) {\n return pathResolve(dirname(closestPackageJson), resolved[0]);\n }\n\n if (pkg.exports) {\n throw new Error(\n \"`exports` exists, but no results - this is a bug in Expo CLI's Metro resolver. Please report an issue\"\n );\n }\n }\n }\n\n let packageJsonPath = '';\n\n try {\n packageJsonPath = resolveSync(`${moduleName}/package.json`, options);\n } catch {\n // ignore if package.json cannot be found\n }\n\n if (!packageJsonPath) {\n return path;\n }\n\n const pkg = options.readPackageSync!(options.readFileSync!, packageJsonPath);\n assert(pkg, 'package.json should be read by `readPackageSync`');\n\n const resolved = resolve.exports(\n pkg,\n (segments.join('/') || '.') as resolve.Exports.Entry,\n createResolveOptions(options.conditions)\n );\n\n if (resolved) {\n return pathResolve(dirname(packageJsonPath), resolved[0]);\n }\n\n if (pkg.exports) {\n throw new Error(\n \"`exports` exists, but no results - this is a bug in Expo CLI's Metro resolver. Please report an issue\"\n );\n }\n\n return path;\n}\n\nfunction createResolveOptions(conditions: string[] | undefined): resolve.Options {\n return conditions\n ? { conditions, unsafe: true }\n : // no conditions were passed - let's assume this is Jest internal and it should be `require`\n { browser: false, require: true };\n}\n\n// if it's a relative import or an absolute path, imports/exports are ignored\nconst shouldIgnoreRequestForExports = (path: string) => path.startsWith('.') || isAbsolute(path);\n\n// adapted from\n// https://github.com/lukeed/escalade/blob/2477005062cdbd8407afc90d3f48f4930354252b/src/sync.js\nfunction findClosestPackageJson(\n start: string,\n options: UpstreamResolveOptionsWithConditions\n): string | undefined {\n let dir = pathResolve('.', start);\n if (!options.isDirectory!(dir)) {\n dir = dirname(dir);\n }\n\n while (true) {\n const pkgJsonFile = pathResolve(dir, './package.json');\n const hasPackageJson = options.pathExists!(pkgJsonFile);\n\n if (hasPackageJson) {\n return pkgJsonFile;\n }\n\n const prevDir = dir;\n dir = dirname(dir);\n\n if (prevDir === dir) {\n return undefined;\n }\n }\n}\n"],"names":["defaultResolver","path","enablePackageExports","blockList","options","resolveOptions","preserveSymlinks","result","resolveSync","getPathInModule","shouldIgnoreRequestForExports","segments","split","moduleName","shift","startsWith","closestPackageJson","findClosestPackageJson","basedir","pkg","readPackageSync","readFileSync","assert","name","resolved","resolve","exports","join","createResolveOptions","conditions","pathResolve","dirname","Error","packageJsonPath","unsafe","browser","require","isAbsolute","start","dir","isDirectory","pkgJsonFile","hasPackageJson","pathExists","prevDir","undefined"],"mappings":"AAAA;;;;;;;;;CASC,GACD;;;;+BA2GA,SAA+B;;aAA/B,QAA+B;;;8DA1GZ,QAAQ;;;;;;;yBACiC,MAAM;;;;;;;yBACM,SAAS;;;;;;;+DACxD,iBAAiB;;;;;;;;;;;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ME,WAAW,GAAGX,IAAAA,KAAW,EAAA,QAAA,EAACS,GAAG,EAAE,gBAAgB,CAAC,AAAC;QACvD,MAAMG,cAAc,GAAGtC,OAAO,CAACuC,UAAU,CAAEF,WAAW,CAAC,AAAC;QAExD,IAAIC,cAAc,EAAE;YAClB,OAAOD,WAAW,CAAC;QACrB,CAAC;QAED,MAAMG,OAAO,GAAGL,GAAG,AAAC;QACpBA,GAAG,GAAGR,IAAAA,KAAO,EAAA,QAAA,EAACQ,GAAG,CAAC,CAAC;QAEnB,IAAIK,OAAO,KAAKL,GAAG,EAAE;YACnB,OAAOM,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/createJResolver.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Fork of the jest resolver but with additional settings for Metro and pnp removed.\n * https://github.com/jestjs/jest/blob/d1a2ed7fea4bdc19836274cd810c8360e3ab62f3/packages/jest-resolve/src/defaultResolver.ts#L1\n */\nimport type { JSONObject as PackageJSON } from '@expo/json-file';\nimport assert from 'assert';\nimport { dirname, isAbsolute, resolve as pathResolve } from 'path';\nimport { sync as resolveSync, SyncOpts as UpstreamResolveOptions } from 'resolve';\nimport * as resolve from 'resolve.exports';\n\n/**\n * Allows transforming parsed `package.json` contents.\n *\n * @param pkg - Parsed `package.json` contents.\n * @param file - Path to `package.json` file.\n * @param dir - Directory that contains the `package.json`.\n *\n * @returns Transformed `package.json` contents.\n */\ntype PackageFilter = (pkg: PackageJSON, file: string, dir: string) => PackageJSON;\n\n/**\n * Allows transforming a path within a package.\n *\n * @param pkg - Parsed `package.json` contents.\n * @param path - Path being resolved.\n * @param relativePath - Path relative from the `package.json` location.\n *\n * @returns Relative path that will be joined from the `package.json` location.\n */\ntype PathFilter = (pkg: PackageJSON, path: string, relativePath: string) => string;\n\ntype ResolverOptions = {\n /** Directory to begin resolving from. */\n basedir: string;\n /** List of export conditions. */\n conditions?: string[];\n /** Instance of default resolver. */\n defaultResolver: typeof defaultResolver;\n /** List of file extensions to search in order. */\n extensions?: string[];\n /**\n * List of directory names to be looked up for modules recursively.\n *\n * @defaultValue\n * The default is `['node_modules']`.\n */\n moduleDirectory?: string[];\n /**\n * List of `require.paths` to use if nothing is found in `node_modules`.\n *\n * @defaultValue\n * The default is `undefined`.\n */\n paths?: string[];\n /** Allows transforming parsed `package.json` contents. */\n packageFilter?: PackageFilter;\n /** Allows transforms a path within a package. */\n pathFilter?: PathFilter;\n /** Current root directory. */\n rootDir?: string;\n\n enablePackageExports?: boolean;\n\n blockList: RegExp[];\n\n getPackageForModule: import('metro-resolver').CustomResolutionContext['getPackageForModule'];\n} & Pick<\n UpstreamResolveOptions,\n | 'readPackageSync'\n | 'realpathSync'\n | 'moduleDirectory'\n | 'extensions'\n | 'preserveSymlinks'\n | 'includeCoreModules'\n>;\n\ntype UpstreamResolveOptionsWithConditions = UpstreamResolveOptions &\n ResolverOptions & {\n pathExists: (file: string) => boolean;\n };\n\nconst defaultResolver = (\n path: string,\n {\n enablePackageExports,\n blockList = [],\n ...options\n }: Omit<ResolverOptions, 'defaultResolver' | 'getPackageForModule'> & {\n isDirectory: (file: string) => boolean;\n isFile: (file: string) => boolean;\n pathExists: (file: string) => boolean;\n }\n): string => {\n // @ts-expect-error\n const resolveOptions: UpstreamResolveOptionsWithConditions = {\n ...options,\n preserveSymlinks: options.preserveSymlinks,\n defaultResolver,\n };\n\n // resolveSync dereferences symlinks to ensure we don't create a separate\n // module instance depending on how it was referenced.\n const result = resolveSync(enablePackageExports ? getPathInModule(path, resolveOptions) : path, {\n ...resolveOptions,\n preserveSymlinks: !options.preserveSymlinks,\n });\n\n return result;\n};\n\nexport default defaultResolver;\n\n/*\n * helper functions\n */\n\nfunction getPathInModule(path: string, options: UpstreamResolveOptionsWithConditions): string {\n if (shouldIgnoreRequestForExports(path)) {\n return path;\n }\n\n const segments = path.split('/');\n\n let moduleName = segments.shift();\n\n if (!moduleName) {\n return path;\n }\n\n if (moduleName.startsWith('@')) {\n moduleName = `${moduleName}/${segments.shift()}`;\n }\n\n // Disable package exports for babel/runtime for https://github.com/facebook/metro/issues/984/\n if (moduleName === '@babel/runtime') {\n return path;\n }\n\n // self-reference\n const closestPackageJson = findClosestPackageJson(options.basedir, options);\n if (closestPackageJson) {\n const pkg = options.readPackageSync!(options.readFileSync!, closestPackageJson);\n assert(pkg, 'package.json should be read by `readPackageSync`');\n\n // Added support for the package.json \"imports\" field (#-prefixed paths)\n if (path.startsWith('#')) {\n const resolved = resolve.imports(pkg, path, createResolveOptions(options.conditions));\n if (resolved) {\n // TODO: Should we attempt to resolve every path in the array?\n return pathResolve(dirname(closestPackageJson), resolved[0]);\n }\n // NOTE: resolve.imports would have thrown by this point.\n return path;\n }\n\n if (pkg.name === moduleName) {\n const resolved = resolve.exports(\n pkg,\n (segments.join('/') || '.') as resolve.Exports.Entry,\n createResolveOptions(options.conditions)\n );\n\n if (resolved) {\n return pathResolve(dirname(closestPackageJson), resolved[0]);\n }\n\n if (pkg.exports) {\n throw new Error(\n \"`exports` exists, but no results - this is a bug in Expo CLI's Metro resolver. Please report an issue\"\n );\n }\n }\n }\n\n let packageJsonPath = '';\n\n try {\n packageJsonPath = resolveSync(`${moduleName}/package.json`, options);\n } catch {\n // ignore if package.json cannot be found\n }\n\n if (!packageJsonPath) {\n return path;\n }\n\n const pkg = options.readPackageSync!(options.readFileSync!, packageJsonPath);\n assert(pkg, 'package.json should be read by `readPackageSync`');\n\n const resolved = resolve.exports(\n pkg,\n (segments.join('/') || '.') as resolve.Exports.Entry,\n createResolveOptions(options.conditions)\n );\n\n if (resolved) {\n return pathResolve(dirname(packageJsonPath), resolved[0]);\n }\n\n if (pkg.exports) {\n throw new Error(\n \"`exports` exists, but no results - this is a bug in Expo CLI's Metro resolver. Please report an issue\"\n );\n }\n\n return path;\n}\n\nfunction createResolveOptions(conditions: string[] | undefined): resolve.Options {\n return conditions\n ? { conditions, unsafe: true }\n : // no conditions were passed - let's assume this is Jest internal and it should be `require`\n { browser: false, require: true };\n}\n\n// if it's a relative import or an absolute path, imports/exports are ignored\nconst shouldIgnoreRequestForExports = (path: string) => path.startsWith('.') || isAbsolute(path);\n\n// adapted from\n// https://github.com/lukeed/escalade/blob/2477005062cdbd8407afc90d3f48f4930354252b/src/sync.js\nfunction findClosestPackageJson(\n start: string,\n options: UpstreamResolveOptionsWithConditions\n): string | undefined {\n let dir = pathResolve('.', start);\n if (!options.isDirectory!(dir)) {\n dir = dirname(dir);\n }\n\n while (true) {\n const pkgJsonFile = pathResolve(dir, './package.json');\n const hasPackageJson = options.pathExists!(pkgJsonFile);\n\n if (hasPackageJson) {\n return pkgJsonFile;\n }\n\n const prevDir = dir;\n dir = dirname(dir);\n\n if (prevDir === dir) {\n return undefined;\n }\n }\n}\n"],"names":["defaultResolver","path","enablePackageExports","blockList","options","resolveOptions","preserveSymlinks","result","resolveSync","getPathInModule","shouldIgnoreRequestForExports","segments","split","moduleName","shift","startsWith","closestPackageJson","findClosestPackageJson","basedir","pkg","readPackageSync","readFileSync","assert","resolved","resolve","imports","createResolveOptions","conditions","pathResolve","dirname","name","exports","join","Error","packageJsonPath","unsafe","browser","require","isAbsolute","start","dir","isDirectory","pkgJsonFile","hasPackageJson","pathExists","prevDir","undefined"],"mappings":"AAAA;;;;;;;;;CASC,GACD;;;;+BA2GA,SAA+B;;aAA/B,QAA+B;;;8DA1GZ,QAAQ;;;;;;;yBACiC,MAAM;;;;;;;yBACM,SAAS;;;;;;;+DACxD,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0E1C,MAAMA,eAAe,GAAG,CACtBC,IAAY,EACZ,EACEC,oBAAoB,CAAA,EACpBC,SAAS,EAAG,EAAE,CAAA,EACd,GAAGC,OAAO,EAKX,GACU;IACX,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bnC,OAA6C,EACzB;IACpB,IAAIoC,GAAG,GAAGZ,IAAAA,KAAW,EAAA,QAAA,EAAC,GAAG,EAAEW,KAAK,CAAC,AAAC;IAClC,IAAI,CAACnC,OAAO,CAACqC,WAAW,CAAED,GAAG,CAAC,EAAE;QAC9BA,GAAG,GAAGX,IAAAA,KAAO,EAAA,QAAA,EAACW,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,MAAO,IAAI,CAAE;QACX,MAAME,WAAW,GAAGd,IAAAA,KAAW,EAAA,QAAA,EAACY,GAAG,EAAE,gBAAgB,CAAC,AAAC;QACvD,MAAMG,cAAc,GAAGvC,OAAO,CAACwC,UAAU,CAAEF,WAAW,CAAC,AAAC;QAExD,IAAIC,cAAc,EAAE;YAClB,OAAOD,WAAW,CAAC;QACrB,CAAC;QAED,MAAMG,OAAO,GAAGL,GAAG,AAAC;QACpBA,GAAG,GAAGX,IAAAA,KAAO,EAAA,QAAA,EAACW,GAAG,CAAC,CAAC;QAEnB,IAAIK,OAAO,KAAKL,GAAG,EAAE;YACnB,OAAOM,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -53,6 +53,7 @@ function _url() {
|
|
|
53
53
|
return data;
|
|
54
54
|
}
|
|
55
55
|
const _metroErrorInterface = require("./metroErrorInterface");
|
|
56
|
+
const _xcodeCompilerLogger = require("../../../export/embed/xcodeCompilerLogger");
|
|
56
57
|
const _ansi = require("../../../utils/ansi");
|
|
57
58
|
const _filePath = require("../../../utils/filePath");
|
|
58
59
|
const _fn = require("../../../utils/fn");
|
|
@@ -109,6 +110,14 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
109
110
|
await (0, _metroErrorInterface.logMetroError)(projectRoot, {
|
|
110
111
|
error
|
|
111
112
|
});
|
|
113
|
+
if (error[_metroErrorInterface.IS_METRO_BUNDLE_ERROR_SYMBOL]) {
|
|
114
|
+
throw new Response(JSON.stringify(error), {
|
|
115
|
+
status: (0, _xcodeCompilerLogger.isPossiblyUnableToResolveError)(error) ? 404 : 500,
|
|
116
|
+
headers: {
|
|
117
|
+
"Content-Type": "application/json"
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
112
121
|
const sanitizedServerMessage = (0, _ansi.stripAnsi)(error.message) ?? error.message;
|
|
113
122
|
throw new Response(sanitizedServerMessage, {
|
|
114
123
|
status: 500,
|
|
@@ -238,13 +247,14 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
238
247
|
}
|
|
239
248
|
const routerCache = new Map();
|
|
240
249
|
async function getExpoRouterRscEntriesGetterAsync({ platform }) {
|
|
250
|
+
await ensureMemo();
|
|
241
251
|
// We can only cache this if we're using the client router since it doesn't change or use HMR
|
|
242
252
|
if (routerCache.has(platform) && useClientRouter) {
|
|
243
253
|
return routerCache.get(platform);
|
|
244
254
|
}
|
|
245
255
|
const router = await ssrLoadModule(routerModule, {
|
|
246
256
|
environment: "react-server",
|
|
247
|
-
|
|
257
|
+
modulesOnly: true,
|
|
248
258
|
platform
|
|
249
259
|
}, {
|
|
250
260
|
hot: !useClientRouter
|
|
@@ -319,7 +329,21 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
319
329
|
};
|
|
320
330
|
}
|
|
321
331
|
const rscRendererCache = new Map();
|
|
332
|
+
let ensurePromise = null;
|
|
333
|
+
async function ensureSSRReady() {
|
|
334
|
+
// TODO: Extract CSS Modules / Assets from the bundler process
|
|
335
|
+
const runtime = await ssrLoadModule("metro-runtime/src/modules/empty-module.js", {
|
|
336
|
+
environment: "react-server",
|
|
337
|
+
platform: "web"
|
|
338
|
+
});
|
|
339
|
+
return runtime;
|
|
340
|
+
}
|
|
341
|
+
const ensureMemo = ()=>{
|
|
342
|
+
ensurePromise ??= ensureSSRReady();
|
|
343
|
+
return ensurePromise;
|
|
344
|
+
};
|
|
322
345
|
async function getRscRendererAsync(platform) {
|
|
346
|
+
await ensureMemo();
|
|
323
347
|
// NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.
|
|
324
348
|
if (rscRendererCache.has(platform)) {
|
|
325
349
|
return rscRendererCache.get(platform);
|
|
@@ -423,10 +447,10 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
423
447
|
(req)=>{
|
|
424
448
|
return getFullUrl(req.url).pathname.startsWith(rscPathPrefix);
|
|
425
449
|
}, rscMiddleware),
|
|
426
|
-
onReloadRscEvent: ()=>{
|
|
450
|
+
onReloadRscEvent: (platform)=>{
|
|
427
451
|
// NOTE: We cannot clear the renderer context because it would break the mounted context state.
|
|
428
|
-
|
|
429
|
-
|
|
452
|
+
rscRendererCache.delete(platform);
|
|
453
|
+
routerCache.delete(platform);
|
|
430
454
|
}
|
|
431
455
|
};
|
|
432
456
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/createServerComponentsMiddleware.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport { getRscMiddleware } from '@expo/server/build/middleware/rsc';\nimport assert from 'assert';\nimport path from 'path';\nimport url from 'url';\n\nimport { logMetroError } from './metroErrorInterface';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { memoize } from '../../../utils/fn';\nimport { getIpAddress } from '../../../utils/ip';\nimport { streamToStringAsync } from '../../../utils/stream';\nimport { createBuiltinAPIRequestHandler } from '../middleware/createBuiltinAPIRequestHandler';\nimport {\n createBundleUrlSearchParams,\n ExpoMetroOptions,\n getMetroOptionsFromUrl,\n} from '../middleware/metroOptions';\n\nconst debug = require('debug')('expo:rsc') as typeof console.log;\n\ntype SSRLoadModuleArtifactsFunc = (\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>\n) => Promise<{ artifacts: SerialAsset[]; src: string }>;\n\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\n\nconst getMetroServerRootMemo = memoize(getMetroServerRoot);\n\nexport function createServerComponentsMiddleware(\n projectRoot: string,\n {\n rscPath,\n instanceMetroOptions,\n ssrLoadModule,\n ssrLoadModuleArtifacts,\n useClientRouter,\n createModuleId,\n }: {\n rscPath: string;\n instanceMetroOptions: Partial<ExpoMetroOptions>;\n ssrLoadModule: SSRLoadModuleFunc;\n ssrLoadModuleArtifacts: SSRLoadModuleArtifactsFunc;\n useClientRouter: boolean;\n createModuleId: (\n filePath: string,\n context: { platform: string; environment: string }\n ) => string | number;\n }\n) {\n const routerModule = useClientRouter\n ? 'expo-router/build/rsc/router/noopRouter'\n : 'expo-router/build/rsc/router/expo-definedRouter';\n\n const rscMiddleware = getRscMiddleware({\n config: {},\n // Disabled in development\n baseUrl: '',\n rscPath,\n onError: console.error,\n renderRsc: async (args) => {\n // In development we should add simulated versions of common production headers.\n if (args.headers['x-real-ip'] == null) {\n args.headers['x-real-ip'] = getIpAddress();\n }\n if (args.headers['x-forwarded-for'] == null) {\n args.headers['x-forwarded-for'] = args.headers['x-real-ip'];\n }\n if (args.headers['x-forwarded-proto'] == null) {\n args.headers['x-forwarded-proto'] = 'http';\n }\n\n // Dev server-only implementation.\n try {\n return await renderRscToReadableStream({\n ...args,\n headers: new Headers(args.headers),\n body: args.body!,\n });\n } catch (error: any) {\n // If you get a codeFrame error during SSR like when using a Class component in React Server Components, then this\n // will throw with:\n // {\n // rawObject: {\n // type: 'TransformError',\n // lineNumber: 0,\n // errors: [ [Object] ],\n // name: 'SyntaxError',\n // message: '...',\n // }\n // }\n\n // TODO: Revisit all error handling now that we do direct metro bundling...\n await logMetroError(projectRoot, { error });\n\n const sanitizedServerMessage = stripAnsi(error.message) ?? error.message;\n throw new Response(sanitizedServerMessage, {\n status: 500,\n headers: {\n 'Content-Type': 'text/plain',\n },\n });\n }\n },\n });\n\n let rscPathPrefix = rscPath;\n if (rscPathPrefix !== '/') {\n rscPathPrefix += '/';\n }\n\n async function exportServerActionsAsync(\n {\n platform,\n entryPoints,\n domRoot,\n }: { platform: string; entryPoints: string[]; domRoot?: string },\n files: ExportAssetMap\n ): Promise<{\n clientBoundaries: string[];\n manifest: Record<string, [string, string]>;\n }> {\n const uniqueEntryPoints = [...new Set(entryPoints)];\n // TODO: Support multiple entry points in a single split server bundle...\n const manifest: Record<string, [string, string]> = {};\n const nestedClientBoundaries: string[] = [];\n const nestedServerBoundaries: string[] = [];\n const processedEntryPoints = new Set<string>();\n async function processEntryPoint(entryPoint: string) {\n processedEntryPoints.add(entryPoint);\n\n const contents = await ssrLoadModuleArtifacts(entryPoint, {\n environment: 'react-server',\n platform,\n // Ignore the metro runtime to avoid overwriting the original in the API route.\n modulesOnly: true,\n // Required\n runModule: true,\n // Required to ensure assets load as client boundaries.\n domRoot,\n });\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (reactClientReferences) {\n nestedClientBoundaries.push(...reactClientReferences!);\n }\n const reactServerReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (reactServerReferences) {\n nestedServerBoundaries.push(...reactServerReferences!);\n }\n\n // Naive check to ensure the module runtime is not included in the server action bundle.\n if (contents.src.includes('The experimental Metro feature')) {\n throw new Error(\n 'Internal error: module runtime should not be included in server action bundles: ' +\n entryPoint\n );\n }\n\n const relativeName = createModuleId(entryPoint, {\n platform,\n environment: 'react-server',\n });\n const safeName = path.basename(contents.artifacts.find((a) => a.type === 'js')!.filename!);\n\n const outputName = `_expo/rsc/${platform}/${safeName}`;\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(outputName, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n // Import relative to `dist/server/_expo/rsc/web/router.js`\n manifest[entryPoint] = [String(relativeName), outputName];\n }\n\n async function processEntryPoints(entryPoints: string[], recursions = 0) {\n // Arbitrary recursion limit to prevent infinite loops.\n if (recursions > 10) {\n throw new Error('Recursion limit exceeded while processing server boundaries');\n }\n\n for (const entryPoint of entryPoints) {\n await processEntryPoint(entryPoint);\n }\n\n // When a server action has other server actions inside of it, we need to process those as well to ensure all entry points are in the manifest and accounted for.\n let uniqueNestedServerBoundaries = [...new Set(nestedServerBoundaries)];\n // Filter out values that have already been processed.\n uniqueNestedServerBoundaries = uniqueNestedServerBoundaries.filter(\n (value) => !processedEntryPoints.has(value)\n );\n if (uniqueNestedServerBoundaries.length) {\n debug('bundling nested server action boundaries', uniqueNestedServerBoundaries);\n return processEntryPoints(uniqueNestedServerBoundaries, recursions + 1);\n }\n }\n\n await processEntryPoints(uniqueEntryPoints);\n\n // Save the SSR manifest so we can perform more replacements in the server renderer and with server actions.\n files.set(`_expo/rsc/${platform}/action-manifest.js`, {\n targetDomain: 'server',\n contents: 'module.exports = ' + JSON.stringify(manifest),\n });\n\n return { manifest, clientBoundaries: nestedClientBoundaries };\n }\n\n async function getExpoRouterClientReferencesAsync(\n { platform, domRoot }: { platform: string; domRoot?: string },\n files: ExportAssetMap\n ): Promise<{\n reactClientReferences: string[];\n reactServerReferences: string[];\n cssModules: SerialAsset[];\n }> {\n const contents = await ssrLoadModuleArtifacts(routerModule, {\n environment: 'react-server',\n platform,\n modulesOnly: true,\n domRoot,\n });\n\n // Extract the global CSS modules that are imported from the router.\n // These will be injected in the head of the HTML document for the website.\n const cssModules = contents.artifacts.filter((a) => a.type.startsWith('css'));\n\n const reactServerReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactServerReferences) {\n throw new Error(\n 'Static server action references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactServerReferences);\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactClientReferences) {\n throw new Error(\n 'Static client references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactClientReferences);\n\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(`_expo/rsc/${platform}/router.js`, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n return { reactClientReferences, reactServerReferences, cssModules };\n }\n\n const routerCache = new Map<\n string,\n typeof import('expo-router/build/rsc/router/expo-definedRouter')\n >();\n\n async function getExpoRouterRscEntriesGetterAsync({ platform }: { platform: string }) {\n // We can only cache this if we're using the client router since it doesn't change or use HMR\n if (routerCache.has(platform) && useClientRouter) {\n return routerCache.get(platform)!;\n }\n\n const router = await ssrLoadModule<\n typeof import('expo-router/build/rsc/router/expo-definedRouter')\n >(\n routerModule,\n {\n environment: 'react-server',\n // modulesOnly: true,\n platform,\n },\n {\n hot: !useClientRouter,\n }\n );\n\n routerCache.set(platform, router);\n return router;\n }\n\n function getResolveClientEntry(context: {\n platform: string;\n engine?: 'hermes' | null;\n ssrManifest?: Map<string, string>;\n }): (\n file: string,\n isServer: boolean\n ) => {\n id: string;\n chunks: string[];\n } {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n const {\n mode,\n minify = false,\n isExporting,\n baseUrl,\n routerRoot,\n asyncRoutes,\n preserveEnvVars,\n reactCompiler,\n lazy,\n } = instanceMetroOptions;\n\n assert(\n isExporting != null &&\n baseUrl != null &&\n mode != null &&\n routerRoot != null &&\n asyncRoutes != null,\n `The server must be started. (isExporting: ${isExporting}, baseUrl: ${baseUrl}, mode: ${mode}, routerRoot: ${routerRoot}, asyncRoutes: ${asyncRoutes})`\n );\n\n return (file: string, isServer: boolean) => {\n if (isExporting) {\n assert(context.ssrManifest, 'SSR manifest must exist when exporting');\n const relativeFilePath = toPosixPath(path.relative(serverRoot, file));\n\n assert(\n context.ssrManifest.has(relativeFilePath),\n `SSR manifest is missing client boundary \"${relativeFilePath}\"`\n );\n\n const chunk = context.ssrManifest.get(relativeFilePath);\n\n return {\n id: String(createModuleId(file, { platform: context.platform, environment: 'client' })),\n chunks: chunk != null ? [chunk] : [],\n };\n }\n\n const environment = isServer ? 'react-server' : 'client';\n const searchParams = createBundleUrlSearchParams({\n mainModuleName: '',\n platform: context.platform,\n mode,\n minify,\n lazy,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n reactCompiler: !!reactCompiler,\n engine: context.engine ?? undefined,\n bytecode: false,\n clientBoundaries: [],\n inlineSourceMap: false,\n environment,\n modulesOnly: true,\n runModule: false,\n });\n\n searchParams.set('resolver.clientboundary', String(true));\n\n const clientReferenceUrl = new URL('http://a');\n\n // TICKLE: Handshake 1\n searchParams.set('xRSC', '1');\n\n clientReferenceUrl.search = searchParams.toString();\n\n const filePath = file.startsWith('file://') ? fileURLToFilePath(file) : file;\n\n const relativeFilePath = path.relative(serverRoot, filePath);\n\n clientReferenceUrl.pathname = relativeFilePath;\n\n // Ensure url.pathname ends with '.bundle'\n if (!clientReferenceUrl.pathname.endsWith('.bundle')) {\n clientReferenceUrl.pathname += '.bundle';\n }\n\n // Return relative URLs to help Android fetch from wherever it was loaded from since it doesn't support localhost.\n const chunkName = clientReferenceUrl.pathname + clientReferenceUrl.search;\n\n return {\n id: String(createModuleId(filePath, { platform: context.platform, environment })),\n chunks: [chunkName],\n };\n };\n }\n\n const rscRendererCache = new Map<string, typeof import('expo-router/build/rsc/rsc-renderer')>();\n\n async function getRscRendererAsync(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRendererCache.has(platform)) {\n return rscRendererCache.get(platform)!;\n }\n\n // TODO: Extract CSS Modules / Assets from the bundler process\n const renderer = await ssrLoadModule<typeof import('expo-router/build/rsc/rsc-renderer')>(\n 'expo-router/build/rsc/rsc-renderer',\n {\n environment: 'react-server',\n platform,\n }\n );\n\n rscRendererCache.set(platform, renderer);\n return renderer;\n }\n\n const rscRenderContext = new Map<string, any>();\n\n function getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n }\n\n async function renderRscToReadableStream(\n {\n input,\n headers,\n method,\n platform,\n body,\n engine,\n contentType,\n ssrManifest,\n decodedBody,\n }: {\n input: string;\n headers: Headers;\n method: 'POST' | 'GET';\n platform: string;\n body?: ReadableStream<Uint8Array>;\n engine?: 'hermes' | null;\n contentType?: string;\n ssrManifest?: Map<string, string>;\n decodedBody?: unknown;\n },\n isExporting: boolean | undefined = instanceMetroOptions.isExporting\n ) {\n assert(\n isExporting != null,\n 'The server must be started before calling renderRscToReadableStream.'\n );\n\n if (method === 'POST') {\n assert(body, 'Server request must be provided when method is POST (server actions)');\n }\n\n const context = getRscRenderContext(platform);\n\n context['__expo_requestHeaders'] = headers;\n\n const { renderRsc } = await getRscRendererAsync(platform);\n\n return renderRsc(\n {\n body,\n decodedBody,\n context,\n config: {},\n input,\n contentType,\n },\n {\n isExporting,\n entries: await getExpoRouterRscEntriesGetterAsync({ platform }),\n resolveClientEntry: getResolveClientEntry({ platform, engine, ssrManifest }),\n async loadServerModuleRsc(urlFragment) {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n debug('[SSR] loadServerModuleRsc:', urlFragment);\n\n const options = getMetroOptionsFromUrl(urlFragment);\n\n return ssrLoadModule(path.join(serverRoot, options.mainModuleName), options, {\n hot: true,\n });\n },\n }\n );\n }\n\n return {\n // Get the static client boundaries (no dead code elimination allowed) for the production export.\n getExpoRouterClientReferencesAsync,\n exportServerActionsAsync,\n\n async exportRoutesAsync(\n {\n platform,\n ssrManifest,\n }: {\n platform: string;\n ssrManifest: Map<string, string>;\n },\n files: ExportAssetMap\n ) {\n // TODO: When we add web SSR support, we need to extract CSS Modules / Assets from the bundler process to prevent FLOUC.\n const { getBuildConfig } = (await getExpoRouterRscEntriesGetterAsync({ platform })).default;\n\n // Get all the routes to render.\n const buildConfig = await getBuildConfig!(async () =>\n // TODO: Rework prefetching code to use Metro runtime.\n []\n );\n\n await Promise.all(\n Array.from(buildConfig).map(async ({ entries }) => {\n for (const { input, isStatic } of entries || []) {\n if (!isStatic) {\n debug('Skipping static export for route', { input });\n continue;\n }\n const destRscFile = path.join('_flight', platform, encodeInput(input));\n\n const pipe = await renderRscToReadableStream(\n {\n input,\n method: 'GET',\n platform,\n headers: new Headers(),\n ssrManifest,\n },\n true\n );\n\n const rsc = await streamToStringAsync(pipe);\n debug('RSC Payload', { platform, input, rsc });\n\n files.set(destRscFile, {\n contents: rsc,\n targetDomain: 'client',\n rscId: input,\n });\n }\n })\n );\n },\n\n middleware: createBuiltinAPIRequestHandler(\n // Match `/_flight/[platform]/[...path]`\n (req) => {\n return getFullUrl(req.url).pathname.startsWith(rscPathPrefix);\n },\n rscMiddleware\n ),\n onReloadRscEvent: () => {\n // NOTE: We cannot clear the renderer context because it would break the mounted context state.\n\n // Clear the render context to ensure that the next render is a fresh start.\n rscRenderContext.clear();\n },\n };\n}\n\nconst getFullUrl = (url: string) => {\n try {\n return new URL(url);\n } catch {\n return new URL(url, 'http://localhost:0');\n }\n};\n\nexport const fileURLToFilePath = (fileURL: string) => {\n return url.fileURLToPath(fileURL);\n};\n\nconst encodeInput = (input: string) => {\n if (input === '') {\n return 'index.txt';\n }\n if (input === 'index') {\n throw new Error('Input should not be `index`');\n }\n if (input.startsWith('/')) {\n throw new Error('Input should not start with `/`');\n }\n if (input.endsWith('/')) {\n throw new Error('Input should not end with `/`');\n }\n return input + '.txt';\n};\n\nfunction wrapBundle(str: string) {\n // Skip the metro runtime so debugging is a bit easier.\n // Replace the __r() call with an export statement.\n // Use gm to apply to the last require line. This is needed when the bundle has side-effects.\n return str.replace(/^(__r\\(.*\\);)$/gm, 'module.exports = $1');\n}\n"],"names":["createServerComponentsMiddleware","fileURLToFilePath","debug","require","getMetroServerRootMemo","memoize","getMetroServerRoot","projectRoot","rscPath","instanceMetroOptions","ssrLoadModule","ssrLoadModuleArtifacts","useClientRouter","createModuleId","routerModule","rscMiddleware","getRscMiddleware","config","baseUrl","onError","console","error","renderRsc","args","headers","getIpAddress","renderRscToReadableStream","Headers","body","logMetroError","sanitizedServerMessage","stripAnsi","message","Response","status","rscPathPrefix","exportServerActionsAsync","platform","entryPoints","domRoot","files","uniqueEntryPoints","Set","manifest","nestedClientBoundaries","nestedServerBoundaries","processedEntryPoints","processEntryPoint","entryPoint","contents","add","environment","modulesOnly","runModule","reactClientReferences","artifacts","filter","a","type","metadata","map","ref","push","reactServerReferences","src","includes","Error","relativeName","safeName","path","basename","find","filename","outputName","set","targetDomain","wrapBundle","String","processEntryPoints","recursions","uniqueNestedServerBoundaries","value","has","length","JSON","stringify","clientBoundaries","getExpoRouterClientReferencesAsync","cssModules","startsWith","routerCache","Map","getExpoRouterRscEntriesGetterAsync","get","router","hot","getResolveClientEntry","context","serverRoot","mode","minify","isExporting","routerRoot","asyncRoutes","preserveEnvVars","reactCompiler","lazy","assert","file","isServer","ssrManifest","relativeFilePath","toPosixPath","relative","chunk","id","chunks","searchParams","createBundleUrlSearchParams","mainModuleName","engine","undefined","bytecode","inlineSourceMap","clientReferenceUrl","URL","search","toString","filePath","pathname","endsWith","chunkName","rscRendererCache","getRscRendererAsync","renderer","rscRenderContext","getRscRenderContext","input","method","contentType","decodedBody","entries","resolveClientEntry","loadServerModuleRsc","urlFragment","options","getMetroOptionsFromUrl","join","exportRoutesAsync","getBuildConfig","default","buildConfig","Promise","all","Array","from","isStatic","destRscFile","encodeInput","pipe","rsc","streamToStringAsync","rscId","middleware","createBuiltinAPIRequestHandler","req","getFullUrl","url","onReloadRscEvent","clear","fileURL","fileURL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AChD,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,MAAM,IAAIvB,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAIuE,KAAK,CAACP,QAAQ,CAAC,GAAG,CAAC,EAAE;QACvB,MAAM,IAAIhE,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAOuE,KAAK,GAAG,MAAM,CAAC;AACxB,CAAC,AAAC;AAEF,SAAS7D,UAAU,CAACgG,GAAW,EAAE;IAC/B,uDAAuD;IACvD,mDAAmD;IACnD,6FAA6F;IAC7F,OAAOA,GAAG,CAACC,OAAO,qBAAqB,qBAAqB,CAAC,CAAC;AAChE,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/createServerComponentsMiddleware.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport { getRscMiddleware } from '@expo/server/build/middleware/rsc';\nimport assert from 'assert';\nimport path from 'path';\nimport url from 'url';\n\nimport { IS_METRO_BUNDLE_ERROR_SYMBOL, logMetroError } from './metroErrorInterface';\nimport { isPossiblyUnableToResolveError } from '../../../export/embed/xcodeCompilerLogger';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { memoize } from '../../../utils/fn';\nimport { getIpAddress } from '../../../utils/ip';\nimport { streamToStringAsync } from '../../../utils/stream';\nimport { createBuiltinAPIRequestHandler } from '../middleware/createBuiltinAPIRequestHandler';\nimport {\n createBundleUrlSearchParams,\n ExpoMetroOptions,\n getMetroOptionsFromUrl,\n} from '../middleware/metroOptions';\n\nconst debug = require('debug')('expo:rsc') as typeof console.log;\n\ntype SSRLoadModuleArtifactsFunc = (\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>\n) => Promise<{ artifacts: SerialAsset[]; src: string }>;\n\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\n\nconst getMetroServerRootMemo = memoize(getMetroServerRoot);\n\nexport function createServerComponentsMiddleware(\n projectRoot: string,\n {\n rscPath,\n instanceMetroOptions,\n ssrLoadModule,\n ssrLoadModuleArtifacts,\n useClientRouter,\n createModuleId,\n }: {\n rscPath: string;\n instanceMetroOptions: Partial<ExpoMetroOptions>;\n ssrLoadModule: SSRLoadModuleFunc;\n ssrLoadModuleArtifacts: SSRLoadModuleArtifactsFunc;\n useClientRouter: boolean;\n createModuleId: (\n filePath: string,\n context: { platform: string; environment: string }\n ) => string | number;\n }\n) {\n const routerModule = useClientRouter\n ? 'expo-router/build/rsc/router/noopRouter'\n : 'expo-router/build/rsc/router/expo-definedRouter';\n\n const rscMiddleware = getRscMiddleware({\n config: {},\n // Disabled in development\n baseUrl: '',\n rscPath,\n onError: console.error,\n renderRsc: async (args) => {\n // In development we should add simulated versions of common production headers.\n if (args.headers['x-real-ip'] == null) {\n args.headers['x-real-ip'] = getIpAddress();\n }\n if (args.headers['x-forwarded-for'] == null) {\n args.headers['x-forwarded-for'] = args.headers['x-real-ip'];\n }\n if (args.headers['x-forwarded-proto'] == null) {\n args.headers['x-forwarded-proto'] = 'http';\n }\n\n // Dev server-only implementation.\n try {\n return await renderRscToReadableStream({\n ...args,\n headers: new Headers(args.headers),\n body: args.body!,\n });\n } catch (error: any) {\n // If you get a codeFrame error during SSR like when using a Class component in React Server Components, then this\n // will throw with:\n // {\n // rawObject: {\n // type: 'TransformError',\n // lineNumber: 0,\n // errors: [ [Object] ],\n // name: 'SyntaxError',\n // message: '...',\n // }\n // }\n\n // TODO: Revisit all error handling now that we do direct metro bundling...\n await logMetroError(projectRoot, { error });\n\n if (error[IS_METRO_BUNDLE_ERROR_SYMBOL]) {\n throw new Response(JSON.stringify(error), {\n status: isPossiblyUnableToResolveError(error) ? 404 : 500,\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n }\n\n const sanitizedServerMessage = stripAnsi(error.message) ?? error.message;\n throw new Response(sanitizedServerMessage, {\n status: 500,\n headers: {\n 'Content-Type': 'text/plain',\n },\n });\n }\n },\n });\n\n let rscPathPrefix = rscPath;\n if (rscPathPrefix !== '/') {\n rscPathPrefix += '/';\n }\n\n async function exportServerActionsAsync(\n {\n platform,\n entryPoints,\n domRoot,\n }: { platform: string; entryPoints: string[]; domRoot?: string },\n files: ExportAssetMap\n ): Promise<{\n clientBoundaries: string[];\n manifest: Record<string, [string, string]>;\n }> {\n const uniqueEntryPoints = [...new Set(entryPoints)];\n // TODO: Support multiple entry points in a single split server bundle...\n const manifest: Record<string, [string, string]> = {};\n const nestedClientBoundaries: string[] = [];\n const nestedServerBoundaries: string[] = [];\n const processedEntryPoints = new Set<string>();\n async function processEntryPoint(entryPoint: string) {\n processedEntryPoints.add(entryPoint);\n\n const contents = await ssrLoadModuleArtifacts(entryPoint, {\n environment: 'react-server',\n platform,\n // Ignore the metro runtime to avoid overwriting the original in the API route.\n modulesOnly: true,\n // Required\n runModule: true,\n // Required to ensure assets load as client boundaries.\n domRoot,\n });\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (reactClientReferences) {\n nestedClientBoundaries.push(...reactClientReferences!);\n }\n const reactServerReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (reactServerReferences) {\n nestedServerBoundaries.push(...reactServerReferences!);\n }\n\n // Naive check to ensure the module runtime is not included in the server action bundle.\n if (contents.src.includes('The experimental Metro feature')) {\n throw new Error(\n 'Internal error: module runtime should not be included in server action bundles: ' +\n entryPoint\n );\n }\n\n const relativeName = createModuleId(entryPoint, {\n platform,\n environment: 'react-server',\n });\n const safeName = path.basename(contents.artifacts.find((a) => a.type === 'js')!.filename!);\n\n const outputName = `_expo/rsc/${platform}/${safeName}`;\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(outputName, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n // Import relative to `dist/server/_expo/rsc/web/router.js`\n manifest[entryPoint] = [String(relativeName), outputName];\n }\n\n async function processEntryPoints(entryPoints: string[], recursions = 0) {\n // Arbitrary recursion limit to prevent infinite loops.\n if (recursions > 10) {\n throw new Error('Recursion limit exceeded while processing server boundaries');\n }\n\n for (const entryPoint of entryPoints) {\n await processEntryPoint(entryPoint);\n }\n\n // When a server action has other server actions inside of it, we need to process those as well to ensure all entry points are in the manifest and accounted for.\n let uniqueNestedServerBoundaries = [...new Set(nestedServerBoundaries)];\n // Filter out values that have already been processed.\n uniqueNestedServerBoundaries = uniqueNestedServerBoundaries.filter(\n (value) => !processedEntryPoints.has(value)\n );\n if (uniqueNestedServerBoundaries.length) {\n debug('bundling nested server action boundaries', uniqueNestedServerBoundaries);\n return processEntryPoints(uniqueNestedServerBoundaries, recursions + 1);\n }\n }\n\n await processEntryPoints(uniqueEntryPoints);\n\n // Save the SSR manifest so we can perform more replacements in the server renderer and with server actions.\n files.set(`_expo/rsc/${platform}/action-manifest.js`, {\n targetDomain: 'server',\n contents: 'module.exports = ' + JSON.stringify(manifest),\n });\n\n return { manifest, clientBoundaries: nestedClientBoundaries };\n }\n\n async function getExpoRouterClientReferencesAsync(\n { platform, domRoot }: { platform: string; domRoot?: string },\n files: ExportAssetMap\n ): Promise<{\n reactClientReferences: string[];\n reactServerReferences: string[];\n cssModules: SerialAsset[];\n }> {\n const contents = await ssrLoadModuleArtifacts(routerModule, {\n environment: 'react-server',\n platform,\n modulesOnly: true,\n domRoot,\n });\n\n // Extract the global CSS modules that are imported from the router.\n // These will be injected in the head of the HTML document for the website.\n const cssModules = contents.artifacts.filter((a) => a.type.startsWith('css'));\n\n const reactServerReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactServerReferences) {\n throw new Error(\n 'Static server action references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactServerReferences);\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactClientReferences) {\n throw new Error(\n 'Static client references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactClientReferences);\n\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(`_expo/rsc/${platform}/router.js`, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n return { reactClientReferences, reactServerReferences, cssModules };\n }\n\n const routerCache = new Map<\n string,\n typeof import('expo-router/build/rsc/router/expo-definedRouter')\n >();\n\n async function getExpoRouterRscEntriesGetterAsync({ platform }: { platform: string }) {\n await ensureMemo();\n // We can only cache this if we're using the client router since it doesn't change or use HMR\n if (routerCache.has(platform) && useClientRouter) {\n return routerCache.get(platform)!;\n }\n\n const router = await ssrLoadModule<\n typeof import('expo-router/build/rsc/router/expo-definedRouter')\n >(\n routerModule,\n {\n environment: 'react-server',\n modulesOnly: true,\n platform,\n },\n {\n hot: !useClientRouter,\n }\n );\n\n routerCache.set(platform, router);\n return router;\n }\n\n function getResolveClientEntry(context: {\n platform: string;\n engine?: 'hermes' | null;\n ssrManifest?: Map<string, string>;\n }): (\n file: string,\n isServer: boolean\n ) => {\n id: string;\n chunks: string[];\n } {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n const {\n mode,\n minify = false,\n isExporting,\n baseUrl,\n routerRoot,\n asyncRoutes,\n preserveEnvVars,\n reactCompiler,\n lazy,\n } = instanceMetroOptions;\n\n assert(\n isExporting != null &&\n baseUrl != null &&\n mode != null &&\n routerRoot != null &&\n asyncRoutes != null,\n `The server must be started. (isExporting: ${isExporting}, baseUrl: ${baseUrl}, mode: ${mode}, routerRoot: ${routerRoot}, asyncRoutes: ${asyncRoutes})`\n );\n\n return (file: string, isServer: boolean) => {\n if (isExporting) {\n assert(context.ssrManifest, 'SSR manifest must exist when exporting');\n const relativeFilePath = toPosixPath(path.relative(serverRoot, file));\n\n assert(\n context.ssrManifest.has(relativeFilePath),\n `SSR manifest is missing client boundary \"${relativeFilePath}\"`\n );\n\n const chunk = context.ssrManifest.get(relativeFilePath);\n\n return {\n id: String(createModuleId(file, { platform: context.platform, environment: 'client' })),\n chunks: chunk != null ? [chunk] : [],\n };\n }\n\n const environment = isServer ? 'react-server' : 'client';\n const searchParams = createBundleUrlSearchParams({\n mainModuleName: '',\n platform: context.platform,\n mode,\n minify,\n lazy,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n reactCompiler: !!reactCompiler,\n engine: context.engine ?? undefined,\n bytecode: false,\n clientBoundaries: [],\n inlineSourceMap: false,\n environment,\n modulesOnly: true,\n runModule: false,\n });\n\n searchParams.set('resolver.clientboundary', String(true));\n\n const clientReferenceUrl = new URL('http://a');\n\n // TICKLE: Handshake 1\n searchParams.set('xRSC', '1');\n\n clientReferenceUrl.search = searchParams.toString();\n\n const filePath = file.startsWith('file://') ? fileURLToFilePath(file) : file;\n\n const relativeFilePath = path.relative(serverRoot, filePath);\n\n clientReferenceUrl.pathname = relativeFilePath;\n\n // Ensure url.pathname ends with '.bundle'\n if (!clientReferenceUrl.pathname.endsWith('.bundle')) {\n clientReferenceUrl.pathname += '.bundle';\n }\n\n // Return relative URLs to help Android fetch from wherever it was loaded from since it doesn't support localhost.\n const chunkName = clientReferenceUrl.pathname + clientReferenceUrl.search;\n\n return {\n id: String(createModuleId(filePath, { platform: context.platform, environment })),\n chunks: [chunkName],\n };\n };\n }\n\n const rscRendererCache = new Map<string, typeof import('expo-router/build/rsc/rsc-renderer')>();\n\n let ensurePromise: Promise<any> | null = null;\n async function ensureSSRReady() {\n // TODO: Extract CSS Modules / Assets from the bundler process\n const runtime = await ssrLoadModule<typeof import('expo-router/build/rsc/rsc-renderer')>(\n 'metro-runtime/src/modules/empty-module.js',\n {\n environment: 'react-server',\n platform: 'web',\n }\n );\n return runtime;\n }\n const ensureMemo = () => {\n ensurePromise ??= ensureSSRReady();\n return ensurePromise;\n };\n\n async function getRscRendererAsync(platform: string) {\n await ensureMemo();\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRendererCache.has(platform)) {\n return rscRendererCache.get(platform)!;\n }\n\n // TODO: Extract CSS Modules / Assets from the bundler process\n const renderer = await ssrLoadModule<typeof import('expo-router/build/rsc/rsc-renderer')>(\n 'expo-router/build/rsc/rsc-renderer',\n {\n environment: 'react-server',\n platform,\n }\n );\n\n rscRendererCache.set(platform, renderer);\n return renderer;\n }\n\n const rscRenderContext = new Map<string, any>();\n\n function getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n }\n\n async function renderRscToReadableStream(\n {\n input,\n headers,\n method,\n platform,\n body,\n engine,\n contentType,\n ssrManifest,\n decodedBody,\n }: {\n input: string;\n headers: Headers;\n method: 'POST' | 'GET';\n platform: string;\n body?: ReadableStream<Uint8Array>;\n engine?: 'hermes' | null;\n contentType?: string;\n ssrManifest?: Map<string, string>;\n decodedBody?: unknown;\n },\n isExporting: boolean | undefined = instanceMetroOptions.isExporting\n ) {\n assert(\n isExporting != null,\n 'The server must be started before calling renderRscToReadableStream.'\n );\n\n if (method === 'POST') {\n assert(body, 'Server request must be provided when method is POST (server actions)');\n }\n\n const context = getRscRenderContext(platform);\n\n context['__expo_requestHeaders'] = headers;\n\n const { renderRsc } = await getRscRendererAsync(platform);\n\n return renderRsc(\n {\n body,\n decodedBody,\n context,\n config: {},\n input,\n contentType,\n },\n {\n isExporting,\n entries: await getExpoRouterRscEntriesGetterAsync({ platform }),\n resolveClientEntry: getResolveClientEntry({ platform, engine, ssrManifest }),\n async loadServerModuleRsc(urlFragment) {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n debug('[SSR] loadServerModuleRsc:', urlFragment);\n\n const options = getMetroOptionsFromUrl(urlFragment);\n\n return ssrLoadModule(path.join(serverRoot, options.mainModuleName), options, {\n hot: true,\n });\n },\n }\n );\n }\n\n return {\n // Get the static client boundaries (no dead code elimination allowed) for the production export.\n getExpoRouterClientReferencesAsync,\n exportServerActionsAsync,\n\n async exportRoutesAsync(\n {\n platform,\n ssrManifest,\n }: {\n platform: string;\n ssrManifest: Map<string, string>;\n },\n files: ExportAssetMap\n ) {\n // TODO: When we add web SSR support, we need to extract CSS Modules / Assets from the bundler process to prevent FLOUC.\n const { getBuildConfig } = (await getExpoRouterRscEntriesGetterAsync({ platform })).default;\n\n // Get all the routes to render.\n const buildConfig = await getBuildConfig!(async () =>\n // TODO: Rework prefetching code to use Metro runtime.\n []\n );\n\n await Promise.all(\n Array.from(buildConfig).map(async ({ entries }) => {\n for (const { input, isStatic } of entries || []) {\n if (!isStatic) {\n debug('Skipping static export for route', { input });\n continue;\n }\n const destRscFile = path.join('_flight', platform, encodeInput(input));\n\n const pipe = await renderRscToReadableStream(\n {\n input,\n method: 'GET',\n platform,\n headers: new Headers(),\n ssrManifest,\n },\n true\n );\n\n const rsc = await streamToStringAsync(pipe);\n debug('RSC Payload', { platform, input, rsc });\n\n files.set(destRscFile, {\n contents: rsc,\n targetDomain: 'client',\n rscId: input,\n });\n }\n })\n );\n },\n\n middleware: createBuiltinAPIRequestHandler(\n // Match `/_flight/[platform]/[...path]`\n (req) => {\n return getFullUrl(req.url).pathname.startsWith(rscPathPrefix);\n },\n rscMiddleware\n ),\n onReloadRscEvent: (platform: string) => {\n // NOTE: We cannot clear the renderer context because it would break the mounted context state.\n\n rscRendererCache.delete(platform);\n routerCache.delete(platform);\n },\n };\n}\n\nconst getFullUrl = (url: string) => {\n try {\n return new URL(url);\n } catch {\n return new URL(url, 'http://localhost:0');\n }\n};\n\nexport const fileURLToFilePath = (fileURL: string) => {\n return url.fileURLToPath(fileURL);\n};\n\nconst encodeInput = (input: string) => {\n if (input === '') {\n return 'index.txt';\n }\n if (input === 'index') {\n throw new Error('Input should not be `index`');\n }\n if (input.startsWith('/')) {\n throw new Error('Input should not start with `/`');\n }\n if (input.endsWith('/')) {\n throw new Error('Input should not end with `/`');\n }\n return input + '.txt';\n};\n\nfunction wrapBundle(str: string) {\n // Skip the metro runtime so debugging is a bit easier.\n // Replace the __r() call with an export statement.\n // Use gm to apply to the last require line. This is needed when the bundle has side-effects.\n return str.replace(/^(__r\\(.*\\);)$/gm, 'module.exports = $1');\n}\n"],"names":["createServerComponentsMiddleware","fileURLToFilePath","debug","require","getMetroServerRootMemo","memoize","getMetroServerRoot","projectRoot","rscPath","instanceMetroOptions","ssrLoadModule","ssrLoadModuleArtifacts","useClientRouter","createModuleId","routerModule","rscMiddleware","getRscMiddleware","config","baseUrl","onError","console","error","renderRsc","args","headers","getIpAddress","renderRscToReadableStream","Headers","body","logMetroError","IS_METRO_BUNDLE_ERROR_SYMBOL","Response","JSON","stringify","status","isPossiblyUnableToResolveError","sanitizedServerMessage","stripAnsi","message","rscPathPrefix","exportServerActionsAsync","platform","entryPoints","domRoot","files","uniqueEntryPoints","Set","manifest","nestedClientBoundaries","nestedServerBoundaries","processedEntryPoints","processEntryPoint","entryPoint","contents","add","environment","modulesOnly","runModule","reactClientReferences","artifacts","filter","a","type","metadata","map","ref","push","reactServerReferences","src","includes","Error","relativeName","safeName","path","basename","find","filename","outputName","set","targetDomain","wrapBundle","String","processEntryPoints","recursions","uniqueNestedServerBoundaries","value","has","length","clientBoundaries","getExpoRouterClientReferencesAsync","cssModules","startsWith","routerCache","Map","getExpoRouterRscEntriesGetterAsync","ensureMemo","get","router","hot","getResolveClientEntry","context","serverRoot","mode","minify","isExporting","routerRoot","asyncRoutes","preserveEnvVars","reactCompiler","lazy","assert","file","isServer","ssrManifest","relativeFilePath","toPosixPath","relative","chunk","id","chunks","searchParams","createBundleUrlSearchParams","mainModuleName","engine","undefined","bytecode","inlineSourceMap","clientReferenceUrl","URL","search","toString","filePath","pathname","endsWith","chunkName","rscRendererCache","ensurePromise","ensureSSRReady","runtime","getRscRendererAsync","renderer","rscRenderContext","getRscRenderContext","input","method","contentType","decodedBody","entries","resolveClientEntry","loadServerModuleRsc","urlFragment","options","getMetroOptionsFromUrl","join","exportRoutesAsync","getBuildConfig","default","buildConfig","Promise","all","Array","from","isStatic","destRscFile","encodeInput","pipe","rsc","streamToStringAsync","rscId","middleware","createBuiltinAPIRequestHandler","req","getFullUrl","url","onReloadRscEvent","delete","fileURL","fileURLToPath","str","replace"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAqCgBA,gCAAgC,MAAhCA,gCAAgC;IAokBnCC,iBAAiB,MAAjBA,iBAAiB;;;yBAzmBK,oBAAoB;;;;;;;yBAEtB,mCAAmC;;;;;;;8DACjD,QAAQ;;;;;;;8DACV,MAAM;;;;;;;8DACP,KAAK;;;;;;qCAEuC,uBAAuB;qCACpC,2CAA2C;sBAEhE,qBAAqB;0BACnB,yBAAyB;oBAC7B,mBAAmB;oBACd,mBAAmB;wBACZ,uBAAuB;gDACZ,8CAA8C;8BAKtF,4BAA4B;;;;;;AAEnC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,AAAsB,AAAC;AAajE,MAAMC,sBAAsB,GAAGC,IAAAA,GAAO,QAAA,EAACC,MAAkB,EAAA,mBAAA,CAAC,AAAC;AAEpD,SAASN,gCAAgC,CAC9CO,WAAmB,EACnB,EACEC,OAAO,CAAA,EACPC,oBAAoB,CAAA,EACpBC,aAAa,CAAA,EACbC,sBAAsB,CAAA,EACtBC,eAAe,CAAA,EACfC,cAAc,CAAA,EAWf,EACD;IACA,MAAMC,YAAY,GAAGF,eA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CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,IAAIyE,KAAK,CAACpD,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,MAAM,IAAIrB,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAIyE,KAAK,CAACV,QAAQ,CAAC,GAAG,CAAC,EAAE;QACvB,MAAM,IAAI/D,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAOyE,KAAK,GAAG,MAAM,CAAC;AACxB,CAAC,AAAC;AAEF,SAAS/D,UAAU,CAACkG,GAAW,EAAE;IAC/B,uDAAuD;IACvD,mDAAmD;IACnD,6FAA6F;IAC7F,OAAOA,GAAG,CAACC,OAAO,qBAAqB,qBAAqB,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -15,6 +15,7 @@ function _export(target, all) {
|
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
17
|
logMetroErrorWithStack: ()=>logMetroErrorWithStack,
|
|
18
|
+
IS_METRO_BUNDLE_ERROR_SYMBOL: ()=>IS_METRO_BUNDLE_ERROR_SYMBOL,
|
|
18
19
|
logMetroError: ()=>logMetroError,
|
|
19
20
|
logMetroErrorAsync: ()=>logMetroErrorAsync,
|
|
20
21
|
getErrorOverlayHtmlAsync: ()=>getErrorOverlayHtmlAsync
|
|
@@ -175,11 +176,14 @@ async function logMetroErrorWithStack(projectRoot, { stack , codeFrame , error
|
|
|
175
176
|
_log.Log.log(_chalk().default.gray(` ${error.stack}`));
|
|
176
177
|
}
|
|
177
178
|
}
|
|
179
|
+
const IS_METRO_BUNDLE_ERROR_SYMBOL = Symbol("_isMetroBundleError");
|
|
180
|
+
const HAS_LOGGED_SYMBOL = Symbol("_hasLoggedInCLI");
|
|
178
181
|
async function logMetroError(projectRoot, { error }) {
|
|
179
182
|
var ref, ref1;
|
|
180
|
-
if (error instanceof _errors.SilentError) {
|
|
183
|
+
if (error instanceof _errors.SilentError || error[HAS_LOGGED_SYMBOL]) {
|
|
181
184
|
return;
|
|
182
185
|
}
|
|
186
|
+
error[HAS_LOGGED_SYMBOL] = true;
|
|
183
187
|
const stack = parseErrorStack(projectRoot, error.stack);
|
|
184
188
|
const log = new _logBoxLog.LogBoxLog({
|
|
185
189
|
level: "static",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { parse, StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { LogBoxLog } from './log-box/LogBoxLog';\nimport type { CodeFrame, StackFrame as MetroStackFrame } from './log-box/LogBoxSymbolication';\nimport { getStackFormattedLocation } from './log-box/formatProjectFilePath';\nimport { Log } from '../../../log';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { CommandError, SilentError } from '../../../utils/errors';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n\nfunction fill(width: number): string {\n return Array(width).join(' ');\n}\n\nfunction formatPaths(config: { filePath: string | null; line?: number; col?: number }) {\n const filePath = chalk.reset(config.filePath);\n return (\n chalk.dim('(') +\n filePath +\n chalk.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`)\n );\n}\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame?: CodeFrame;\n error: Error;\n }\n) {\n if (error instanceof SilentError) {\n return;\n }\n\n // process.stdout.write('\\u001b[0m'); // Reset attributes\n // process.stdout.write('\\u001bc'); // Reset the terminal\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (error instanceof CommandError) {\n return;\n }\n\n if (codeFrame) {\n const maxWarningLineLength = Math.max(200, process.stdout.columns);\n\n const lineText = codeFrame.content;\n const isPreviewTooLong = codeFrame.content\n .split('\\n')\n .some((line) => line.length > maxWarningLineLength);\n const column = codeFrame.location?.column;\n // When the preview is too long, we skip reading the file and attempting to apply\n // code coloring, this is because it can get very slow.\n if (isPreviewTooLong) {\n let previewLine = '';\n let cursorLine = '';\n\n const formattedPath = formatPaths({\n filePath: codeFrame.fileName,\n line: codeFrame.location?.row,\n col: codeFrame.location?.column,\n });\n // Create a curtailed preview line like:\n // `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`\n // If there is no text preview or column number, we can't do anything.\n if (lineText && column != null) {\n const rangeWindow = Math.round(\n Math.max(codeFrame.fileName?.length ?? 0, Math.max(80, process.stdout.columns)) / 2\n );\n let minBounds = Math.max(0, column - rangeWindow);\n const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);\n previewLine = lineText.slice(minBounds, maxBounds);\n\n // If we splice content off the start, then we should append `...`.\n // This is unlikely to happen since we limit the activation size.\n if (minBounds > 0) {\n // Adjust the min bounds so the cursor is aligned after we add the \"...\"\n minBounds -= 3;\n previewLine = chalk.dim('...') + previewLine;\n }\n if (maxBounds < lineText.length) {\n previewLine += chalk.dim('...');\n }\n\n // If the column property could be found, then use that to fix the cursor location which is often broken in regex.\n cursorLine = (column == null ? '' : fill(column) + chalk.reset('^')).slice(minBounds);\n\n Log.log(\n [formattedPath, '', previewLine, cursorLine, chalk.dim('(error truncated)')].join('\\n')\n );\n }\n } else {\n Log.log(codeFrame.content);\n }\n }\n\n if (stack?.length) {\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse,\n };\n });\n\n const stackLines: string[] = [];\n\n stackProps.forEach((frame) => {\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n // Never show the internal module system.\n if (!frame.subtitle.match(/\\/metro-require\\/require\\.js/)) {\n stackLines.push(lineItem);\n }\n });\n\n Log.log();\n Log.log(chalk.bold`Call Stack`);\n if (!stackLines.length) {\n Log.log(chalk.gray(' No stack trace available.'));\n } else {\n Log.log(stackLines.join('\\n'));\n }\n } else {\n Log.log(chalk.gray(` ${error.stack}`));\n }\n}\n\nexport async function logMetroError(projectRoot: string, { error }: { error: Error }) {\n if (error instanceof SilentError) {\n return;\n }\n\n const stack = parseErrorStack(projectRoot, error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\nfunction isTransformError(\n error: any\n): error is { type: 'TransformError'; filename: string; lineNumber: number; column: number } {\n return error.type === 'TransformError';\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nfunction logFromError({ error, projectRoot }: { error: Error; projectRoot: string }) {\n // Remap direct Metro Node.js errors to a format that will appear more client-friendly in the logbox UI.\n let stack: MetroStackFrame[] | undefined;\n if (isTransformError(error) && error.filename) {\n // Syntax errors in static rendering.\n stack = [\n {\n file: path.join(projectRoot, error.filename),\n methodName: '<unknown>',\n arguments: [],\n // TODO: Import stack\n lineNumber: error.lineNumber,\n column: error.column,\n },\n ];\n } else if ('originModulePath' in error && typeof error.originModulePath === 'string') {\n // TODO: Use import stack here when the error is resolution based.\n stack = [\n {\n file: error.originModulePath,\n methodName: '<unknown>',\n arguments: [],\n // TODO: Import stack\n lineNumber: 0,\n column: 0,\n },\n ];\n } else {\n stack = parseErrorStack(projectRoot, error.stack);\n }\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot,\n}: {\n error: Error;\n projectRoot: string;\n routerRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n if ('message' in log && 'content' in log.message && typeof log.message.content === 'string') {\n log.message.content = stripAnsi(log.message.content)!;\n }\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n mode: 'development',\n platform: 'web',\n minify: false,\n optimize: false,\n usedExports: false,\n baseUrl: '',\n routerRoot,\n isExporting: false,\n reactCompiler: false,\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n\nfunction parseErrorStack(\n projectRoot: string,\n stack?: string\n): (StackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n\n return parse(stack)\n .map((frame) => {\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n\n if (frame.file) {\n // SSR will sometimes have absolute paths followed by `.bundle?...`, we need to try and make them relative paths and append a dev server URL.\n if (frame.file.startsWith('/') && frame.file.includes('bundle?') && !canParse(frame.file)) {\n // Malformed stack file from SSR. Attempt to repair.\n frame.file = 'https://localhost:8081/' + path.relative(serverRoot, frame.file);\n }\n }\n\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n })\n .filter((frame) => frame.file && !frame.file.includes('node_modules'));\n}\n\nfunction canParse(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["logMetroErrorWithStack","logMetroError","logMetroErrorAsync","getErrorOverlayHtmlAsync","fill","width","Array","join","formatPaths","config","filePath","chalk","reset","dim","line","col","filter","Boolean","projectRoot","stack","codeFrame","error","SilentError","Log","log","red","message","CommandError","maxWarningLineLength","Math","max","process","stdout","columns","lineText","content","isPreviewTooLong","split","some","length","column","location","previewLine","cursorLine","formattedPath","fileName","row","rangeWindow","round","minBounds","maxBounds","min","slice","stackProps","map","frame","title","methodName","subtitle","getStackFormattedLocation","collapse","stackLines","forEach","position","terminalLink","isSupported","lineItem","gray","match","push","bold","parseErrorStack","LogBoxLog","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","isTransformError","type","logFromError","filename","file","path","arguments","lineNumber","originModulePath","routerRoot","stripAnsi","logBoxContext","selectedLogIndex","isDisabled","logs","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","resolveFrom","mode","platform","minify","optimize","usedExports","baseUrl","isExporting","reactCompiler","htmlWithJs","replace","isArray","serverRoot","getMetroServerRoot","parse","startsWith","includes","canParse","relative","url","URL"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IA4BsBA,sBAAsB,MAAtBA,sBAAsB;IAqHtBC,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AAC,CAAC;YACjF,CAAC;QACH,CAAC;QAED,OAAO;YACL,GAAG/B,KAAK;YACRf,MAAM,EAAEe,KAAK,CAACf,MAAM,IAAI,IAAI,GAAGe,KAAK,CAACf,MAAM,GAAG,CAAC,GAAG,IAAI;SACvD,CAAC;IACJ,CAAC,CAAC,CACDxB,MAAM,CAAC,CAACuC,KAAK,GAAKA,KAAK,CAAC+B,IAAI,IAAI,CAAC/B,KAAK,CAAC+B,IAAI,CAACgC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED,SAASC,QAAQ,CAACE,GAAW,EAAW;IACtC,IAAI;QACF,kCAAkC;QAClC,IAAIC,GAAG,CAACD,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,CAAC;IACd,EAAE,OAAM;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/metroErrorInterface.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport chalk from 'chalk';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { parse, StackFrame } from 'stacktrace-parser';\nimport terminalLink from 'terminal-link';\n\nimport { LogBoxLog } from './log-box/LogBoxLog';\nimport type { CodeFrame, StackFrame as MetroStackFrame } from './log-box/LogBoxSymbolication';\nimport { getStackFormattedLocation } from './log-box/formatProjectFilePath';\nimport { Log } from '../../../log';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { CommandError, SilentError } from '../../../utils/errors';\nimport { createMetroEndpointAsync } from '../getStaticRenderFunctions';\n\nfunction fill(width: number): string {\n return Array(width).join(' ');\n}\n\nfunction formatPaths(config: { filePath: string | null; line?: number; col?: number }) {\n const filePath = chalk.reset(config.filePath);\n return (\n chalk.dim('(') +\n filePath +\n chalk.dim(`:${[config.line, config.col].filter(Boolean).join(':')})`)\n );\n}\n\nexport async function logMetroErrorWithStack(\n projectRoot: string,\n {\n stack,\n codeFrame,\n error,\n }: {\n stack: MetroStackFrame[];\n codeFrame?: CodeFrame;\n error: Error;\n }\n) {\n if (error instanceof SilentError) {\n return;\n }\n\n // process.stdout.write('\\u001b[0m'); // Reset attributes\n // process.stdout.write('\\u001bc'); // Reset the terminal\n\n Log.log();\n Log.log(chalk.red('Metro error: ') + error.message);\n Log.log();\n\n if (error instanceof CommandError) {\n return;\n }\n\n if (codeFrame) {\n const maxWarningLineLength = Math.max(200, process.stdout.columns);\n\n const lineText = codeFrame.content;\n const isPreviewTooLong = codeFrame.content\n .split('\\n')\n .some((line) => line.length > maxWarningLineLength);\n const column = codeFrame.location?.column;\n // When the preview is too long, we skip reading the file and attempting to apply\n // code coloring, this is because it can get very slow.\n if (isPreviewTooLong) {\n let previewLine = '';\n let cursorLine = '';\n\n const formattedPath = formatPaths({\n filePath: codeFrame.fileName,\n line: codeFrame.location?.row,\n col: codeFrame.location?.column,\n });\n // Create a curtailed preview line like:\n // `...transition:'fade'},k._updatePropsStack=function(){clearImmediate(k._updateImmediate),k._updateImmediate...`\n // If there is no text preview or column number, we can't do anything.\n if (lineText && column != null) {\n const rangeWindow = Math.round(\n Math.max(codeFrame.fileName?.length ?? 0, Math.max(80, process.stdout.columns)) / 2\n );\n let minBounds = Math.max(0, column - rangeWindow);\n const maxBounds = Math.min(minBounds + rangeWindow * 2, lineText.length);\n previewLine = lineText.slice(minBounds, maxBounds);\n\n // If we splice content off the start, then we should append `...`.\n // This is unlikely to happen since we limit the activation size.\n if (minBounds > 0) {\n // Adjust the min bounds so the cursor is aligned after we add the \"...\"\n minBounds -= 3;\n previewLine = chalk.dim('...') + previewLine;\n }\n if (maxBounds < lineText.length) {\n previewLine += chalk.dim('...');\n }\n\n // If the column property could be found, then use that to fix the cursor location which is often broken in regex.\n cursorLine = (column == null ? '' : fill(column) + chalk.reset('^')).slice(minBounds);\n\n Log.log(\n [formattedPath, '', previewLine, cursorLine, chalk.dim('(error truncated)')].join('\\n')\n );\n }\n } else {\n Log.log(codeFrame.content);\n }\n }\n\n if (stack?.length) {\n const stackProps = stack.map((frame) => {\n return {\n title: frame.methodName,\n subtitle: getStackFormattedLocation(projectRoot, frame),\n collapse: frame.collapse,\n };\n });\n\n const stackLines: string[] = [];\n\n stackProps.forEach((frame) => {\n const position = terminalLink.isSupported\n ? terminalLink(frame.subtitle, frame.subtitle)\n : frame.subtitle;\n let lineItem = chalk.gray(` ${frame.title} (${position})`);\n if (frame.collapse) {\n lineItem = chalk.dim(lineItem);\n }\n // Never show the internal module system.\n if (!frame.subtitle.match(/\\/metro-require\\/require\\.js/)) {\n stackLines.push(lineItem);\n }\n });\n\n Log.log();\n Log.log(chalk.bold`Call Stack`);\n if (!stackLines.length) {\n Log.log(chalk.gray(' No stack trace available.'));\n } else {\n Log.log(stackLines.join('\\n'));\n }\n } else {\n Log.log(chalk.gray(` ${error.stack}`));\n }\n}\n\nexport const IS_METRO_BUNDLE_ERROR_SYMBOL = Symbol('_isMetroBundleError');\nconst HAS_LOGGED_SYMBOL = Symbol('_hasLoggedInCLI');\n\nexport async function logMetroError(\n projectRoot: string,\n {\n error,\n }: {\n error: Error & {\n [HAS_LOGGED_SYMBOL]?: boolean;\n };\n }\n) {\n if (error instanceof SilentError || error[HAS_LOGGED_SYMBOL]) {\n return;\n }\n error[HAS_LOGGED_SYMBOL] = true;\n\n const stack = parseErrorStack(projectRoot, error.stack);\n\n const log = new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\nfunction isTransformError(\n error: any\n): error is { type: 'TransformError'; filename: string; lineNumber: number; column: number } {\n return error.type === 'TransformError';\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nfunction logFromError({ error, projectRoot }: { error: Error; projectRoot: string }) {\n // Remap direct Metro Node.js errors to a format that will appear more client-friendly in the logbox UI.\n let stack: MetroStackFrame[] | undefined;\n if (isTransformError(error) && error.filename) {\n // Syntax errors in static rendering.\n stack = [\n {\n file: path.join(projectRoot, error.filename),\n methodName: '<unknown>',\n arguments: [],\n // TODO: Import stack\n lineNumber: error.lineNumber,\n column: error.column,\n },\n ];\n } else if ('originModulePath' in error && typeof error.originModulePath === 'string') {\n // TODO: Use import stack here when the error is resolution based.\n stack = [\n {\n file: error.originModulePath,\n methodName: '<unknown>',\n arguments: [],\n // TODO: Import stack\n lineNumber: 0,\n column: 0,\n },\n ];\n } else {\n stack = parseErrorStack(projectRoot, error.stack);\n }\n\n return new LogBoxLog({\n level: 'static',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack,\n category: 'static',\n componentStack: [],\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function logMetroErrorAsync({\n error,\n projectRoot,\n}: {\n error: Error;\n projectRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n}\n\n/** @returns the html required to render the static metro error as an SPA. */\nexport async function getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot,\n}: {\n error: Error;\n projectRoot: string;\n routerRoot: string;\n}) {\n const log = logFromError({ projectRoot, error });\n\n await new Promise<void>((res) => log.symbolicate('stack', () => res()));\n\n logMetroErrorWithStack(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n error,\n });\n\n if ('message' in log && 'content' in log.message && typeof log.message.content === 'string') {\n log.message.content = stripAnsi(log.message.content)!;\n }\n\n const logBoxContext = {\n selectedLogIndex: 0,\n isDisabled: false,\n logs: [log],\n };\n const html = `<html><head><style>#root,body,html{height:100%}body{overflow:hidden}#root{display:flex}</style></head><body><div id=\"root\"></div><script id=\"_expo-static-error\" type=\"application/json\">${JSON.stringify(\n logBoxContext\n )}</script></body></html>`;\n\n const errorOverlayEntry = await createMetroEndpointAsync(\n projectRoot,\n // Keep the URL relative\n '',\n resolveFrom(projectRoot, 'expo-router/_error'),\n {\n mode: 'development',\n platform: 'web',\n minify: false,\n optimize: false,\n usedExports: false,\n baseUrl: '',\n routerRoot,\n isExporting: false,\n reactCompiler: false,\n }\n );\n\n const htmlWithJs = html.replace('</body>', `<script src=${errorOverlayEntry}></script></body>`);\n return htmlWithJs;\n}\n\nfunction parseErrorStack(\n projectRoot: string,\n stack?: string\n): (StackFrame & { collapse?: boolean })[] {\n if (stack == null) {\n return [];\n }\n if (Array.isArray(stack)) {\n return stack;\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n\n return parse(stack)\n .map((frame) => {\n // frame.file will mostly look like `http://localhost:8081/index.bundle?platform=web&dev=true&hot=false`\n\n if (frame.file) {\n // SSR will sometimes have absolute paths followed by `.bundle?...`, we need to try and make them relative paths and append a dev server URL.\n if (frame.file.startsWith('/') && frame.file.includes('bundle?') && !canParse(frame.file)) {\n // Malformed stack file from SSR. Attempt to repair.\n frame.file = 'https://localhost:8081/' + path.relative(serverRoot, frame.file);\n }\n }\n\n return {\n ...frame,\n column: frame.column != null ? frame.column - 1 : null,\n };\n })\n .filter((frame) => frame.file && !frame.file.includes('node_modules'));\n}\n\nfunction canParse(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n"],"names":["logMetroErrorWithStack","IS_METRO_BUNDLE_ERROR_SYMBOL","logMetroError","logMetroErrorAsync","getErrorOverlayHtmlAsync","fill","width","Array","join","formatPaths","config","filePath","chalk","reset","dim","line","col","filter","Boolean","projectRoot","stack","codeFrame","error","SilentError","Log","log","red","message","CommandError","maxWarningLineLength","Math","max","process","stdout","columns","lineText","content","isPreviewTooLong","split","some","length","column","location","previewLine","cursorLine","formattedPath","fileName","row","rangeWindow","round","minBounds","maxBounds","min","slice","stackProps","map","frame","title","methodName","subtitle","getStackFormattedLocation","collapse","stackLines","forEach","position","terminalLink","isSupported","lineItem","gray","match","push","bold","Symbol","HAS_LOGGED_SYMBOL","parseErrorStack","LogBoxLog","level","substitutions","isComponentError","category","componentStack","Promise","res","symbolicate","symbolicated","isTransformError","type","logFromError","filename","file","path","arguments","lineNumber","originModulePath","routerRoot","stripAnsi","logBoxContext","selectedLogIndex","isDisabled","logs","html","JSON","stringify","errorOverlayEntry","createMetroEndpointAsync","resolveFrom","mode","platform","minify","optimize","usedExports","baseUrl","isExporting","reactCompiler","htmlWithJs","replace","isArray","serverRoot","getMetroServerRoot","parse","startsWith","includes","canParse","relative","url","URL"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IA4BsBA,sBAAsB,MAAtBA,sBAAsB;IAqH/BC,4BAA4B,MAA5BA,4BAA4B;IAGnBC,aAAa,MAAbA,aAAa;IA0FbC,kBAAkB,MAAlBA,kBAAkB;IAmBlBC,wBAAwB,MAAxBA,wBAAwB;;;yBAjQX,oBAAoB;;;;;;;8DACrC,OAAO;;;;;;;8DACR,MAAM;;;;;;;8DACC,cAAc;;;;;;;yBACJ,mBAAmB;;;;;;;8DAC5B,eAAe;;;;;;2BAEd,qBAAqB;uCAEL,iCAAiC;qBACvD,cAAc;sBACR,qBAAqB;wBACL,uBAAuB;0CACxB,6BAA6B;;;;;;AAEtE,SAASC,IAAI,CAACC,KAAa,EAAU;IACnC,OAAOC,KAAK,CAACD,KAAK,CAAC,CAACE,IAAI,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,SAASC,WAAW,CAACC,MAAgE,EAAE;IACrF,MAAMC,QAAQ,GAAGC,MAAK,EAAA,QAAA,CAACC,KAAK,CAACH,MAAM,CAACC,QAAQ,CAAC,AAAC;IAC9C,OACEC,MAAK,EAAA,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AAW;IACtC,IAAI;QACF,kCAAkC;QAClC,IAAIC,GAAG,CAACD,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,CAAC;IACd,EAAE,OAAM;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -611,9 +611,10 @@ function withExtendedResolver(config, { tsconfig , isTsconfigPathsEnabled , isFa
|
|
|
611
611
|
if (((ref2 = context.customResolverOptions) == null ? void 0 : ref2.environment) === "react-server") {
|
|
612
612
|
context.unstable_conditionNames = [
|
|
613
613
|
"node",
|
|
614
|
+
"import",
|
|
614
615
|
"require",
|
|
615
616
|
"react-server",
|
|
616
|
-
"workerd"
|
|
617
|
+
"workerd",
|
|
617
618
|
];
|
|
618
619
|
} else {
|
|
619
620
|
context.unstable_conditionNames = [
|