@expo/cli 0.17.2 → 0.17.4
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 +2 -2
- package/build/src/export/exportApp.js +4 -0
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/favicon.js +27 -17
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +9 -0
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +2 -1
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/resolveOptions.js +6 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +12 -8
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +1 -1
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +19 -0
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.types.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -6
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js +3 -1
- package/build/src/start/server/middleware/FaviconMiddleware.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/package.json +2 -2
package/build/bin/cli
CHANGED
|
@@ -137,7 +137,7 @@ const args = (0, _arg).default({
|
|
|
137
137
|
});
|
|
138
138
|
if (args["--version"]) {
|
|
139
139
|
// Version is added in the build script.
|
|
140
|
-
console.log("0.17.
|
|
140
|
+
console.log("0.17.4");
|
|
141
141
|
process.exit(0);
|
|
142
142
|
}
|
|
143
143
|
if (args["--non-interactive"]) {
|
|
@@ -272,7 +272,7 @@ commands[command]().then((exec)=>{
|
|
|
272
272
|
logEventAsync("action", {
|
|
273
273
|
action: `expo ${command}`,
|
|
274
274
|
source: "expo/cli",
|
|
275
|
-
source_version: "0.17.
|
|
275
|
+
source_version: "0.17.4"
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
});
|
|
@@ -16,6 +16,7 @@ var _publicFolder = require("./publicFolder");
|
|
|
16
16
|
var _saveAssets = require("./saveAssets");
|
|
17
17
|
var _writeContents = require("./writeContents");
|
|
18
18
|
var Log = _interopRequireWildcard(require("../log"));
|
|
19
|
+
var _webSupportProjectPrerequisite = require("../start/doctor/web/WebSupportProjectPrerequisite");
|
|
19
20
|
var _router = require("../start/server/metro/router");
|
|
20
21
|
var _serializeHtml = require("../start/server/metro/serializeHtml");
|
|
21
22
|
var _metroOptions = require("../start/server/middleware/metroOptions");
|
|
@@ -57,6 +58,9 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
57
58
|
// Web doesn't require validation.
|
|
58
59
|
skipValidation: platforms.length === 1 && platforms[0] === "web"
|
|
59
60
|
});
|
|
61
|
+
if (platforms.includes("web")) {
|
|
62
|
+
await new _webSupportProjectPrerequisite.WebSupportProjectPrerequisite(projectRoot).assertAsync();
|
|
63
|
+
}
|
|
60
64
|
var ref1;
|
|
61
65
|
const useServerRendering = [
|
|
62
66
|
"static",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport { unstable_exportStaticAsync } from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { createBundlesAsync } from './fork-bundleAsync';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport { ExportAssetMap, getFilesFromSerialAssets, persistMetroFilesAsync } from './saveAssets';\nimport { createAssetMap, createSourceMapDebugHtml } from './writeContents';\nimport * as Log from '../log';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n minify,\n maxWorkers,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'maxWorkers'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundles = await createBundlesAsync(projectRoot, projectConfig, {\n clear: !!clear,\n minify,\n sourcemaps: sourceMaps,\n platforms: useServerRendering ? platforms.filter((platform) => platform !== 'web') : platforms,\n dev,\n maxWorkers,\n });\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n Object.values(bundles).forEach((bundle) => {\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n });\n });\n\n const bundleEntries = Object.entries(bundles);\n // Can be empty during web-only SSG.\n if (bundleEntries.length) {\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts.filter((asset) => asset.type === 'js').map((asset) => asset.filename),\n ])\n );\n\n // build source maps\n if (sourceMaps) {\n Log.log('Preparing additional debugging files');\n // If we output source maps, then add a debug HTML file which the user can open in\n // the web browser to inspect the output like web.\n files.set('debug.html', {\n contents: createSourceMapDebugHtml({\n fileNames: Object.values(fileNames).flat(),\n }),\n });\n }\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web')) {\n if (useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n await unstable_exportStaticAsync(projectRoot, {\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n asyncRoutes: getAsyncRoutesFromExpoConfig(exp, dev ? 'development' : 'production', 'web'),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n exportServer,\n maxWorkers,\n });\n } else {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n mode: 'production',\n resources: bundles.web!.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: 'client',\n });\n }\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","Log","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","minify","maxWorkers","exp","setNodeEnv","require","load","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","useServerRendering","includes","web","output","baseUrl","getBaseUrlFromExpoConfig","log","chalk","gray","startsWith","yellow","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","copyPublicFolderAsync","bundles","createBundlesAsync","sourcemaps","filter","platform","files","Map","Object","values","forEach","bundle","getFilesFromSerialAssets","artifacts","includeSourceMaps","bundleEntries","entries","assets","embeddedHashSet","exportAssetsAsync","set","contents","JSON","stringify","createAssetMap","fileNames","fromEntries","map","asset","type","filename","createSourceMapDebugHtml","flat","createMetadataJson","exportServer","unstable_exportStaticAsync","asyncRoutes","getAsyncRoutesFromExpoConfig","routerRoot","getRouterDirectoryModuleIdWithManifest","html","serializeHtmlWithAssets","mode","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","targetDomain","persistMetroFilesAsync"],"mappings":"AAAA;;;;QAyBsB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ACXC,QAAQ,EAAE,EAAE;iBACb,CAAC;gBACF5D,OAAO;aACR,CAAC,AAAC;YAEH,sCAAsC;YACtC,MAAM6D,UAAU,GAAG,MAAMC,CAAAA,GAAAA,QAA4B,AAInD,CAAA,6BAJmD,CAACpF,WAAW,EAAE;gBACjEE,SAAS;gBACToB,OAAO;gBACPmB,KAAK;aACN,CAAC,AAAC;YACH,IAAI0C,UAAU,EAAE;gBACdR,IAAI,GAAGQ,UAAU,CAACR,IAAI,CAAC,CAAC;aACzB;YAED,iCAAiC;YACjC,oDAAoD;YACpDlC,KAAK,CAACc,GAAG,CAAC,YAAY,EAAE;gBACtBC,QAAQ,EAAEmB,IAAI;gBACdU,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;SACJ;KACF;IAED,kDAAkD;IAClD,MAAMC,CAAAA,GAAAA,WAAsB,AAAmB,CAAA,uBAAnB,CAAC7C,KAAK,EAAEP,UAAU,CAAC,CAAC;CACjD"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport { unstable_exportStaticAsync } from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { createBundlesAsync } from './fork-bundleAsync';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport { ExportAssetMap, getFilesFromSerialAssets, persistMetroFilesAsync } from './saveAssets';\nimport { createAssetMap, createSourceMapDebugHtml } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n minify,\n maxWorkers,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'maxWorkers'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundles = await createBundlesAsync(projectRoot, projectConfig, {\n clear: !!clear,\n minify,\n sourcemaps: sourceMaps,\n platforms: useServerRendering ? platforms.filter((platform) => platform !== 'web') : platforms,\n dev,\n maxWorkers,\n });\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n Object.values(bundles).forEach((bundle) => {\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n });\n });\n\n const bundleEntries = Object.entries(bundles);\n // Can be empty during web-only SSG.\n if (bundleEntries.length) {\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts.filter((asset) => asset.type === 'js').map((asset) => asset.filename),\n ])\n );\n\n // build source maps\n if (sourceMaps) {\n Log.log('Preparing additional debugging files');\n // If we output source maps, then add a debug HTML file which the user can open in\n // the web browser to inspect the output like web.\n files.set('debug.html', {\n contents: createSourceMapDebugHtml({\n fileNames: Object.values(fileNames).flat(),\n }),\n });\n }\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web')) {\n if (useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n await unstable_exportStaticAsync(projectRoot, {\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n asyncRoutes: getAsyncRoutesFromExpoConfig(exp, dev ? 'development' : 'production', 'web'),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n exportServer,\n maxWorkers,\n });\n } else {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n mode: 'production',\n resources: bundles.web!.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: 'client',\n });\n }\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","Log","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","minify","maxWorkers","exp","setNodeEnv","require","load","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","baseUrl","getBaseUrlFromExpoConfig","log","chalk","gray","startsWith","yellow","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","copyPublicFolderAsync","bundles","createBundlesAsync","sourcemaps","filter","platform","files","Map","Object","values","forEach","bundle","getFilesFromSerialAssets","artifacts","includeSourceMaps","bundleEntries","entries","assets","embeddedHashSet","exportAssetsAsync","set","contents","JSON","stringify","createAssetMap","fileNames","fromEntries","map","asset","type","filename","createSourceMapDebugHtml","flat","createMetadataJson","exportServer","unstable_exportStaticAsync","asyncRoutes","getAsyncRoutesFromExpoConfig","routerRoot","getRouterDirectoryModuleIdWithManifest","html","serializeHtmlWithAssets","mode","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","targetDomain","persistMetroFilesAsync"],"mappings":"AAAA;;;;QA0BsBA,cAAc,GAAdA,cAAc;AA1BV,IAAA,OAAc,WAAd,cAAc,CAAA;AACtB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACR,IAAA,KAAM,kCAAN,M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,AAGnD,CAAA,sCAHmD,CAAClF,WAAW,EAAE;oBACjEmF,OAAO,EAAE,EAAE;oBACXC,QAAQ,EAAE,EAAE;iBACb,CAAC;gBACF5D,OAAO;aACR,CAAC,AAAC;YAEH,sCAAsC;YACtC,MAAM6D,UAAU,GAAG,MAAMC,CAAAA,GAAAA,QAA4B,AAInD,CAAA,6BAJmD,CAACtF,WAAW,EAAE;gBACjEE,SAAS;gBACTsB,OAAO;gBACPmB,KAAK;aACN,CAAC,AAAC;YACH,IAAI0C,UAAU,EAAE;gBACdR,IAAI,GAAGQ,UAAU,CAACR,IAAI,CAAC,CAAC;aACzB;YAED,iCAAiC;YACjC,oDAAoD;YACpDlC,KAAK,CAACc,GAAG,CAAC,YAAY,EAAE;gBACtBC,QAAQ,EAAEmB,IAAI;gBACdU,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;SACJ;KACF;IAED,kDAAkD;IAClD,MAAMC,CAAAA,GAAAA,WAAsB,AAAmB,CAAA,uBAAnB,CAAC7C,KAAK,EAAEP,UAAU,CAAC,CAAC;CACjD"}
|
|
@@ -10,6 +10,7 @@ var _imageUtils = require("@expo/image-utils");
|
|
|
10
10
|
var _fs = _interopRequireDefault(require("fs"));
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
var _publicFolder = require("./publicFolder");
|
|
13
|
+
var _log = require("../log");
|
|
13
14
|
function _interopRequireDefault(obj) {
|
|
14
15
|
return obj && obj.__esModule ? obj : {
|
|
15
16
|
default: obj
|
|
@@ -54,7 +55,7 @@ async function getVirtualFaviconAssetsAsync(projectRoot, { baseUrl , outputDir ,
|
|
|
54
55
|
}
|
|
55
56
|
return injectFaviconTag;
|
|
56
57
|
}
|
|
57
|
-
async function getFaviconFromExpoConfigAsync(projectRoot) {
|
|
58
|
+
async function getFaviconFromExpoConfigAsync(projectRoot, { force =false } = {}) {
|
|
58
59
|
var ref;
|
|
59
60
|
const { exp } = (0, _config).getConfig(projectRoot);
|
|
60
61
|
var ref1;
|
|
@@ -69,22 +70,31 @@ async function getFaviconFromExpoConfigAsync(projectRoot) {
|
|
|
69
70
|
];
|
|
70
71
|
const cacheType = "favicon";
|
|
71
72
|
const size = dims[dims.length - 1];
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
try {
|
|
74
|
+
const { source } = await (0, _imageUtils).generateImageAsync({
|
|
75
|
+
projectRoot,
|
|
76
|
+
cacheType
|
|
77
|
+
}, {
|
|
78
|
+
resizeMode: "contain",
|
|
79
|
+
src,
|
|
80
|
+
backgroundColor: "transparent",
|
|
81
|
+
width: size,
|
|
82
|
+
height: size,
|
|
83
|
+
name: `favicon-${size}.png`
|
|
84
|
+
});
|
|
85
|
+
const faviconBuffer = await (0, _imageUtils).generateFaviconAsync(source, dims);
|
|
86
|
+
return {
|
|
87
|
+
source: faviconBuffer,
|
|
88
|
+
path: "favicon.ico"
|
|
89
|
+
};
|
|
90
|
+
} catch (error) {
|
|
91
|
+
// Check for ENOENT
|
|
92
|
+
if (!force && error.code === "ENOENT") {
|
|
93
|
+
_log.Log.warn(`Favicon source file in Expo config (web.favicon) does not exist: ${src}`);
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
//# sourceMappingURL=favicon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/favicon.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport { generateFaviconAsync, generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { getUserDefinedFile } from './publicFolder';\nimport { ExportAssetMap } from './saveAssets';\n\nconst debug = require('debug')('expo:favicon') as typeof console.log;\n\n/** @returns the file system path for a user-defined favicon.ico file in the public folder. */\nexport function getUserDefinedFaviconFile(projectRoot: string): string | null {\n return getUserDefinedFile(projectRoot, ['./favicon.ico']);\n}\n\nexport async function getVirtualFaviconAssetsAsync(\n projectRoot: string,\n { baseUrl, outputDir, files }: { outputDir: string; baseUrl: string; files?: ExportAssetMap }\n): Promise<((html: string) => string) | null> {\n const existing = getUserDefinedFaviconFile(projectRoot);\n if (existing) {\n debug('Using user-defined favicon.ico file.');\n return null;\n }\n\n const data = await getFaviconFromExpoConfigAsync(projectRoot);\n\n if (!data) {\n return null;\n }\n\n await Promise.all(\n [data].map(async (asset) => {\n const assetPath = path.join(outputDir, asset.path);\n if (files) {\n debug('Storing asset for persisting: ' + assetPath);\n files?.set(asset.path, {\n contents: asset.source,\n targetDomain: 'client',\n });\n } else {\n debug('Writing asset to disk: ' + assetPath);\n await fs.promises.writeFile(assetPath, asset.source);\n }\n })\n );\n\n function injectFaviconTag(html: string): string {\n if (!html.includes('</head>')) {\n return html;\n }\n return html.replace(\n '</head>',\n `<link rel=\"shortcut icon\" href=\"${baseUrl}/favicon.ico\" /></head>`\n );\n }\n\n return injectFaviconTag;\n}\n\nexport async function getFaviconFromExpoConfigAsync(projectRoot: string) {\n const { exp } = getConfig(projectRoot);\n\n const src = exp.web?.favicon ?? null;\n if (!src) {\n return null;\n }\n\n const dims = [16, 32, 48];\n const cacheType = 'favicon';\n\n const size = dims[dims.length - 1];\n const { source } = await generateImageAsync(\n
|
|
1
|
+
{"version":3,"sources":["../../../src/export/favicon.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport { generateFaviconAsync, generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { getUserDefinedFile } from './publicFolder';\nimport { ExportAssetMap } from './saveAssets';\nimport { Log } from '../log';\n\nconst debug = require('debug')('expo:favicon') as typeof console.log;\n\n/** @returns the file system path for a user-defined favicon.ico file in the public folder. */\nexport function getUserDefinedFaviconFile(projectRoot: string): string | null {\n return getUserDefinedFile(projectRoot, ['./favicon.ico']);\n}\n\nexport async function getVirtualFaviconAssetsAsync(\n projectRoot: string,\n { baseUrl, outputDir, files }: { outputDir: string; baseUrl: string; files?: ExportAssetMap }\n): Promise<((html: string) => string) | null> {\n const existing = getUserDefinedFaviconFile(projectRoot);\n if (existing) {\n debug('Using user-defined favicon.ico file.');\n return null;\n }\n\n const data = await getFaviconFromExpoConfigAsync(projectRoot);\n\n if (!data) {\n return null;\n }\n\n await Promise.all(\n [data].map(async (asset) => {\n const assetPath = path.join(outputDir, asset.path);\n if (files) {\n debug('Storing asset for persisting: ' + assetPath);\n files?.set(asset.path, {\n contents: asset.source,\n targetDomain: 'client',\n });\n } else {\n debug('Writing asset to disk: ' + assetPath);\n await fs.promises.writeFile(assetPath, asset.source);\n }\n })\n );\n\n function injectFaviconTag(html: string): string {\n if (!html.includes('</head>')) {\n return html;\n }\n return html.replace(\n '</head>',\n `<link rel=\"shortcut icon\" href=\"${baseUrl}/favicon.ico\" /></head>`\n );\n }\n\n return injectFaviconTag;\n}\n\nexport async function getFaviconFromExpoConfigAsync(\n projectRoot: string,\n { force = false }: { force?: boolean } = {}\n) {\n const { exp } = getConfig(projectRoot);\n\n const src = exp.web?.favicon ?? null;\n if (!src) {\n return null;\n }\n\n const dims = [16, 32, 48];\n const cacheType = 'favicon';\n\n const size = dims[dims.length - 1];\n try {\n const { source } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n resizeMode: 'contain',\n src,\n backgroundColor: 'transparent',\n width: size,\n height: size,\n name: `favicon-${size}.png`,\n }\n );\n\n const faviconBuffer = await generateFaviconAsync(source, dims);\n\n return { source: faviconBuffer, path: 'favicon.ico' };\n } catch (error: any) {\n // Check for ENOENT\n if (!force && error.code === 'ENOENT') {\n Log.warn(`Favicon source file in Expo config (web.favicon) does not exist: ${src}`);\n return null;\n }\n throw error;\n }\n}\n"],"names":["getUserDefinedFaviconFile","getVirtualFaviconAssetsAsync","getFaviconFromExpoConfigAsync","debug","require","projectRoot","getUserDefinedFile","baseUrl","outputDir","files","existing","data","Promise","all","map","asset","assetPath","path","join","set","contents","source","targetDomain","fs","promises","writeFile","injectFaviconTag","html","includes","replace","force","exp","getConfig","src","web","favicon","dims","cacheType","size","length","generateImageAsync","resizeMode","backgroundColor","width","height","name","faviconBuffer","generateFaviconAsync","error","code","Log","warn"],"mappings":"AAAA;;;;QAYgBA,yBAAyB,GAAzBA,yBAAyB;QAInBC,4BAA4B,GAA5BA,4BAA4B;QA6C5BC,6BAA6B,GAA7BA,6BAA6B;AA7DzB,IAAA,OAAc,WAAd,cAAc,CAAA;AACiB,IAAA,WAAmB,WAAnB,mBAAmB,CAAA;AAC7D,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEY,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AAE/B,IAAA,IAAQ,WAAR,QAAQ,CAAA;;;;;;AAE5B,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,AAAsB,AAAC;AAG9D,SAASJ,yBAAyB,CAACK,WAAmB,EAAiB;IAC5E,OAAOC,CAAAA,GAAAA,aAAkB,AAAgC,CAAA,mBAAhC,CAACD,WAAW,EAAE;QAAC,eAAe;KAAC,CAAC,CAAC;CAC3D;AAEM,eAAeJ,4BAA4B,CAChDI,WAAmB,EACnB,EAAEE,OAAO,CAAA,EAAEC,SAAS,CAAA,EAAEC,KAAK,CAAA,EAAkE,EACjD;IAC5C,MAAMC,QAAQ,GAAGV,yBAAyB,CAACK,WAAW,CAAC,AAAC;IACxD,IAAIK,QAAQ,EAAE;QACZP,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;KACb;IAED,MAAMQ,IAAI,GAAG,MAAMT,6BAA6B,CAACG,WAAW,CAAC,AAAC;IAE9D,IAAI,CAACM,IAAI,EAAE;QACT,OAAO,IAAI,C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./exportHermes");
|
|
|
15
15
|
var _instantiateMetro = require("../start/server/metro/instantiateMetro");
|
|
16
16
|
var _manifestMiddleware = require("../start/server/middleware/ManifestMiddleware");
|
|
17
17
|
var _metroOptions = require("../start/server/middleware/metroOptions");
|
|
18
|
+
var _errors = require("../utils/errors");
|
|
18
19
|
function _interopRequireDefault(obj) {
|
|
19
20
|
return obj && obj.__esModule ? obj : {
|
|
20
21
|
default: obj
|
|
@@ -56,6 +57,12 @@ async function createBundlesAsync(projectRoot, projectConfig, bundleOptions) {
|
|
|
56
57
|
})
|
|
57
58
|
, {});
|
|
58
59
|
}
|
|
60
|
+
function assertMetroConfig(config) {
|
|
61
|
+
var ref;
|
|
62
|
+
if (!((ref = config.serializer) == null ? void 0 : ref.customSerializer)) {
|
|
63
|
+
throw new _errors.CommandError("METRO_CONFIG_MALFORMED", `The Metro bundler configuration is missing required features from 'expo/metro-config' and cannot be used with Expo CLI. Ensure the metro.config.js file is extending 'expo/metro-config'. Learn more: https://docs.expo.dev/guides/customizing-metro`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
59
66
|
async function bundleProductionMetroClientAsync(projectRoot, expoConfig, metroOptions, bundles) {
|
|
60
67
|
// Assert early so the user doesn't have to wait until bundling is complete to find out that
|
|
61
68
|
// Hermes won't be available.
|
|
@@ -65,6 +72,7 @@ async function bundleProductionMetroClientAsync(projectRoot, expoConfig, metroOp
|
|
|
65
72
|
exp: expoConfig,
|
|
66
73
|
isExporting: true
|
|
67
74
|
});
|
|
75
|
+
assertMetroConfig(config);
|
|
68
76
|
const metroServer = await _metro.default.runMetro(config, {
|
|
69
77
|
watch: false
|
|
70
78
|
});
|
|
@@ -200,6 +208,7 @@ async function forkMetroBuildAsync(metro, options) {
|
|
|
200
208
|
// Custom options we pass to the serializer to emulate the URL query parameters.
|
|
201
209
|
serializerOptions: options.serializerOptions
|
|
202
210
|
};
|
|
211
|
+
assertMetroConfig(metro._config);
|
|
203
212
|
const bundle = await metro._config.serializer.customSerializer(entryPoint, // @ts-expect-error: Metro is typed incorrectly
|
|
204
213
|
prepend, graph, bundleOptions);
|
|
205
214
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform, ProjectConfig } from '@expo/config';\nimport { LoadOptions } from '@expo/metro-config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport Metro, { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { TransformInputOptions } from 'metro/src/DeltaBundler/types';\nimport IncrementalBundler from 'metro/src/IncrementalBundler';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport type {\n ResolverInputOptions,\n BundleOptions as MetroBundleOptions,\n} from 'metro/src/shared/types';\nimport { ConfigT } from 'metro-config';\nimport path from 'path';\n\nimport { isEnableHermesManaged, maybeThrowFromInconsistentEngineAsync } from './exportHermes';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport {\n ExpoMetroBundleOptions,\n getMetroDirectBundleOptionsForExpoConfig,\n} from '../start/server/middleware/metroOptions';\n\nexport type MetroDevServerOptions = LoadOptions;\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nlet nextBuildID = 0;\n\nasync function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function createBundlesAsync(\n projectRoot: string,\n projectConfig: ProjectConfig,\n bundleOptions: {\n clear?: boolean;\n maxWorkers?: number;\n platforms: Platform[];\n dev?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n entryPoint?: string;\n }\n): Promise<Partial<Record<Platform, BundleOutput>>> {\n if (!bundleOptions.platforms.length) {\n return {};\n }\n const { exp, pkg } = projectConfig;\n\n const bundles = await bundleProductionMetroClientAsync(\n projectRoot,\n exp,\n {\n // If not legacy, ignore the target option to prevent warnings from being thrown.\n resetCache: bundleOptions.clear,\n maxWorkers: bundleOptions.maxWorkers,\n },\n bundleOptions.platforms.map((platform: Platform) => ({\n platform,\n entryPoint:\n bundleOptions.entryPoint ?? getEntryWithServerRoot(projectRoot, { platform, pkg }),\n sourcemaps: bundleOptions.sourcemaps,\n minify: bundleOptions.minify,\n dev: bundleOptions.dev,\n }))\n );\n\n // { ios: bundle, android: bundle }\n return bundleOptions.platforms.reduce<Partial<Record<Platform, BundleOutput>>>(\n (prev, platform, index) => ({\n ...prev,\n [platform]: bundles[index],\n }),\n {}\n );\n}\n\nasync function bundleProductionMetroClientAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n metroOptions: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const { config, reporter } = await loadMetroConfigAsync(projectRoot, metroOptions, {\n exp: expoConfig,\n isExporting: true,\n });\n\n const metroServer = await Metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const isHermes = isEnableHermesManaged(expoConfig, bundle.platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, expoConfig, bundle.platform);\n }\n const bundleOptions: MetroBundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n sourceMapUrl: bundle.sourceMapUrl,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, expoConfig, {\n mainModuleName: bundle.entryPoint,\n platform: bundle.platform,\n mode: bundle.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: bundle.sourcemaps,\n // Bundle splitting on web-only for now.\n // serializerOutput: bundle.platform === 'web' ? 'static' : undefined,\n serializerOutput: 'static',\n serializerIncludeBytecode: isHermes,\n isExporting: true,\n }),\n bundleType: 'bundle',\n inlineSourceMap: false,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n },\n };\n\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails,\n });\n try {\n const artifacts = await forkMetroBuildAsync(metroServer, bundleOptions);\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return artifacts;\n } catch (error) {\n reporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n try {\n return await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n\n// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n// behavior.\nexport async function getAssets(metro: Metro.Server, options: MetroBundleOptions) {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions(options);\n\n // @ts-expect-error: _bundler isn't exposed on the type.\n const dependencies = await metro._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n // @ts-expect-error\n const _config = metro._config as ConfigT;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: _config.serializer.processModuleFilter,\n assetPlugins: _config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n projectRoot: _config.projectRoot, // this._getServerRootDir(),\n publicPath: _config.transformer.publicPath,\n });\n}\n\nfunction isMetroServerInstance(metro: Metro.Server): metro is Metro.Server & {\n _shouldAddModuleToIgnoreList: (module: Module<MixedOutput>) => boolean;\n _bundler: IncrementalBundler;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n _getEntryPointAbsolutePath(entryFile: string): string;\n _getSortedModules(graph: ReadOnlyGraph): Module<MixedOutput>[];\n} {\n return '_shouldAddModuleToIgnoreList' in metro;\n}\n\nasync function forkMetroBuildAsync(\n metro: Metro.Server,\n options: ExpoMetroBundleOptions\n): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n if (!isMetroServerInstance(metro)) {\n throw new Error('Expected Metro server instance to have private functions exposed.');\n }\n\n if (options.serializerOptions?.output !== 'static') {\n throw new Error('Only multi-serializer output is supported.');\n }\n\n const {\n entryFile,\n graphOptions,\n onProgress,\n resolverOptions,\n serializerOptions,\n transformOptions,\n } = splitBundleOptions(options);\n\n const { prepend, graph } = await metro._bundler.buildGraph(\n entryFile,\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n // @ts-expect-error\n lazy: graphOptions.lazy,\n }\n );\n\n const entryPoint = metro._getEntryPointAbsolutePath(entryFile);\n\n const bundleOptions = {\n asyncRequireModulePath: await metro._resolveRelativePath(\n metro._config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n processModuleFilter: metro._config.serializer.processModuleFilter,\n createModuleId: metro._createModuleId,\n getRunModuleStatement: metro._config.serializer.getRunModuleStatement,\n dev: transformOptions.dev,\n includeAsyncPaths: graphOptions.lazy,\n projectRoot: metro._config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: metro._config.serializer.getModulesRunBeforeMainModule(\n path.relative(metro._config.projectRoot, entryPoint)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: metro._config.server.unstable_serverRoot ?? metro._config.projectRoot,\n shouldAddToIgnoreList: (module: Module<MixedOutput>) =>\n metro._shouldAddModuleToIgnoreList(module),\n // Custom options we pass to the serializer to emulate the URL query parameters.\n serializerOptions: options.serializerOptions,\n };\n\n const bundle = await metro._config.serializer.customSerializer!(\n entryPoint,\n // @ts-expect-error: Metro is typed incorrectly\n prepend,\n graph,\n bundleOptions\n );\n\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n return parsed;\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n}\n"],"names":["createBundlesAsync","getAssets","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","projectConfig","bundleOptions","platforms","length","pkg","bundles","bundleProductionMetroClientAsync","resetCache","clear","maxWorkers","map","entryPoint","getEntryWithServerRoot","sourcemaps","minify","dev","reduce","prev","index","expoConfig","metroOptions","Promise","all","config","reporter","loadMetroConfigAsync","isExporting","metroServer","Metro","runMetro","watch","buildAsync","bundle","buildID","isHermes","Server","DEFAULT_BUNDLE_OPTIONS","sourceMapUrl","getMetroDirectBundleOptionsForExpoConfig","mainModuleName","mode","engine","undefined","serializerIncludeMaps","serializerOutput","serializerIncludeBytecode","bundleType","inlineSourceMap","createModuleIdFactory","serializer","onProgress","transformedFileCount","totalFileCount","update","type","bundleDetails","artifacts","forkMetroBuildAsync","error","console","log","end","metro","options","entryFile","resolverOptions","transformOptions","splitBundleOptions","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","assetPlugins","transformer","publicPath","isMetroServerInstance","Error","serializerOptions","output","graphOptions","prepend","graph","buildGraph","_getEntryPointAbsolutePath","asyncRequireModulePath","_resolveRelativePath","relativeTo","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","modulesOnly","runBeforeMainModule","getModulesRunBeforeMainModule","path","relative","runModule","sourceUrl","serverRoot","server","unstable_serverRoot","shouldAddToIgnoreList","module","_shouldAddModuleToIgnoreList","customSerializer","parsed","JSON","parse","assert","Array","isArray","message"],"mappings":"AAAA;;;;QA8DsBA,kBAAkB,GAAlBA,kBAAkB;QA4IlBC,SAAS,GAATA,SAAS;AA1MyC,IAAA,OAAc,WAAd,cAAc,CAAA;AAG3D,IAAA,UAAqD,kCAArD,qDAAqD,EAAA;AAC7D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAC+B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG9C,IAAA,OAAkB,kCAAlB,kBAAkB,EAAA;AACN,IAAA,mBAAkC,kCAAlC,kCAAkC,EAAA;AAMhD,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEsD,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AACxD,IAAA,iBAAwC,WAAxC,wCAAwC,CAAA;AACtC,IAAA,mBAA+C,WAA/C,+CAA+C,CAAA;AAI/E,IAAA,aAAyC,WAAzC,yCAAyC,CA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CtD,eAAe,EAAEkC,iBAAiB,CAAClC,eAAe;QAClDuD,UAAU,EAAExC,CAAAA,oBAAwC,GAAxCA,KAAK,CAACW,OAAO,CAAC8B,MAAM,CAACC,mBAAmB,YAAxC1C,oBAAwC,GAAIA,KAAK,CAACW,OAAO,CAACpF,WAAW;QACjFoH,qBAAqB,EAAE,CAACC,MAA2B,GACjD5C,KAAK,CAAC6C,4BAA4B,CAACD,MAAM,CAAC;QAAA;QAC5C,gFAAgF;QAChFzB,iBAAiB,EAAElB,OAAO,CAACkB,iBAAiB;KAC7C,AAAC;IAEF,MAAMjD,MAAM,GAAG,MAAM8B,KAAK,CAACW,OAAO,CAACxB,UAAU,CAAC2D,gBAAgB,CAC5DjG,UAAU,EACV,+CAA+C;IAC/CyE,OAAO,EACPC,KAAK,EACLpF,aAAa,CACd,AAAC;IAEF,IAAI;QACF,MAAM4G,MAAM,GAAG,OAAO7E,MAAM,KAAK,QAAQ,GAAG8E,IAAI,CAACC,KAAK,CAAC/E,MAAM,CAAC,GAAGA,MAAM,AAAC;QAExEgF,CAAAA,GAAAA,OAAM,AAGL,CAAA,QAHK,CACJ,WAAW,IAAIH,MAAM,IAAII,KAAK,CAACC,OAAO,CAACL,MAAM,CAACrD,SAAS,CAAC,EACxD,kGAAkG,CACnG,CAAC;QACF,OAAOqD,MAAM,CAAC;KACf,CAAC,OAAOnD,KAAK,EAAO;QACnB,MAAM,IAAIsB,KAAK,CACb,gHAAgH,GAC9GtB,KAAK,CAACyD,OAAO,CAChB,CAAC;KACH;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform, ProjectConfig } from '@expo/config';\nimport { LoadOptions } from '@expo/metro-config';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport Metro, { MixedOutput, Module, ReadOnlyGraph } from 'metro';\nimport type { TransformInputOptions } from 'metro/src/DeltaBundler/types';\nimport IncrementalBundler from 'metro/src/IncrementalBundler';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport type {\n ResolverInputOptions,\n BundleOptions as MetroBundleOptions,\n} from 'metro/src/shared/types';\nimport { ConfigT } from 'metro-config';\nimport path from 'path';\n\nimport { isEnableHermesManaged, maybeThrowFromInconsistentEngineAsync } from './exportHermes';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport {\n ExpoMetroBundleOptions,\n getMetroDirectBundleOptionsForExpoConfig,\n} from '../start/server/middleware/metroOptions';\nimport { CommandError } from '../utils/errors';\n\nexport type MetroDevServerOptions = LoadOptions;\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nlet nextBuildID = 0;\n\nasync function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function createBundlesAsync(\n projectRoot: string,\n projectConfig: ProjectConfig,\n bundleOptions: {\n clear?: boolean;\n maxWorkers?: number;\n platforms: Platform[];\n dev?: boolean;\n minify?: boolean;\n sourcemaps?: boolean;\n entryPoint?: string;\n }\n): Promise<Partial<Record<Platform, BundleOutput>>> {\n if (!bundleOptions.platforms.length) {\n return {};\n }\n const { exp, pkg } = projectConfig;\n\n const bundles = await bundleProductionMetroClientAsync(\n projectRoot,\n exp,\n {\n // If not legacy, ignore the target option to prevent warnings from being thrown.\n resetCache: bundleOptions.clear,\n maxWorkers: bundleOptions.maxWorkers,\n },\n bundleOptions.platforms.map((platform: Platform) => ({\n platform,\n entryPoint:\n bundleOptions.entryPoint ?? getEntryWithServerRoot(projectRoot, { platform, pkg }),\n sourcemaps: bundleOptions.sourcemaps,\n minify: bundleOptions.minify,\n dev: bundleOptions.dev,\n }))\n );\n\n // { ios: bundle, android: bundle }\n return bundleOptions.platforms.reduce<Partial<Record<Platform, BundleOutput>>>(\n (prev, platform, index) => ({\n ...prev,\n [platform]: bundles[index],\n }),\n {}\n );\n}\n\nfunction assertMetroConfig(\n config: ConfigT\n): asserts config is ConfigT & { serializer: NonNullable<ConfigT['serializer']> } {\n if (!config.serializer?.customSerializer) {\n throw new CommandError(\n 'METRO_CONFIG_MALFORMED',\n `The Metro bundler configuration is missing required features from 'expo/metro-config' and cannot be used with Expo CLI. Ensure the metro.config.js file is extending 'expo/metro-config'. Learn more: https://docs.expo.dev/guides/customizing-metro`\n );\n }\n}\n\nasync function bundleProductionMetroClientAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n metroOptions: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const { config, reporter } = await loadMetroConfigAsync(projectRoot, metroOptions, {\n exp: expoConfig,\n isExporting: true,\n });\n\n assertMetroConfig(config);\n\n const metroServer = await Metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const isHermes = isEnableHermesManaged(expoConfig, bundle.platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, expoConfig, bundle.platform);\n }\n const bundleOptions: MetroBundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n sourceMapUrl: bundle.sourceMapUrl,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, expoConfig, {\n mainModuleName: bundle.entryPoint,\n platform: bundle.platform,\n mode: bundle.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: bundle.sourcemaps,\n // Bundle splitting on web-only for now.\n // serializerOutput: bundle.platform === 'web' ? 'static' : undefined,\n serializerOutput: 'static',\n serializerIncludeBytecode: isHermes,\n isExporting: true,\n }),\n bundleType: 'bundle',\n inlineSourceMap: false,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n },\n };\n\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails,\n });\n try {\n const artifacts = await forkMetroBuildAsync(metroServer, bundleOptions);\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return artifacts;\n } catch (error) {\n reporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n try {\n return await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n\n// Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n// behavior.\nexport async function getAssets(metro: Metro.Server, options: MetroBundleOptions) {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions(options);\n\n // @ts-expect-error: _bundler isn't exposed on the type.\n const dependencies = await metro._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n // @ts-expect-error\n const _config = metro._config as ConfigT;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: _config.serializer.processModuleFilter,\n assetPlugins: _config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n projectRoot: _config.projectRoot, // this._getServerRootDir(),\n publicPath: _config.transformer.publicPath,\n });\n}\n\nfunction isMetroServerInstance(metro: Metro.Server): metro is Metro.Server & {\n _shouldAddModuleToIgnoreList: (module: Module<MixedOutput>) => boolean;\n _bundler: IncrementalBundler;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n _getEntryPointAbsolutePath(entryFile: string): string;\n _getSortedModules(graph: ReadOnlyGraph): Module<MixedOutput>[];\n} {\n return '_shouldAddModuleToIgnoreList' in metro;\n}\n\nasync function forkMetroBuildAsync(\n metro: Metro.Server,\n options: ExpoMetroBundleOptions\n): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n if (!isMetroServerInstance(metro)) {\n throw new Error('Expected Metro server instance to have private functions exposed.');\n }\n\n if (options.serializerOptions?.output !== 'static') {\n throw new Error('Only multi-serializer output is supported.');\n }\n\n const {\n entryFile,\n graphOptions,\n onProgress,\n resolverOptions,\n serializerOptions,\n transformOptions,\n } = splitBundleOptions(options);\n\n const { prepend, graph } = await metro._bundler.buildGraph(\n entryFile,\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n // @ts-expect-error\n lazy: graphOptions.lazy,\n }\n );\n\n const entryPoint = metro._getEntryPointAbsolutePath(entryFile);\n\n const bundleOptions = {\n asyncRequireModulePath: await metro._resolveRelativePath(\n metro._config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n processModuleFilter: metro._config.serializer.processModuleFilter,\n createModuleId: metro._createModuleId,\n getRunModuleStatement: metro._config.serializer.getRunModuleStatement,\n dev: transformOptions.dev,\n includeAsyncPaths: graphOptions.lazy,\n projectRoot: metro._config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: metro._config.serializer.getModulesRunBeforeMainModule(\n path.relative(metro._config.projectRoot, entryPoint)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: metro._config.server.unstable_serverRoot ?? metro._config.projectRoot,\n shouldAddToIgnoreList: (module: Module<MixedOutput>) =>\n metro._shouldAddModuleToIgnoreList(module),\n // Custom options we pass to the serializer to emulate the URL query parameters.\n serializerOptions: options.serializerOptions,\n };\n\n assertMetroConfig(metro._config);\n\n const bundle = await metro._config.serializer.customSerializer!(\n entryPoint,\n // @ts-expect-error: Metro is typed incorrectly\n prepend,\n graph,\n bundleOptions\n );\n\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n return parsed;\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n}\n"],"names":["createBundlesAsync","getAssets","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","projectConfig","bundleOptions","platforms","length","pkg","bundles","bundleProductionMetroClientAsync","resetCache","clear","maxWorkers","map","entryPoint","getEntryWithServerRoot","sourcemaps","minify","dev","reduce","prev","index","assertMetroConfig","config","serializer","customSerializer","CommandError","expoConfig","metroOptions","Promise","all","reporter","loadMetroConfigAsync","isExporting","metroServer","Metro","runMetro","watch","buildAsync","bundle","buildID","isHermes","Server","DEFAULT_BUNDLE_OPTIONS","sourceMapUrl","getMetroDirectBundleOptionsForExpoConfig","mainModuleName","mode","engine","undefined","serializerIncludeMaps","serializerOutput","serializerIncludeBytecode","bundleType","inlineSourceMap","createModuleIdFactory","onProgress","transformedFileCount","totalFileCount","update","type","bundleDetails","artifacts","forkMetroBuildAsync","error","console","log","end","metro","options","entryFile","resolverOptions","transformOptions","splitBundleOptions","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","assetPlugins","transformer","publicPath","isMetroServerInstance","Error","serializerOptions","output","graphOptions","prepend","graph","buildGraph","_getEntryPointAbsolutePath","asyncRequireModulePath","_resolveRelativePath","relativeTo","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","modulesOnly","runBeforeMainModule","getModulesRunBeforeMainModule","path","relative","runModule","sourceUrl","serverRoot","server","unstable_serverRoot","shouldAddToIgnoreList","module","_shouldAddModuleToIgnoreList","parsed","JSON","parse","assert","Array","isArray","message"],"mappings":"AAAA;;;;QA+DsBA,kBAAkB,GAAlBA,kBAAkB;QAyJlBC,SAAS,GAATA,SAAS;AAxNyC,IAAA,OAAc,WAAd,cAAc,CAAA;AAG3D,IAAA,UAAqD,kCAArD,qDAAqD,EAAA;AAC7D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAC+B,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG9C,IAAA,OAAkB,kCAAlB,kBAAkB,EAAA;AACN,IAAA,mBAAkC,kCAAlC,kCAAkC,EAAA;AAMhD,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEsD,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AACxD,IAAA,iBAAwC,WAAxC,wCAAwC,CAAA;AACtC,IAAA,mBAA+C,WAA/C,+CAA+C,CAAA;AAI/E,IAAA,aAAyC,WAAzC,yCAAyC,CAAA;AACnB,IAAA,OAAiB,WAAjB,iBAAiB,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AAOlD,KAAK,EAAO;QACnB,MAAM,IAAIsB,KAAK,CACb,gHAAgH,GAC9GtB,KAAK,CAACwD,OAAO,CAChB,CAAC;KACH;CACF"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.getAssetLocalPath = getAssetLocalPath;
|
|
6
6
|
exports.stripAssetPrefix = stripAssetPrefix;
|
|
7
|
+
exports.drawableFileTypes = void 0;
|
|
7
8
|
var _path = _interopRequireDefault(require("path"));
|
|
8
9
|
function _interopRequireDefault(obj) {
|
|
9
10
|
return obj && obj.__esModule ? obj : {
|
|
@@ -65,7 +66,6 @@ function stripAssetPrefix(path, baseUrl) {
|
|
|
65
66
|
return null;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
// See https://developer.android.com/guide/topics/resources/drawable-resource.html
|
|
69
69
|
const drawableFileTypes = new Set([
|
|
70
70
|
"gif",
|
|
71
71
|
"jpeg",
|
|
@@ -74,6 +74,7 @@ const drawableFileTypes = new Set([
|
|
|
74
74
|
"webp",
|
|
75
75
|
"xml"
|
|
76
76
|
]);
|
|
77
|
+
exports.drawableFileTypes = drawableFileTypes;
|
|
77
78
|
function getAndroidResourceFolderName(asset, scale) {
|
|
78
79
|
if (!drawableFileTypes.has(asset.type)) {
|
|
79
80
|
return "raw";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/metroAssetLocalPath.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 * Based on the community asset persisting for Metro but with base path and web support:\n * https://github.com/facebook/react-native/blob/d6e0bc714ad4d215ede4949d3c4f44af6dea5dd3/packages/community-cli-plugin/src/commands/bundle/saveAssets.js#L1\n */\nimport type { AssetData } from 'metro';\nimport path from 'path';\n\nexport function getAssetLocalPath(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale, platform }: { baseUrl?: string; scale: number; platform: string }\n): string {\n if (platform === 'android') {\n return getAssetLocalPathAndroid(asset, { baseUrl, scale });\n }\n return getAssetLocalPathDefault(asset, { baseUrl, scale });\n}\n\nfunction getAssetLocalPathAndroid(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n {\n baseUrl,\n scale,\n }: {\n // TODO: baseUrl support\n baseUrl?: string;\n scale: number;\n }\n): string {\n const androidFolder = getAndroidResourceFolderName(asset, scale);\n const fileName = getResourceIdentifier(asset);\n return path.join(androidFolder, `${fileName}.${asset.type}`);\n}\n\nfunction getAssetLocalPathDefault(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale }: { baseUrl?: string; scale: number }\n): string {\n const suffix = scale === 1 ? '' : `@${scale}x`;\n const fileName = `${asset.name}${suffix}.${asset.type}`;\n\n const adjustedHttpServerLocation = stripAssetPrefix(asset.httpServerLocation, baseUrl);\n\n return path.join(\n // Assets can have relative paths outside of the project root.\n // Replace `../` with `_` to make sure they don't end up outside of\n // the expected assets directory.\n adjustedHttpServerLocation.replace(/^\\/+/g, '').replace(/\\.\\.\\//g, '_'),\n fileName\n );\n}\n\nexport function stripAssetPrefix(path: string, baseUrl?: string) {\n path = path.replace(/\\/assets\\?export_path=(.*)/, '$1');\n\n // TODO: Windows?\n if (baseUrl) {\n return path.replace(/^\\/+/g, '').replace(\n new RegExp(\n `^${baseUrl\n .replace(/^\\/+/g, '')\n .replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n .replace(/-/g, '\\\\x2d')}`,\n 'g'\n ),\n ''\n );\n }\n return path;\n}\n\n/**\n * FIXME: using number to represent discrete scale numbers is fragile in essence because of\n * floating point numbers imprecision.\n */\nfunction getAndroidAssetSuffix(scale: number): string | null {\n switch (scale) {\n case 0.75:\n return 'ldpi';\n case 1:\n return 'mdpi';\n case 1.5:\n return 'hdpi';\n case 2:\n return 'xhdpi';\n case 3:\n return 'xxhdpi';\n case 4:\n return 'xxxhdpi';\n default:\n return null;\n }\n}\n\n// See https://developer.android.com/guide/topics/resources/drawable-resource.html\
|
|
1
|
+
{"version":3,"sources":["../../../src/export/metroAssetLocalPath.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 * Based on the community asset persisting for Metro but with base path and web support:\n * https://github.com/facebook/react-native/blob/d6e0bc714ad4d215ede4949d3c4f44af6dea5dd3/packages/community-cli-plugin/src/commands/bundle/saveAssets.js#L1\n */\nimport type { AssetData } from 'metro';\nimport path from 'path';\n\nexport function getAssetLocalPath(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale, platform }: { baseUrl?: string; scale: number; platform: string }\n): string {\n if (platform === 'android') {\n return getAssetLocalPathAndroid(asset, { baseUrl, scale });\n }\n return getAssetLocalPathDefault(asset, { baseUrl, scale });\n}\n\nfunction getAssetLocalPathAndroid(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n {\n baseUrl,\n scale,\n }: {\n // TODO: baseUrl support\n baseUrl?: string;\n scale: number;\n }\n): string {\n const androidFolder = getAndroidResourceFolderName(asset, scale);\n const fileName = getResourceIdentifier(asset);\n return path.join(androidFolder, `${fileName}.${asset.type}`);\n}\n\nfunction getAssetLocalPathDefault(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale }: { baseUrl?: string; scale: number }\n): string {\n const suffix = scale === 1 ? '' : `@${scale}x`;\n const fileName = `${asset.name}${suffix}.${asset.type}`;\n\n const adjustedHttpServerLocation = stripAssetPrefix(asset.httpServerLocation, baseUrl);\n\n return path.join(\n // Assets can have relative paths outside of the project root.\n // Replace `../` with `_` to make sure they don't end up outside of\n // the expected assets directory.\n adjustedHttpServerLocation.replace(/^\\/+/g, '').replace(/\\.\\.\\//g, '_'),\n fileName\n );\n}\n\nexport function stripAssetPrefix(path: string, baseUrl?: string) {\n path = path.replace(/\\/assets\\?export_path=(.*)/, '$1');\n\n // TODO: Windows?\n if (baseUrl) {\n return path.replace(/^\\/+/g, '').replace(\n new RegExp(\n `^${baseUrl\n .replace(/^\\/+/g, '')\n .replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n .replace(/-/g, '\\\\x2d')}`,\n 'g'\n ),\n ''\n );\n }\n return path;\n}\n\n/**\n * FIXME: using number to represent discrete scale numbers is fragile in essence because of\n * floating point numbers imprecision.\n */\nfunction getAndroidAssetSuffix(scale: number): string | null {\n switch (scale) {\n case 0.75:\n return 'ldpi';\n case 1:\n return 'mdpi';\n case 1.5:\n return 'hdpi';\n case 2:\n return 'xhdpi';\n case 3:\n return 'xxhdpi';\n case 4:\n return 'xxxhdpi';\n default:\n return null;\n }\n}\n\n// See https://developer.android.com/guide/topics/resources/drawable-resource.html\nexport const drawableFileTypes = new Set<string>(['gif', 'jpeg', 'jpg', 'png', 'webp', 'xml']);\n\nfunction getAndroidResourceFolderName(asset: Pick<AssetData, 'type'>, scale: number): string {\n if (!drawableFileTypes.has(asset.type)) {\n return 'raw';\n }\n const suffix = getAndroidAssetSuffix(scale);\n if (!suffix) {\n throw new Error(\n `Asset \"${JSON.stringify(asset)}\" does not use a supported Android resolution suffix`\n );\n }\n return `drawable-${suffix}`;\n}\n\nfunction getResourceIdentifier(asset: Pick<AssetData, 'httpServerLocation' | 'name'>): string {\n const folderPath = getBaseUrl(asset);\n return `${folderPath}/${asset.name}`\n .toLowerCase()\n .replace(/\\//g, '_') // Encode folder structure in file name\n .replace(/([^a-z0-9_])/g, '') // Remove illegal chars\n .replace(/^assets_/, ''); // Remove \"assets_\" prefix\n}\n\nfunction getBaseUrl(asset: Pick<AssetData, 'httpServerLocation'>): string {\n let baseUrl = asset.httpServerLocation;\n if (baseUrl[0] === '/') {\n baseUrl = baseUrl.substring(1);\n }\n return baseUrl;\n}\n"],"names":["getAssetLocalPath","stripAssetPrefix","asset","baseUrl","scale","platform","getAssetLocalPathAndroid","getAssetLocalPathDefault","androidFolder","getAndroidResourceFolderName","fileName","getResourceIdentifier","path","join","type","suffix","name","adjustedHttpServerLocation","httpServerLocation","replace","RegExp","getAndroidAssetSuffix","drawableFileTypes","Set","has","Error","JSON","stringify","folderPath","getBaseUrl","toLowerCase","substring"],"mappings":"AAUA;;;;QAGgBA,iBAAiB,GAAjBA,iBAAiB;QA4CjBC,gBAAgB,GAAhBA,gBAAgB;;AA9Cf,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEhB,SAASD,iBAAiB,CAC/BE,KAA8D,EAC9D,EAAEC,OAAO,CAAA,EAAEC,KAAK,CAAA,EAAEC,QAAQ,CAAA,EAAyD,EAC3E;IACR,IAAIA,QAAQ,KAAK,SAAS,EAAE;QAC1B,OAAOC,wBAAwB,CAACJ,KAAK,EAAE;YAAEC,OAAO;YAAEC,KAAK;SAAE,CAAC,CAAC;KAC5D;IACD,OAAOG,wBAAwB,CAACL,KAAK,EAAE;QAAEC,OAAO;QAAEC,KAAK;KAAE,CAAC,CAAC;CAC5D;AAED,SAASE,wBAAwB,CAC/BJ,KAA8D,EAC9D,EACEC,OAAO,CAAA,EACPC,KAAK,CAAA,EAKN,EACO;IACR,MAAMI,aAAa,GAAGC,4BAA4B,CAACP,KAAK,EAAEE,KAAK,CAAC,AAAC;IACjE,MAAMM,QAAQ,GAAGC,qBAAqB,CAACT,KAAK,CAAC,AAAC;IAC9C,OAAOU,KAAI,QAAA,CAACC,IAAI,CAACL,aAAa,EAAE,CAAC,EAAEE,QAAQ,CAAC,CAAC,EAAER,KAAK,CAACY,IAAI,CAAC,CAAC,CAAC,CAAC;CAC9D;AAED,SAASP,wBAAwB,CAC/BL,KAA8D,EAC9D,EAAEC,OAAO,CAAA,EAAEC,KAAK,CAAA,EAAuC,EAC/C;IACR,MAAMW,MAAM,GAAGX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AAC,CAAC,CAAC,CAAC;KAChC;IACD,OAAO5B,OAAO,CAAC;CAChB"}
|
|
@@ -19,7 +19,12 @@ function resolvePlatformOption(exp, platformBundlers, platform1 = [
|
|
|
19
19
|
}
|
|
20
20
|
const assertPlatformBundler = (platform)=>{
|
|
21
21
|
if (!platformsAvailable[platform]) {
|
|
22
|
-
|
|
22
|
+
var ref, ref1;
|
|
23
|
+
if (!((ref = exp.platforms) == null ? void 0 : ref.includes(platform)) && platform === "web") {
|
|
24
|
+
// Pass through so the more robust error message is shown.
|
|
25
|
+
return platform;
|
|
26
|
+
}
|
|
27
|
+
throw new _errors.CommandError("BAD_ARGS", `Platform "${platform}" is not configured to use the Metro bundler in the project Expo config, or is missing from the supported platforms in the platforms array: [${(ref1 = exp.platforms) == null ? void 0 : ref1.join(", ")}].`);
|
|
23
28
|
}
|
|
24
29
|
return platform;
|
|
25
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import { ExpoConfig, getConfig, Platform } from '@expo/config';\n\nimport { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';\nimport { CommandError } from '../utils/errors';\n\nexport type Options = {\n outputDir: string;\n platforms: Platform[];\n maxWorkers?: number;\n dev: boolean;\n clear: boolean;\n minify: boolean;\n dumpAssetmap: boolean;\n sourceMaps: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n exp: ExpoConfig,\n platformBundlers: PlatformBundlers,\n platform: string[] = ['all']\n): Platform[] {\n const platformsAvailable: Partial<PlatformBundlers> = Object.fromEntries(\n Object.entries(platformBundlers).filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n );\n\n if (!Object.keys(platformsAvailable).length) {\n throw new CommandError(\n `No platforms are configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n const assertPlatformBundler = (platform: Platform): Platform => {\n if (!platformsAvailable[platform]) {\n throw new CommandError(\n 'BAD_ARGS',\n `Platform \"${platform}\" is not configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n return platform;\n };\n\n const knownPlatforms = ['android', 'ios', 'web'] as Platform[];\n const assertPlatformIsKnown = (platform: string): Platform => {\n if (!knownPlatforms.includes(platform as Platform)) {\n throw new CommandError(\n `Unsupported platform \"${platform}\". Options are: ${knownPlatforms.join(',')},all`\n );\n }\n\n return platform as Platform;\n };\n\n return (\n platform\n // Expand `all` to all available platforms.\n .map((platform) => (platform === 'all' ? Object.keys(platformsAvailable) : platform))\n .flat()\n // Remove duplicated platforms\n .filter((platform, index, list) => list.indexOf(platform) === index)\n // Assert platforms are valid\n .map((platform) => assertPlatformIsKnown(platform))\n .map((platform) => assertPlatformBundler(platform))\n );\n}\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n const { exp } = getConfig(projectRoot, { skipPlugins: true, skipSDKVersionRequirement: true });\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n return {\n platforms: resolvePlatformOption(exp, platformBundlers, args['--platform']),\n outputDir: args['--output-dir'] ?? 'dist',\n minify: !args['--no-minify'],\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n sourceMaps: !!args['--source-maps'],\n };\n}\n"],"names":["resolvePlatformOption","resolveOptionsAsync","exp","platformBundlers","platform","platformsAvailable","Object","fromEntries","entries","filter","bundler","platforms","includes","keys","length","CommandError","assertPlatformBundler","
|
|
1
|
+
{"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import { ExpoConfig, getConfig, Platform } from '@expo/config';\n\nimport { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';\nimport { CommandError } from '../utils/errors';\n\nexport type Options = {\n outputDir: string;\n platforms: Platform[];\n maxWorkers?: number;\n dev: boolean;\n clear: boolean;\n minify: boolean;\n dumpAssetmap: boolean;\n sourceMaps: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n exp: ExpoConfig,\n platformBundlers: PlatformBundlers,\n platform: string[] = ['all']\n): Platform[] {\n const platformsAvailable: Partial<PlatformBundlers> = Object.fromEntries(\n Object.entries(platformBundlers).filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n );\n\n if (!Object.keys(platformsAvailable).length) {\n throw new CommandError(\n `No platforms are configured to use the Metro bundler in the project Expo config.`\n );\n }\n\n const assertPlatformBundler = (platform: Platform): Platform => {\n if (!platformsAvailable[platform]) {\n if (!exp.platforms?.includes(platform) && platform === 'web') {\n // Pass through so the more robust error message is shown.\n return platform;\n }\n throw new CommandError(\n 'BAD_ARGS',\n `Platform \"${platform}\" is not configured to use the Metro bundler in the project Expo config, or is missing from the supported platforms in the platforms array: [${exp.platforms?.join(\n ', '\n )}].`\n );\n }\n\n return platform;\n };\n\n const knownPlatforms = ['android', 'ios', 'web'] as Platform[];\n const assertPlatformIsKnown = (platform: string): Platform => {\n if (!knownPlatforms.includes(platform as Platform)) {\n throw new CommandError(\n `Unsupported platform \"${platform}\". Options are: ${knownPlatforms.join(',')},all`\n );\n }\n\n return platform as Platform;\n };\n\n return (\n platform\n // Expand `all` to all available platforms.\n .map((platform) => (platform === 'all' ? Object.keys(platformsAvailable) : platform))\n .flat()\n // Remove duplicated platforms\n .filter((platform, index, list) => list.indexOf(platform) === index)\n // Assert platforms are valid\n .map((platform) => assertPlatformIsKnown(platform))\n .map((platform) => assertPlatformBundler(platform))\n );\n}\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n const { exp } = getConfig(projectRoot, { skipPlugins: true, skipSDKVersionRequirement: true });\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n return {\n platforms: resolvePlatformOption(exp, platformBundlers, args['--platform']),\n outputDir: args['--output-dir'] ?? 'dist',\n minify: !args['--no-minify'],\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n sourceMaps: !!args['--source-maps'],\n };\n}\n"],"names":["resolvePlatformOption","resolveOptionsAsync","exp","platformBundlers","platform","platformsAvailable","Object","fromEntries","entries","filter","bundler","platforms","includes","keys","length","CommandError","assertPlatformBundler","join","knownPlatforms","assertPlatformIsKnown","map","flat","index","list","indexOf","projectRoot","args","getConfig","skipPlugins","skipSDKVersionRequirement","getPlatformBundlers","outputDir","minify","clear","dev","maxWorkers","dumpAssetmap","sourceMaps"],"mappings":"AAAA;;;;QAiBgBA,qBAAqB,GAArBA,qBAAqB;QA0DfC,mBAAmB,GAAnBA,mBAAmB;AA3EO,IAAA,OAAc,WAAd,cAAc,CAAA;AAER,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAC3D,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAcvC,SAASD,qBAAqB,CACnCE,GAAe,EACfC,gBAAkC,EAClCC,SAAkB,GAAG;IAAC,KAAK;CAAC,EAChB;IACZ,MAAMC,kBAAkB,GAA8BC,MAAM,CAACC,WAAW,CACtED,MAAM,CAACE,OAAO,CAACL,gBAAgB,CAAC,CAACM,MAAM,CACrC,CAAC,CAACL,QAAQ,EAAEM,OAAO,CAAC;YAA4BR,GAAa;QAApCQ,OAAAA,OAAO,KAAK,OAAO,KAAIR,CAAAA,GAAa,GAAbA,GAAG,CAACS,SAAS,SAAU,GAAvBT,KAAAA,CAAuB,GAAvBA,GAAa,CAAEU,QAAQ,CAACR,QAAQ,CAAa,CAAA,CAAA;KAAA,CAC9F,CACF,AAAC;IAEF,IAAI,CAACE,MAAM,CAACO,IAAI,CAACR,kBAAkB,CAAC,CAACS,MAAM,EAAE;QAC3C,MAAM,IAAIC,OAAY,aAAA,CACpB,CAAC,gFAAgF,CAAC,CACnF,CAAC;KACH;IAED,MAAMC,qBAAqB,GAAG,CAACZ,QAAkB,GAAe;QAC9D,IAAI,CAACC,kBAAkB,CA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luded(rootConfig) {
|
|
110
110
|
var ref, ref1, ref2;
|
|
111
111
|
// Detect if the 'web' string is purposefully missing from the platforms array.
|
|
112
|
-
const isWebExcluded = Array.isArray((ref = rootConfig.expo) == null ? void 0 : ref.platforms) && !!((ref1 = rootConfig.expo) == null ? void 0 : ref1.platforms.length) && !((ref2 = rootConfig.expo) == null ? void 0 : ref2.platforms.includes("web"));
|
|
112
|
+
const isWebExcluded = Array.isArray(rootConfig == null ? void 0 : (ref = rootConfig.expo) == null ? void 0 : ref.platforms) && !!((ref1 = rootConfig.expo) == null ? void 0 : ref1.platforms.length) && !((ref2 = rootConfig.expo) == null ? void 0 : ref2.platforms.includes("web"));
|
|
113
113
|
return isWebExcluded;
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n // use react-native-web/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n { file: 'react-native-web/package.json', pkg: 'react-native-web' },\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n}\n\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/web/WebSupportProjectPrerequisite.ts"],"sourcesContent":["import {\n AppJSONConfig,\n ExpoConfig,\n getConfig,\n getProjectConfigDescriptionWithPaths,\n ProjectConfig,\n} from '@expo/config';\nimport chalk from 'chalk';\n\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { getPlatformBundlers } from '../../server/platformBundlers';\nimport { PrerequisiteCommandError, ProjectPrerequisite } from '../Prerequisite';\nimport { ensureDependenciesAsync } from '../dependencies/ensureDependenciesAsync';\nimport { ResolvedPackage } from '../dependencies/getMissingPackages';\n\nconst debug = require('debug')('expo:doctor:webSupport') as typeof console.log;\n\n/** Ensure the project has the required web support settings. */\nexport class WebSupportProjectPrerequisite extends ProjectPrerequisite {\n /** Ensure a project that hasn't explicitly disabled web support has all the required packages for running in the browser. */\n async assertImplementation(): Promise<void> {\n if (env.EXPO_NO_WEB_SETUP) {\n Log.warn('Skipping web setup: EXPO_NO_WEB_SETUP is enabled.');\n return;\n }\n debug('Ensuring web support is setup');\n\n const result = await this._shouldSetupWebSupportAsync();\n\n // Ensure web packages are installed\n await this._ensureWebDependenciesInstalledAsync({ exp: result.exp });\n }\n\n /** Exposed for testing. */\n async _shouldSetupWebSupportAsync(): Promise<ProjectConfig> {\n const config = getConfig(this.projectRoot);\n\n // Detect if the 'web' string is purposefully missing from the platforms array.\n if (isWebPlatformExcluded(config.rootConfig)) {\n // Get exact config description with paths.\n const configName = getProjectConfigDescriptionWithPaths(this.projectRoot, config);\n throw new PrerequisiteCommandError(\n 'WEB_SUPPORT',\n chalk`Skipping web setup: {bold \"web\"} is not included in the project ${configName} {bold \"platforms\"} array.`\n );\n }\n\n return config;\n }\n\n /** Exposed for testing. */\n async _ensureWebDependenciesInstalledAsync({ exp }: { exp: ExpoConfig }): Promise<boolean> {\n const requiredPackages: ResolvedPackage[] = [\n // use react-native-web/package.json to skip node module cache issues when the user installs\n // the package and attempts to resolve the module in the same process.\n { file: 'react-native-web/package.json', pkg: 'react-native-web' },\n { file: 'react-dom/package.json', pkg: 'react-dom' },\n ];\n\n const bundler = getPlatformBundlers(this.projectRoot, exp).web;\n // Only include webpack-config if bundler is webpack.\n if (bundler === 'webpack') {\n requiredPackages.push(\n // `webpack` and `webpack-dev-server` should be installed in the `@expo/webpack-config`\n {\n file: '@expo/webpack-config/package.json',\n pkg: '@expo/webpack-config',\n dev: true,\n }\n );\n } else if (bundler === 'metro') {\n requiredPackages.push({\n file: '@expo/metro-runtime/package.json',\n pkg: '@expo/metro-runtime',\n });\n }\n\n try {\n return await ensureDependenciesAsync(this.projectRoot, {\n // This never seems to work when prompting, installing, and running -- instead just inform the user to run the install command and try again.\n skipPrompt: true,\n isProjectMutable: false,\n exp,\n installMessage: `It looks like you're trying to use web support but don't have the required dependencies installed.`,\n warningMessage: chalk`If you're not using web, please ensure you remove the {bold \"web\"} string from the platforms array in the project Expo config.`,\n requiredPackages,\n });\n } catch (error) {\n // Reset the cached check so we can re-run the check if the user re-runs the command by pressing 'w' in the Terminal UI.\n this.resetAssertion();\n throw error;\n }\n }\n}\n\n/** Return `true` if the `web` platform is purposefully excluded from the project Expo config. */\nexport function isWebPlatformExcluded(rootConfig: AppJSONConfig): boolean {\n // Detect if the 'web' string is purposefully missing from the platforms array.\n const isWebExcluded =\n Array.isArray(rootConfig?.expo?.platforms) &&\n !!rootConfig.expo?.platforms.length &&\n !rootConfig.expo?.platforms.includes('web');\n return isWebExcluded;\n}\n"],"names":["isWebPlatformExcluded","Log","debug","require","WebSupportProjectPrerequisite","ProjectPrerequisite","assertImplementation","env","EXPO_NO_WEB_SETUP","warn","result","_shouldSetupWebSupportAsync","_ensureWebDependenciesInstalledAsync","exp","config","getConfig","projectRoot","rootConfig","configName","getProjectConfigDescriptionWithPaths","PrerequisiteCommandError","chalk","requiredPackages","file","pkg","bundler","getPlatformBundlers","web","push","dev","ensureDependenciesAsync","skipPrompt","isProjectMutable","installMessage","warningMessage","error","resetAssertion","isWebExcluded","Array","isArray","expo","platforms","length","includes"],"mappings":"AAAA;;;;QAiGgBA,qBAAqB,GAArBA,qBAAqB;AA3F9B,IAAA,OAAc,WAAd,cAAc,CAAA;AACH,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACK,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACJ,IAAA,iBAA+B,WAA/B,+BAA+B,CAAA;AACL,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;AACvC,IAAA,wBAAyC,WAAzC,yCAAyC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGjF,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,AAAsB,AAAC;AAGxE,MAAMC,6BAA6B,SAASC,aAAmB,oBAAA;IACpE,6HAA6H,CAC7H,MAAMC,oBAAoB,GAAkB;QAC1C,IAAIC,IAAG,IAAA,CAACC,iBAAiB,EAAE;YACzBP,GAAG,CAACQ,IAAI,CAAC,mDAAmD,CAAC,CAAC;YAC9D,OAAO;SACR;QACDP,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEvC,MAAMQ,MAAM,GAAG,MAAM,IAAI,CAACC,2BAA2B,EAAE,AAAC;QAExD,oCAAoC;QACpC,MAAM,IAAI,CAACC,oCAAoC,CAAC;YAAEC,GAAG,EAAEH,MAAM,CAACG,GAAG;SAAE,CAAC,CAAC;KACtE;IAED,2BAA2B,CAC3B,MAAMF,2BAA2B,GAA2B;QAC1D,MAAMG,MAAM,GAAGC,CAAAA,GAAAA,OAAS,AAAkB,CAAA,UAAlB,CAAC,IAAI,CAACC,WAAW,CAAC,AAAC;QAE3C,+EAA+E;QAC/E,IAAIhB,qBAAqB,CAACc,MAAM,CAACG,UAAU,CAAC,EAAE;YAC5C,2CAA2C;YAC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BACvBnB,GAAG;gBACHoB,cAAc,EAAE,CAAC,kGAAkG,CAAC;gBACpHC,cAAc,EAAEb,MAAK,QAAA,CAAC,8HAA8H,CAAC;gBACrJC,gBAAgB;aACjB,CAAC,CAAC;SACJ,CAAC,OAAOa,KAAK,EAAE;YACd,wHAAwH;YACxH,IAAI,CAACC,cAAc,EAAE,CAAC;YACtB,MAAMD,KAAK,CAAC;SACb;KACF;CACF;QA3EY/B,6BAA6B,GAA7BA,6BAA6B;AA8EnC,SAASJ,qBAAqB,CAACiB,UAAyB,EAAW;QAGxDA,GAAgB,EAC5BA,IAAe,EAChBA,IAAe;IAJlB,+EAA+E;IAC/E,MAAMoB,aAAa,GACjBC,KAAK,CAACC,OAAO,CAACtB,UAAU,QAAM,GAAhBA,KAAAA,CAAgB,GAAhBA,CAAAA,GAAgB,GAAhBA,UAAU,CAAEuB,IAAI,SAAA,GAAhBvB,KAAAA,CAAgB,GAAhBA,GAAgB,CAAEwB,SAAS,AAAX,CAAY,IAC1C,CAAC,EAACxB,CAAAA,IAAe,GAAfA,UAAU,CAACuB,IAAI,SAAW,GAA1BvB,KAAAA,CAA0B,GAA1BA,IAAe,CAAEwB,SAAS,CAACC,MAAM,CAAA,IACnC,CAACzB,CAAAA,CAAAA,IAAe,GAAfA,UAAU,CAACuB,IAAI,SAAW,GAA1BvB,KAAAA,CAA0B,GAA1BA,IAAe,CAAEwB,SAAS,CAACE,QAAQ,CAAC,KAAK,CAAC,CAAA,AAAC;IAC9C,OAAON,aAAa,CAAC;CACtB"}
|
|
@@ -39,10 +39,12 @@ function _interopRequireWildcard(obj) {
|
|
|
39
39
|
}
|
|
40
40
|
const debug = require("debug")("expo:start:interface:interactiveActions");
|
|
41
41
|
class DevServerManagerActions {
|
|
42
|
-
constructor(devServerManager){
|
|
42
|
+
constructor(devServerManager, options){
|
|
43
43
|
this.devServerManager = devServerManager;
|
|
44
|
+
this.options = options;
|
|
44
45
|
}
|
|
45
46
|
printDevServerInfo(options) {
|
|
47
|
+
var ref;
|
|
46
48
|
// If native dev server is running, print its URL.
|
|
47
49
|
if (this.devServerManager.getNativeDevServerPort()) {
|
|
48
50
|
const devServer = this.devServerManager.getDefaultDevServer();
|
|
@@ -72,13 +74,15 @@ class DevServerManagerActions {
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
if ((ref = this.options.platforms) == null ? void 0 : ref.includes("web")) {
|
|
78
|
+
const webDevServer = this.devServerManager.getWebDevServer();
|
|
79
|
+
const webUrl = webDevServer == null ? void 0 : webDevServer.getDevServerUrl({
|
|
80
|
+
hostType: "localhost"
|
|
81
|
+
});
|
|
82
|
+
if (webUrl) {
|
|
83
|
+
Log.log();
|
|
84
|
+
Log.log((0, _commandsTable).printItem(_chalk.default`Web is waiting on {underline ${webUrl}}`));
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
(0, _commandsTable).printUsage(options, {
|
|
84
88
|
verbose: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { ExpoChoice, selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n MetroInspectorProxyApp,\n openJsInspector,\n queryAllInspectorAppsAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\ninterface MoreToolMenuItem extends ExpoChoice<string> {\n action?: () => unknown;\n}\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n let app: MetroInspectorProxyApp | null = null;\n\n if (!apps.length) {\n return Log.warn(\n chalk`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n }\n\n if (apps.length === 1) {\n app = apps[0];\n } else {\n const choices = apps.map((app) => ({\n title: app.deviceName ?? 'Unknown device',\n value: app.id,\n app,\n }));\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n const menuItem = choices.find((item) => item.value === value);\n if (!menuItem) {\n return Log.error(chalk`{bold Debug:} No device available for \"${value}\"`);\n }\n\n app = menuItem.app;\n }\n\n if (!app) {\n return Log.error(chalk`{bold Debug:} No device selected`);\n }\n\n try {\n await openJsInspector(metroServerOrigin, app);\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n // Options match: Chrome > View > Developer\n try {\n const defaultMenuItems: MoreToolMenuItem[] = [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n {\n title: 'Open React devtools',\n value: 'openReactDevTools',\n action: this.openReactDevToolsAsync.bind(this),\n },\n // TODO: Maybe a \"View Source\" option to open code.\n ];\n const pluginMenuItems = (\n await this.devServerManager.devtoolsPluginManager.queryPluginsAsync()\n ).map((plugin) => ({\n title: chalk`Open devtools plugin - {bold ${plugin.packageName}}`,\n value: `devtoolsPlugin:${plugin.packageName}`,\n action: async () => {\n const url = new URL(\n plugin.webpageEndpoint,\n this.devServerManager\n .getDefaultDevServer()\n .getUrlCreator()\n .constructUrl({ scheme: 'http' })\n );\n await openBrowserAsync(url.toString());\n },\n }));\n const menuItems = [...defaultMenuItems, ...pluginMenuItems];\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, menuItems);\n const menuItem = menuItems.find((item) => item.value === value);\n if (menuItem?.action) {\n menuItem.action();\n } else if (menuItem?.value) {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: menuItem.value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async openReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","apps","queryAllInspectorAppsAsync","app","length","warn","choices","map","title","deviceName","value","id","selectAsync","menuItem","find","item","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","defaultMenuItems","action","openReactDevToolsAsync","bind","pluginMenuItems","devtoolsPluginManager","queryPluginsAsync","plugin","packageName","url","URL","webpageEndpoint","getUrlCreator","constructUrl","scheme","openBrowserAsync","toString","menuItems","name","startReactDevToolsProxyAsync","getReactDevToolsUrl","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,O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I,CAAC,CAAC;QACvB,IAAI,CAAC3E,gBAAgB,CAACkD,gBAAgB,CAAC,gBAAgB,EAAE;YAAEoB,IAAI,EAAE,wBAAwB;SAAE,CAAC,CAAC;KAC9F;IAEDM,aAAa,GAAG;QACdjF,GAAG,CAACgB,GAAG,CAAC,CAAC,EAAEsC,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACjD,gBAAgB,CAACkD,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAjLYpD,uBAAuB,GAAvBA,uBAAuB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { ExpoChoice, selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n MetroInspectorProxyApp,\n openJsInspector,\n queryAllInspectorAppsAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\ninterface MoreToolMenuItem extends ExpoChoice<string> {\n action?: () => unknown;\n}\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(\n private devServerManager: DevServerManager,\n private options: Pick<StartOptions, 'devClient' | 'platforms'>\n ) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', error);\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n if (this.options.platforms?.includes('web')) {\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n let app: MetroInspectorProxyApp | null = null;\n\n if (!apps.length) {\n return Log.warn(\n chalk`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n }\n\n if (apps.length === 1) {\n app = apps[0];\n } else {\n const choices = apps.map((app) => ({\n title: app.deviceName ?? 'Unknown device',\n value: app.id,\n app,\n }));\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n const menuItem = choices.find((item) => item.value === value);\n if (!menuItem) {\n return Log.error(chalk`{bold Debug:} No device available for \"${value}\"`);\n }\n\n app = menuItem.app;\n }\n\n if (!app) {\n return Log.error(chalk`{bold Debug:} No device selected`);\n }\n\n try {\n await openJsInspector(metroServerOrigin, app);\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n // Options match: Chrome > View > Developer\n try {\n const defaultMenuItems: MoreToolMenuItem[] = [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n {\n title: 'Open React devtools',\n value: 'openReactDevTools',\n action: this.openReactDevToolsAsync.bind(this),\n },\n // TODO: Maybe a \"View Source\" option to open code.\n ];\n const pluginMenuItems = (\n await this.devServerManager.devtoolsPluginManager.queryPluginsAsync()\n ).map((plugin) => ({\n title: chalk`Open devtools plugin - {bold ${plugin.packageName}}`,\n value: `devtoolsPlugin:${plugin.packageName}`,\n action: async () => {\n const url = new URL(\n plugin.webpageEndpoint,\n this.devServerManager\n .getDefaultDevServer()\n .getUrlCreator()\n .constructUrl({ scheme: 'http' })\n );\n await openBrowserAsync(url.toString());\n },\n }));\n const menuItems = [...defaultMenuItems, ...pluginMenuItems];\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, menuItems);\n const menuItem = menuItems.find((item) => item.value === value);\n if (menuItem?.action) {\n menuItem.action();\n } else if (menuItem?.value) {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: menuItem.value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async openReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","options","printDevServerInfo","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","platforms","includes","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","apps","queryAllInspectorAppsAsync","app","length","warn","choices","map","title","deviceName","value","id","selectAsync","menuItem","find","item","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","defaultMenuItems","action","openReactDevToolsAsync","bind","pluginMenuItems","devtoolsPluginManager","queryPluginsAsync","plugin","packageName","url","URL","webpageEndpoint","getUrlCreator","constructUrl","scheme","openBrowserAsync","toString","menuItems","name","startReactDevToolsProxyAsync","getReactDevToolsUrl","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEwD,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACtFA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACY,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAK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AAgB,CAACoD,gBAAgB,CAAC,gBAAgB,EAAE;YAAEoB,IAAI,EAAE,wBAAwB;SAAE,CAAC,CAAC;KAC9F;IAEDM,aAAa,GAAG;QACdnF,GAAG,CAACgB,GAAG,CAAC,CAAC,EAAEwC,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACnD,gBAAgB,CAACoD,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAtLYtD,uBAAuB,GAAvBA,uBAAuB"}
|
|
@@ -58,7 +58,7 @@ const PLATFORM_SETTINGS = {
|
|
|
58
58
|
};
|
|
59
59
|
async function startInterfaceAsync(devServerManager, options) {
|
|
60
60
|
var ref2;
|
|
61
|
-
const actions = new _interactiveActions.DevServerManagerActions(devServerManager);
|
|
61
|
+
const actions = new _interactiveActions.DevServerManagerActions(devServerManager, options);
|
|
62
62
|
const isWebSocketsEnabled = (ref2 = devServerManager.getDefaultDevServer()) == null ? void 0 : ref2.isTargetingNative();
|
|
63
63
|
const usageOptions = {
|
|
64
64
|
isWebSocketsEnabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/startInterface.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { KeyPressHandler } from './KeyPressHandler';\nimport { BLT, printHelp, printUsage, StartOptions } from './commandsTable';\nimport { DevServerManagerActions } from './interactiveActions';\nimport * as Log from '../../log';\nimport { openInEditorAsync } from '../../utils/editor';\nimport { AbortCommandError } from '../../utils/errors';\nimport { getAllSpinners, ora } from '../../utils/ora';\nimport { getProgressBar, setProgressBar } from '../../utils/progress';\nimport { addInteractionListener, pauseInteractions } from '../../utils/prompts';\nimport { WebSupportProjectPrerequisite } from '../doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../server/DevServerManager';\n\nconst debug = require('debug')('expo:start:interface:startInterface') as typeof console.log;\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\nconst CTRL_L = '\\u000C';\n\nconst PLATFORM_SETTINGS: Record<\n string,\n { name: string; key: 'android' | 'ios'; launchTarget: 'emulator' | 'simulator' }\n> = {\n android: {\n name: 'Android',\n key: 'android',\n launchTarget: 'emulator',\n },\n ios: {\n name: 'iOS',\n key: 'ios',\n launchTarget: 'simulator',\n },\n};\n\nexport async function startInterfaceAsync(\n devServerManager: DevServerManager,\n options: Pick<StartOptions, 'devClient' | 'platforms'>\n) {\n const actions = new DevServerManagerActions(devServerManager);\n\n const isWebSocketsEnabled = devServerManager.getDefaultDevServer()?.isTargetingNative();\n\n const usageOptions = {\n isWebSocketsEnabled,\n devClient: devServerManager.options.devClient,\n ...options,\n };\n\n actions.printDevServerInfo(usageOptions);\n\n const onPressAsync = async (key: string) => {\n // Auxillary commands all escape.\n switch (key) {\n case CTRL_C:\n case CTRL_D: {\n // Prevent terminal UI from accepting commands while the process is closing.\n // Without this, fast typers will close the server then start typing their\n // next command and have a bunch of unrelated things pop up.\n pauseInteractions();\n\n const spinners = getAllSpinners();\n spinners.forEach((spinner) => {\n spinner.fail();\n });\n\n const currentProgress = getProgressBar();\n if (currentProgress) {\n currentProgress.terminate();\n setProgressBar(null);\n }\n const spinner = ora({ text: 'Stopping server', color: 'white' }).start();\n try {\n await devServerManager.stopAsync();\n spinner.stopAndPersist({ text: 'Stopped server', symbol: `\\u203A` });\n // @ts-ignore: Argument of type '\"SIGINT\"' is not assignable to parameter of type '\"disconnect\"'.\n process.emit('SIGINT');\n\n // TODO: Is this the right place to do this?\n process.exit();\n } catch (error) {\n spinner.fail('Failed to stop server');\n throw error;\n }\n break;\n }\n case CTRL_L:\n return Log.clear();\n case '?':\n return printUsage(usageOptions, { verbose: true });\n }\n\n // Optionally enabled\n\n if (isWebSocketsEnabled) {\n switch (key) {\n case 'm':\n return actions.toggleDevMenu();\n case 'M':\n return actions.openMoreToolsAsync();\n }\n }\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n if (['i', 'a'].includes(key.toLowerCase())) {\n const platform = key.toLowerCase() === 'i' ? 'ios' : 'android';\n\n const shouldPrompt = ['I', 'A'].includes(key);\n if (shouldPrompt) {\n Log.clear();\n }\n\n const server = devServerManager.getDefaultDevServer();\n const settings = PLATFORM_SETTINGS[platform];\n\n Log.log(`${BLT} Opening on ${settings.name}...`);\n\n if (server.isTargetingNative() && !platforms.includes(settings.key)) {\n Log.warn(\n chalk`${settings.name} is disabled, enable it by adding {bold ${settings.key}} to the platforms array in your app.json or app.config.js`\n );\n } else {\n try {\n await server.openPlatformAsync(settings.launchTarget, { shouldPrompt });\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n }\n // Break out early.\n return;\n }\n\n switch (key) {\n case 's': {\n Log.clear();\n if (await devServerManager.toggleRuntimeMode()) {\n usageOptions.devClient = devServerManager.options.devClient;\n return actions.printDevServerInfo(usageOptions);\n }\n break;\n }\n case 'w': {\n try {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n if (!platforms.includes('web')) {\n platforms.push('web');\n options.platforms?.push('web');\n }\n } catch (e: any) {\n Log.warn(e.message);\n break;\n }\n\n const isDisabled = !platforms.includes('web');\n if (isDisabled) {\n debug('Web is disabled');\n // Use warnings from the web support setup.\n break;\n }\n\n // Ensure the Webpack dev server is running first\n if (!devServerManager.getWebDevServer()) {\n debug('Starting up webpack dev server');\n await devServerManager.ensureWebDevServerRunningAsync();\n // When this is the first time webpack is started, reprint the connection info.\n actions.printDevServerInfo(usageOptions);\n }\n\n Log.log(`${BLT} Open in the web browser...`);\n try {\n await devServerManager.getWebDevServer()?.openPlatformAsync('desktop');\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n break;\n }\n case 'c':\n Log.clear();\n return actions.printDevServerInfo(usageOptions);\n case 'j':\n return actions.openJsInspectorAsync();\n case 'r':\n return actions.reloadApp();\n case 'o':\n Log.log(`${BLT} Opening the editor...`);\n return openInEditorAsync(devServerManager.projectRoot);\n }\n };\n\n const keyPressHandler = new KeyPressHandler(onPressAsync);\n\n const listener = keyPressHandler.createInteractionListener();\n\n addInteractionListener(listener);\n\n // Start observing...\n keyPressHandler.startInterceptingKeyStrokes();\n}\n"],"names":["startInterfaceAsync","Log","debug","require","CTRL_C","CTRL_D","CTRL_L","PLATFORM_SETTINGS","android","name","key","launchTarget","ios","devServerManager","options","actions","DevServerManagerActions","isWebSocketsEnabled","getDefaultDevServer","isTargetingNative","usageOptions","devClient","printDevServerInfo","onPressAsync","pauseInteractions","spinners","getAllSpinners","forEach","spinner","fail","currentProgress","getProgressBar","terminate","setProgressBar","ora","text","color","start","stopAsync","stopAndPersist","symbol","process","emit","exit","error","clear","printUsage","verbose","toggleDevMenu","openMoreToolsAsync","platforms","includes","toLowerCase","platform","shouldPrompt","server","settings","log","BLT","warn","chalk","openPlatformAsync","printHelp","AbortCommandError","exception","toggleRuntimeMode","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","push","e","message","isDisabled","getWebDevServer","ensureWebDevServerRunningAsync","openJsInspectorAsync","reloadApp","openInEditorAsync","projectRoot","keyPressHandler","KeyPressHandler","listener","createInteractionListener","addInteractionListener","startInterceptingKeyStrokes"],"mappings":"AAAA;;;;QAoCsBA,mBAAmB,GAAnBA,mBAAmB;AApCvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEO,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACM,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAClDC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACmB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACpB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAClB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACN,IAAA,SAAsB,WAAtB,sBAAsB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACjC,IAAA,8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ACxC,OAAOkB,CAAAA,GAAAA,OAAiB,AAA8B,CAAA,kBAA9B,CAAC/D,gBAAgB,CAACgE,WAAW,CAAC,CAAC;SAC1D;KACF,AAAC;IAEF,MAAMC,eAAe,GAAG,IAAIC,gBAAe,gBAAA,CAACxD,YAAY,CAAC,AAAC;IAE1D,MAAMyD,QAAQ,GAAGF,eAAe,CAACG,yBAAyB,EAAE,AAAC;IAE7DC,CAAAA,GAAAA,QAAsB,AAAU,CAAA,uBAAV,CAACF,QAAQ,CAAC,CAAC;IAEjC,qBAAqB;IACrBF,eAAe,CAACK,2BAA2B,EAAE,CAAC;CAC/C"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/startInterface.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { KeyPressHandler } from './KeyPressHandler';\nimport { BLT, printHelp, printUsage, StartOptions } from './commandsTable';\nimport { DevServerManagerActions } from './interactiveActions';\nimport * as Log from '../../log';\nimport { openInEditorAsync } from '../../utils/editor';\nimport { AbortCommandError } from '../../utils/errors';\nimport { getAllSpinners, ora } from '../../utils/ora';\nimport { getProgressBar, setProgressBar } from '../../utils/progress';\nimport { addInteractionListener, pauseInteractions } from '../../utils/prompts';\nimport { WebSupportProjectPrerequisite } from '../doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../server/DevServerManager';\n\nconst debug = require('debug')('expo:start:interface:startInterface') as typeof console.log;\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\nconst CTRL_L = '\\u000C';\n\nconst PLATFORM_SETTINGS: Record<\n string,\n { name: string; key: 'android' | 'ios'; launchTarget: 'emulator' | 'simulator' }\n> = {\n android: {\n name: 'Android',\n key: 'android',\n launchTarget: 'emulator',\n },\n ios: {\n name: 'iOS',\n key: 'ios',\n launchTarget: 'simulator',\n },\n};\n\nexport async function startInterfaceAsync(\n devServerManager: DevServerManager,\n options: Pick<StartOptions, 'devClient' | 'platforms'>\n) {\n const actions = new DevServerManagerActions(devServerManager, options);\n\n const isWebSocketsEnabled = devServerManager.getDefaultDevServer()?.isTargetingNative();\n\n const usageOptions = {\n isWebSocketsEnabled,\n devClient: devServerManager.options.devClient,\n ...options,\n };\n\n actions.printDevServerInfo(usageOptions);\n\n const onPressAsync = async (key: string) => {\n // Auxillary commands all escape.\n switch (key) {\n case CTRL_C:\n case CTRL_D: {\n // Prevent terminal UI from accepting commands while the process is closing.\n // Without this, fast typers will close the server then start typing their\n // next command and have a bunch of unrelated things pop up.\n pauseInteractions();\n\n const spinners = getAllSpinners();\n spinners.forEach((spinner) => {\n spinner.fail();\n });\n\n const currentProgress = getProgressBar();\n if (currentProgress) {\n currentProgress.terminate();\n setProgressBar(null);\n }\n const spinner = ora({ text: 'Stopping server', color: 'white' }).start();\n try {\n await devServerManager.stopAsync();\n spinner.stopAndPersist({ text: 'Stopped server', symbol: `\\u203A` });\n // @ts-ignore: Argument of type '\"SIGINT\"' is not assignable to parameter of type '\"disconnect\"'.\n process.emit('SIGINT');\n\n // TODO: Is this the right place to do this?\n process.exit();\n } catch (error) {\n spinner.fail('Failed to stop server');\n throw error;\n }\n break;\n }\n case CTRL_L:\n return Log.clear();\n case '?':\n return printUsage(usageOptions, { verbose: true });\n }\n\n // Optionally enabled\n\n if (isWebSocketsEnabled) {\n switch (key) {\n case 'm':\n return actions.toggleDevMenu();\n case 'M':\n return actions.openMoreToolsAsync();\n }\n }\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n if (['i', 'a'].includes(key.toLowerCase())) {\n const platform = key.toLowerCase() === 'i' ? 'ios' : 'android';\n\n const shouldPrompt = ['I', 'A'].includes(key);\n if (shouldPrompt) {\n Log.clear();\n }\n\n const server = devServerManager.getDefaultDevServer();\n const settings = PLATFORM_SETTINGS[platform];\n\n Log.log(`${BLT} Opening on ${settings.name}...`);\n\n if (server.isTargetingNative() && !platforms.includes(settings.key)) {\n Log.warn(\n chalk`${settings.name} is disabled, enable it by adding {bold ${settings.key}} to the platforms array in your app.json or app.config.js`\n );\n } else {\n try {\n await server.openPlatformAsync(settings.launchTarget, { shouldPrompt });\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n }\n // Break out early.\n return;\n }\n\n switch (key) {\n case 's': {\n Log.clear();\n if (await devServerManager.toggleRuntimeMode()) {\n usageOptions.devClient = devServerManager.options.devClient;\n return actions.printDevServerInfo(usageOptions);\n }\n break;\n }\n case 'w': {\n try {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n if (!platforms.includes('web')) {\n platforms.push('web');\n options.platforms?.push('web');\n }\n } catch (e: any) {\n Log.warn(e.message);\n break;\n }\n\n const isDisabled = !platforms.includes('web');\n if (isDisabled) {\n debug('Web is disabled');\n // Use warnings from the web support setup.\n break;\n }\n\n // Ensure the Webpack dev server is running first\n if (!devServerManager.getWebDevServer()) {\n debug('Starting up webpack dev server');\n await devServerManager.ensureWebDevServerRunningAsync();\n // When this is the first time webpack is started, reprint the connection info.\n actions.printDevServerInfo(usageOptions);\n }\n\n Log.log(`${BLT} Open in the web browser...`);\n try {\n await devServerManager.getWebDevServer()?.openPlatformAsync('desktop');\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n break;\n }\n case 'c':\n Log.clear();\n return actions.printDevServerInfo(usageOptions);\n case 'j':\n return actions.openJsInspectorAsync();\n case 'r':\n return actions.reloadApp();\n case 'o':\n Log.log(`${BLT} Opening the editor...`);\n return openInEditorAsync(devServerManager.projectRoot);\n }\n };\n\n const keyPressHandler = new KeyPressHandler(onPressAsync);\n\n const listener = keyPressHandler.createInteractionListener();\n\n addInteractionListener(listener);\n\n // Start observing...\n keyPressHandler.startInterceptingKeyStrokes();\n}\n"],"names":["startInterfaceAsync","Log","debug","require","CTRL_C","CTRL_D","CTRL_L","PLATFORM_SETTINGS","android","name","key","launchTarget","ios","devServerManager","options","actions","DevServerManagerActions","isWebSocketsEnabled","getDefaultDevServer","isTargetingNative","usageOptions","devClient","printDevServerInfo","onPressAsync","pauseInteractions","spinners","getAllSpinners","forEach","spinner","fail","currentProgress","getProgressBar","terminate","setProgressBar","ora","text","color","start","stopAsync","stopAndPersist","symbol","process","emit","exit","error","clear","printUsage","verbose","toggleDevMenu","openMoreToolsAsync","platforms","includes","toLowerCase","platform","shouldPrompt","server","settings","log","BLT","warn","chalk","openPlatformAsync","printHelp","AbortCommandError","exception","toggleRuntimeMode","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","push","e","message","isDisabled","getWebDevServer","ensureWebDevServerRunningAsync","openJsInspectorAsync","reloadApp","openInEditorAsync","projectRoot","keyPressHandler","KeyPressHandler","listener","createInteractionListener","addInteractionListener","startInterceptingKeyStrokes"],"mappings":"AAAA;;;;QAoCsBA,mBAAmB,GAAnBA,mBAAmB;AApCvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEO,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACM,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAClDC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACmB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACpB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAClB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACN,IAAA,SAAsB,WAAtB,sBAAsB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACjC,IAAA,8BAA6C,WAA7C,6CAA6C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3F,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,AAAsB,AAAC;AAE5F,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,IAAQ,AAAC;AAExB,MAAMC,iBAAiB,GAGnB;IACFC,OAA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CAAA,uBAAV,CAACF,QAAQ,CAAC,CAAC;IAEjC,qBAAqB;IACrBF,eAAe,CAACK,2BAA2B,EAAE,CAAC;CAC/C"}
|
|
@@ -103,6 +103,25 @@ class TerminalReporter extends XTerminalReporter {
|
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* We use Math.pow(ratio, 2) to as a conservative measure of progress because
|
|
108
|
+
* we know the `totalCount` is going to progressively increase as well. We
|
|
109
|
+
* also prevent the ratio from going backwards.
|
|
110
|
+
*/ _updateBundleProgress(options) {
|
|
111
|
+
super._updateBundleProgress(options);
|
|
112
|
+
const currentProgress = this._activeBundles.get(options.buildID);
|
|
113
|
+
if (!currentProgress) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
// Fix an issue where the transformer is faster than the resolver,
|
|
117
|
+
// locking the progress bar at 100% after transforming the first and only resolved file (1/1).
|
|
118
|
+
if (currentProgress.ratio === 1 && options.totalFileCount === 1) {
|
|
119
|
+
Object.assign(currentProgress, {
|
|
120
|
+
...currentProgress,
|
|
121
|
+
ratio: 0
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
106
125
|
}
|
|
107
126
|
exports.TerminalReporter = TerminalReporter;
|
|
108
127
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.ts"],"sourcesContent":["// This file represents an abstraction on the metro TerminalReporter.\n// We use this abstraction to safely extend the TerminalReporter for our own custom logging.\nimport chalk from 'chalk';\nimport UpstreamTerminalReporter from 'metro/src/lib/TerminalReporter';\nimport { Terminal } from 'metro-core';\nimport util from 'util';\n\nimport {\n BundleDetails,\n TerminalReportableEvent,\n TerminalReporterInterface,\n} from './TerminalReporter.types';\nimport { stripAnsi } from '../../../utils/ansi';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\n/**\n * A standard way to log a warning to the terminal. This should not be called\n * from some arbitrary Metro logic, only from the reporters. Instead of\n * calling this, add a new type of ReportableEvent instead, and implement a\n * proper handler in the reporter(s).\n */\nexport function logWarning(terminal: Terminal, format: string, ...args: any[]): void {\n const str = util.format(format, ...args);\n terminal.log('%s: %s', chalk.yellow('warning'), str);\n}\n\n/**\n * Similar to `logWarning`, but for messages that require the user to act.\n */\nexport function logError(terminal: Terminal, format: string, ...args: any[]): void {\n terminal.log(\n '%s: %s',\n chalk.red('error'),\n // Syntax errors may have colors applied for displaying code frames\n // in various places outside of where Metro is currently running.\n // If the current terminal does not support color, we'll strip the colors\n // here.\n util.format(chalk.supportsColor ? format : stripAnsi(format), ...args)\n );\n}\n\nconst XTerminalReporter = UpstreamTerminalReporter as unknown as TerminalReporterInterface;\n\n/** Extended TerminalReporter class but with proper types and extra functionality to avoid using the `_log` method directly in subclasses. */\nexport class TerminalReporter extends XTerminalReporter implements TerminalReporterInterface {\n /**\n * A cache of { [buildID]: BundleDetails } which can be used to\n * add more contextual logs. BundleDetails is currently only sent with `bundle_build_started`\n * so we need to cache the details in order to print the platform info with other event types.\n */\n _bundleDetails: Map<string, BundleDetails> = new Map();\n\n /** Keep track of how long a bundle takes to complete */\n _bundleTimers: Map<string, number> = new Map();\n\n /** Keep track of bundle processes that should not be logged. */\n _hiddenBundleEvents: Set<string> = new Set();\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'transform_cache_reset':\n return this.transformCacheReset();\n case 'dep_graph_loading':\n return this.dependencyGraphLoading(event.hasReducedPerformance);\n case 'client_log':\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n break;\n }\n return super._log(event);\n }\n\n /** Gives subclasses an easy interface for filtering out logs. Return `true` to skip. */\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return false;\n }\n\n /** Gives subclasses an easy interface for filtering out bundle events, specifically for source maps. Return `true` to skip. */\n shouldFilterBundleEvent(event: TerminalReportableEvent): boolean {\n return false;\n }\n\n /** Cache has been reset. */\n transformCacheReset(): void {}\n\n /** One of the first logs that will be printed. */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {}\n\n /**\n * Custom log event representing the end of the bundling.\n *\n * @param event event object.\n * @param duration duration of the build in milliseconds.\n */\n bundleBuildEnded(event: TerminalReportableEvent, duration: number): void {}\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(\n event: TerminalReportableEvent & { bundleDetails?: BundleDetails; buildID?: string }\n ) {\n // Append the buildID to the bundleDetails.\n if (event.bundleDetails) {\n event.bundleDetails.buildID = event.buildID;\n }\n\n const buildID = event.bundleDetails?.buildID ?? event.buildID;\n\n if (buildID && !this._hiddenBundleEvents.has(buildID)) {\n if (this.shouldFilterBundleEvent(event)) {\n debug('skipping bundle events for', buildID, event);\n this._hiddenBundleEvents.add(buildID);\n } else {\n super._updateState(event);\n }\n } else {\n super._updateState(event);\n }\n\n switch (event.type) {\n case 'bundle_build_done':\n case 'bundle_build_failed': {\n const startTime = this._bundleTimers.get(event.buildID);\n // Observed a bug in Metro where the `bundle_build_done` is invoked twice during a static bundle\n // i.e. `expo export`.\n if (startTime == null) {\n break;\n }\n\n this.bundleBuildEnded(event, startTime ? Date.now() - startTime : 0);\n this._bundleTimers.delete(event.buildID);\n break;\n }\n case 'bundle_build_started':\n this._bundleDetails.set(event.buildID, event.bundleDetails);\n this._bundleTimers.set(event.buildID, Date.now());\n break;\n }\n }\n}\n"],"names":["logWarning","logError","debug","require","terminal","format","args","str","util","log","chalk","yellow","red","supportsColor","stripAnsi","XTerminalReporter","UpstreamTerminalReporter","TerminalReporter","_bundleDetails","Map","_bundleTimers","_hiddenBundleEvents","Set","_log","event","type","transformCacheReset","dependencyGraphLoading","hasReducedPerformance","shouldFilterClientLog","shouldFilterBundleEvent","bundleBuildEnded","duration","_updateState","bundleDetails","buildID","has","add","startTime","get","Date","now","delete","set"],"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B,CAACe,GAAG,CAACD,OAAO,CAAC,EAAE;YACrD,IAAI,IAAI,CAACL,uBAAuB,CAACN,KAAK,CAAC,EAAE;gBACvCtB,KAAK,CAAC,4BAA4B,EAAEiC,OAAO,EAAEX,KAAK,CAAC,CAAC;gBACpD,IAAI,CAACH,mBAAmB,CAACgB,GAAG,CAACF,OAAO,CAAC,CAAC;aACvC,MAAM;gBACL,KAAK,CAACF,YAAY,CAACT,KAAK,CAAC,CAAC;aAC3B;SACF,MAAM;YACL,KAAK,CAACS,YAAY,CAACT,KAAK,CAAC,CAAC;SAC3B;QAED,OAAQA,KAAK,CAACC,IAAI;YAChB,KAAK,mBAAmB,CAAC;YACzB,KAAK,qBAAqB;gBAAE;oBAC1B,MAAMa,SAAS,GAAG,IAAI,CAAClB,aAAa,CAACmB,GAAG,CAACf,KAAK,CAACW,OAAO,CAAC,AAAC;oBACxD,gGAAgG;oBAChG,sBAAsB;oBACtB,IAAIG,SAAS,IAAI,IAAI,EAAE;wBACrB,MAAM;qBACP;oBAED,IAAI,CAACP,gBAAgB,CAACP,KAAK,EAAEc,SAAS,GAAGE,IAAI,CAACC,GAAG,EAAE,GAAGH,SAAS,GAAG,CAAC,CAAC,CAAC;oBACrE,IAAI,CAAClB,aAAa,CAACsB,MAAM,CAAClB,KAAK,CAACW,OAAO,CAAC,CAAC;oBACzC,MAAM;iBACP;YACD,KAAK,sBAAsB;gBACzB,IAAI,CAACjB,cAAc,CAACyB,GAAG,CAACnB,KAAK,CAACW,OAAO,EAAEX,KAAK,CAACU,aAAa,CAAC,CAAC;gBAC5D,IAAI,CAACd,aAAa,CAACuB,GAAG,CAACnB,KAAK,CAACW,OAAO,EAAEK,IAAI,CAACC,GAAG,EAAE,CAAC,CAAC;gBAClD,MAAM;SACT;KACF;CACF;QAtGYxB,gBAAgB,GAAhBA,gBAAgB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.ts"],"sourcesContent":["// This file represents an abstraction on the metro TerminalReporter.\n// We use this abstraction to safely extend the TerminalReporter for our own custom logging.\nimport chalk from 'chalk';\nimport UpstreamTerminalReporter from 'metro/src/lib/TerminalReporter';\nimport { Terminal } from 'metro-core';\nimport util from 'util';\n\nimport {\n BundleDetails,\n BundleProgressUpdate,\n TerminalReportableEvent,\n TerminalReporterInterface,\n} from './TerminalReporter.types';\nimport { stripAnsi } from '../../../utils/ansi';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\n/**\n * A standard way to log a warning to the terminal. This should not be called\n * from some arbitrary Metro logic, only from the reporters. Instead of\n * calling this, add a new type of ReportableEvent instead, and implement a\n * proper handler in the reporter(s).\n */\nexport function logWarning(terminal: Terminal, format: string, ...args: any[]): void {\n const str = util.format(format, ...args);\n terminal.log('%s: %s', chalk.yellow('warning'), str);\n}\n\n/**\n * Similar to `logWarning`, but for messages that require the user to act.\n */\nexport function logError(terminal: Terminal, format: string, ...args: any[]): void {\n terminal.log(\n '%s: %s',\n chalk.red('error'),\n // Syntax errors may have colors applied for displaying code frames\n // in various places outside of where Metro is currently running.\n // If the current terminal does not support color, we'll strip the colors\n // here.\n util.format(chalk.supportsColor ? format : stripAnsi(format), ...args)\n );\n}\n\nconst XTerminalReporter = UpstreamTerminalReporter as unknown as TerminalReporterInterface;\n\n/** Extended TerminalReporter class but with proper types and extra functionality to avoid using the `_log` method directly in subclasses. */\nexport class TerminalReporter extends XTerminalReporter implements TerminalReporterInterface {\n /**\n * A cache of { [buildID]: BundleDetails } which can be used to\n * add more contextual logs. BundleDetails is currently only sent with `bundle_build_started`\n * so we need to cache the details in order to print the platform info with other event types.\n */\n _bundleDetails: Map<string, BundleDetails> = new Map();\n\n /** Keep track of how long a bundle takes to complete */\n _bundleTimers: Map<string, number> = new Map();\n\n /** Keep track of bundle processes that should not be logged. */\n _hiddenBundleEvents: Set<string> = new Set();\n\n _log(event: TerminalReportableEvent): void {\n switch (event.type) {\n case 'transform_cache_reset':\n return this.transformCacheReset();\n case 'dep_graph_loading':\n return this.dependencyGraphLoading(event.hasReducedPerformance);\n case 'client_log':\n if (this.shouldFilterClientLog(event)) {\n return;\n }\n break;\n }\n return super._log(event);\n }\n\n /** Gives subclasses an easy interface for filtering out logs. Return `true` to skip. */\n shouldFilterClientLog(event: {\n type: 'client_log';\n level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug';\n data: unknown[];\n }): boolean {\n return false;\n }\n\n /** Gives subclasses an easy interface for filtering out bundle events, specifically for source maps. Return `true` to skip. */\n shouldFilterBundleEvent(event: TerminalReportableEvent): boolean {\n return false;\n }\n\n /** Cache has been reset. */\n transformCacheReset(): void {}\n\n /** One of the first logs that will be printed. */\n dependencyGraphLoading(hasReducedPerformance: boolean): void {}\n\n /**\n * Custom log event representing the end of the bundling.\n *\n * @param event event object.\n * @param duration duration of the build in milliseconds.\n */\n bundleBuildEnded(event: TerminalReportableEvent, duration: number): void {}\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(\n event: TerminalReportableEvent & { bundleDetails?: BundleDetails; buildID?: string }\n ) {\n // Append the buildID to the bundleDetails.\n if (event.bundleDetails) {\n event.bundleDetails.buildID = event.buildID;\n }\n\n const buildID = event.bundleDetails?.buildID ?? event.buildID;\n\n if (buildID && !this._hiddenBundleEvents.has(buildID)) {\n if (this.shouldFilterBundleEvent(event)) {\n debug('skipping bundle events for', buildID, event);\n this._hiddenBundleEvents.add(buildID);\n } else {\n super._updateState(event);\n }\n } else {\n super._updateState(event);\n }\n\n switch (event.type) {\n case 'bundle_build_done':\n case 'bundle_build_failed': {\n const startTime = this._bundleTimers.get(event.buildID);\n // Observed a bug in Metro where the `bundle_build_done` is invoked twice during a static bundle\n // i.e. `expo export`.\n if (startTime == null) {\n break;\n }\n\n this.bundleBuildEnded(event, startTime ? Date.now() - startTime : 0);\n this._bundleTimers.delete(event.buildID);\n break;\n }\n case 'bundle_build_started':\n this._bundleDetails.set(event.buildID, event.bundleDetails);\n this._bundleTimers.set(event.buildID, Date.now());\n break;\n }\n }\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress(options: BundleProgressUpdate) {\n super._updateBundleProgress(options);\n\n const currentProgress = this._activeBundles.get(options.buildID);\n if (!currentProgress) {\n return;\n }\n\n // Fix an issue where the transformer is faster than the resolver,\n // locking the progress bar at 100% after transforming the first and only resolved file (1/1).\n if (currentProgress.ratio === 1 && options.totalFileCount === 1) {\n Object.assign(currentProgress, { ...currentProgress, ratio: 0 });\n }\n }\n}\n"],"names":["logWarning","logError","debug","require","terminal","format","args","str","util","log","chalk","yellow","red","supportsColor","stripAnsi","XTerminalReporter","UpstreamTerminalReporter","TerminalReporter","_bundleDetails","Map","_bundleTimers","_hiddenBundleEvents","Set","_log","event","type","transformCacheReset","dependencyGraphLoading","hasReducedPerformance","shouldFilterClientLog","shouldFilterBundleEvent","bundleBuildEnded","duration","_updateState","bundleDetails","buildID","has","add","startTime","get","Date","now","delete","set","_updateBundleProgress","options","currentProgress","_activeBundles","ratio","totalFileCount","Object","assign"],"mappings":"AAEA;;;;QAqBgBA,UAAU,GAAVA,UAAU;QAQVC,QAAQ,GAARA,QAAQ;AA7BN,IAAA,MAAO,kCAAP,OAAO,EAAA;AACY,IAAA,iBAAgC,kCAAhC,gCAAgC,EAAA;AAEpD,IAAA,KAAM,kCAAN,MAAM,EAAA;AAQG,IAAA,KAAqB,WAArB,qBAAqB,CAAA;;;;;;AAE/C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAsB,AAAC;AAQnE,SAASH,UAAU,CAACI,QAAkB,EAAEC,MAAc,EAAE,GAAGC,IAAI,AAAO,EAAQ;IACnF,MAAMC,GAAG,GAAGC,KAAI,QAAA,CAACH,MAAM,CAACA,MAAM,KAAKC,IAAI,CAAC,AAAC;IACzCF,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ACmB,GAAG,CAACf,KAAK,CAACW,OAAO,CAAC,AAAC;oBACxD,gGAAgG;oBAChG,sBAAsB;oBACtB,IAAIG,SAAS,IAAI,IAAI,EAAE;wBACrB,MAAM;qBACP;oBAED,IAAI,CAACP,gBAAgB,CAACP,KAAK,EAAEc,SAAS,GAAGE,IAAI,CAACC,GAAG,EAAE,GAAGH,SAAS,GAAG,CAAC,CAAC,CAAC;oBACrE,IAAI,CAAClB,aAAa,CAACsB,MAAM,CAAClB,KAAK,CAACW,OAAO,CAAC,CAAC;oBACzC,MAAM;iBACP;YACD,KAAK,sBAAsB;gBACzB,IAAI,CAACjB,cAAc,CAACyB,GAAG,CAACnB,KAAK,CAACW,OAAO,EAAEX,KAAK,CAACU,aAAa,CAAC,CAAC;gBAC5D,IAAI,CAACd,aAAa,CAACuB,GAAG,CAACnB,KAAK,CAACW,OAAO,EAAEK,IAAI,CAACC,GAAG,EAAE,CAAC,CAAC;gBAClD,MAAM;SACT;KACF;IAED;;;;KAIG,CACHG,qBAAqB,CAACC,OAA6B,EAAE;QACnD,KAAK,CAACD,qBAAqB,CAACC,OAAO,CAAC,CAAC;QAErC,MAAMC,eAAe,GAAG,IAAI,CAACC,cAAc,CAACR,GAAG,CAACM,OAAO,CAACV,OAAO,CAAC,AAAC;QACjE,IAAI,CAACW,eAAe,EAAE;YACpB,OAAO;SACR;QAED,kEAAkE;QAClE,8FAA8F;QAC9F,IAAIA,eAAe,CAACE,KAAK,KAAK,CAAC,IAAIH,OAAO,CAACI,cAAc,KAAK,CAAC,EAAE;YAC/DC,MAAM,CAACC,MAAM,CAACL,eAAe,EAAE;gBAAE,GAAGA,eAAe;gBAAEE,KAAK,EAAE,CAAC;aAAE,CAAC,CAAC;SAClE;KACF;CACF;QA1HY/B,gBAAgB,GAAhBA,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.types.ts"],"sourcesContent":["import type { ReportableEvent } from 'metro';\nimport type { TerminalReportableEvent } from 'metro/src/lib/TerminalReporter';\nimport type { Terminal } from 'metro-core';\n\nexport type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';\n\nexport type BundleDetails = {\n buildID?: string;\n bundleType: string;\n dev: boolean;\n entryFile: string;\n minify: boolean;\n platform: string | null | undefined;\n customTransformOptions?: { environment?: 'node' };\n runtimeBytecodeVersion: number | null | undefined;\n};\n\nexport type BundleProgress = {\n bundleDetails: BundleDetails;\n transformedFileCount: number;\n totalFileCount: number;\n ratio: number;\n};\n\nexport { TerminalReportableEvent };\n\nexport type BuildPhase = 'in_progress' | 'done' | 'failed';\n\n/**\n * Code across the application takes a reporter as an option and calls the\n * update whenever one of the ReportableEvent happens. Code does not directly\n * write to the standard output, because a build would be:\n *\n * 1. ad-hoc, embedded into another tool, in which case we do not want to\n * pollute that tool's own output. The tool is free to present the\n * warnings/progress we generate any way they want, by specifying a custom\n * reporter.\n * 2. run as a background process from another tool, in which case we want\n * to expose updates in a way that is easily machine-readable, for example\n * a JSON-stream. We don't want to pollute it with textual messages.\n *\n * We centralize terminal reporting into a single place because we want the\n * output to be robust and consistent. The most common reporter is\n * TerminalReporter, that should be the only place in the application should\n * access the `terminal` module (nor the `console`).\n */\nexport type Reporter = { update(event: ReportableEvent): void };\n\nexport interface SnippetError extends Error {\n code?: string;\n filename?: string;\n snippet?: string;\n\n /** Module that failed to load ex 'fs' */\n targetModuleName?: string;\n originModulePath?: string;\n\n errors?: any[];\n}\n\nexport interface TerminalReporterInterface {\n new (terminal: Terminal): TerminalReporterInterface;\n\n /**\n * The bundle builds for which we are actively maintaining the status on the\n * terminal, ie. showing a progress bar. There can be several bundles being\n * built at the same time.\n */\n _activeBundles: Map<string, BundleProgress>;\n\n _scheduleUpdateBundleProgress: {\n (data: { buildID: string; transformedFileCount: number; totalFileCount: number }): void;\n cancel(): void;\n };\n\n /** Set in super type */\n terminal: Terminal;\n\n /**\n * Construct a message that represents the progress of a\n * single bundle build, for example:\n *\n * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)\n */\n _getBundleStatusMessage(\n {\n bundleDetails: { entryFile, bundleType, runtimeBytecodeVersion },\n transformedFileCount,\n totalFileCount,\n ratio,\n }: BundleProgress,\n phase: BuildPhase\n ): string;\n\n /**\n * This function is only concerned with logging and should not do state\n * or terminal status updates.\n */\n _log(event: TerminalReportableEvent): void;\n\n _logCacheDisabled(reason: GlobalCacheDisabledReason): void;\n\n _logBundleBuildDone(buildID: string): void;\n\n _logBundleBuildFailed(buildID: string): void;\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void;\n\n _logInitializingFailed(port: number, error: SnippetError): void;\n\n /**\n * We do not want to log the whole stacktrace for bundling error, because\n * these are operational errors, not programming errors, and the stacktrace\n * is not actionable to end users.\n */\n _logBundlingError(error: SnippetError): void;\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress({\n buildID,\n transformedFileCount,\n totalFileCount,\n }:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/TerminalReporter.types.ts"],"sourcesContent":["import type { ReportableEvent } from 'metro';\nimport type { TerminalReportableEvent } from 'metro/src/lib/TerminalReporter';\nimport type { Terminal } from 'metro-core';\n\nexport type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';\n\nexport type BundleDetails = {\n buildID?: string;\n bundleType: string;\n dev: boolean;\n entryFile: string;\n minify: boolean;\n platform: string | null | undefined;\n customTransformOptions?: { environment?: 'node' };\n runtimeBytecodeVersion: number | null | undefined;\n};\n\nexport type BundleProgress = {\n bundleDetails: BundleDetails;\n transformedFileCount: number;\n totalFileCount: number;\n ratio: number;\n};\n\nexport type BundleProgressUpdate = {\n buildID: string;\n transformedFileCount: number;\n totalFileCount: number;\n};\n\nexport { TerminalReportableEvent };\n\nexport type BuildPhase = 'in_progress' | 'done' | 'failed';\n\n/**\n * Code across the application takes a reporter as an option and calls the\n * update whenever one of the ReportableEvent happens. Code does not directly\n * write to the standard output, because a build would be:\n *\n * 1. ad-hoc, embedded into another tool, in which case we do not want to\n * pollute that tool's own output. The tool is free to present the\n * warnings/progress we generate any way they want, by specifying a custom\n * reporter.\n * 2. run as a background process from another tool, in which case we want\n * to expose updates in a way that is easily machine-readable, for example\n * a JSON-stream. We don't want to pollute it with textual messages.\n *\n * We centralize terminal reporting into a single place because we want the\n * output to be robust and consistent. The most common reporter is\n * TerminalReporter, that should be the only place in the application should\n * access the `terminal` module (nor the `console`).\n */\nexport type Reporter = { update(event: ReportableEvent): void };\n\nexport interface SnippetError extends Error {\n code?: string;\n filename?: string;\n snippet?: string;\n\n /** Module that failed to load ex 'fs' */\n targetModuleName?: string;\n originModulePath?: string;\n\n errors?: any[];\n}\n\nexport interface TerminalReporterInterface {\n new (terminal: Terminal): TerminalReporterInterface;\n\n /**\n * The bundle builds for which we are actively maintaining the status on the\n * terminal, ie. showing a progress bar. There can be several bundles being\n * built at the same time.\n */\n _activeBundles: Map<string, BundleProgress>;\n\n _scheduleUpdateBundleProgress: {\n (data: { buildID: string; transformedFileCount: number; totalFileCount: number }): void;\n cancel(): void;\n };\n\n /** Set in super type */\n terminal: Terminal;\n\n /**\n * Construct a message that represents the progress of a\n * single bundle build, for example:\n *\n * BUNDLE path/to/bundle.js ▓▓▓▓▓░░░░░░░░░░░ 36.6% (4790/7922)\n */\n _getBundleStatusMessage(\n {\n bundleDetails: { entryFile, bundleType, runtimeBytecodeVersion },\n transformedFileCount,\n totalFileCount,\n ratio,\n }: BundleProgress,\n phase: BuildPhase\n ): string;\n\n /**\n * This function is only concerned with logging and should not do state\n * or terminal status updates.\n */\n _log(event: TerminalReportableEvent): void;\n\n _logCacheDisabled(reason: GlobalCacheDisabledReason): void;\n\n _logBundleBuildDone(buildID: string): void;\n\n _logBundleBuildFailed(buildID: string): void;\n\n _logInitializing(port: number, hasReducedPerformance: boolean): void;\n\n _logInitializingFailed(port: number, error: SnippetError): void;\n\n /**\n * We do not want to log the whole stacktrace for bundling error, because\n * these are operational errors, not programming errors, and the stacktrace\n * is not actionable to end users.\n */\n _logBundlingError(error: SnippetError): void;\n\n /**\n * We use Math.pow(ratio, 2) to as a conservative measure of progress because\n * we know the `totalCount` is going to progressively increase as well. We\n * also prevent the ratio from going backwards.\n */\n _updateBundleProgress({\n buildID,\n transformedFileCount,\n totalFileCount,\n }: BundleProgressUpdate): void;\n\n /**\n * This function is exclusively concerned with updating the internal state.\n * No logging or status updates should be done at this point.\n */\n _updateState(event: TerminalReportableEvent): void;\n /**\n * Return a status message that is always consistent with the current state\n * of the application. Having this single function ensures we don't have\n * different call sites overriding each other status messages.\n */\n _getStatusMessage(): string;\n\n _logHmrClientError(e: Error): void;\n\n /**\n * Single entry point for reporting events. That allows us to implement the\n * corresponding JSON reporter easily and have a consistent reporting.\n */\n update(event: TerminalReportableEvent): void;\n}\n"],"names":[],"mappings":"AAAA"}
|
|
@@ -22,7 +22,6 @@ var _exit = require("../../../utils/exit");
|
|
|
22
22
|
var _interactive = require("../../../utils/interactive");
|
|
23
23
|
var _loadTsConfigPaths = require("../../../utils/tsconfig/loadTsConfigPaths");
|
|
24
24
|
var _resolveWithTsConfigPaths = require("../../../utils/tsconfig/resolveWithTsConfigPaths");
|
|
25
|
-
var _webSupportProjectPrerequisite = require("../../doctor/web/WebSupportProjectPrerequisite");
|
|
26
25
|
function _interopRequireDefault(obj) {
|
|
27
26
|
return obj && obj.__esModule ? obj : {
|
|
28
27
|
default: obj
|
|
@@ -134,7 +133,7 @@ function withExtendedResolver(config, { tsconfig , isTsconfigPathsEnabled , isFa
|
|
|
134
133
|
]
|
|
135
134
|
};
|
|
136
135
|
var _paths1, _baseUrl1;
|
|
137
|
-
let tsConfigResolve = (tsconfig == null ? void 0 : tsconfig.paths) ? _resolveWithTsConfigPaths.resolveWithTsConfigPaths.bind(_resolveWithTsConfigPaths.resolveWithTsConfigPaths, {
|
|
136
|
+
let tsConfigResolve = isTsconfigPathsEnabled && ((tsconfig == null ? void 0 : tsconfig.paths) || (tsconfig == null ? void 0 : tsconfig.baseUrl) != null) ? _resolveWithTsConfigPaths.resolveWithTsConfigPaths.bind(_resolveWithTsConfigPaths.resolveWithTsConfigPaths, {
|
|
138
137
|
paths: (_paths1 = tsconfig.paths) != null ? _paths1 : {},
|
|
139
138
|
baseUrl: (_baseUrl1 = tsconfig.baseUrl) != null ? _baseUrl1 : config.projectRoot,
|
|
140
139
|
hasBaseUrl: !!tsconfig.baseUrl
|
|
@@ -336,7 +335,6 @@ function shouldAliasModule(input, alias) {
|
|
|
336
335
|
return input.platform === alias.platform && ((ref = input.result) == null ? void 0 : ref.type) === "sourceFile" && typeof ((ref6 = input.result) == null ? void 0 : ref6.filePath) === "string" && normalizeSlashes(input.result.filePath).endsWith(alias.output);
|
|
337
336
|
}
|
|
338
337
|
async function withMetroMultiPlatformAsync(projectRoot, { config , exp , platformBundlers , isTsconfigPathsEnabled , webOutput , isFastResolverEnabled , isExporting }) {
|
|
339
|
-
var ref7;
|
|
340
338
|
if (!config.projectRoot) {
|
|
341
339
|
// @ts-expect-error: read-only types
|
|
342
340
|
config.projectRoot = projectRoot;
|
|
@@ -364,9 +362,6 @@ async function withMetroMultiPlatformAsync(projectRoot, { config , exp , platfor
|
|
|
364
362
|
config.transformer._expoRouterWebRendering = webOutput;
|
|
365
363
|
// @ts-expect-error: Invalidate the cache when the location of expo-router changes on-disk.
|
|
366
364
|
config.transformer._expoRouterPath = _resolveFrom.default.silent(projectRoot, "expo-router");
|
|
367
|
-
if (((ref7 = exp.platforms) == null ? void 0 : ref7.includes("web")) && platformBundlers.web === "metro") {
|
|
368
|
-
await new _webSupportProjectPrerequisite.WebSupportProjectPrerequisite(projectRoot).assertAsync();
|
|
369
|
-
}
|
|
370
365
|
let tsconfig = null;
|
|
371
366
|
if (isTsconfigPathsEnabled) {
|
|
372
367
|
tsconfig = await (0, _loadTsConfigPaths).loadTsConfigPathsAsync(projectRoot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/withMetroMultiPlatform.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 { ExpoConfig, Platform } from '@expo/config';\nimport fs from 'fs';\nimport { ConfigT } from 'metro-config';\nimport { Resolution, ResolutionContext, CustomResolutionContext } from 'metro-resolver';\nimport * as metroResolver from 'metro-resolver';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { createFastResolver } from './createExpoMetroResolver';\nimport {\n EXTERNAL_REQUIRE_NATIVE_POLYFILL,\n EXTERNAL_REQUIRE_POLYFILL,\n METRO_SHIMS_FOLDER,\n getNodeExternalModuleId,\n isNodeExternal,\n setupNodeExternals,\n setupShimFiles,\n} from './externals';\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport {\n withMetroErrorReportingResolver,\n withMetroMutatedResolverContext,\n withMetroResolvers,\n} from './withMetroResolvers';\nimport { Log } from '../../../log';\nimport { FileNotifier } from '../../../utils/FileNotifier';\nimport { env } from '../../../utils/env';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { loadTsConfigPathsAsync, TsConfigPaths } from '../../../utils/tsconfig/loadTsConfigPaths';\nimport { resolveWithTsConfigPaths } from '../../../utils/tsconfig/resolveWithTsConfigPaths';\nimport { WebSupportProjectPrerequisite } from '../../doctor/web/WebSupportProjectPrerequisite';\nimport { PlatformBundlers } from '../platformBundlers';\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nconst debug = require('debug')('expo:start:server:metro:multi-platform') as typeof console.log;\n\nfunction withWebPolyfills(config: ConfigT): ConfigT {\n const originalGetPolyfills = config.serializer.getPolyfills\n ? config.serializer.getPolyfills.bind(config.serializer)\n : () => [];\n\n const getPolyfills = (ctx: { platform: string | null }): readonly string[] => {\n if (ctx.platform === 'web') {\n return [\n // NOTE: We might need this for all platforms\n path.join(config.projectRoot, EXTERNAL_REQUIRE_POLYFILL),\n // TODO: runtime polyfills, i.e. Fast Refresh, error overlay, React Dev Tools...\n ];\n }\n // Generally uses `rn-get-polyfills`\n const polyfills = originalGetPolyfills(ctx);\n\n return [...polyfills, path.join(config.projectRoot, EXTERNAL_REQUIRE_NATIVE_POLYFILL)];\n };\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n getPolyfills,\n },\n };\n}\n\nfunction normalizeSlashes(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nexport function getNodejsExtensions(srcExts: readonly string[]): string[] {\n const mjsExts = srcExts.filter((ext) => /mjs$/.test(ext));\n const nodejsSourceExtensions = srcExts.filter((ext) => !/mjs$/.test(ext));\n // find index of last `*.js` extension\n const jsIndex = nodejsSourceExtensions.reduce((index, ext, i) => {\n return /jsx?$/.test(ext) ? i : index;\n }, -1);\n\n // insert `*.mjs` extensions after `*.js` extensions\n nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);\n\n return nodejsSourceExtensions;\n}\n\n/**\n * Apply custom resolvers to do the following:\n * - Disable `.native.js` extensions on web.\n * - Alias `react-native` to `react-native-web` on web.\n * - Redirect `react-native-web/dist/modules/AssetRegistry/index.js` to `@react-native/assets/registry.js` on web.\n * - Add support for `tsconfig.json`/`jsconfig.json` aliases via `compilerOptions.paths`.\n */\nexport function withExtendedResolver(\n config: ConfigT,\n {\n tsconfig,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n isExporting,\n }: {\n tsconfig: TsConfigPaths | null;\n isTsconfigPathsEnabled?: boolean;\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n }\n) {\n if (isFastResolverEnabled) {\n Log.warn(`Experimental bundling features are enabled.`);\n }\n\n // Get the `transformer.assetRegistryPath`\n // this needs to be unified since you can't dynamically\n // swap out the transformer based on platform.\n const assetRegistryPath = fs.realpathSync(\n path.resolve(resolveFrom(config.projectRoot, '@react-native/assets-registry/registry.js'))\n );\n\n const defaultResolver = metroResolver.resolve;\n const resolver = isFastResolverEnabled\n ? createFastResolver({\n preserveSymlinks: config.resolver?.unstable_enableSymlinks ?? true,\n blockList: Array.isArray(config.resolver?.blockList)\n ? config.resolver?.blockList\n : [config.resolver?.blockList],\n })\n : defaultResolver;\n\n const aliases: { [key: string]: Record<string, string> } = {\n web: {\n 'react-native': 'react-native-web',\n 'react-native/index': 'react-native-web',\n },\n };\n\n const universalAliases: [RegExp, string][] = [];\n\n // This package is currently always installed as it is included in the `expo` package.\n if (resolveFrom.silent(config.projectRoot, '@expo/vector-icons')) {\n debug('Enabling alias: react-native-vector-icons -> @expo/vector-icons');\n universalAliases.push([/^react-native-vector-icons(\\/.*)?/, '@expo/vector-icons$1']);\n }\n\n const preferredMainFields: { [key: string]: string[] } = {\n // Defaults from Expo Webpack. Most packages using `react-native` don't support web\n // in the `react-native` field, so we should prefer the `browser` field.\n // https://github.com/expo/router/issues/37\n web: ['browser', 'module', 'main'],\n };\n\n let tsConfigResolve = tsconfig?.paths\n ? resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsconfig.paths ?? {},\n baseUrl: tsconfig.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsconfig.baseUrl,\n })\n : null;\n\n // TODO: Move this to be a transform key for invalidation.\n if (!isExporting && isInteractive()) {\n if (isTsconfigPathsEnabled) {\n // TODO: We should track all the files that used imports and invalidate them\n // currently the user will need to save all the files that use imports to\n // use the new aliases.\n const configWatcher = new FileNotifier(config.projectRoot, [\n './tsconfig.json',\n './jsconfig.json',\n ]);\n configWatcher.startObserving(() => {\n debug('Reloading tsconfig.json');\n loadTsConfigPathsAsync(config.projectRoot).then((tsConfigPaths) => {\n if (tsConfigPaths?.paths && !!Object.keys(tsConfigPaths.paths).length) {\n debug('Enabling tsconfig.json paths support');\n tsConfigResolve = resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsConfigPaths.paths ?? {},\n baseUrl: tsConfigPaths.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsConfigPaths.baseUrl,\n });\n } else {\n debug('Disabling tsconfig.json paths support');\n tsConfigResolve = null;\n }\n });\n });\n\n // TODO: This probably prevents the process from exiting.\n installExitHooks(() => {\n configWatcher.stopObserving();\n });\n } else {\n debug('Skipping tsconfig.json paths support');\n }\n }\n\n let nodejsSourceExtensions: string[] | null = null;\n\n const shimsFolder = path.join(config.projectRoot, METRO_SHIMS_FOLDER);\n\n function getStrictResolver(\n { resolveRequest, ...context }: ResolutionContext,\n platform: string | null\n ) {\n return function doResolve(moduleName: string): Resolution {\n return resolver(context, moduleName, platform);\n };\n }\n\n function getOptionalResolver(context: ResolutionContext, platform: string | null) {\n const doResolve = getStrictResolver(context, platform);\n return function optionalResolve(moduleName: string): Resolution | null {\n try {\n return doResolve(moduleName);\n } catch (error) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n }\n return null;\n };\n }\n\n const metroConfigWithCustomResolver = withMetroResolvers(config, [\n // tsconfig paths\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n return (\n tsConfigResolve?.(\n {\n originModulePath: context.originModulePath,\n moduleName,\n },\n getOptionalResolver(context, platform)\n ) ?? null\n );\n },\n\n // Node.js externals support\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // This is a web-only feature, we may extend the shimming to native platforms in the future.\n if (platform !== 'web') {\n return null;\n }\n\n const moduleId = isNodeExternal(moduleName);\n if (!moduleId) {\n return null;\n }\n\n if (\n // In browser runtimes, we want to either resolve a local node module by the same name, or shim the module to\n // prevent crashing when Node.js built-ins are imported.\n context.customResolverOptions?.environment !== 'node'\n ) {\n // Perform optional resolve first. If the module doesn't exist (no module in the node_modules)\n // then we can mock the file to use an empty module.\n const result = getOptionalResolver(context, platform)(moduleName);\n return (\n result ?? {\n // In this case, mock the file to use an empty module.\n type: 'empty',\n }\n );\n }\n\n const redirectedModuleName = getNodeExternalModuleId(context.originModulePath, moduleId);\n debug(`Redirecting Node.js external \"${moduleId}\" to \"${redirectedModuleName}\"`);\n return getStrictResolver(context, platform)(redirectedModuleName);\n },\n\n // Basic moduleId aliases\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // Conditionally remap `react-native` to `react-native-web` on web in\n // a way that doesn't require Babel to resolve the alias.\n if (platform && platform in aliases && aliases[platform][moduleName]) {\n const redirectedModuleName = aliases[platform][moduleName];\n return getStrictResolver(context, platform)(redirectedModuleName);\n }\n\n for (const [matcher, alias] of universalAliases) {\n const match = moduleName.match(matcher);\n if (match) {\n const aliasedModule = alias.replace(\n /\\$(\\d+)/g,\n (_, index) => match[parseInt(index, 10)] ?? ''\n );\n const doResolve = getStrictResolver(context, platform);\n debug(`Alias \"${moduleName}\" to \"${aliasedModule}\"`);\n return doResolve(aliasedModule);\n }\n }\n\n return null;\n },\n\n // HACK(EvanBacon):\n // React Native uses `event-target-shim` incorrectly and this causes the native runtime\n // to fail to load. This is a temporary workaround until we can fix this upstream.\n // https://github.com/facebook/react-native/pull/38628\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n if (platform !== 'web' && moduleName === 'event-target-shim') {\n debug('For event-target-shim to use js:', context.originModulePath);\n const doResolve = getStrictResolver(context, platform);\n return doResolve('event-target-shim/dist/event-target-shim.js');\n }\n\n return null;\n },\n\n // TODO: Reduce these as much as possible in the future.\n // Complex post-resolution rewrites.\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n const doResolve = getStrictResolver(context, platform);\n\n const result = doResolve(moduleName);\n\n if (result.type !== 'sourceFile') {\n return result;\n }\n\n // Replace the web resolver with the original one.\n // This is basically an alias for web-only.\n // TODO: Drop this in favor of the standalone asset registry module.\n if (shouldAliasAssetRegistryForWeb(platform, result)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = assetRegistryPath;\n }\n\n if (platform === 'web' && result.filePath.includes('node_modules')) {\n // Replace with static shims\n\n const normalName = normalizeSlashes(result.filePath)\n // Drop everything up until the `node_modules` folder.\n .replace(/.*node_modules\\//, '');\n\n const shimPath = path.join(shimsFolder, normalName);\n if (fs.existsSync(shimPath)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = shimPath;\n }\n }\n\n return result;\n },\n ]);\n\n // Ensure we mutate the resolution context to include the custom resolver options for server and web.\n const metroConfigWithCustomContext = withMetroMutatedResolverContext(\n metroConfigWithCustomResolver,\n (\n immutableContext: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ): CustomResolutionContext => {\n const context: Mutable<CustomResolutionContext> = {\n ...immutableContext,\n preferNativePlatform: platform !== 'web',\n };\n\n if (context.customResolverOptions?.environment === 'node') {\n // Adjust nodejs source extensions to sort mjs after js, including platform variants.\n if (nodejsSourceExtensions === null) {\n nodejsSourceExtensions = getNodejsExtensions(context.sourceExts);\n }\n context.sourceExts = nodejsSourceExtensions;\n\n context.unstable_enablePackageExports = true;\n context.unstable_conditionNames = ['node', 'require'];\n context.unstable_conditionsByPlatform = {};\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['main', 'module'];\n } else {\n // Non-server changes\n\n if (!env.EXPO_METRO_NO_MAIN_FIELD_OVERRIDE && platform && platform in preferredMainFields) {\n context.mainFields = preferredMainFields[platform];\n }\n }\n\n return context;\n }\n );\n\n return withMetroErrorReportingResolver(metroConfigWithCustomContext);\n}\n\n/** @returns `true` if the incoming resolution should be swapped on web. */\nexport function shouldAliasAssetRegistryForWeb(\n platform: string | null,\n result: Resolution\n): boolean {\n return (\n platform === 'web' &&\n result?.type === 'sourceFile' &&\n typeof result?.filePath === 'string' &&\n normalizeSlashes(result.filePath).endsWith(\n 'react-native-web/dist/modules/AssetRegistry/index.js'\n )\n );\n}\n/** @returns `true` if the incoming resolution should be swapped. */\nexport function shouldAliasModule(\n input: {\n platform: string | null;\n result: Resolution;\n },\n alias: { platform: string; output: string }\n): boolean {\n return (\n input.platform === alias.platform &&\n input.result?.type === 'sourceFile' &&\n typeof input.result?.filePath === 'string' &&\n normalizeSlashes(input.result.filePath).endsWith(alias.output)\n );\n}\n\n/** Add support for `react-native-web` and the Web platform. */\nexport async function withMetroMultiPlatformAsync(\n projectRoot: string,\n {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled,\n webOutput,\n isFastResolverEnabled,\n isExporting,\n }: {\n config: ConfigT;\n exp: ExpoConfig;\n isTsconfigPathsEnabled: boolean;\n platformBundlers: PlatformBundlers;\n webOutput?: 'single' | 'static' | 'server';\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n }\n) {\n if (!config.projectRoot) {\n // @ts-expect-error: read-only types\n config.projectRoot = projectRoot;\n }\n\n // Required for @expo/metro-runtime to format paths in the web LogBox.\n process.env.EXPO_PUBLIC_PROJECT_ROOT = process.env.EXPO_PUBLIC_PROJECT_ROOT ?? projectRoot;\n\n if (['static', 'server'].includes(webOutput ?? '')) {\n // Enable static rendering in runtime space.\n process.env.EXPO_PUBLIC_USE_STATIC = '1';\n }\n\n // This is used for running Expo CLI in development against projects outside the monorepo.\n if (!isDirectoryIn(__dirname, projectRoot)) {\n if (!config.watchFolders) {\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders = [];\n }\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders.push(path.join(require.resolve('metro-runtime/package.json'), '../..'));\n }\n\n // @ts-expect-error\n config.transformer._expoRouterWebRendering = webOutput;\n // @ts-expect-error: Invalidate the cache when the location of expo-router changes on-disk.\n config.transformer._expoRouterPath = resolveFrom.silent(projectRoot, 'expo-router');\n\n if (exp.platforms?.includes('web') && platformBundlers.web === 'metro') {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n let tsconfig: null | TsConfigPaths = null;\n\n if (isTsconfigPathsEnabled) {\n tsconfig = await loadTsConfigPathsAsync(projectRoot);\n }\n\n await setupShimFiles(projectRoot);\n await setupNodeExternals(projectRoot);\n\n let expoConfigPlatforms = Object.entries(platformBundlers)\n .filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n .map(([platform]) => platform);\n\n if (Array.isArray(config.resolver.platforms)) {\n expoConfigPlatforms = [...new Set(expoConfigPlatforms.concat(config.resolver.platforms))];\n }\n\n // @ts-expect-error: typed as `readonly`.\n config.resolver.platforms = expoConfigPlatforms;\n\n config = withWebPolyfills(config);\n\n return withExtendedResolver(config, {\n tsconfig,\n isExporting,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n });\n}\n\nfunction isDirectoryIn(a: string, b: string) {\n return b.startsWith(a) && b.length > a.length;\n}\n"],"names":["getNodejsExtensions","withExtendedResolver","shouldAliasAssetRegistryForWeb","shouldAliasModule","withMetroMultiPlatformAsync","metroResolver","debug","require","withWebPolyfills","config","originalGetPolyfills","serializer","getPolyfills","bind","ctx","platform","path","join","projectRoot","EXTERNAL_REQUIRE_POLYFILL","polyfills","EXTERNAL_REQUIRE_NATIVE_POLYFILL","normalizeSlashes","p","replace","srcExts","mjsExts","filter","ext","test","nodejsSourceExtensions","jsIndex","reduce","index","i","splice","tsconfig","isTsconfigPathsEnabled","isFastResolverEnabled","isExporting","Log","warn","assetRegistryPath","fs","realpathSync","resolve","resolveFrom","defaultResolver","resolver","createFastResolver","preserveSymlinks","unstable_enableSymlinks","blockList","Array","isArray","aliases","web","universalAliases","silent","push","preferredMainFields","tsConfigResolve","paths","resolveWithTsConfigPaths","baseUrl","hasBaseUrl","isInteractive","configWatcher","FileNotifier","startObserving","loadTsConfigPathsAsync","then","tsConfigPaths","Object","keys","length","installExitHooks","stopObserving","shimsFolder","METRO_SHIMS_FOLDER","getStrictResolver","resolveRequest","context","doResolve","moduleName","getOptionalResolver","optionalResolve","error","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","metroConfigWithCustomResolver","withMetroResolvers","originModulePath","moduleId","isNodeExternal","customResolverOptions","environment","result","type","redirectedModuleName","getNodeExternalModuleId","matcher","alias","match","aliasedModule","_","parseInt","filePath","includes","normalName","shimPath","existsSync","metroConfigWithCustomContext","withMetroMutatedResolverContext","immutableContext","preferNativePlatform","sourceExts","unstable_enablePackageExports","unstable_conditionNames","unstable_conditionsByPlatform","mainFields","env","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","withMetroErrorReportingResolver","endsWith","input","output","exp","platformBundlers","webOutput","process","EXPO_PUBLIC_PROJECT_ROOT","EXPO_PUBLIC_USE_STATIC","isDirectoryIn","__dirname","watchFolders","transformer","_expoRouterWebRendering","_expoRouterPath","platforms","WebSupportProjectPrerequisite","assertAsync","setupShimFiles","setupNodeExternals","expoConfigPlatforms","entries","bundler","map","Set","concat","a","b","startsWith"],"mappings":"AAMA;;;;QAsEgBA,mBAAmB,GAAnBA,mBAAmB;QAqBnBC,oBAAoB,GAApBA,oBAAoB;QAySpBC,8BAA8B,GAA9BA,8BAA8B;QAc9BC,iBAAiB,GAAjBA,iBAAiB;QAgBXC,2BAA2B,GAA3BA,2BAA2B;AAjalC,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAGPC,IAAAA,aAAa,mCAAM,gBAAgB,EAAtB;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEH,IAAA,wBAA2B,WAA3B,2BAA2B,CAAA;AASvD,IAAA,UAAa,WAAb,aAAa,CAAA;AACmD,IAAA,YAAe,WAAf,eAAe,CAAA;AAK/E,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACT,IAAA,IAAc,WAAd,cAAc,CAAA;AACL,IAAA,aAA6B,WAA7B,6BAA6B,CAAA;AACtC,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACP,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACxB,IAAA,YAA4B,WAA5B,4BAA4B,CAAA;AACJ,IAAA,kBAA2C,WAA3C,2CAA2C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AIsC,KAAK,CAACC,OAAO,CAAC7C,MAAM,CAACuC,QAAQ,CAAC4F,SAAS,CAAC,EAAE;QAC5CK,mBAAmB,GAAG;eAAI,IAAII,GAAG,CAACJ,mBAAmB,CAACK,MAAM,CAAC7I,MAAM,CAACuC,QAAQ,CAAC4F,SAAS,CAAC,CAAC;SAAC,CAAC;KAC3F;IAED,yCAAyC;IACzCnI,MAAM,CAACuC,QAAQ,CAAC4F,SAAS,GAAGK,mBAAmB,CAAC;IAEhDxI,MAAM,GAAGD,gBAAgB,CAACC,MAAM,CAAC,CAAC;IAElC,OAAOR,oBAAoB,CAACQ,MAAM,EAAE;QAClC2B,QAAQ;QACRG,WAAW;QACXF,sBAAsB;QACtBC,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,SAASgG,aAAa,CAACiB,CAAS,EAAEC,CAAS,EAAE;IAC3C,OAAOA,CAAC,CAACC,UAAU,CAACF,CAAC,CAAC,IAAIC,CAAC,CAAC7E,MAAM,GAAG4E,CAAC,CAAC5E,MAAM,CAAC;CAC/C"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/withMetroMultiPlatform.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 { ExpoConfig, Platform } from '@expo/config';\nimport fs from 'fs';\nimport { ConfigT } from 'metro-config';\nimport { Resolution, ResolutionContext, CustomResolutionContext } from 'metro-resolver';\nimport * as metroResolver from 'metro-resolver';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { createFastResolver } from './createExpoMetroResolver';\nimport {\n EXTERNAL_REQUIRE_NATIVE_POLYFILL,\n EXTERNAL_REQUIRE_POLYFILL,\n METRO_SHIMS_FOLDER,\n getNodeExternalModuleId,\n isNodeExternal,\n setupNodeExternals,\n setupShimFiles,\n} from './externals';\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport {\n withMetroErrorReportingResolver,\n withMetroMutatedResolverContext,\n withMetroResolvers,\n} from './withMetroResolvers';\nimport { Log } from '../../../log';\nimport { FileNotifier } from '../../../utils/FileNotifier';\nimport { env } from '../../../utils/env';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { loadTsConfigPathsAsync, TsConfigPaths } from '../../../utils/tsconfig/loadTsConfigPaths';\nimport { resolveWithTsConfigPaths } from '../../../utils/tsconfig/resolveWithTsConfigPaths';\nimport { PlatformBundlers } from '../platformBundlers';\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nconst debug = require('debug')('expo:start:server:metro:multi-platform') as typeof console.log;\n\nfunction withWebPolyfills(config: ConfigT): ConfigT {\n const originalGetPolyfills = config.serializer.getPolyfills\n ? config.serializer.getPolyfills.bind(config.serializer)\n : () => [];\n\n const getPolyfills = (ctx: { platform: string | null }): readonly string[] => {\n if (ctx.platform === 'web') {\n return [\n // NOTE: We might need this for all platforms\n path.join(config.projectRoot, EXTERNAL_REQUIRE_POLYFILL),\n // TODO: runtime polyfills, i.e. Fast Refresh, error overlay, React Dev Tools...\n ];\n }\n // Generally uses `rn-get-polyfills`\n const polyfills = originalGetPolyfills(ctx);\n\n return [...polyfills, path.join(config.projectRoot, EXTERNAL_REQUIRE_NATIVE_POLYFILL)];\n };\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n getPolyfills,\n },\n };\n}\n\nfunction normalizeSlashes(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nexport function getNodejsExtensions(srcExts: readonly string[]): string[] {\n const mjsExts = srcExts.filter((ext) => /mjs$/.test(ext));\n const nodejsSourceExtensions = srcExts.filter((ext) => !/mjs$/.test(ext));\n // find index of last `*.js` extension\n const jsIndex = nodejsSourceExtensions.reduce((index, ext, i) => {\n return /jsx?$/.test(ext) ? i : index;\n }, -1);\n\n // insert `*.mjs` extensions after `*.js` extensions\n nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);\n\n return nodejsSourceExtensions;\n}\n\n/**\n * Apply custom resolvers to do the following:\n * - Disable `.native.js` extensions on web.\n * - Alias `react-native` to `react-native-web` on web.\n * - Redirect `react-native-web/dist/modules/AssetRegistry/index.js` to `@react-native/assets/registry.js` on web.\n * - Add support for `tsconfig.json`/`jsconfig.json` aliases via `compilerOptions.paths`.\n */\nexport function withExtendedResolver(\n config: ConfigT,\n {\n tsconfig,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n isExporting,\n }: {\n tsconfig: TsConfigPaths | null;\n isTsconfigPathsEnabled?: boolean;\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n }\n) {\n if (isFastResolverEnabled) {\n Log.warn(`Experimental bundling features are enabled.`);\n }\n\n // Get the `transformer.assetRegistryPath`\n // this needs to be unified since you can't dynamically\n // swap out the transformer based on platform.\n const assetRegistryPath = fs.realpathSync(\n path.resolve(resolveFrom(config.projectRoot, '@react-native/assets-registry/registry.js'))\n );\n\n const defaultResolver = metroResolver.resolve;\n const resolver = isFastResolverEnabled\n ? createFastResolver({\n preserveSymlinks: config.resolver?.unstable_enableSymlinks ?? true,\n blockList: Array.isArray(config.resolver?.blockList)\n ? config.resolver?.blockList\n : [config.resolver?.blockList],\n })\n : defaultResolver;\n\n const aliases: { [key: string]: Record<string, string> } = {\n web: {\n 'react-native': 'react-native-web',\n 'react-native/index': 'react-native-web',\n },\n };\n\n const universalAliases: [RegExp, string][] = [];\n\n // This package is currently always installed as it is included in the `expo` package.\n if (resolveFrom.silent(config.projectRoot, '@expo/vector-icons')) {\n debug('Enabling alias: react-native-vector-icons -> @expo/vector-icons');\n universalAliases.push([/^react-native-vector-icons(\\/.*)?/, '@expo/vector-icons$1']);\n }\n\n const preferredMainFields: { [key: string]: string[] } = {\n // Defaults from Expo Webpack. Most packages using `react-native` don't support web\n // in the `react-native` field, so we should prefer the `browser` field.\n // https://github.com/expo/router/issues/37\n web: ['browser', 'module', 'main'],\n };\n\n let tsConfigResolve =\n isTsconfigPathsEnabled && (tsconfig?.paths || tsconfig?.baseUrl != null)\n ? resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsconfig.paths ?? {},\n baseUrl: tsconfig.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsconfig.baseUrl,\n })\n : null;\n\n // TODO: Move this to be a transform key for invalidation.\n if (!isExporting && isInteractive()) {\n if (isTsconfigPathsEnabled) {\n // TODO: We should track all the files that used imports and invalidate them\n // currently the user will need to save all the files that use imports to\n // use the new aliases.\n const configWatcher = new FileNotifier(config.projectRoot, [\n './tsconfig.json',\n './jsconfig.json',\n ]);\n configWatcher.startObserving(() => {\n debug('Reloading tsconfig.json');\n loadTsConfigPathsAsync(config.projectRoot).then((tsConfigPaths) => {\n if (tsConfigPaths?.paths && !!Object.keys(tsConfigPaths.paths).length) {\n debug('Enabling tsconfig.json paths support');\n tsConfigResolve = resolveWithTsConfigPaths.bind(resolveWithTsConfigPaths, {\n paths: tsConfigPaths.paths ?? {},\n baseUrl: tsConfigPaths.baseUrl ?? config.projectRoot,\n hasBaseUrl: !!tsConfigPaths.baseUrl,\n });\n } else {\n debug('Disabling tsconfig.json paths support');\n tsConfigResolve = null;\n }\n });\n });\n\n // TODO: This probably prevents the process from exiting.\n installExitHooks(() => {\n configWatcher.stopObserving();\n });\n } else {\n debug('Skipping tsconfig.json paths support');\n }\n }\n\n let nodejsSourceExtensions: string[] | null = null;\n\n const shimsFolder = path.join(config.projectRoot, METRO_SHIMS_FOLDER);\n\n function getStrictResolver(\n { resolveRequest, ...context }: ResolutionContext,\n platform: string | null\n ) {\n return function doResolve(moduleName: string): Resolution {\n return resolver(context, moduleName, platform);\n };\n }\n\n function getOptionalResolver(context: ResolutionContext, platform: string | null) {\n const doResolve = getStrictResolver(context, platform);\n return function optionalResolve(moduleName: string): Resolution | null {\n try {\n return doResolve(moduleName);\n } catch (error) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n }\n return null;\n };\n }\n\n const metroConfigWithCustomResolver = withMetroResolvers(config, [\n // tsconfig paths\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n return (\n tsConfigResolve?.(\n {\n originModulePath: context.originModulePath,\n moduleName,\n },\n getOptionalResolver(context, platform)\n ) ?? null\n );\n },\n\n // Node.js externals support\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // This is a web-only feature, we may extend the shimming to native platforms in the future.\n if (platform !== 'web') {\n return null;\n }\n\n const moduleId = isNodeExternal(moduleName);\n if (!moduleId) {\n return null;\n }\n\n if (\n // In browser runtimes, we want to either resolve a local node module by the same name, or shim the module to\n // prevent crashing when Node.js built-ins are imported.\n context.customResolverOptions?.environment !== 'node'\n ) {\n // Perform optional resolve first. If the module doesn't exist (no module in the node_modules)\n // then we can mock the file to use an empty module.\n const result = getOptionalResolver(context, platform)(moduleName);\n return (\n result ?? {\n // In this case, mock the file to use an empty module.\n type: 'empty',\n }\n );\n }\n\n const redirectedModuleName = getNodeExternalModuleId(context.originModulePath, moduleId);\n debug(`Redirecting Node.js external \"${moduleId}\" to \"${redirectedModuleName}\"`);\n return getStrictResolver(context, platform)(redirectedModuleName);\n },\n\n // Basic moduleId aliases\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n // Conditionally remap `react-native` to `react-native-web` on web in\n // a way that doesn't require Babel to resolve the alias.\n if (platform && platform in aliases && aliases[platform][moduleName]) {\n const redirectedModuleName = aliases[platform][moduleName];\n return getStrictResolver(context, platform)(redirectedModuleName);\n }\n\n for (const [matcher, alias] of universalAliases) {\n const match = moduleName.match(matcher);\n if (match) {\n const aliasedModule = alias.replace(\n /\\$(\\d+)/g,\n (_, index) => match[parseInt(index, 10)] ?? ''\n );\n const doResolve = getStrictResolver(context, platform);\n debug(`Alias \"${moduleName}\" to \"${aliasedModule}\"`);\n return doResolve(aliasedModule);\n }\n }\n\n return null;\n },\n\n // HACK(EvanBacon):\n // React Native uses `event-target-shim` incorrectly and this causes the native runtime\n // to fail to load. This is a temporary workaround until we can fix this upstream.\n // https://github.com/facebook/react-native/pull/38628\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n if (platform !== 'web' && moduleName === 'event-target-shim') {\n debug('For event-target-shim to use js:', context.originModulePath);\n const doResolve = getStrictResolver(context, platform);\n return doResolve('event-target-shim/dist/event-target-shim.js');\n }\n\n return null;\n },\n\n // TODO: Reduce these as much as possible in the future.\n // Complex post-resolution rewrites.\n (context: ResolutionContext, moduleName: string, platform: string | null) => {\n const doResolve = getStrictResolver(context, platform);\n\n const result = doResolve(moduleName);\n\n if (result.type !== 'sourceFile') {\n return result;\n }\n\n // Replace the web resolver with the original one.\n // This is basically an alias for web-only.\n // TODO: Drop this in favor of the standalone asset registry module.\n if (shouldAliasAssetRegistryForWeb(platform, result)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = assetRegistryPath;\n }\n\n if (platform === 'web' && result.filePath.includes('node_modules')) {\n // Replace with static shims\n\n const normalName = normalizeSlashes(result.filePath)\n // Drop everything up until the `node_modules` folder.\n .replace(/.*node_modules\\//, '');\n\n const shimPath = path.join(shimsFolder, normalName);\n if (fs.existsSync(shimPath)) {\n // @ts-expect-error: `readonly` for some reason.\n result.filePath = shimPath;\n }\n }\n\n return result;\n },\n ]);\n\n // Ensure we mutate the resolution context to include the custom resolver options for server and web.\n const metroConfigWithCustomContext = withMetroMutatedResolverContext(\n metroConfigWithCustomResolver,\n (\n immutableContext: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ): CustomResolutionContext => {\n const context: Mutable<CustomResolutionContext> = {\n ...immutableContext,\n preferNativePlatform: platform !== 'web',\n };\n\n if (context.customResolverOptions?.environment === 'node') {\n // Adjust nodejs source extensions to sort mjs after js, including platform variants.\n if (nodejsSourceExtensions === null) {\n nodejsSourceExtensions = getNodejsExtensions(context.sourceExts);\n }\n context.sourceExts = nodejsSourceExtensions;\n\n context.unstable_enablePackageExports = true;\n context.unstable_conditionNames = ['node', 'require'];\n context.unstable_conditionsByPlatform = {};\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['main', 'module'];\n } else {\n // Non-server changes\n\n if (!env.EXPO_METRO_NO_MAIN_FIELD_OVERRIDE && platform && platform in preferredMainFields) {\n context.mainFields = preferredMainFields[platform];\n }\n }\n\n return context;\n }\n );\n\n return withMetroErrorReportingResolver(metroConfigWithCustomContext);\n}\n\n/** @returns `true` if the incoming resolution should be swapped on web. */\nexport function shouldAliasAssetRegistryForWeb(\n platform: string | null,\n result: Resolution\n): boolean {\n return (\n platform === 'web' &&\n result?.type === 'sourceFile' &&\n typeof result?.filePath === 'string' &&\n normalizeSlashes(result.filePath).endsWith(\n 'react-native-web/dist/modules/AssetRegistry/index.js'\n )\n );\n}\n/** @returns `true` if the incoming resolution should be swapped. */\nexport function shouldAliasModule(\n input: {\n platform: string | null;\n result: Resolution;\n },\n alias: { platform: string; output: string }\n): boolean {\n return (\n input.platform === alias.platform &&\n input.result?.type === 'sourceFile' &&\n typeof input.result?.filePath === 'string' &&\n normalizeSlashes(input.result.filePath).endsWith(alias.output)\n );\n}\n\n/** Add support for `react-native-web` and the Web platform. */\nexport async function withMetroMultiPlatformAsync(\n projectRoot: string,\n {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled,\n webOutput,\n isFastResolverEnabled,\n isExporting,\n }: {\n config: ConfigT;\n exp: ExpoConfig;\n isTsconfigPathsEnabled: boolean;\n platformBundlers: PlatformBundlers;\n webOutput?: 'single' | 'static' | 'server';\n isFastResolverEnabled?: boolean;\n isExporting?: boolean;\n }\n) {\n if (!config.projectRoot) {\n // @ts-expect-error: read-only types\n config.projectRoot = projectRoot;\n }\n\n // Required for @expo/metro-runtime to format paths in the web LogBox.\n process.env.EXPO_PUBLIC_PROJECT_ROOT = process.env.EXPO_PUBLIC_PROJECT_ROOT ?? projectRoot;\n\n if (['static', 'server'].includes(webOutput ?? '')) {\n // Enable static rendering in runtime space.\n process.env.EXPO_PUBLIC_USE_STATIC = '1';\n }\n\n // This is used for running Expo CLI in development against projects outside the monorepo.\n if (!isDirectoryIn(__dirname, projectRoot)) {\n if (!config.watchFolders) {\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders = [];\n }\n // @ts-expect-error: watchFolders is readonly\n config.watchFolders.push(path.join(require.resolve('metro-runtime/package.json'), '../..'));\n }\n\n // @ts-expect-error\n config.transformer._expoRouterWebRendering = webOutput;\n // @ts-expect-error: Invalidate the cache when the location of expo-router changes on-disk.\n config.transformer._expoRouterPath = resolveFrom.silent(projectRoot, 'expo-router');\n\n let tsconfig: null | TsConfigPaths = null;\n\n if (isTsconfigPathsEnabled) {\n tsconfig = await loadTsConfigPathsAsync(projectRoot);\n }\n\n await setupShimFiles(projectRoot);\n await setupNodeExternals(projectRoot);\n\n let expoConfigPlatforms = Object.entries(platformBundlers)\n .filter(\n ([platform, bundler]) => bundler === 'metro' && exp.platforms?.includes(platform as Platform)\n )\n .map(([platform]) => platform);\n\n if (Array.isArray(config.resolver.platforms)) {\n expoConfigPlatforms = [...new Set(expoConfigPlatforms.concat(config.resolver.platforms))];\n }\n\n // @ts-expect-error: typed as `readonly`.\n config.resolver.platforms = expoConfigPlatforms;\n\n config = withWebPolyfills(config);\n\n return withExtendedResolver(config, {\n tsconfig,\n isExporting,\n isTsconfigPathsEnabled,\n isFastResolverEnabled,\n });\n}\n\nfunction isDirectoryIn(a: string, b: string) {\n return b.startsWith(a) && b.length > a.length;\n}\n"],"names":["getNodejsExtensions","withExtendedResolver","shouldAliasAssetRegistryForWeb","shouldAliasModule","withMetroMultiPlatformAsync","metroResolver","debug","require","withWebPolyfills","config","originalGetPolyfills","serializer","getPolyfills","bind","ctx","platform","path","join","projectRoot","EXTERNAL_REQUIRE_POLYFILL","polyfills","EXTERNAL_REQUIRE_NATIVE_POLYFILL","normalizeSlashes","p","replace","srcExts","mjsExts","filter","ext","test","nodejsSourceExtensions","jsIndex","reduce","index","i","splice","tsconfig","isTsconfigPathsEnabled","isFastResolverEnabled","isExporting","Log","warn","assetRegistryPath","fs","realpathSync","resolve","resolveFrom","defaultResolver","resolver","createFastResolver","preserveSymlinks","unstable_enableSymlinks","blockList","Array","isArray","aliases","web","universalAliases","silent","push","preferredMainFields","tsConfigResolve","paths","baseUrl","resolveWithTsConfigPaths","hasBaseUrl","isInteractive","configWatcher","FileNotifier","startObserving","loadTsConfigPathsAsync","then","tsConfigPaths","Object","keys","length","installExitHooks","stopObserving","shimsFolder","METRO_SHIMS_FOLDER","getStrictResolver","resolveRequest","context","doResolve","moduleName","getOptionalResolver","optionalResolve","error","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","metroConfigWithCustomResolver","withMetroResolvers","originModulePath","moduleId","isNodeExternal","customResolverOptions","environment","result","type","redirectedModuleName","getNodeExternalModuleId","matcher","alias","match","aliasedModule","_","parseInt","filePath","includes","normalName","shimPath","existsSync","metroConfigWithCustomContext","withMetroMutatedResolverContext","immutableContext","preferNativePlatform","sourceExts","unstable_enablePackageExports","unstable_conditionNames","unstable_conditionsByPlatform","mainFields","env","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","withMetroErrorReportingResolver","endsWith","input","output","exp","platformBundlers","webOutput","process","EXPO_PUBLIC_PROJECT_ROOT","EXPO_PUBLIC_USE_STATIC","isDirectoryIn","__dirname","watchFolders","transformer","_expoRouterWebRendering","_expoRouterPath","setupShimFiles","setupNodeExternals","expoConfigPlatforms","entries","bundler","platforms","map","Set","concat","a","b","startsWith"],"mappings":"AAMA;;;;QAqEgBA,mBAAmB,GAAnBA,mBAAmB;QAqBnBC,oBAAoB,GAApBA,oBAAoB;QA0SpBC,8BAA8B,GAA9BA,8BAA8B;QAc9BC,iBAAiB,GAAjBA,iBAAiB;QAgBXC,2BAA2B,GAA3BA,2BAA2B;AAjalC,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAGPC,IAA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Aa;QAApCgB,OAAAA,OAAO,KAAK,OAAO,KAAIhB,CAAAA,GAAa,GAAbA,GAAG,CAACiB,SAAS,SAAU,GAAvBjB,KAAAA,CAAuB,GAAvBA,GAAa,CAAEnB,QAAQ,CAAC9F,QAAQ,CAAa,CAAA,CAAA;KAAA,CAC9F,CACAmI,GAAG,CAAC,CAAC,CAACnI,QAAQ,CAAC,GAAKA,QAAQ;IAAA,CAAC,AAAC;IAEjC,IAAIsC,KAAK,CAACC,OAAO,CAAC7C,MAAM,CAACuC,QAAQ,CAACiG,SAAS,CAAC,EAAE;QAC5CH,mBAAmB,GAAG;eAAI,IAAIK,GAAG,CAACL,mBAAmB,CAACM,MAAM,CAAC3I,MAAM,CAACuC,QAAQ,CAACiG,SAAS,CAAC,CAAC;SAAC,CAAC;KAC3F;IAED,yCAAyC;IACzCxI,MAAM,CAACuC,QAAQ,CAACiG,SAAS,GAAGH,mBAAmB,CAAC;IAEhDrI,MAAM,GAAGD,gBAAgB,CAACC,MAAM,CAAC,CAAC;IAElC,OAAOR,oBAAoB,CAACQ,MAAM,EAAE;QAClC2B,QAAQ;QACRG,WAAW;QACXF,sBAAsB;QACtBC,qBAAqB;KACtB,CAAC,CAAC;CACJ;AAED,SAASgG,aAAa,CAACe,CAAS,EAAEC,CAAS,EAAE;IAC3C,OAAOA,CAAC,CAACC,UAAU,CAACF,CAAC,CAAC,IAAIC,CAAC,CAAC3E,MAAM,GAAG0E,CAAC,CAAC1E,MAAM,CAAC;CAC/C"}
|
|
@@ -21,7 +21,9 @@ class FaviconMiddleware extends _expoMiddleware.ExpoMiddleware {
|
|
|
21
21
|
}
|
|
22
22
|
let faviconImageData;
|
|
23
23
|
try {
|
|
24
|
-
const data = await (0, _favicon).getFaviconFromExpoConfigAsync(this.projectRoot
|
|
24
|
+
const data = await (0, _favicon).getFaviconFromExpoConfigAsync(this.projectRoot, {
|
|
25
|
+
force: true
|
|
26
|
+
});
|
|
25
27
|
if (!data) {
|
|
26
28
|
debug("No favicon defined in the Expo Config, skipping generation.");
|
|
27
29
|
return next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/middleware/FaviconMiddleware.ts"],"sourcesContent":["import { ExpoMiddleware } from './ExpoMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { getFaviconFromExpoConfigAsync } from '../../../export/favicon';\n\nconst debug = require('debug')('expo:start:server:middleware:favicon') as typeof console.log;\n\n/**\n * Middleware for generating a favicon.ico file for the current project if one doesn't exist.\n *\n * Test by making a get request with:\n * curl -v http://localhost:8081/favicon.ico\n */\nexport class FaviconMiddleware extends ExpoMiddleware {\n constructor(protected projectRoot: string) {\n super(projectRoot, ['/favicon.ico']);\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n if (!['GET', 'HEAD'].includes(req.method || '')) {\n return next();\n }\n\n let faviconImageData: Buffer | null;\n try {\n const data = await getFaviconFromExpoConfigAsync(this.projectRoot);\n if (!data) {\n debug('No favicon defined in the Expo Config, skipping generation.');\n return next();\n }\n faviconImageData = data.source;\n debug('✅ Generated favicon successfully.');\n } catch (error: any) {\n debug('Failed to generate favicon from Expo config:', error);\n return next(error);\n }\n // Respond with the generated favicon file\n res.setHeader('Content-Type', 'image/x-icon');\n res.end(faviconImageData);\n }\n}\n"],"names":["debug","require","FaviconMiddleware","ExpoMiddleware","constructor","projectRoot","handleRequestAsync","req","res","next","includes","method","faviconImageData","data","getFaviconFromExpoConfigAsync","source","error","setHeader","end"],"mappings":"AAAA;;;;AAA+B,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AAEH,IAAA,QAAyB,WAAzB,yBAAyB,CAAA;AAEvE,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,AAAsB,AAAC;AAQtF,MAAMC,iBAAiB,SAASC,eAAc,eAAA;IACnDC,YAAsBC,WAAmB,CAAE;QACzC,KAAK,CAACA,WAAW,EAAE;YAAC,cAAc;SAAC,CAAC,CAAC;aADjBA,WAAmB,GAAnBA,WAAmB;KAExC;IAED,MAAMC,kBAAkB,CACtBC,GAAkB,EAClBC,GAAmB,EACnBC,IAAgB,EACD;QACf,IAAI,CAAC;YAAC,KAAK;YAAE,MAAM;SAAC,CAACC,QAAQ,CAACH,GAAG,CAACI,MAAM,IAAI,EAAE,CAAC,EAAE;YAC/C,OAAOF,IAAI,EAAE,CAAC;SACf;QAED,IAAIG,gBAAgB,AAAe,AAAC;QACpC,IAAI;YACF,MAAMC,IAAI,GAAG,MAAMC,CAAAA,GAAAA,QAA6B,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/FaviconMiddleware.ts"],"sourcesContent":["import { ExpoMiddleware } from './ExpoMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { getFaviconFromExpoConfigAsync } from '../../../export/favicon';\n\nconst debug = require('debug')('expo:start:server:middleware:favicon') as typeof console.log;\n\n/**\n * Middleware for generating a favicon.ico file for the current project if one doesn't exist.\n *\n * Test by making a get request with:\n * curl -v http://localhost:8081/favicon.ico\n */\nexport class FaviconMiddleware extends ExpoMiddleware {\n constructor(protected projectRoot: string) {\n super(projectRoot, ['/favicon.ico']);\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n if (!['GET', 'HEAD'].includes(req.method || '')) {\n return next();\n }\n\n let faviconImageData: Buffer | null;\n try {\n const data = await getFaviconFromExpoConfigAsync(this.projectRoot, { force: true });\n if (!data) {\n debug('No favicon defined in the Expo Config, skipping generation.');\n return next();\n }\n faviconImageData = data.source;\n debug('✅ Generated favicon successfully.');\n } catch (error: any) {\n debug('Failed to generate favicon from Expo config:', error);\n return next(error);\n }\n // Respond with the generated favicon file\n res.setHeader('Content-Type', 'image/x-icon');\n res.end(faviconImageData);\n }\n}\n"],"names":["debug","require","FaviconMiddleware","ExpoMiddleware","constructor","projectRoot","handleRequestAsync","req","res","next","includes","method","faviconImageData","data","getFaviconFromExpoConfigAsync","force","source","error","setHeader","end"],"mappings":"AAAA;;;;AAA+B,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AAEH,IAAA,QAAyB,WAAzB,yBAAyB,CAAA;AAEvE,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,AAAsB,AAAC;AAQtF,MAAMC,iBAAiB,SAASC,eAAc,eAAA;IACnDC,YAAsBC,WAAmB,CAAE;QACzC,KAAK,CAACA,WAAW,EAAE;YAAC,cAAc;SAAC,CAAC,CAAC;aADjBA,WAAmB,GAAnBA,WAAmB;KAExC;IAED,MAAMC,kBAAkB,CACtBC,GAAkB,EAClBC,GAAmB,EACnBC,IAAgB,EACD;QACf,IAAI,CAAC;YAAC,KAAK;YAAE,MAAM;SAAC,CAACC,QAAQ,CAACH,GAAG,CAACI,MAAM,IAAI,EAAE,CAAC,EAAE;YAC/C,OAAOF,IAAI,EAAE,CAAC;SACf;QAED,IAAIG,gBAAgB,AAAe,AAAC;QACpC,IAAI;YACF,MAAMC,IAAI,GAAG,MAAMC,CAAAA,GAAAA,QAA6B,AAAmC,CAAA,8BAAnC,CAAC,IAAI,CAACT,WAAW,EAAE;gBAAEU,KAAK,EAAE,IAAI;aAAE,CAAC,AAAC;YACpF,IAAI,CAACF,IAAI,EAAE;gBACTb,KAAK,CAAC,6DAA6D,CAAC,CAAC;gBACrE,OAAOS,IAAI,EAAE,CAAC;aACf;YACDG,gBAAgB,GAAGC,IAAI,CAACG,MAAM,CAAC;YAC/BhB,KAAK,CAAC,wCAAmC,CAAC,CAAC;SAC5C,CAAC,OAAOiB,KAAK,EAAO;YACnBjB,KAAK,CAAC,8CAA8C,EAAEiB,KAAK,CAAC,CAAC;YAC7D,OAAOR,IAAI,CAACQ,KAAK,CAAC,CAAC;SACpB;QACD,0CAA0C;QAC1CT,GAAG,CAACU,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QAC9CV,GAAG,CAACW,GAAG,CAACP,gBAAgB,CAAC,CAAC;KAC3B;CACF;QA/BYV,iBAAiB,GAAjBA,iBAAiB"}
|
|
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
const { userId , deviceId } = identifyData;
|
|
96
96
|
const commonEventProperties = {
|
|
97
|
-
source_version: "0.17.
|
|
97
|
+
source_version: "0.17.4",
|
|
98
98
|
source: "expo"
|
|
99
99
|
};
|
|
100
100
|
const identity = {
|
|
@@ -135,7 +135,7 @@ function getContext() {
|
|
|
135
135
|
},
|
|
136
136
|
app: {
|
|
137
137
|
name: "expo",
|
|
138
|
-
version: "0.17.
|
|
138
|
+
version: "0.17.4"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -167,5 +167,5 @@
|
|
|
167
167
|
"tree-kill": "^1.2.2",
|
|
168
168
|
"tsd": "^0.28.1"
|
|
169
169
|
},
|
|
170
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "9e4890b069b18598ea429734b5114b40e3afeabb"
|
|
171
171
|
}
|