@expo/cli 56.1.15 → 56.1.16
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/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/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +10 -10
package/build/bin/cli
CHANGED
|
@@ -76,7 +76,7 @@ function getInitMetadata() {
|
|
|
76
76
|
return {
|
|
77
77
|
format: 'v0-jsonl',
|
|
78
78
|
// Version is added in the build script.
|
|
79
|
-
version: "56.1.
|
|
79
|
+
version: "56.1.16" ?? 'UNVERSIONED'
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function getWellKnownTemporaryLogFile(projectRoot, command) {
|
|
@@ -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,UA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B,EAAE,OAAOG,OAAO;QACdJ,kBAAkBG,IAAI,CAAC;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;;;;;;;gEACj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,MAAMqD,IAAAA,mCAAkB,EAAChE,aAAa;YACpCiE,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;gBA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,IAAI,CAAClD,MAAM;QAEhD,2EAA2E;QAC3E,qIAAqI;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,uBAA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,OAAOW,OAAY;YACnB,yHAAyH;YACzH,IAAIA,MAAMH,MAAM,KAAK,KAAK;gBACxB,+FAA+F;gBAC/F,gEAAgE;gBAChE,EAAE;gBACF,uFAAuF;gBACvF,MAAM,IAAI3B,oBAAY,CACpB,qBACA,CAAC,OAAO,EAAE,IAAI,CAACU,MAAM,CAACM,IAAI,CAAC,EAAE,EAAE,IAAI,CAACN,MAAM,CAACjB,IAAI,CAAC,gCAAgC,EAAE+D,KAAK;YAE3F;YACA,MAAM1B;QACR;IACF;IAEA,MAAMF,sBAAsB;QAC1B,MAAMgC,IAAAA,yDAA8B,EAAC,IAAI,CAAClD,MAAM;QAEhD,2EAA2E;QAC3E,qIAAqI;QACrI,IAAImD,IAAAA,0BAAa,KAAI;YACnB,oCAAoC;YACpC,MAAMC,IAAAA,uBAAqB,EAAC;gBAC1B,CAAC,0CAA0C,CAAC;gBAC5C,CAAC,wCAAwC,CAAC;gBAC1C,CAAC,+CAA+C,CAAC;gBACjD,CAAC,wCAAwC,CAAC;gBAC1C,CAAC,MAAM,CAAC;aACT;QACH;IACF;IAEAC,iBAAyB;QACvB,OAAOvE;IACT;IAEA,MAAMwE,kBAAkBC,UAAkB,EAAoB;QAC5D,IAAI,IAAI,CAACvD,MAAM,CAAChB,MAAM,KAAK,WAAW;YACpC,MAAM,IAAIM,oBAAY,CACpB,sBACA,CAAC,2FAA2F,CAAC;QAEjG;QACA,MAAMkE,YAAY,IAAIC,gCAAe,CAAC,OAAO3E,2BAA2ByE;QACxE,OAAOC,UAAUE,WAAW,CAAC,IAAI;IACnC;AACF"}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "ensureSimulatorAppRunningAsync", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
function _osascript() {
|
|
12
|
-
const data =
|
|
12
|
+
const data = require("@expo/osascript");
|
|
13
13
|
_osascript = function() {
|
|
14
14
|
return data;
|
|
15
15
|
};
|
|
@@ -95,8 +95,8 @@ async function waitForSimulatorAppToStart({ maxWaitTime } = {}) {
|
|
|
95
95
|
// I think the app can be open while no simulators are booted.
|
|
96
96
|
async function isSimulatorAppRunningAsync() {
|
|
97
97
|
try {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
98
|
+
const result = await (0, _osascript().spawnAsync)('tell app "System Events" to count processes whose name is "Simulator" or name is "DeviceHub"');
|
|
99
|
+
if (result.stdout.trim() === '0') {
|
|
100
100
|
return false;
|
|
101
101
|
}
|
|
102
102
|
} catch (error) {
|
|
@@ -108,15 +108,30 @@ async function isSimulatorAppRunningAsync() {
|
|
|
108
108
|
return true;
|
|
109
109
|
}
|
|
110
110
|
async function openSimulatorAppAsync(device) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
try {
|
|
112
|
+
const args = [
|
|
113
|
+
'-a',
|
|
114
|
+
'Simulator'
|
|
115
|
+
];
|
|
116
|
+
if (device.udid) {
|
|
117
|
+
// This has no effect if the app is already running.
|
|
118
|
+
args.push('--args', '-CurrentDeviceUDID', device.udid);
|
|
119
|
+
}
|
|
120
|
+
await (0, _spawnasync().default)('open', args);
|
|
121
|
+
} catch {
|
|
122
|
+
// Xcode 27+ replaces Simulator.app with DeviceHub, so `open -a Simulator` fails.
|
|
123
|
+
// DeviceHub registers the `devices://` URL scheme, which lets us focus the right
|
|
124
|
+
// device by its UDID — `open -a DeviceHub` can only bring the app forward.
|
|
125
|
+
const deviceHubArgs = device.udid ? [
|
|
126
|
+
`devices://device/open?id=${device.udid}`
|
|
127
|
+
] : [
|
|
128
|
+
'-a',
|
|
129
|
+
'DeviceHub'
|
|
130
|
+
];
|
|
131
|
+
await (0, _spawnasync().default)('open', deviceHubArgs).catch(()=>{
|
|
132
|
+
// Noop - we can't do much more here
|
|
133
|
+
});
|
|
118
134
|
}
|
|
119
|
-
await (0, _spawnasync().default)('open', args);
|
|
120
135
|
}
|
|
121
136
|
|
|
122
137
|
//# sourceMappingURL=ensureSimulatorAppRunning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/ios/ensureSimulatorAppRunning.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/ios/ensureSimulatorAppRunning.ts"],"sourcesContent":["import { spawnAsync as spawnAppleScriptAsync } from '@expo/osascript';\nimport spawnAsync from '@expo/spawn-async';\n\nimport type { Device } from './simctl';\nimport * as Log from '../../../log';\nimport { waitForActionAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\n\n/** Open the Simulator.app and return when the system registers it as 'open'. */\nexport async function ensureSimulatorAppRunningAsync(\n device: Partial<Pick<Device, 'udid'>>,\n {\n maxWaitTime,\n }: {\n maxWaitTime?: number;\n } = {}\n): Promise<void> {\n if (await isSimulatorAppRunningAsync()) {\n return;\n }\n\n Log.log(`\\u203A Opening the iOS simulator, this might take a moment.`);\n\n // In theory this would ensure the correct simulator is booted as well.\n // This isn't theory though, this is Xcode.\n await openSimulatorAppAsync(device);\n\n if (!(await waitForSimulatorAppToStart({ maxWaitTime }))) {\n throw new CommandError(\n 'SIMULATOR_TIMEOUT',\n `Simulator app did not open fast enough. Try opening Simulator first, then running your app.`\n );\n }\n}\n\nasync function waitForSimulatorAppToStart({\n maxWaitTime,\n}: { maxWaitTime?: number } = {}): Promise<boolean> {\n return waitForActionAsync<boolean>({\n interval: 50,\n maxWaitTime,\n action: isSimulatorAppRunningAsync,\n });\n}\n\n// I think the app can be open while no simulators are booted.\nasync function isSimulatorAppRunningAsync(): Promise<boolean> {\n try {\n const result = await spawnAppleScriptAsync(\n 'tell app \"System Events\" to count processes whose name is \"Simulator\" or name is \"DeviceHub\"'\n );\n if (result.stdout.trim() === '0') {\n return false;\n }\n } catch (error: any) {\n if (error.message.includes('Application isn’t running')) {\n return false;\n }\n throw error;\n }\n\n return true;\n}\n\nasync function openSimulatorAppAsync(device: { udid?: string }) {\n try {\n const args = ['-a', 'Simulator'];\n if (device.udid) {\n // This has no effect if the app is already running.\n args.push('--args', '-CurrentDeviceUDID', device.udid);\n }\n await spawnAsync('open', args);\n } catch {\n // Xcode 27+ replaces Simulator.app with DeviceHub, so `open -a Simulator` fails.\n // DeviceHub registers the `devices://` URL scheme, which lets us focus the right\n // device by its UDID — `open -a DeviceHub` can only bring the app forward.\n const deviceHubArgs = device.udid\n ? [`devices://device/open?id=${device.udid}`]\n : ['-a', 'DeviceHub'];\n await spawnAsync('open', deviceHubArgs).catch(() => {\n // Noop - we can't do much more here\n });\n }\n}\n"],"names":["ensureSimulatorAppRunningAsync","device","maxWaitTime","isSimulatorAppRunningAsync","Log","log","openSimulatorAppAsync","waitForSimulatorAppToStart","CommandError","waitForActionAsync","interval","action","result","spawnAppleScriptAsync","stdout","trim","error","message","includes","args","udid","push","spawnAsync","deviceHubArgs","catch"],"mappings":";;;;+BASsBA;;;eAAAA;;;;yBAT8B;;;;;;;gEAC7B;;;;;;6DAGF;uBACc;wBACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtB,eAAeA,+BACpBC,MAAqC,EACrC,EACEC,WAAW,EAGZ,GAAG,CAAC,CAAC;IAEN,IAAI,MAAMC,8BAA8B;QACtC;IACF;IAEAC,KAAIC,GAAG,CAAC,CAAC,2DAA2D,CAAC;IAErE,uEAAuE;IACvE,2CAA2C;IAC3C,MAAMC,sBAAsBL;IAE5B,IAAI,CAAE,MAAMM,2BAA2B;QAAEL;IAAY,IAAK;QACxD,MAAM,IAAIM,oBAAY,CACpB,qBACA,CAAC,2FAA2F,CAAC;IAEjG;AACF;AAEA,eAAeD,2BAA2B,EACxCL,WAAW,EACc,GAAG,CAAC,CAAC;IAC9B,OAAOO,IAAAA,yBAAkB,EAAU;QACjCC,UAAU;QACVR;QACAS,QAAQR;IACV;AACF;AAEA,8DAA8D;AAC9D,eAAeA;IACb,IAAI;QACF,MAAMS,SAAS,MAAMC,IAAAA,uBAAqB,EACxC;QAEF,IAAID,OAAOE,MAAM,CAACC,IAAI,OAAO,KAAK;YAChC,OAAO;QACT;IACF,EAAE,OAAOC,OAAY;QACnB,IAAIA,MAAMC,OAAO,CAACC,QAAQ,CAAC,8BAA8B;YACvD,OAAO;QACT;QACA,MAAMF;IACR;IAEA,OAAO;AACT;AAEA,eAAeV,sBAAsBL,MAAyB;IAC5D,IAAI;QACF,MAAMkB,OAAO;YAAC;YAAM;SAAY;QAChC,IAAIlB,OAAOmB,IAAI,EAAE;YACf,oDAAoD;YACpDD,KAAKE,IAAI,CAAC,UAAU,sBAAsBpB,OAAOmB,IAAI;QACvD;QACA,MAAME,IAAAA,qBAAU,EAAC,QAAQH;IAC3B,EAAE,OAAM;QACN,iFAAiF;QACjF,iFAAiF;QACjF,2EAA2E;QAC3E,MAAMI,gBAAgBtB,OAAOmB,IAAI,GAC7B;YAAC,CAAC,yBAAyB,EAAEnB,OAAOmB,IAAI,EAAE;SAAC,GAC3C;YAAC;YAAM;SAAY;QACvB,MAAME,IAAAA,qBAAU,EAAC,QAAQC,eAAeC,KAAK,CAAC;QAC5C,oCAAoC;QACtC;IACF;AACF"}
|
|
@@ -26,7 +26,7 @@ class FetchClient {
|
|
|
26
26
|
this.headers = {
|
|
27
27
|
accept: 'application/json',
|
|
28
28
|
'content-type': 'application/json',
|
|
29
|
-
'user-agent': `expo-cli/${"56.1.
|
|
29
|
+
'user-agent': `expo-cli/${"56.1.16"}`,
|
|
30
30
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
31
31
|
};
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "56.1.
|
|
3
|
+
"version": "56.1.16",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"bin": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@expo/code-signing-certificates": "^0.0.6",
|
|
42
42
|
"@expo/config": "~56.0.9",
|
|
43
|
-
"@expo/config-plugins": "~56.0.
|
|
43
|
+
"@expo/config-plugins": "~56.0.9",
|
|
44
44
|
"@expo/devcert": "^1.2.1",
|
|
45
45
|
"@expo/env": "~2.3.0",
|
|
46
46
|
"@expo/image-utils": "^0.10.1",
|
|
47
|
-
"@expo/inline-modules": "^0.0.
|
|
47
|
+
"@expo/inline-modules": "^0.0.12",
|
|
48
48
|
"@expo/json-file": "^10.2.0",
|
|
49
49
|
"@expo/log-box": "^56.0.13",
|
|
50
50
|
"@expo/metro": "~56.0.0",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@expo/osascript": "^2.6.0",
|
|
54
54
|
"@expo/package-manager": "^1.12.1",
|
|
55
55
|
"@expo/plist": "^0.7.0",
|
|
56
|
-
"@expo/prebuild-config": "^56.0.
|
|
56
|
+
"@expo/prebuild-config": "^56.0.16",
|
|
57
57
|
"@expo/require-utils": "^56.1.3",
|
|
58
|
-
"@expo/router-server": "^56.0.
|
|
58
|
+
"@expo/router-server": "^56.0.14",
|
|
59
59
|
"@expo/schema-utils": "^56.0.0",
|
|
60
60
|
"@expo/spawn-async": "^1.8.0",
|
|
61
61
|
"@expo/ws-tunnel": "^2.0.0",
|
|
@@ -156,13 +156,13 @@
|
|
|
156
156
|
"playwright": "^1.59.0",
|
|
157
157
|
"taskr": "^1.1.0",
|
|
158
158
|
"tree-kill": "^1.2.2",
|
|
159
|
-
"
|
|
160
|
-
"expo": "56.0.10",
|
|
159
|
+
"expo": "56.0.12",
|
|
161
160
|
"expo-module-scripts": "56.0.3",
|
|
162
|
-
"expo-modules-autolinking": "56.0.
|
|
163
|
-
"expo
|
|
161
|
+
"expo-modules-autolinking": "56.0.16",
|
|
162
|
+
"@expo/fingerprint": "0.19.4",
|
|
163
|
+
"expo-router": "56.2.11"
|
|
164
164
|
},
|
|
165
|
-
"gitHead": "
|
|
165
|
+
"gitHead": "812dc007aefed0c432c0439fdfe05ee2f4f21da2",
|
|
166
166
|
"scripts": {
|
|
167
167
|
"build": "taskr",
|
|
168
168
|
"clean": "expo-module clean",
|