@expo/cli 56.1.15 → 56.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/events/index.js +1 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +6 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +2 -1
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +1 -1
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportHermes.js +9 -1
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/resolveOptions.js +9 -10
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +3 -1
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +53 -91
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/platforms/ios/AppleDeviceManager.js +8 -2
- package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js +26 -11
- package/build/src/start/platforms/ios/ensureSimulatorAppRunning.js.map +1 -1
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js +21 -8
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +5 -2
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +88 -11
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +3 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +3 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +4 -2
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/start/server/platformBundlers.js +3 -1
- package/build/src/start/server/platformBundlers.js.map +1 -1
- package/build/src/utils/findUp.js +17 -19
- package/build/src/utils/findUp.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +14 -14
|
@@ -25,31 +25,29 @@ function _config() {
|
|
|
25
25
|
}
|
|
26
26
|
const _platformBundlers = require("../start/server/platformBundlers");
|
|
27
27
|
const _errors = require("../utils/errors");
|
|
28
|
-
function resolvePlatformOption(
|
|
28
|
+
function resolvePlatformOption(configPlatforms, platformBundlers, platform = [
|
|
29
29
|
'all'
|
|
30
30
|
]) {
|
|
31
|
-
const platformsAvailable = Object.fromEntries(Object.entries(platformBundlers).filter(([platform, bundler])=>
|
|
32
|
-
var _exp_platforms;
|
|
33
|
-
return bundler === 'metro' && ((_exp_platforms = exp.platforms) == null ? void 0 : _exp_platforms.includes(platform));
|
|
34
|
-
}));
|
|
31
|
+
const platformsAvailable = Object.fromEntries(Object.entries(platformBundlers).filter(([platform, bundler])=>bundler === 'metro' && configPlatforms.includes(platform)));
|
|
35
32
|
if (!Object.keys(platformsAvailable).length) {
|
|
36
33
|
throw new _errors.CommandError(`No platforms are configured to use the Metro bundler in the project Expo config.`);
|
|
37
34
|
}
|
|
38
35
|
const assertPlatformBundler = (platform)=>{
|
|
39
36
|
if (!platformsAvailable[platform]) {
|
|
40
|
-
|
|
41
|
-
if (!((_exp_platforms = exp.platforms) == null ? void 0 : _exp_platforms.includes(platform)) && platform === 'web') {
|
|
37
|
+
if (!configPlatforms.includes(platform) && platform === 'web') {
|
|
42
38
|
// Pass through so the more robust error message is shown.
|
|
43
39
|
return platform;
|
|
44
40
|
}
|
|
45
|
-
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: [${
|
|
41
|
+
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: [${configPlatforms.join(', ')}].`);
|
|
46
42
|
}
|
|
47
43
|
return platform;
|
|
48
44
|
};
|
|
49
45
|
const knownPlatforms = [
|
|
50
46
|
'android',
|
|
51
47
|
'ios',
|
|
52
|
-
'web'
|
|
48
|
+
'web',
|
|
49
|
+
'tvos',
|
|
50
|
+
'macos'
|
|
53
51
|
];
|
|
54
52
|
const assertPlatformIsKnown = (platform)=>{
|
|
55
53
|
if (!knownPlatforms.includes(platform)) {
|
|
@@ -68,7 +66,8 @@ async function resolveOptionsAsync(projectRoot, args) {
|
|
|
68
66
|
skipSDKVersionRequirement: true
|
|
69
67
|
});
|
|
70
68
|
const platformBundlers = (0, _platformBundlers.getPlatformBundlers)(projectRoot, exp);
|
|
71
|
-
const
|
|
69
|
+
const platformsFromConfig = (0, _config().getPlatformsFromConfig)(projectRoot, exp);
|
|
70
|
+
const platforms = resolvePlatformOption(platformsFromConfig, platformBundlers, args['--platform']);
|
|
72
71
|
// --source-maps can be true, "external", or "inline"
|
|
73
72
|
const sourceMapsArg = args['--source-maps'];
|
|
74
73
|
const sourceMaps = !!sourceMapsArg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/export/resolveOptions.ts"],"sourcesContent":["import type { Platform } from '@expo/config';\nimport { getConfig, getPlatformsFromConfig } from '@expo/config';\n\nimport type { PlatformBundlers } from '../start/server/platformBundlers';\nimport { getPlatformBundlers } 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 bytecode: boolean;\n dumpAssetmap: boolean;\n sourceMaps: boolean;\n inlineSourceMaps: boolean;\n skipSSG: boolean;\n hostedNative: boolean;\n};\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n configPlatforms: Platform[],\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' && configPlatforms.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 (!configPlatforms.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: [${configPlatforms.join(\n ', '\n )}].`\n );\n }\n\n return platform;\n };\n\n const knownPlatforms = ['android', 'ios', 'web', 'tvos', 'macos'] 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 const platformsFromConfig = getPlatformsFromConfig(projectRoot, exp);\n const platforms = resolvePlatformOption(\n platformsFromConfig,\n platformBundlers,\n args['--platform']\n );\n\n // --source-maps can be true, \"external\", or \"inline\"\n const sourceMapsArg = args['--source-maps'];\n const sourceMaps = !!sourceMapsArg;\n const inlineSourceMaps = sourceMapsArg === 'inline';\n\n return {\n platforms,\n hostedNative: !!args['--unstable-hosted-native'],\n outputDir: args['--output-dir'] ?? 'dist',\n minify: !args['--no-minify'],\n bytecode: !args['--no-bytecode'],\n clear: !!args['--clear'],\n dev: !!args['--dev'],\n maxWorkers: args['--max-workers'],\n dumpAssetmap: !!args['--dump-assetmap'],\n sourceMaps,\n inlineSourceMaps,\n skipSSG: !!args['--no-ssg'] || !!args['--api-only'],\n };\n}\n"],"names":["resolveOptionsAsync","resolvePlatformOption","configPlatforms","platformBundlers","platform","platformsAvailable","Object","fromEntries","entries","filter","bundler","includes","keys","length","CommandError","assertPlatformBundler","join","knownPlatforms","assertPlatformIsKnown","map","flat","index","list","indexOf","projectRoot","args","exp","getConfig","skipPlugins","skipSDKVersionRequirement","getPlatformBundlers","platformsFromConfig","getPlatformsFromConfig","platforms","sourceMapsArg","sourceMaps","inlineSourceMaps","hostedNative","outputDir","minify","bytecode","clear","dev","maxWorkers","dumpAssetmap","skipSSG"],"mappings":";;;;;;;;;;;QAiFsBA;eAAAA;;QA1DNC;eAAAA;;;;yBAtBkC;;;;;;kCAGd;wBACP;AAkBtB,SAASA,sBACdC,eAA2B,EAC3BC,gBAAkC,EAClCC,WAAqB;IAAC;CAAM;IAE5B,MAAMC,qBAAgDC,OAAOC,WAAW,CACtED,OAAOE,OAAO,CAACL,kBAAkBM,MAAM,CACrC,CAAC,CAACL,UAAUM,QAAQ,GAAKA,YAAY,WAAWR,gBAAgBS,QAAQ,CAACP;IAI7E,IAAI,CAACE,OAAOM,IAAI,CAACP,oBAAoBQ,MAAM,EAAE;QAC3C,MAAM,IAAIC,oBAAY,CACpB,CAAC,gFAAgF,CAAC;IAEtF;IAEA,M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,MAAMS,gBAAgBT,IAAI,CAAC,gBAAgB;IAC3C,MAAMU,aAAa,CAAC,CAACD;IACrB,MAAME,mBAAmBF,kBAAkB;IAE3C,OAAO;QACLD;QACAI,cAAc,CAAC,CAACZ,IAAI,CAAC,2BAA2B;QAChDa,WAAWb,IAAI,CAAC,eAAe,IAAI;QACnCc,QAAQ,CAACd,IAAI,CAAC,cAAc;QAC5Be,UAAU,CAACf,IAAI,CAAC,gBAAgB;QAChCgB,OAAO,CAAC,CAAChB,IAAI,CAAC,UAAU;QACxBiB,KAAK,CAAC,CAACjB,IAAI,CAAC,QAAQ;QACpBkB,YAAYlB,IAAI,CAAC,gBAAgB;QACjCmB,cAAc,CAAC,CAACnB,IAAI,CAAC,kBAAkB;QACvCU;QACAC;QACAS,SAAS,CAAC,CAACpB,IAAI,CAAC,WAAW,IAAI,CAAC,CAACA,IAAI,CAAC,aAAa;IACrD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/saveAssets.ts"],"sourcesContent":["/**\n * Copyright © 2023 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 type { AssetData } from '@expo/metro/metro';\nimport type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { Log } from '../log';\nimport { env } from '../utils/env';\n\nlet bytesFormatter: Intl.NumberFormat | undefined | null;\n\nconst prettyBytes = (bytes: number): string => {\n try {\n if (bytesFormatter === undefined && typeof Intl === 'object') {\n bytesFormatter = new Intl.NumberFormat('en', {\n notation: 'compact',\n style: 'unit',\n unit: 'byte',\n unitDisplay: 'narrow',\n });\n }\n if (bytesFormatter != null) {\n return bytesFormatter.format(bytes);\n }\n } catch {\n bytesFormatter = null;\n }\n // Fall back if ICU is unavailable, which is rare but possible with custom Node.js builds\n if (bytes >= 900_000) {\n return `${(bytes / 1_000_000).toFixed(1)}MB`;\n } else if (bytes >= 900) {\n return `${(bytes / 1_000).toFixed(1)}KB`;\n } else {\n return `${bytes}B`;\n }\n};\n\nconst BLT = '\\u203A';\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\n\nexport type BundleAssetWithFileHashes = AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\n\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nexport type ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\nexport type ExportAssetDescriptor = {\n contents: string | Buffer;\n originFilename?: string;\n /** An identifier for grouping together variations of the same asset. */\n assetId?: string;\n /** Expo Router route path for formatting the HTML output. */\n routeId?: string;\n /** Expo Router route path for formatting the middleware function output. */\n middlewareId?: string;\n /** Expo Router API route path for formatting the server function output. */\n apiRouteId?: string;\n /** Expo Router route path for formatting the RSC output. */\n rscId?: string;\n /** Expo Router route path for formatting the loader module output. */\n loaderId?: string;\n /** A key for grouping together output files by server- or client-side. */\n targetDomain?: 'server' | 'client';\n};\n\nexport type ExportAssetMap = Map<string, ExportAssetDescriptor>;\n\nexport async function persistMetroFilesAsync(files: ExportAssetMap, outputDir: string) {\n if (!files.size) {\n return;\n }\n await fs.promises.mkdir(path.join(outputDir), { recursive: true });\n\n // Test fixtures:\n // Log.log(\n // JSON.stringify(\n // Object.fromEntries([...files.entries()].map(([k, v]) => [k, { ...v, contents: '' }]))\n // )\n // );\n\n const assetEntries: [string, ExportAssetDescriptor][] = [];\n const apiRouteEntries: [string, ExportAssetDescriptor][] = [];\n const middlewareEntries: [string, ExportAssetDescriptor][] = [];\n const routeEntries: [string, ExportAssetDescriptor][] = [];\n const rscEntries: [string, ExportAssetDescriptor][] = [];\n const loaderEntries: [string, ExportAssetDescriptor][] = [];\n const remainingEntries: [string, ExportAssetDescriptor][] = [];\n\n let hasServerOutput = false;\n for (const asset of files.entries()) {\n hasServerOutput = hasServerOutput || asset[1].targetDomain === 'server';\n if (asset[1].assetId) assetEntries.push(asset);\n else if (asset[1].routeId != null) routeEntries.push(asset);\n else if (asset[1].middlewareId != null) middlewareEntries.push(asset);\n else if (asset[1].apiRouteId != null) apiRouteEntries.push(asset);\n else if (asset[1].rscId != null) rscEntries.push(asset);\n else if (asset[1].loaderId != null) loaderEntries.push(asset);\n else remainingEntries.push(asset);\n }\n\n const groups = groupBy(assetEntries, ([, { assetId }]) => assetId!);\n\n const contentSize = (contents: string | Buffer) => {\n const length =\n typeof contents === 'string' ? Buffer.byteLength(contents, 'utf8') : contents.length;\n return length;\n };\n\n const sizeStr = (contents: string | Buffer) => {\n const length = contentSize(contents);\n const size = chalk.gray`(${prettyBytes(length)})`;\n return size;\n };\n\n // TODO: If any Expo Router is used, then use a new style which is more simple:\n // `chalk.gray(/path/to/) + chalk.cyan('route')`\n // | index.html (1.2kb)\n // | /path\n // | other.html (1.2kb)\n\n const isExpoRouter = routeEntries.length;\n\n // Phase out printing all the assets as users can simply check the file system for more info.\n const showAdditionalInfo = !isExpoRouter || env.EXPO_DEBUG;\n\n const assetGroups = [...groups.entries()].sort((a, b) => a[0].localeCompare(b[0])) as [\n string,\n [string, ExportAssetDescriptor][],\n ][];\n\n if (showAdditionalInfo) {\n if (assetGroups.length) {\n const totalAssets = assetGroups.reduce((sum, [, assets]) => sum + assets.length, 0);\n\n Log.log('');\n Log.log(chalk.bold`${BLT} Assets (${totalAssets}):`);\n\n for (const [assetId, assets] of assetGroups) {\n const averageContentSize =\n assets.reduce((sum, [, { contents }]) => sum + contentSize(contents), 0) / assets.length;\n Log.log(\n assetId,\n chalk.gray(\n `(${[\n assets.length > 1 ? `${assets.length} variations` : '',\n `${prettyBytes(averageContentSize)}`,\n ]\n .filter(Boolean)\n .join(' | ')})`\n )\n );\n }\n }\n }\n\n const bundles: Map<string, [string, ExportAssetDescriptor][]> = new Map();\n const other: [string, ExportAssetDescriptor][] = [];\n\n remainingEntries.forEach(([filepath, asset]) => {\n if (!filepath.match(/_expo\\/(server|static)\\//)) {\n other.push([filepath, asset]);\n } else {\n const platform = filepath.match(/_expo\\/static\\/js\\/([^/]+)\\//)?.[1] ?? 'web';\n if (!bundles.has(platform)) bundles.set(platform, []);\n\n bundles.get(platform)!.push([filepath, asset]);\n }\n });\n\n [...bundles.entries()].forEach(([platform, assets]) => {\n Log.log('');\n Log.log(chalk.bold`${BLT} ${platform} bundles (${assets.length}):`);\n\n const allAssets = assets.sort((a, b) => a[0].localeCompare(b[0]));\n while (allAssets.length) {\n const [filePath, asset] = allAssets.shift()!;\n Log.log(filePath, sizeStr(asset.contents));\n if (filePath.match(/\\.(js|hbc)$/)) {\n // Get source map\n const sourceMapIndex = allAssets.findIndex(([fp]) => fp === filePath + '.map');\n if (sourceMapIndex !== -1) {\n const [sourceMapFilePath, sourceMapAsset] = allAssets.splice(sourceMapIndex, 1)[0]!;\n Log.log(chalk.gray(sourceMapFilePath), sizeStr(sourceMapAsset.contents));\n }\n }\n }\n });\n\n if (showAdditionalInfo && other.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Files (${other.length}):`);\n\n for (const [filePath, asset] of other.sort((a, b) => a[0].localeCompare(b[0]))) {\n Log.log(filePath, sizeStr(asset.contents));\n }\n }\n\n if (rscEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} React Server Components (${rscEntries.length}):`);\n\n for (const [filePath, assets] of rscEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.rscId!;\n Log.log(\n '/' + (id === '' ? chalk.gray(' (index)') : id),\n sizeStr(assets.contents),\n chalk.gray(filePath)\n );\n }\n }\n\n if (routeEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Static routes (${routeEntries.length}):`);\n\n for (const [, assets] of routeEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.routeId!;\n Log.log('/' + (id === '' ? chalk.gray(' (index)') : id), sizeStr(assets.contents));\n }\n }\n\n if (apiRouteEntries.length) {\n const apiRoutesWithoutSourcemaps = apiRouteEntries.filter(\n (route) => !route[0].endsWith('.map')\n );\n Log.log('');\n Log.log(chalk.bold`${BLT} API routes (${apiRoutesWithoutSourcemaps.length}):`);\n\n for (const [apiRouteFilename, assets] of apiRoutesWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.apiRouteId!;\n const hasSourceMap = apiRouteEntries.find(\n ([filename, route]) =>\n filename !== apiRouteFilename &&\n route.apiRouteId === assets.apiRouteId &&\n filename.endsWith('.map')\n );\n Log.log(\n id === '' ? chalk.gray(' (index)') : id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n if (middlewareEntries.length) {\n const middlewareWithoutSourcemaps = middlewareEntries.filter(\n (route) => !route[0].endsWith('.map')\n );\n Log.log('');\n Log.log(chalk.bold`${BLT} Middleware:`);\n\n for (const [middlewareFilename, assets] of middlewareWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.middlewareId!;\n const hasSourceMap = middlewareEntries.find(\n ([filename, route]) =>\n filename !== middlewareFilename &&\n route.middlewareId === assets.middlewareId &&\n filename.endsWith('.map')\n );\n Log.log(\n id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n if (loaderEntries.length) {\n const loadersWithoutSourcemaps = loaderEntries.filter((entry) => !entry[0].endsWith('.map'));\n Log.log('');\n Log.log(chalk.bold`${BLT} Loaders (${loadersWithoutSourcemaps.length}):`);\n\n for (const [loaderFilename, assets] of loadersWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.loaderId!;\n const hasSourceMap = loaderEntries.find(\n ([filename, entry]) =>\n filename !== loaderFilename &&\n entry.loaderId === assets.loaderId &&\n filename.endsWith('.map')\n );\n Log.log(\n id === '/' ? '/ ' + chalk.gray('(index)') : id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n // Decouple logging from writing for better performance.\n\n await Promise.all(\n [...files.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(async ([file, { contents, targetDomain }]) => {\n // NOTE: Only use `targetDomain` if we have at least one server asset\n const domain = (hasServerOutput && targetDomain) || '';\n const outputPath = path.join(outputDir, domain, file);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.promises.writeFile(outputPath, contents);\n })\n );\n\n Log.log('');\n}\n\nfunction groupBy<T>(array: T[], key: (item: T) => string): Map<string, T[]> {\n const map = new Map<string, T[]>();\n array.forEach((item) => {\n const group = key(item);\n const list = map.get(group) ?? [];\n list.push(item);\n map.set(group, list);\n });\n return map;\n}\n\n// TODO: Move source map modification to the serializer\nexport function getFilesFromSerialAssets(\n resources: SerialAsset[],\n {\n includeSourceMaps,\n files = new Map(),\n platform,\n isServerHosted = platform === 'web',\n }: {\n includeSourceMaps: boolean;\n files?: ExportAssetMap;\n platform?: string;\n isServerHosted?: boolean;\n }\n) {\n resources.forEach((resource) => {\n if (resource.type === 'css-external') {\n return;\n }\n files.set(resource.filename, {\n contents: resource.source,\n originFilename: resource.originFilename,\n targetDomain: isServerHosted ? 'client' : undefined,\n });\n });\n\n return files;\n}\n"],"names":["getFilesFromSerialAssets","persistMetroFilesAsync","bytesFormatter","prettyBytes","bytes","undefined","Intl","NumberFormat","notation","style","unit","unitDisplay","format","toFixed","BLT","files","outputDir","size","fs","promises","mkdir","path","join","recursive","assetEntries","apiRouteEntries","middlewareEntries","routeEntries","rscEntries","loaderEntries","remainingEntries","hasServerOutput","asset","entries","targetDomain","assetId","push","routeId","middlewareId","apiRouteId","rscId","loaderId","groups","groupBy","contentSize","contents","length","Buffer","byteLength","sizeStr","chalk","gray","isExpoRouter","showAdditionalInfo","env","EXPO_DEBUG","assetGroups","sort","a","b","localeCompare","totalAssets","reduce","sum","assets","Log","log","bold","averageContentSize","filter","Boolean","bundles","Map","other","forEach","filepath","match","platform","has","set","get","allAssets","filePath","shift","sourceMapIndex","findIndex","fp","sourceMapFilePath","sourceMapAsset","splice","id","apiRoutesWithoutSourcemaps","route","endsWith","apiRouteFilename","hasSourceMap","find","filename","middlewareWithoutSourcemaps","middlewareFilename","loadersWithoutSourcemaps","entry","loaderFilename","Promise","all","map","file","domain","outputPath","dirname","writeFile","array","key","item","group","list","resources","includeSourceMaps","isServerHosted","resource","type","source","originFilename"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QAoVeA;eAAAA;;QAhQMC;eAAAA;;;;gEAjFJ;;;;;;;gEACH;;;;;;;gEACE;;;;;;qBAEG;qBACA;;;;;;AAEpB,IAAIC;AAEJ,MAAMC,cAAc,CAACC;IACnB,IAAI;QACF,IAAIF,mBAAmBG,aAAa,OAAOC,SAAS,UAAU;YAC5DJ,iBAAiB,IAAII,KAAKC,YAAY,CAAC,MAAM;gBAC3CC,UAAU;gBACVC,OAAO;gBACPC,MAAM;gBACNC,aAAa;YACf;QACF;QACA,IAAIT,kBAAkB,MAAM;YAC1B,OAAOA,eAAeU,MAAM,CAACR;QAC/B;IACF,EAAE,OAAM;QACNF,iBAAiB;IACnB;IACA,yFAAyF;IACzF,IAAIE,SAAS,QAAS;QACpB,OAAO,GAAG,AAACA,CAAAA,QAAQ,OAAQ,EAAGS,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9C,OAAO,IAAIT,SAAS,KAAK;QACvB,OAAO,GAAG,AAACA,CAAAA,QAAQ,IAAI,EAAGS,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1C,OAAO;QACL,OAAO,GAAGT,MAAM,CAAC,CAAC;IACpB;AACF;AAEA,MAAMU,MAAM;AA8CL,eAAeb,uBAAuBc,KAAqB,EAAEC,SAAiB;IAC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AG,CAAC;AACV;AAEA,SAASvB,QAAWoE,KAAU,EAAEC,GAAwB;IACtD,MAAMP,MAAM,IAAIjC;IAChBuC,MAAMrC,OAAO,CAAC,CAACuC;QACb,MAAMC,QAAQF,IAAIC;QAClB,MAAME,OAAOV,IAAIzB,GAAG,CAACkC,UAAU,EAAE;QACjCC,KAAK/E,IAAI,CAAC6E;QACVR,IAAI1B,GAAG,CAACmC,OAAOC;IACjB;IACA,OAAOV;AACT;AAGO,SAASzG,yBACdoH,SAAwB,EACxB,EACEC,iBAAiB,EACjBtG,QAAQ,IAAIyD,KAAK,EACjBK,QAAQ,EACRyC,iBAAiBzC,aAAa,KAAK,EAMpC;IAEDuC,UAAU1C,OAAO,CAAC,CAAC6C;QACjB,IAAIA,SAASC,IAAI,KAAK,gBAAgB;YACpC;QACF;QACAzG,MAAMgE,GAAG,CAACwC,SAAStB,QAAQ,EAAE;YAC3BpD,UAAU0E,SAASE,MAAM;YACzBC,gBAAgBH,SAASG,cAAc;YACvCxF,cAAcoF,iBAAiB,WAAWjH;QAC5C;IACF;IAEA,OAAOU;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/saveAssets.ts"],"sourcesContent":["/**\n * Copyright © 2023 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 type { Platform } from '@expo/config';\nimport type { AssetData } from '@expo/metro/metro';\nimport type { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { Log } from '../log';\nimport { env } from '../utils/env';\n\nlet bytesFormatter: Intl.NumberFormat | undefined | null;\n\nconst prettyBytes = (bytes: number): string => {\n try {\n if (bytesFormatter === undefined && typeof Intl === 'object') {\n bytesFormatter = new Intl.NumberFormat('en', {\n notation: 'compact',\n style: 'unit',\n unit: 'byte',\n unitDisplay: 'narrow',\n });\n }\n if (bytesFormatter != null) {\n return bytesFormatter.format(bytes);\n }\n } catch {\n bytesFormatter = null;\n }\n // Fall back if ICU is unavailable, which is rare but possible with custom Node.js builds\n if (bytes >= 900_000) {\n return `${(bytes / 1_000_000).toFixed(1)}MB`;\n } else if (bytes >= 900) {\n return `${(bytes / 1_000).toFixed(1)}KB`;\n } else {\n return `${bytes}B`;\n }\n};\n\nconst BLT = '\\u203A';\n\nexport type BundleOptions = {\n entryPoint: string;\n platform: Platform;\n dev?: boolean;\n minify?: boolean;\n bytecode: boolean;\n sourceMapUrl?: string;\n sourcemaps?: boolean;\n};\n\nexport type BundleAssetWithFileHashes = AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\n\nexport type BundleOutput = {\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nexport type ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\nexport type ExportAssetDescriptor = {\n contents: string | Buffer;\n originFilename?: string;\n /** An identifier for grouping together variations of the same asset. */\n assetId?: string;\n /** Expo Router route path for formatting the HTML output. */\n routeId?: string;\n /** Expo Router route path for formatting the middleware function output. */\n middlewareId?: string;\n /** Expo Router API route path for formatting the server function output. */\n apiRouteId?: string;\n /** Expo Router route path for formatting the RSC output. */\n rscId?: string;\n /** Expo Router route path for formatting the loader module output. */\n loaderId?: string;\n /** A key for grouping together output files by server- or client-side. */\n targetDomain?: 'server' | 'client';\n};\n\nexport type ExportAssetMap = Map<string, ExportAssetDescriptor>;\n\nexport async function persistMetroFilesAsync(files: ExportAssetMap, outputDir: string) {\n if (!files.size) {\n return;\n }\n await fs.promises.mkdir(path.join(outputDir), { recursive: true });\n\n // Test fixtures:\n // Log.log(\n // JSON.stringify(\n // Object.fromEntries([...files.entries()].map(([k, v]) => [k, { ...v, contents: '' }]))\n // )\n // );\n\n const assetEntries: [string, ExportAssetDescriptor][] = [];\n const apiRouteEntries: [string, ExportAssetDescriptor][] = [];\n const middlewareEntries: [string, ExportAssetDescriptor][] = [];\n const routeEntries: [string, ExportAssetDescriptor][] = [];\n const rscEntries: [string, ExportAssetDescriptor][] = [];\n const loaderEntries: [string, ExportAssetDescriptor][] = [];\n const remainingEntries: [string, ExportAssetDescriptor][] = [];\n\n let hasServerOutput = false;\n for (const asset of files.entries()) {\n hasServerOutput = hasServerOutput || asset[1].targetDomain === 'server';\n if (asset[1].assetId) assetEntries.push(asset);\n else if (asset[1].routeId != null) routeEntries.push(asset);\n else if (asset[1].middlewareId != null) middlewareEntries.push(asset);\n else if (asset[1].apiRouteId != null) apiRouteEntries.push(asset);\n else if (asset[1].rscId != null) rscEntries.push(asset);\n else if (asset[1].loaderId != null) loaderEntries.push(asset);\n else remainingEntries.push(asset);\n }\n\n const groups = groupBy(assetEntries, ([, { assetId }]) => assetId!);\n\n const contentSize = (contents: string | Buffer) => {\n const length =\n typeof contents === 'string' ? Buffer.byteLength(contents, 'utf8') : contents.length;\n return length;\n };\n\n const sizeStr = (contents: string | Buffer) => {\n const length = contentSize(contents);\n const size = chalk.gray`(${prettyBytes(length)})`;\n return size;\n };\n\n // TODO: If any Expo Router is used, then use a new style which is more simple:\n // `chalk.gray(/path/to/) + chalk.cyan('route')`\n // | index.html (1.2kb)\n // | /path\n // | other.html (1.2kb)\n\n const isExpoRouter = routeEntries.length;\n\n // Phase out printing all the assets as users can simply check the file system for more info.\n const showAdditionalInfo = !isExpoRouter || env.EXPO_DEBUG;\n\n const assetGroups = [...groups.entries()].sort((a, b) => a[0].localeCompare(b[0])) as [\n string,\n [string, ExportAssetDescriptor][],\n ][];\n\n if (showAdditionalInfo) {\n if (assetGroups.length) {\n const totalAssets = assetGroups.reduce((sum, [, assets]) => sum + assets.length, 0);\n\n Log.log('');\n Log.log(chalk.bold`${BLT} Assets (${totalAssets}):`);\n\n for (const [assetId, assets] of assetGroups) {\n const averageContentSize =\n assets.reduce((sum, [, { contents }]) => sum + contentSize(contents), 0) / assets.length;\n Log.log(\n assetId,\n chalk.gray(\n `(${[\n assets.length > 1 ? `${assets.length} variations` : '',\n `${prettyBytes(averageContentSize)}`,\n ]\n .filter(Boolean)\n .join(' | ')})`\n )\n );\n }\n }\n }\n\n const bundles: Map<string, [string, ExportAssetDescriptor][]> = new Map();\n const other: [string, ExportAssetDescriptor][] = [];\n\n remainingEntries.forEach(([filepath, asset]) => {\n if (!filepath.match(/_expo\\/(server|static)\\//)) {\n other.push([filepath, asset]);\n } else {\n const platform = filepath.match(/_expo\\/static\\/js\\/([^/]+)\\//)?.[1] ?? 'web';\n if (!bundles.has(platform)) bundles.set(platform, []);\n\n bundles.get(platform)!.push([filepath, asset]);\n }\n });\n\n [...bundles.entries()].forEach(([platform, assets]) => {\n Log.log('');\n Log.log(chalk.bold`${BLT} ${platform} bundles (${assets.length}):`);\n\n const allAssets = assets.sort((a, b) => a[0].localeCompare(b[0]));\n while (allAssets.length) {\n const [filePath, asset] = allAssets.shift()!;\n Log.log(filePath, sizeStr(asset.contents));\n if (filePath.match(/\\.(js|hbc)$/)) {\n // Get source map\n const sourceMapIndex = allAssets.findIndex(([fp]) => fp === filePath + '.map');\n if (sourceMapIndex !== -1) {\n const [sourceMapFilePath, sourceMapAsset] = allAssets.splice(sourceMapIndex, 1)[0]!;\n Log.log(chalk.gray(sourceMapFilePath), sizeStr(sourceMapAsset.contents));\n }\n }\n }\n });\n\n if (showAdditionalInfo && other.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Files (${other.length}):`);\n\n for (const [filePath, asset] of other.sort((a, b) => a[0].localeCompare(b[0]))) {\n Log.log(filePath, sizeStr(asset.contents));\n }\n }\n\n if (rscEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} React Server Components (${rscEntries.length}):`);\n\n for (const [filePath, assets] of rscEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.rscId!;\n Log.log(\n '/' + (id === '' ? chalk.gray(' (index)') : id),\n sizeStr(assets.contents),\n chalk.gray(filePath)\n );\n }\n }\n\n if (routeEntries.length) {\n Log.log('');\n Log.log(chalk.bold`${BLT} Static routes (${routeEntries.length}):`);\n\n for (const [, assets] of routeEntries.sort((a, b) => a[0].length - b[0].length)) {\n const id = assets.routeId!;\n Log.log('/' + (id === '' ? chalk.gray(' (index)') : id), sizeStr(assets.contents));\n }\n }\n\n if (apiRouteEntries.length) {\n const apiRoutesWithoutSourcemaps = apiRouteEntries.filter(\n (route) => !route[0].endsWith('.map')\n );\n Log.log('');\n Log.log(chalk.bold`${BLT} API routes (${apiRoutesWithoutSourcemaps.length}):`);\n\n for (const [apiRouteFilename, assets] of apiRoutesWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.apiRouteId!;\n const hasSourceMap = apiRouteEntries.find(\n ([filename, route]) =>\n filename !== apiRouteFilename &&\n route.apiRouteId === assets.apiRouteId &&\n filename.endsWith('.map')\n );\n Log.log(\n id === '' ? chalk.gray(' (index)') : id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n if (middlewareEntries.length) {\n const middlewareWithoutSourcemaps = middlewareEntries.filter(\n (route) => !route[0].endsWith('.map')\n );\n Log.log('');\n Log.log(chalk.bold`${BLT} Middleware:`);\n\n for (const [middlewareFilename, assets] of middlewareWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.middlewareId!;\n const hasSourceMap = middlewareEntries.find(\n ([filename, route]) =>\n filename !== middlewareFilename &&\n route.middlewareId === assets.middlewareId &&\n filename.endsWith('.map')\n );\n Log.log(\n id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n if (loaderEntries.length) {\n const loadersWithoutSourcemaps = loaderEntries.filter((entry) => !entry[0].endsWith('.map'));\n Log.log('');\n Log.log(chalk.bold`${BLT} Loaders (${loadersWithoutSourcemaps.length}):`);\n\n for (const [loaderFilename, assets] of loadersWithoutSourcemaps.sort(\n (a, b) => a[0].length - b[0].length\n )) {\n const id = assets.loaderId!;\n const hasSourceMap = loaderEntries.find(\n ([filename, entry]) =>\n filename !== loaderFilename &&\n entry.loaderId === assets.loaderId &&\n filename.endsWith('.map')\n );\n Log.log(\n id === '/' ? '/ ' + chalk.gray('(index)') : id,\n sizeStr(assets.contents),\n hasSourceMap ? chalk.gray(`(source map ${sizeStr(hasSourceMap[1].contents)})`) : ''\n );\n }\n }\n\n // Decouple logging from writing for better performance.\n\n await Promise.all(\n [...files.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(async ([file, { contents, targetDomain }]) => {\n // NOTE: Only use `targetDomain` if we have at least one server asset\n const domain = (hasServerOutput && targetDomain) || '';\n const outputPath = path.join(outputDir, domain, file);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.promises.writeFile(outputPath, contents);\n })\n );\n\n Log.log('');\n}\n\nfunction groupBy<T>(array: T[], key: (item: T) => string): Map<string, T[]> {\n const map = new Map<string, T[]>();\n array.forEach((item) => {\n const group = key(item);\n const list = map.get(group) ?? [];\n list.push(item);\n map.set(group, list);\n });\n return map;\n}\n\n// TODO: Move source map modification to the serializer\nexport function getFilesFromSerialAssets(\n resources: SerialAsset[],\n {\n includeSourceMaps,\n files = new Map(),\n platform,\n isServerHosted = platform === 'web',\n }: {\n includeSourceMaps: boolean;\n files?: ExportAssetMap;\n platform?: string;\n isServerHosted?: boolean;\n }\n) {\n resources.forEach((resource) => {\n if (resource.type === 'css-external') {\n return;\n }\n files.set(resource.filename, {\n contents: resource.source,\n originFilename: resource.originFilename,\n targetDomain: isServerHosted ? 'client' : undefined,\n });\n });\n\n return files;\n}\n"],"names":["getFilesFromSerialAssets","persistMetroFilesAsync","bytesFormatter","prettyBytes","bytes","undefined","Intl","NumberFormat","notation","style","unit","unitDisplay","format","toFixed","BLT","files","outputDir","size","fs","promises","mkdir","path","join","recursive","assetEntries","apiRouteEntries","middlewareEntries","routeEntries","rscEntries","loaderEntries","remainingEntries","hasServerOutput","asset","entries","targetDomain","assetId","push","routeId","middlewareId","apiRouteId","rscId","loaderId","groups","groupBy","contentSize","contents","length","Buffer","byteLength","sizeStr","chalk","gray","isExpoRouter","showAdditionalInfo","env","EXPO_DEBUG","assetGroups","sort","a","b","localeCompare","totalAssets","reduce","sum","assets","Log","log","bold","averageContentSize","filter","Boolean","bundles","Map","other","forEach","filepath","match","platform","has","set","get","allAssets","filePath","shift","sourceMapIndex","findIndex","fp","sourceMapFilePath","sourceMapAsset","splice","id","apiRoutesWithoutSourcemaps","route","endsWith","apiRouteFilename","hasSourceMap","find","filename","middlewareWithoutSourcemaps","middlewareFilename","loadersWithoutSourcemaps","entry","loaderFilename","Promise","all","map","file","domain","outputPath","dirname","writeFile","array","key","item","group","list","resources","includeSourceMaps","isServerHosted","resource","type","source","originFilename"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QAqVeA;eAAAA;;QAhQMC;eAAAA;;;;gEAjFJ;;;;;;;gEACH;;;;;;;gEACE;;;;;;qBAEG;qBACA;;;;;;AAEpB,IAAIC;AAEJ,MAAMC,cAAc,CAACC;IACnB,IAAI;QACF,IAAIF,mBAAmBG,aAAa,OAAOC,SAAS,UAAU;YAC5DJ,iBAAiB,IAAII,KAAKC,YAAY,CAAC,MAAM;gBAC3CC,UAAU;gBACVC,OAAO;gBACPC,MAAM;gBACNC,aAAa;YACf;QACF;QACA,IAAIT,kBAAkB,MAAM;YAC1B,OAAOA,eAAeU,MAAM,CAACR;QAC/B;IACF,EAAE,OAAM;QACNF,iBAAiB;IACnB;IACA,yFAAyF;IACzF,IAAIE,SAAS,QAAS;QACpB,OAAO,GAAG,AAACA,CAAAA,QAAQ,OAAQ,EAAGS,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9C,OAAO,IAAIT,SAAS,KAAK;QACvB,OAAO,GAAG,AAACA,CAAAA,QAAQ,IAAI,EAAGS,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1C,OAAO;QACL,OAAO,GAA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AW;QAAK;QACpE,MAAML,aAAE,CAACC,QAAQ,CAAC2F,SAAS,CAACF,YAAY/D;IAC1C;IAGJoB,QAAG,CAACC,GAAG,CAAC;AACV;AAEA,SAASvB,QAAWoE,KAAU,EAAEC,GAAwB;IACtD,MAAMP,MAAM,IAAIjC;IAChBuC,MAAMrC,OAAO,CAAC,CAACuC;QACb,MAAMC,QAAQF,IAAIC;QAClB,MAAME,OAAOV,IAAIzB,GAAG,CAACkC,UAAU,EAAE;QACjCC,KAAK/E,IAAI,CAAC6E;QACVR,IAAI1B,GAAG,CAACmC,OAAOC;IACjB;IACA,OAAOV;AACT;AAGO,SAASzG,yBACdoH,SAAwB,EACxB,EACEC,iBAAiB,EACjBtG,QAAQ,IAAIyD,KAAK,EACjBK,QAAQ,EACRyC,iBAAiBzC,aAAa,KAAK,EAMpC;IAEDuC,UAAU1C,OAAO,CAAC,CAAC6C;QACjB,IAAIA,SAASC,IAAI,KAAK,gBAAgB;YACpC;QACF;QACAzG,MAAMgE,GAAG,CAACwC,SAAStB,QAAQ,EAAE;YAC3BpD,UAAU0E,SAASE,MAAM;YACzBC,gBAAgBH,SAASG,cAAc;YACvCxF,cAAcoF,iBAAiB,WAAWjH;QAC5C;IACF;IAEA,OAAOU;AACT"}
|
|
@@ -195,7 +195,9 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
195
195
|
const inlineModules = ((_exp_experiments = exp.experiments) == null ? void 0 : _exp_experiments.inlineModules) ?? false;
|
|
196
196
|
if (inlineModules && options.platforms.includes('ios')) {
|
|
197
197
|
await (0, _inlinemodules().updateXcodeProject)(projectRoot, {
|
|
198
|
-
watchedDirectories: inlineModules.watchedDirectories ?? []
|
|
198
|
+
watchedDirectories: inlineModules.watchedDirectories ?? [],
|
|
199
|
+
xcodeProjectTargets: inlineModules.xcodeProjectTargets,
|
|
200
|
+
name: exp.name
|
|
199
201
|
});
|
|
200
202
|
}
|
|
201
203
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport type { ModPlatform } from '@expo/config-plugins';\nimport { updateXcodeProject } from '@expo/inline-modules';\nimport chalk from 'chalk';\n\nimport {\n clearNativeFolder,\n promptToClearMalformedNativeProjectsAsync,\n maybeBailOnNativeModuleAsync,\n} from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n loadEnvFiles(projectRoot);\n\n const { platforms } = getConfig(projectRoot).exp;\n if (platforms?.length) {\n // Filter out platforms that aren't in the app.json.\n const finalPlatforms = options.platforms.filter((platform) => platforms.includes(platform));\n if (finalPlatforms.length > 0) {\n options.platforms = finalPlatforms;\n } else {\n const requestedPlatforms = options.platforms.join(', ');\n Log.warn(\n chalk`⚠️ Requested prebuild for \"${requestedPlatforms}\", but only \"${platforms.join(', ')}\" is present in app config (\"expo.platforms\" entry). Continuing with \"${requestedPlatforms}\".`\n );\n }\n }\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Check if the target project is actually a native module, which we don't want to erase\n if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, templateChecksum, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n templateChecksum,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n const inlineModules = exp.experiments?.inlineModules ?? false;\n if (inlineModules && options.platforms.includes('ios')) {\n await updateXcodeProject(projectRoot, {\n watchedDirectories: inlineModules.watchedDirectories ?? [],\n });\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","exp","setNodeEnv","loadEnvFiles","platforms","getConfig","length","finalPlatforms","filter","platform","includes","requestedPlatforms","join","Log","warn","chalk","clean","maybeBailOnGitStatusAsync","maybeBailOnNativeModuleAsync","clearNativeFolder","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","templateChecksum","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","log","gray","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","installCocoaPodsAsync","inlineModules","experiments","updateXcodeProject","watchedDirectories","nodeInstall","podInstall"],"mappings":";;;;+BAgDsBA;;;eAAAA;;;;yBA/CI;;;;;;;yBAES;;;;;;;gEACjB;;;;;;mCAMX;uCAC+B;mCACJ;gCAC2C;oCACrC;8BACX;qBACT;qBACA;yBACqB;6BACH;qBACR;yBACN;yBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAwBxB,eAAeF,cACpBG,WAAmB,EACnBC,OAkBC;QAqHqBC;IAnHtBC,IAAAA,mBAAU,EAAC;IACXC,IAAAA,qBAAY,EAACJ;IAEb,MAAM,EAAEK,SAAS,EAAE,GAAGC,IAAAA,mBAAS,EAACN,aAAaE,GAAG;IAChD,IAAIG,6BAAAA,UAAWE,MAAM,EAAE;QACrB,oDAAoD;QACpD,MAAMC,iBAAiBP,QAAQI,SAAS,CAACI,MAAM,CAAC,CAACC,WAAaL,UAAUM,QAAQ,CAACD;QACjF,IAAIF,eAAeD,MAAM,GAAG,GAAG;YAC7BN,QAAQI,SAAS,GAAGG;QACtB,OAAO;YACL,MAAMI,qBAAqBX,QAAQI,SAAS,CAACQ,IAAI,CAAC;YAClDC,QAAG,CAACC,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,4BAA4B,EAAEJ,mBAAmB,aAAa,EAAEP,UAAUQ,IAAI,CAAC,MAAM,sEAAsE,EAAED,mBAAmB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AAC;QACvB,MAAMC;IACR;IAEA,oBAAoB;IACpB,IAAII,gBAAyB;IAC7B,8GAA8G;IAC9G,IAAI3D,QAAQI,SAAS,CAACM,QAAQ,CAAC,UAAUV,QAAQkC,OAAO,IAAIR,iBAAiB;QAC3E,MAAM,EAAEkC,qBAAqB,EAAE,GAAG,MAAM,mEAAA,QAAO;QAE/CD,gBAAgB,MAAMC,sBAAsB7D;IAC9C,OAAO;QACLF,MAAM;IACR;IACA,MAAMgE,gBAAgB5D,EAAAA,mBAAAA,IAAI6D,WAAW,qBAAf7D,iBAAiB4D,aAAa,KAAI;IACxD,IAAIA,iBAAiB7D,QAAQI,SAAS,CAACM,QAAQ,CAAC,QAAQ;QACtD,MAAMqD,IAAAA,mCAAkB,EAAChE,aAAa;YACpCiE,oBAAoBH,cAAcG,kBAAkB,IAAI,EAAE;QAC5D;IACF;IAEA,OAAO;QACLC,aAAa,CAAC,CAACjE,QAAQkC,OAAO;QAC9BgC,YAAY,CAACP;QACbvD,WAAWJ,QAAQI,SAAS;QAC5BqB;QACAxB;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport type { ModPlatform } from '@expo/config-plugins';\nimport { updateXcodeProject } from '@expo/inline-modules';\nimport chalk from 'chalk';\n\nimport {\n clearNativeFolder,\n promptToClearMalformedNativeProjectsAsync,\n maybeBailOnNativeModuleAsync,\n} from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n loadEnvFiles(projectRoot);\n\n const { platforms } = getConfig(projectRoot).exp;\n if (platforms?.length) {\n // Filter out platforms that aren't in the app.json.\n const finalPlatforms = options.platforms.filter((platform) => platforms.includes(platform));\n if (finalPlatforms.length > 0) {\n options.platforms = finalPlatforms;\n } else {\n const requestedPlatforms = options.platforms.join(', ');\n Log.warn(\n chalk`⚠️ Requested prebuild for \"${requestedPlatforms}\", but only \"${platforms.join(', ')}\" is present in app config (\"expo.platforms\" entry). Continuing with \"${requestedPlatforms}\".`\n );\n }\n }\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Check if the target project is actually a native module, which we don't want to erase\n if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, templateChecksum, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\n })\n ) {\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n }\n }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n templateChecksum,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n const inlineModules = exp.experiments?.inlineModules ?? false;\n if (inlineModules && options.platforms.includes('ios')) {\n await updateXcodeProject(projectRoot, {\n watchedDirectories: inlineModules.watchedDirectories ?? [],\n xcodeProjectTargets: inlineModules.xcodeProjectTargets,\n name: exp.name,\n });\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","exp","setNodeEnv","loadEnvFiles","platforms","getConfig","length","finalPlatforms","filter","platform","includes","requestedPlatforms","join","Log","warn","chalk","clean","maybeBailOnGitStatusAsync","maybeBailOnNativeModuleAsync","clearNativeFolder","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","templateChecksum","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","log","gray","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","installCocoaPodsAsync","inlineModules","experiments","updateXcodeProject","watchedDirectories","xcodeProjectTargets","name","nodeInstall","podInstall"],"mappings":";;;;+BAgDsBA;;;eAAAA;;;;yBA/CI;;;;;;;yBAES;;;;;;;gEACjB;;;;;;mCAMX;uCAC+B;mCACJ;gCAC2C;oCACrC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,oBAAoBH,cAAcG,kBAAkB,IAAI,EAAE;YAC1DC,qBAAqBJ,cAAcI,mBAAmB;YACtDC,MAAMjE,IAAIiE,IAAI;QAChB;IACF;IAEA,OAAO;QACLC,aAAa,CAAC,CAACnE,QAAQkC,OAAO;QAC9BkC,YAAY,CAACT;QACbvD,WAAWJ,QAAQI,SAAS;QAC5BqB;QACAxB;IACF;AACF"}
|
|
@@ -22,112 +22,49 @@ function _spawnasync() {
|
|
|
22
22
|
};
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
27
|
-
|
|
25
|
+
function _nodepath() {
|
|
26
|
+
const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
27
|
+
_nodepath = function() {
|
|
28
28
|
return data;
|
|
29
29
|
};
|
|
30
30
|
return data;
|
|
31
31
|
}
|
|
32
|
-
const _log =
|
|
32
|
+
const _log = require("../../../log");
|
|
33
33
|
const _Prerequisite = require("../Prerequisite");
|
|
34
34
|
function _interop_require_default(obj) {
|
|
35
35
|
return obj && obj.__esModule ? obj : {
|
|
36
36
|
default: obj
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
40
|
-
if (typeof WeakMap !== "function") return null;
|
|
41
|
-
var cacheBabelInterop = new WeakMap();
|
|
42
|
-
var cacheNodeInterop = new WeakMap();
|
|
43
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
44
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
45
|
-
})(nodeInterop);
|
|
46
|
-
}
|
|
47
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
48
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
49
|
-
return obj;
|
|
50
|
-
}
|
|
51
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
52
|
-
return {
|
|
53
|
-
default: obj
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
57
|
-
if (cache && cache.has(obj)) {
|
|
58
|
-
return cache.get(obj);
|
|
59
|
-
}
|
|
60
|
-
var newObj = {
|
|
61
|
-
__proto__: null
|
|
62
|
-
};
|
|
63
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
64
|
-
for(var key in obj){
|
|
65
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
66
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
67
|
-
if (desc && (desc.get || desc.set)) {
|
|
68
|
-
Object.defineProperty(newObj, key, desc);
|
|
69
|
-
} else {
|
|
70
|
-
newObj[key] = obj[key];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
newObj.default = obj;
|
|
75
|
-
if (cache) {
|
|
76
|
-
cache.set(obj, newObj);
|
|
77
|
-
}
|
|
78
|
-
return newObj;
|
|
79
|
-
}
|
|
80
39
|
const debug = require('debug')('expo:doctor:apple:simulatorApp');
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
* (e.g. when Xcode lives on an external or renamed volume).
|
|
85
|
-
*/ async function getSimulatorAppIdViaAppleScriptAsync() {
|
|
86
|
-
try {
|
|
87
|
-
return (await (0, _osascript().execAsync)('id of app "Simulator"')).trim();
|
|
88
|
-
} catch {
|
|
89
|
-
// This error may occur in CI where the user intends to install just the simulators but no
|
|
90
|
-
// Xcode, or when Simulator.app is not registered in LaunchServices (e.g. Xcode on an
|
|
91
|
-
// external or renamed volume).
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Fallback: locate Simulator.app via the active Xcode developer directory and read its
|
|
97
|
-
* CFBundleIdentifier directly from the app bundle's Info.plist.
|
|
98
|
-
* This works even when LaunchServices hasn't indexed Simulator.app.
|
|
99
|
-
*/ async function getSimulatorAppIdFromBundleAsync() {
|
|
100
|
-
try {
|
|
101
|
-
const { stdout: developerDir } = await (0, _spawnasync().default)('xcode-select', [
|
|
102
|
-
'--print-path'
|
|
103
|
-
]);
|
|
104
|
-
const simulatorInfoPlist = _path().default.join(developerDir.trim(), 'Applications', 'Simulator.app', 'Contents', 'Info.plist');
|
|
105
|
-
const { stdout: bundleId } = await (0, _spawnasync().default)('defaults', [
|
|
106
|
-
'read',
|
|
107
|
-
simulatorInfoPlist,
|
|
108
|
-
'CFBundleIdentifier'
|
|
109
|
-
]);
|
|
110
|
-
return bundleId.trim() || null;
|
|
111
|
-
} catch {
|
|
112
|
-
// Simulator.app not found at the expected path or xcode-select is unavailable.
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
async function getSimulatorAppIdAsync() {
|
|
117
|
-
return await getSimulatorAppIdViaAppleScriptAsync() ?? await getSimulatorAppIdFromBundleAsync();
|
|
118
|
-
}
|
|
40
|
+
// NOTE(cedric): Xcode 27 Beta moved the `<xcode>/Contents/Developer/Applications` to `<xcode>/Contents/Applications`
|
|
41
|
+
const XCODE_DEVICE_HUB_PATH = '../Applications/DeviceHub.app/Contents/Info.plist';
|
|
42
|
+
const XCODE_SIMULATOR_PATH = './Applications/Simulator.app/Contents/Info.plist';
|
|
119
43
|
class SimulatorAppPrerequisite extends _Prerequisite.Prerequisite {
|
|
120
44
|
static #_ = this.instance = new SimulatorAppPrerequisite();
|
|
121
45
|
async assertImplementation() {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
46
|
+
// Xcode 27 replaces Simulator with DeviceHub
|
|
47
|
+
// See: https://developer.apple.com/documentation/xcode/device-hub
|
|
48
|
+
// TODO(cedric): once Xcode 27 stable is released, resolve DeviceHub first
|
|
49
|
+
let appId = await (0, _osascript().safeIdOfAppAsync)('Simulator').then((appId)=>{
|
|
50
|
+
return appId || (0, _osascript().safeIdOfAppAsync)('DeviceHub');
|
|
51
|
+
});
|
|
52
|
+
if (!appId) {
|
|
53
|
+
const xcodePath = await getXcodeSelectPath();
|
|
54
|
+
debug('Xcode select path: %s', xcodePath);
|
|
55
|
+
if (xcodePath) {
|
|
56
|
+
appId = await getXcodeInfoPlistBundleId(_nodepath().default.join(xcodePath, XCODE_SIMULATOR_PATH)).then((appId)=>{
|
|
57
|
+
return appId || getXcodeInfoPlistBundleId(_nodepath().default.join(xcodePath, XCODE_DEVICE_HUB_PATH));
|
|
58
|
+
});
|
|
59
|
+
}
|
|
126
60
|
}
|
|
127
|
-
if (
|
|
128
|
-
throw new _Prerequisite.PrerequisiteCommandError('SIMULATOR_APP', "Simulator
|
|
61
|
+
if (!appId) {
|
|
62
|
+
throw new _Prerequisite.PrerequisiteCommandError('SIMULATOR_APP', "Can't determine id of Device Hub or Simulator app; the Device Hub or Simulator is most likely not installed on this machine. Run `sudo xcode-select -s /Applications/Xcode.app`");
|
|
129
63
|
}
|
|
130
|
-
|
|
64
|
+
if (appId !== 'com.apple.dt.Devices' && appId !== 'com.apple.iphonesimulator' && appId !== 'com.apple.CoreSimulator.SimulatorTrampoline') {
|
|
65
|
+
throw new _Prerequisite.PrerequisiteCommandError('SIMULATOR_APP', `Device Hub or Simulator is installed but is identified as '${appId}'; don't know what that is.`);
|
|
66
|
+
}
|
|
67
|
+
debug('Xcode simulator app id: %s', appId);
|
|
131
68
|
try {
|
|
132
69
|
// make sure we can run simctl
|
|
133
70
|
await (0, _spawnasync().default)('xcrun', [
|
|
@@ -135,10 +72,35 @@ class SimulatorAppPrerequisite extends _Prerequisite.Prerequisite {
|
|
|
135
72
|
'help'
|
|
136
73
|
]);
|
|
137
74
|
} catch (error) {
|
|
138
|
-
_log.warn(`Unable to run simctl:\n${error.toString()}`);
|
|
75
|
+
_log.Log.warn(`Unable to run simctl:\n${error.toString()}`);
|
|
139
76
|
throw new _Prerequisite.PrerequisiteCommandError('SIMCTL', 'xcrun is not configured correctly. Ensure `sudo xcode-select --reset` works before running this command again.');
|
|
140
77
|
}
|
|
141
78
|
}
|
|
142
79
|
}
|
|
80
|
+
async function getXcodeSelectPath() {
|
|
81
|
+
try {
|
|
82
|
+
const result = await (0, _spawnasync().default)('xcode-select', [
|
|
83
|
+
'--print-path'
|
|
84
|
+
]);
|
|
85
|
+
return result.stdout.trim() || null;
|
|
86
|
+
} catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Read the Info.plist of an app within Xcode and return the bundle ID.
|
|
92
|
+
* This uses `defaults read <path>/Info.plist CFBundleIdentifier`.
|
|
93
|
+
*/ async function getXcodeInfoPlistBundleId(infoPlistPath) {
|
|
94
|
+
try {
|
|
95
|
+
const result = await (0, _spawnasync().default)('defaults', [
|
|
96
|
+
'read',
|
|
97
|
+
infoPlistPath,
|
|
98
|
+
'CFBundleIdentifier'
|
|
99
|
+
]);
|
|
100
|
+
return result.stdout.trim() || null;
|
|
101
|
+
} catch {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
143
105
|
|
|
144
106
|
//# sourceMappingURL=SimulatorAppPrerequisite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/doctor/apple/SimulatorAppPrerequisite.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/doctor/apple/SimulatorAppPrerequisite.ts"],"sourcesContent":["import { safeIdOfAppAsync } from '@expo/osascript';\nimport spawnAsync from '@expo/spawn-async';\nimport path from 'node:path';\n\nimport { Log } from '../../../log';\nimport { Prerequisite, PrerequisiteCommandError } from '../Prerequisite';\n\nconst debug = require('debug')('expo:doctor:apple:simulatorApp') as typeof console.log;\n\n// NOTE(cedric): Xcode 27 Beta moved the `<xcode>/Contents/Developer/Applications` to `<xcode>/Contents/Applications`\nconst XCODE_DEVICE_HUB_PATH = '../Applications/DeviceHub.app/Contents/Info.plist';\nconst XCODE_SIMULATOR_PATH = './Applications/Simulator.app/Contents/Info.plist';\n\nexport class SimulatorAppPrerequisite extends Prerequisite {\n static instance = new SimulatorAppPrerequisite();\n\n async assertImplementation(): Promise<void> {\n // Xcode 27 replaces Simulator with DeviceHub\n // See: https://developer.apple.com/documentation/xcode/device-hub\n // TODO(cedric): once Xcode 27 stable is released, resolve DeviceHub first\n let appId = await safeIdOfAppAsync('Simulator').then((appId) => {\n return appId || safeIdOfAppAsync('DeviceHub');\n });\n\n if (!appId) {\n const xcodePath = await getXcodeSelectPath();\n debug('Xcode select path: %s', xcodePath);\n if (xcodePath) {\n appId = await getXcodeInfoPlistBundleId(path.join(xcodePath, XCODE_SIMULATOR_PATH)).then(\n (appId) => {\n return appId || getXcodeInfoPlistBundleId(path.join(xcodePath, XCODE_DEVICE_HUB_PATH));\n }\n );\n }\n }\n\n if (!appId) {\n throw new PrerequisiteCommandError(\n 'SIMULATOR_APP',\n \"Can't determine id of Device Hub or Simulator app; the Device Hub or Simulator is most likely not installed on this machine. Run `sudo xcode-select -s /Applications/Xcode.app`\"\n );\n }\n\n if (\n appId !== 'com.apple.dt.Devices' &&\n appId !== 'com.apple.iphonesimulator' &&\n appId !== 'com.apple.CoreSimulator.SimulatorTrampoline'\n ) {\n throw new PrerequisiteCommandError(\n 'SIMULATOR_APP',\n `Device Hub or Simulator is installed but is identified as '${appId}'; don't know what that is.`\n );\n }\n\n debug('Xcode simulator app id: %s', appId);\n\n try {\n // make sure we can run simctl\n await spawnAsync('xcrun', ['simctl', 'help']);\n } catch (error: any) {\n Log.warn(`Unable to run simctl:\\n${error.toString()}`);\n throw new PrerequisiteCommandError(\n 'SIMCTL',\n 'xcrun is not configured correctly. Ensure `sudo xcode-select --reset` works before running this command again.'\n );\n }\n }\n}\n\nasync function getXcodeSelectPath() {\n try {\n const result = await spawnAsync('xcode-select', ['--print-path']);\n return result.stdout.trim() || null;\n } catch {\n return null;\n }\n}\n\n/**\n * Read the Info.plist of an app within Xcode and return the bundle ID.\n * This uses `defaults read <path>/Info.plist CFBundleIdentifier`.\n */\nasync function getXcodeInfoPlistBundleId(infoPlistPath: string) {\n try {\n const result = await spawnAsync('defaults', ['read', infoPlistPath, 'CFBundleIdentifier']);\n return result.stdout.trim() || null;\n } catch {\n return null;\n }\n}\n"],"names":["SimulatorAppPrerequisite","debug","require","XCODE_DEVICE_HUB_PATH","XCODE_SIMULATOR_PATH","Prerequisite","instance","assertImplementation","appId","safeIdOfAppAsync","then","xcodePath","getXcodeSelectPath","getXcodeInfoPlistBundleId","path","join","PrerequisiteCommandError","spawnAsync","error","Log","warn","toString","result","stdout","trim","infoPlistPath"],"mappings":";;;;+BAaaA;;;eAAAA;;;;yBAboB;;;;;;;gEACV;;;;;;;gEACN;;;;;;qBAEG;8BACmC;;;;;;AAEvD,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,qHAAqH;AACrH,MAAMC,wBAAwB;AAC9B,MAAMC,uBAAuB;AAEtB,MAAMJ,iCAAiCK,0BAAY;qBACjDC,WAAW,IAAIN;IAEtB,MAAMO,uBAAsC;QAC1C,6CAA6C;QAC7C,kEAAkE;QAClE,0EAA0E;QAC1E,IAAIC,QAAQ,MAAMC,IAAAA,6BAAgB,EAAC,aAAaC,IAAI,CAAC,CAACF;YACpD,OAAOA,SAASC,IAAAA,6BAAgB,EAAC;QACnC;QAEA,IAAI,CAACD,OAAO;YACV,MAAMG,YAAY,MAAMC;YACxBX,MAAM,yBAAyBU;YAC/B,IAAIA,WAAW;gBACbH,QAAQ,MAAMK,0BAA0BC,mBAAI,CAACC,IAAI,CAACJ,WAAWP,uBAAuBM,IAAI,CACtF,CAACF;oBACC,OAAOA,SAASK,0BAA0BC,mBAAI,CAACC,IAAI,CAACJ,WAAWR;gBACjE;YAEJ;QACF;QAEA,IAAI,CAACK,OAAO;YACV,MAAM,IAAIQ,sCAAwB,CAChC,iBACA;QAEJ;QAEA,IACER,UAAU,0BACVA,UAAU,+BACVA,UAAU,+CACV;YACA,MAAM,IAAIQ,sCAAwB,CAChC,iBACA,CAAC,2DAA2D,EAAER,MAAM,2BAA2B,CAAC;QAEpG;QAEAP,MAAM,8BAA8BO;QAEpC,IAAI;YACF,8BAA8B;YAC9B,MAAMS,IAAAA,qBAAU,EAAC,SAAS;gBAAC;gBAAU;aAAO;QAC9C,EAAE,OAAOC,OAAY;YACnBC,QAAG,CAACC,IAAI,CAAC,CAAC,uBAAuB,EAAEF,MAAMG,QAAQ,IAAI;YACrD,MAAM,IAAIL,sCAAwB,CAChC,UACA;QAEJ;IACF;AACF;AAEA,eAAeJ;IACb,IAAI;QACF,MAAMU,SAAS,MAAML,IAAAA,qBAAU,EAAC,gBAAgB;YAAC;SAAe;QAChE,OAAOK,OAAOC,MAAM,CAACC,IAAI,MAAM;IACjC,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;CAGC,GACD,eAAeX,0BAA0BY,aAAqB;IAC5D,IAAI;QACF,MAAMH,SAAS,MAAML,IAAAA,qBAAU,EAAC,YAAY;YAAC;YAAQQ;YAAe;SAAqB;QACzF,OAAOH,OAAOC,MAAM,CAACC,IAAI,MAAM;IACjC,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
|
@@ -17,7 +17,7 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function _osascript() {
|
|
20
|
-
const data =
|
|
20
|
+
const data = require("@expo/osascript");
|
|
21
21
|
_osascript = function() {
|
|
22
22
|
return data;
|
|
23
23
|
};
|
|
@@ -273,7 +273,13 @@ class AppleDeviceManager extends _DeviceManager.DeviceManager {
|
|
|
273
273
|
// In non-interactive mode, we should assume this is an agent and not attempt to focus the Simulator app since it doesn't need focus.
|
|
274
274
|
if ((0, _interactive.isInteractive)()) {
|
|
275
275
|
// TODO: Focus the individual window
|
|
276
|
-
await _osascript().
|
|
276
|
+
await (0, _osascript().spawnAsync)([
|
|
277
|
+
`if application "Simulator" is running then`,
|
|
278
|
+
`tell application "Simulator" to activate`,
|
|
279
|
+
`else if application "DeviceHub" is running then`,
|
|
280
|
+
`tell application "DeviceHub" to activate`,
|
|
281
|
+
`end if`
|
|
282
|
+
]);
|
|
277
283
|
}
|
|
278
284
|
}
|
|
279
285
|
getExpoGoAppId() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/AppleDeviceManager.ts"],"sourcesContent":["import * as osascript from '@expo/osascript';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { assertSystemRequirementsAsync } from './assertSystemRequirements';\nimport { ensureSimulatorAppRunningAsync } from './ensureSimulatorAppRunning';\nimport {\n getBestBootedSimulatorAsync,\n getBestUnbootedSimulatorAsync,\n getSelectableSimulatorsAsync,\n} from './getBestSimulator';\nimport { promptAppleDeviceAsync } from './promptAppleDevice';\nimport * as SimControl from './simctl';\nimport { delayAsync, waitForActionAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { isInteractive } from '../../../utils/interactive';\nimport { parsePlistAsync } from '../../../utils/plist';\nimport { validateUrl } from '../../../utils/url';\nimport { DeviceManager } from '../DeviceManager';\nimport { ExpoGoInstaller } from '../ExpoGoInstaller';\nimport type { BaseResolveDeviceProps } from '../PlatformManager';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleDeviceManager') as typeof console.log;\n\nconst EXPO_GO_BUNDLE_IDENTIFIER = 'host.exp.Exponent';\n\n/**\n * Ensure a simulator is booted and the Simulator app is opened.\n * This is where any timeout related error handling should live.\n */\nexport async function ensureSimulatorOpenAsync(\n { udid, osType }: Partial<Pick<SimControl.Device, 'udid' | 'osType'>> = {},\n tryAgain: boolean = true\n): Promise<SimControl.Device> {\n // Use a default simulator if none was specified\n if (!udid) {\n // If a simulator is open, side step the entire booting sequence.\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp;\n }\n\n // Otherwise, find the best possible simulator from user defaults and continue\n const bestUdid = await getBestUnbootedSimulatorAsync({ osType });\n if (!bestUdid) {\n throw new CommandError('No simulators found.');\n }\n udid = bestUdid;\n }\n\n const bootedDevice = await waitForActionAsync({\n action: () => {\n // Just for the type check.\n assert(udid);\n return SimControl.bootAsync({ udid });\n },\n });\n\n if (!bootedDevice) {\n // Give it a second chance, this might not be needed but it could potentially lead to a better UX on slower devices.\n if (tryAgain) {\n return await ensureSimulatorOpenAsync({ udid, osType }, false);\n }\n // TODO: We should eliminate all needs for a timeout error, it's bad UX to get an error about the simulator not starting while the user can clearly see it starting on their slow computer.\n throw new CommandError(\n 'SIMULATOR_TIMEOUT',\n `Simulator didn't boot fast enough. Try opening Simulator first, then running your app.`\n );\n }\n return bootedDevice;\n}\nexport class AppleDeviceManager extends DeviceManager<SimControl.Device> {\n static assertSystemRequirementsAsync = assertSystemRequirementsAsync;\n\n static async resolveAsync({\n device,\n shouldPrompt,\n }: BaseResolveDeviceProps<\n Partial<Pick<SimControl.Device, 'udid' | 'osType'>>\n > = {}): Promise<AppleDeviceManager> {\n if (shouldPrompt) {\n const devices = await getSelectableSimulatorsAsync(device);\n device = await promptAppleDeviceAsync(devices, device?.osType);\n }\n\n const booted = await ensureSimulatorOpenAsync(device);\n return new AppleDeviceManager(booted);\n }\n\n get name() {\n return this.device.name;\n }\n\n get identifier(): string {\n return this.device.udid;\n }\n\n async getAppVersionAsync(\n appId: string,\n { containerPath }: { containerPath?: string } = {}\n ): Promise<string | null> {\n return await SimControl.getInfoPlistValueAsync(this.device, {\n appId,\n key: 'CFBundleShortVersionString',\n containerPath,\n });\n }\n\n async startAsync(): Promise<SimControl.Device> {\n return ensureSimulatorOpenAsync({ osType: this.device.osType, udid: this.device.udid });\n }\n\n async launchApplicationIdAsync(appId: string) {\n try {\n const result = await SimControl.openAppIdAsync(this.device, {\n appId,\n });\n if (result.status === 0) {\n await this.activateWindowAsync();\n } else {\n throw new CommandError(result.stderr);\n }\n } catch (error: any) {\n let errorMessage = `Couldn't open iOS app with ID \"${appId}\" on device \"${this.name}\".`;\n if (error instanceof CommandError && error.code === 'APP_NOT_INSTALLED') {\n if (appId === EXPO_GO_BUNDLE_IDENTIFIER) {\n errorMessage = `Couldn't open Expo Go app on device \"${this.name}\". Install it: https://expo.dev/go.`;\n } else {\n errorMessage += `\\nThe app might not be installed, try installing it with: ${chalk.bold(\n `npx expo run:ios -d ${this.device.udid}`\n )}`;\n }\n }\n if (error.stderr) {\n errorMessage += chalk.gray(`\\n${error.stderr}`);\n } else if (error.message) {\n errorMessage += chalk.gray(`\\n${error.message}`);\n }\n throw new CommandError(errorMessage);\n }\n }\n\n async installAppAsync(filePath: string) {\n await SimControl.installAsync(this.device, {\n filePath,\n });\n\n await this.waitForAppInstalledAsync(await this.getApplicationIdFromBundle(filePath));\n }\n\n private async getApplicationIdFromBundle(filePath: string): Promise<string> {\n debug('getApplicationIdFromBundle:', filePath);\n const builtInfoPlistPath = path.join(filePath, 'Info.plist');\n if (fs.existsSync(builtInfoPlistPath)) {\n const { CFBundleIdentifier } = await parsePlistAsync(builtInfoPlistPath);\n debug('getApplicationIdFromBundle: using built Info.plist', CFBundleIdentifier);\n return CFBundleIdentifier;\n }\n debug('getApplicationIdFromBundle: no Info.plist found');\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n private async waitForAppInstalledAsync(applicationId: string): Promise<boolean> {\n while (true) {\n if (await this.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(applicationId)) {\n return true;\n }\n await delayAsync(100);\n }\n }\n\n async uninstallAppAsync(appId: string) {\n await SimControl.uninstallAsync(this.device, {\n appId,\n });\n }\n\n async isAppInstalledAndIfSoReturnContainerPathForIOSAsync(appId: string) {\n return (\n (await SimControl.getContainerPathAsync(this.device, {\n appId,\n })) ?? false\n );\n }\n\n async openUrlAsync(url: string, options: { appId?: string } = {}) {\n // Non-compliant URLs will be treated as application identifiers.\n if (!validateUrl(url, { requireProtocol: true })) {\n return await this.launchApplicationIdAsync(url);\n }\n\n try {\n await SimControl.openUrlAsync(this.device, { url, appId: options.appId });\n } catch (error: any) {\n // 194 means the device does not conform to a given URL, in this case we'll assume that the desired app is not installed.\n if (error.status === 194) {\n // An error was encountered processing the command (domain=NSOSStatusErrorDomain, code=-10814):\n // The operation couldn’t be completed. (OSStatus error -10814.)\n //\n // This can be thrown when no app conforms to the URI scheme that we attempted to open.\n throw new CommandError(\n 'APP_NOT_INSTALLED',\n `Device ${this.device.name} (${this.device.udid}) has no app to handle the URI: ${url}`\n );\n }\n throw error;\n }\n }\n\n async activateWindowAsync() {\n await ensureSimulatorAppRunningAsync(this.device);\n\n // If we're in interactive mode, we can attempt to focus the Simulator app.\n // In non-interactive mode, we should assume this is an agent and not attempt to focus the Simulator app since it doesn't need focus.\n if (isInteractive()) {\n // TODO: Focus the individual window\n await osascript.execAsync(`tell application \"Simulator\" to activate`);\n }\n }\n\n getExpoGoAppId(): string {\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n async ensureExpoGoAsync(sdkVersion: string): Promise<boolean> {\n if (this.device.osType === 'watchOS') {\n throw new CommandError(\n 'UNSUPPORTED_DEVICE',\n `Expo Go is not supported on Apple Watch. Please select an iPhone or iPad simulator instead.`\n );\n }\n const installer = new ExpoGoInstaller('ios', EXPO_GO_BUNDLE_IDENTIFIER, sdkVersion);\n return installer.ensureAsync(this);\n }\n}\n"],"names":["AppleDeviceManager","ensureSimulatorOpenAsync","debug","require","EXPO_GO_BUNDLE_IDENTIFIER","udid","osType","tryAgain","simulatorOpenedByApp","getBestBootedSimulatorAsync","bestUdid","getBestUnbootedSimulatorAsync","CommandError","bootedDevice","waitForActionAsync","action","assert","SimControl","bootAsync","DeviceManager","assertSystemRequirementsAsync","resolveAsync","device","shouldPrompt","devices","getSelectableSimulatorsAsync","promptAppleDeviceAsync","booted","name","identifier","getAppVersionAsync","appId","containerPath","getInfoPlistValueAsync","key","startAsync","launchApplicationIdAsync","result","openAppIdAsync","status","activateWindowAsync","stderr","error","errorMessage","code","chalk","bold","gray","message","installAppAsync","filePath","installAsync","waitForAppInstalledAsync","getApplicationIdFromBundle","builtInfoPlistPath","path","join","fs","existsSync","CFBundleIdentifier","parsePlistAsync","applicationId","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","delayAsync","uninstallAppAsync","uninstallAsync","getContainerPathAsync","openUrlAsync","url","options","validateUrl","requireProtocol","ensureSimulatorAppRunningAsync","isInteractive","osascript","execAsync","getExpoGoAppId","ensureExpoGoAsync","sdkVersion","installer","ExpoGoInstaller","ensureAsync"],"mappings":";;;;;;;;;;;QAyEaA;eAAAA;;QAzCSC;eAAAA;;;;iEAhCK;;;;;;;gEACR;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;0CAE6B;2CACC;kCAKxC;mCACgC;gEACX;uBACmB;wBAClB;6BACC;uBACE;qBACJ;+BACE;iCACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGhC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,4BAA4B;AAM3B,eAAeH,yBACpB,EAAEI,IAAI,EAAEC,MAAM,EAAuD,GAAG,CAAC,CAAC,EAC1EC,WAAoB,IAAI;IAExB,gDAAgD;IAChD,IAAI,CAACF,MAAM;QACT,iEAAiE;QACjE,MAAMG,uBAAuB,MAAMC,IAAAA,6CAA2B,EAAC;YAAEH;QAAO;QACxE,IAAIE,sBAAsB;YACxB,OAAOA;QACT;QAEA,8EAA8E;QAC9E,MAAME,WAAW,MAAMC,IAAAA,+CAA6B,EAAC;YAAEL;QAAO;QAC9D,IAAI,CAACI,UAAU;YACb,MAAM,IAAIE,oBAAY,CAAC;QACzB;QACAP,OAAOK;IACT;IAEA,MAAMG,eAAe,MAAMC,IAAAA,yBAAkB,EAAC;QAC5CC,QAAQ;YACN,2BAA2B;YAC3BC,IAAAA,iBAAM,EAACX;YACP,OAAOY,QAAWC,SAAS,CAAC;gBAAEb;YAAK;QACrC;IACF;IAEA,IAAI,CAACQ,cAAc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AAqI;QACrI,IAAImD,IAAAA,0BAAa,KAAI;YACnB,oCAAoC;YACpC,MAAMC,aAAUC,SAAS,CAAC,CAAC,wCAAwC,CAAC;QACtE;IACF;IAEAC,iBAAyB;QACvB,OAAOxE;IACT;IAEA,MAAMyE,kBAAkBC,UAAkB,EAAoB;QAC5D,IAAI,IAAI,CAACxD,MAAM,CAAChB,MAAM,KAAK,WAAW;YACpC,MAAM,IAAIM,oBAAY,CACpB,sBACA,CAAC,2FAA2F,CAAC;QAEjG;QACA,MAAMmE,YAAY,IAAIC,gCAAe,CAAC,OAAO5E,2BAA2B0E;QACxE,OAAOC,UAAUE,WAAW,CAAC,IAAI;IACnC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/AppleDeviceManager.ts"],"sourcesContent":["import { spawnAsync as spawnAppleScriptAsync } from '@expo/osascript';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { assertSystemRequirementsAsync } from './assertSystemRequirements';\nimport { ensureSimulatorAppRunningAsync } from './ensureSimulatorAppRunning';\nimport {\n getBestBootedSimulatorAsync,\n getBestUnbootedSimulatorAsync,\n getSelectableSimulatorsAsync,\n} from './getBestSimulator';\nimport { promptAppleDeviceAsync } from './promptAppleDevice';\nimport * as SimControl from './simctl';\nimport { delayAsync, waitForActionAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { isInteractive } from '../../../utils/interactive';\nimport { parsePlistAsync } from '../../../utils/plist';\nimport { validateUrl } from '../../../utils/url';\nimport { DeviceManager } from '../DeviceManager';\nimport { ExpoGoInstaller } from '../ExpoGoInstaller';\nimport type { BaseResolveDeviceProps } from '../PlatformManager';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleDeviceManager') as typeof console.log;\n\nconst EXPO_GO_BUNDLE_IDENTIFIER = 'host.exp.Exponent';\n\n/**\n * Ensure a simulator is booted and the Simulator app is opened.\n * This is where any timeout related error handling should live.\n */\nexport async function ensureSimulatorOpenAsync(\n { udid, osType }: Partial<Pick<SimControl.Device, 'udid' | 'osType'>> = {},\n tryAgain: boolean = true\n): Promise<SimControl.Device> {\n // Use a default simulator if none was specified\n if (!udid) {\n // If a simulator is open, side step the entire booting sequence.\n const simulatorOpenedByApp = await getBestBootedSimulatorAsync({ osType });\n if (simulatorOpenedByApp) {\n return simulatorOpenedByApp;\n }\n\n // Otherwise, find the best possible simulator from user defaults and continue\n const bestUdid = await getBestUnbootedSimulatorAsync({ osType });\n if (!bestUdid) {\n throw new CommandError('No simulators found.');\n }\n udid = bestUdid;\n }\n\n const bootedDevice = await waitForActionAsync({\n action: () => {\n // Just for the type check.\n assert(udid);\n return SimControl.bootAsync({ udid });\n },\n });\n\n if (!bootedDevice) {\n // Give it a second chance, this might not be needed but it could potentially lead to a better UX on slower devices.\n if (tryAgain) {\n return await ensureSimulatorOpenAsync({ udid, osType }, false);\n }\n // TODO: We should eliminate all needs for a timeout error, it's bad UX to get an error about the simulator not starting while the user can clearly see it starting on their slow computer.\n throw new CommandError(\n 'SIMULATOR_TIMEOUT',\n `Simulator didn't boot fast enough. Try opening Simulator first, then running your app.`\n );\n }\n return bootedDevice;\n}\nexport class AppleDeviceManager extends DeviceManager<SimControl.Device> {\n static assertSystemRequirementsAsync = assertSystemRequirementsAsync;\n\n static async resolveAsync({\n device,\n shouldPrompt,\n }: BaseResolveDeviceProps<\n Partial<Pick<SimControl.Device, 'udid' | 'osType'>>\n > = {}): Promise<AppleDeviceManager> {\n if (shouldPrompt) {\n const devices = await getSelectableSimulatorsAsync(device);\n device = await promptAppleDeviceAsync(devices, device?.osType);\n }\n\n const booted = await ensureSimulatorOpenAsync(device);\n return new AppleDeviceManager(booted);\n }\n\n get name() {\n return this.device.name;\n }\n\n get identifier(): string {\n return this.device.udid;\n }\n\n async getAppVersionAsync(\n appId: string,\n { containerPath }: { containerPath?: string } = {}\n ): Promise<string | null> {\n return await SimControl.getInfoPlistValueAsync(this.device, {\n appId,\n key: 'CFBundleShortVersionString',\n containerPath,\n });\n }\n\n async startAsync(): Promise<SimControl.Device> {\n return ensureSimulatorOpenAsync({ osType: this.device.osType, udid: this.device.udid });\n }\n\n async launchApplicationIdAsync(appId: string) {\n try {\n const result = await SimControl.openAppIdAsync(this.device, {\n appId,\n });\n if (result.status === 0) {\n await this.activateWindowAsync();\n } else {\n throw new CommandError(result.stderr);\n }\n } catch (error: any) {\n let errorMessage = `Couldn't open iOS app with ID \"${appId}\" on device \"${this.name}\".`;\n if (error instanceof CommandError && error.code === 'APP_NOT_INSTALLED') {\n if (appId === EXPO_GO_BUNDLE_IDENTIFIER) {\n errorMessage = `Couldn't open Expo Go app on device \"${this.name}\". Install it: https://expo.dev/go.`;\n } else {\n errorMessage += `\\nThe app might not be installed, try installing it with: ${chalk.bold(\n `npx expo run:ios -d ${this.device.udid}`\n )}`;\n }\n }\n if (error.stderr) {\n errorMessage += chalk.gray(`\\n${error.stderr}`);\n } else if (error.message) {\n errorMessage += chalk.gray(`\\n${error.message}`);\n }\n throw new CommandError(errorMessage);\n }\n }\n\n async installAppAsync(filePath: string) {\n await SimControl.installAsync(this.device, {\n filePath,\n });\n\n await this.waitForAppInstalledAsync(await this.getApplicationIdFromBundle(filePath));\n }\n\n private async getApplicationIdFromBundle(filePath: string): Promise<string> {\n debug('getApplicationIdFromBundle:', filePath);\n const builtInfoPlistPath = path.join(filePath, 'Info.plist');\n if (fs.existsSync(builtInfoPlistPath)) {\n const { CFBundleIdentifier } = await parsePlistAsync(builtInfoPlistPath);\n debug('getApplicationIdFromBundle: using built Info.plist', CFBundleIdentifier);\n return CFBundleIdentifier;\n }\n debug('getApplicationIdFromBundle: no Info.plist found');\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n private async waitForAppInstalledAsync(applicationId: string): Promise<boolean> {\n while (true) {\n if (await this.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(applicationId)) {\n return true;\n }\n await delayAsync(100);\n }\n }\n\n async uninstallAppAsync(appId: string) {\n await SimControl.uninstallAsync(this.device, {\n appId,\n });\n }\n\n async isAppInstalledAndIfSoReturnContainerPathForIOSAsync(appId: string) {\n return (\n (await SimControl.getContainerPathAsync(this.device, {\n appId,\n })) ?? false\n );\n }\n\n async openUrlAsync(url: string, options: { appId?: string } = {}) {\n // Non-compliant URLs will be treated as application identifiers.\n if (!validateUrl(url, { requireProtocol: true })) {\n return await this.launchApplicationIdAsync(url);\n }\n\n try {\n await SimControl.openUrlAsync(this.device, { url, appId: options.appId });\n } catch (error: any) {\n // 194 means the device does not conform to a given URL, in this case we'll assume that the desired app is not installed.\n if (error.status === 194) {\n // An error was encountered processing the command (domain=NSOSStatusErrorDomain, code=-10814):\n // The operation couldn’t be completed. (OSStatus error -10814.)\n //\n // This can be thrown when no app conforms to the URI scheme that we attempted to open.\n throw new CommandError(\n 'APP_NOT_INSTALLED',\n `Device ${this.device.name} (${this.device.udid}) has no app to handle the URI: ${url}`\n );\n }\n throw error;\n }\n }\n\n async activateWindowAsync() {\n await ensureSimulatorAppRunningAsync(this.device);\n\n // If we're in interactive mode, we can attempt to focus the Simulator app.\n // In non-interactive mode, we should assume this is an agent and not attempt to focus the Simulator app since it doesn't need focus.\n if (isInteractive()) {\n // TODO: Focus the individual window\n await spawnAppleScriptAsync([\n `if application \"Simulator\" is running then`,\n `tell application \"Simulator\" to activate`,\n `else if application \"DeviceHub\" is running then`,\n `tell application \"DeviceHub\" to activate`,\n `end if`,\n ]);\n }\n }\n\n getExpoGoAppId(): string {\n return EXPO_GO_BUNDLE_IDENTIFIER;\n }\n\n async ensureExpoGoAsync(sdkVersion: string): Promise<boolean> {\n if (this.device.osType === 'watchOS') {\n throw new CommandError(\n 'UNSUPPORTED_DEVICE',\n `Expo Go is not supported on Apple Watch. Please select an iPhone or iPad simulator instead.`\n );\n }\n const installer = new ExpoGoInstaller('ios', EXPO_GO_BUNDLE_IDENTIFIER, sdkVersion);\n return installer.ensureAsync(this);\n }\n}\n"],"names":["AppleDeviceManager","ensureSimulatorOpenAsync","debug","require","EXPO_GO_BUNDLE_IDENTIFIER","udid","osType","tryAgain","simulatorOpenedByApp","getBestBootedSimulatorAsync","bestUdid","getBestUnbootedSimulatorAsync","CommandError","bootedDevice","waitForActionAsync","action","assert","SimControl","bootAsync","DeviceManager","assertSystemRequirementsAsync","resolveAsync","device","shouldPrompt","devices","getSelectableSimulatorsAsync","promptAppleDeviceAsync","booted","name","identifier","getAppVersionAsync","appId","containerPath","getInfoPlistValueAsync","key","startAsync","launchApplicationIdAsync","result","openAppIdAsync","status","activateWindowAsync","stderr","error","errorMessage","code","chalk","bold","gray","message","installAppAsync","filePath","installAsync","waitForAppInstalledAsync","getApplicationIdFromBundle","builtInfoPlistPath","path","join","fs","existsSync","CFBundleIdentifier","parsePlistAsync","applicationId","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","delayAsync","uninstallAppAsync","uninstallAsync","getContainerPathAsync","openUrlAsync","url","options","validateUrl","requireProtocol","ensureSimulatorAppRunningAsync","isInteractive","spawnAppleScriptAsync","getExpoGoAppId","ensureExpoGoAsync","sdkVersion","installer","ExpoGoInstaller","ensureAsync"],"mappings":";;;;;;;;;;;QAyEaA;eAAAA;;QAzCSC;eAAAA;;;;yBAhC8B;;;;;;;gEACjC;;;;;;;gEACD;;;;;;;gEACH;;;;;;;gEACE;;;;;;0CAE6B;2CACC;kCAKxC;mCACgC;gEACX;uBACmB;wBAClB;6BACC;uBACE;qBACJ;+BACE;iCACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGhC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,4BAA4B;AAM3B,eAAeH,yBACpB,EAAEI,IAAI,EAAEC,MAAM,EAAuD,GAAG,CAAC,CAAC,EAC1EC,WAAoB,IAAI;IAExB,gDAAgD;IAChD,IAAI,CAACF,MAAM;QACT,iEAAiE;QACjE,MAAMG,uBAAuB,MAAMC,IAAAA,6CAA2B,EAAC;YAAEH;QAAO;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