@expo/cli 0.24.6 → 0.24.7
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/run/android/resolveOptions.js +13 -1
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +17 -24
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +13 -1
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +20 -19
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +2 -2
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/utils/remote-build-cache-providers/eas.js +12 -2
- package/build/src/utils/remote-build-cache-providers/eas.js.map +1 -1
- package/build/src/utils/remote-build-cache-providers/helpers.js +55 -3
- package/build/src/utils/remote-build-cache-providers/helpers.js.map +1 -1
- package/build/src/utils/remote-build-cache-providers/index.js +171 -0
- package/build/src/utils/remote-build-cache-providers/index.js.map +1 -0
- package/build/src/utils/remote-build-cache-providers/types.js +6 -0
- package/build/src/utils/remote-build-cache-providers/types.js.map +1 -0
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +3 -3
- package/build/src/run/remoteBuildCache.js +0 -80
- package/build/src/run/remoteBuildCache.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -8,13 +8,24 @@ Object.defineProperty(exports, "resolveOptionsAsync", {
|
|
|
8
8
|
return resolveOptionsAsync;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
function _config() {
|
|
12
|
+
const data = require("@expo/config");
|
|
13
|
+
_config = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
11
18
|
const _resolveDevice = require("./resolveDevice");
|
|
12
19
|
const _resolveGradlePropsAsync = require("./resolveGradlePropsAsync");
|
|
13
20
|
const _resolveLaunchProps = require("./resolveLaunchProps");
|
|
21
|
+
const _remotebuildcacheproviders = require("../../utils/remote-build-cache-providers");
|
|
14
22
|
const _resolveBundlerProps = require("../resolveBundlerProps");
|
|
15
23
|
async function resolveOptionsAsync(projectRoot, options) {
|
|
24
|
+
var _projectConfig_exp_experiments_remoteBuildCache, _projectConfig_exp_experiments;
|
|
16
25
|
// Resolve the device before the gradle props because we need the device to be running to get the ABI.
|
|
17
26
|
const device = await (0, _resolveDevice.resolveDeviceAsync)(options.device);
|
|
27
|
+
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
28
|
+
const buildCacheProvider = (0, _remotebuildcacheproviders.resolveRemoteBuildCacheProvider)((_projectConfig_exp_experiments = projectConfig.exp.experiments) == null ? void 0 : (_projectConfig_exp_experiments_remoteBuildCache = _projectConfig_exp_experiments.remoteBuildCache) == null ? void 0 : _projectConfig_exp_experiments_remoteBuildCache.provider, projectRoot);
|
|
18
29
|
return {
|
|
19
30
|
...await (0, _resolveBundlerProps.resolveBundlerPropsAsync)(projectRoot, options),
|
|
20
31
|
...await (0, _resolveGradlePropsAsync.resolveGradlePropsAsync)(projectRoot, options, device.device),
|
|
@@ -24,7 +35,8 @@ async function resolveOptionsAsync(projectRoot, options) {
|
|
|
24
35
|
// from a list of devices (connected or simulated) that are filtered by the scheme.
|
|
25
36
|
device,
|
|
26
37
|
buildCache: !!options.buildCache,
|
|
27
|
-
install: !!options.install
|
|
38
|
+
install: !!options.install,
|
|
39
|
+
buildCacheProvider
|
|
28
40
|
};
|
|
29
41
|
}
|
|
30
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/android/resolveOptions.ts"],"sourcesContent":["import { resolveDeviceAsync } from './resolveDevice';\nimport { GradleProps, resolveGradlePropsAsync } from './resolveGradlePropsAsync';\nimport { LaunchProps, resolveLaunchPropsAsync } from './resolveLaunchProps';\nimport { AndroidDeviceManager } from '../../start/platforms/android/AndroidDeviceManager';\nimport { BundlerProps, resolveBundlerPropsAsync } from '../resolveBundlerProps';\n\nexport type Options = {\n variant?: string;\n device?: boolean | string;\n port?: number;\n bundler?: boolean;\n install?: boolean;\n buildCache?: boolean;\n allArch?: boolean;\n binary?: string;\n appId?: string;\n};\n\nexport type ResolvedOptions = GradleProps &\n BundlerProps &\n LaunchProps & {\n variant: string;\n buildCache: boolean;\n device: AndroidDeviceManager;\n install: boolean;\n architectures?: string;\n appId?: string;\n };\n\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<ResolvedOptions> {\n // Resolve the device before the gradle props because we need the device to be running to get the ABI.\n const device = await resolveDeviceAsync(options.device);\n\n return {\n ...(await resolveBundlerPropsAsync(projectRoot, options)),\n ...(await resolveGradlePropsAsync(projectRoot, options, device.device)),\n ...(await resolveLaunchPropsAsync(projectRoot, options)),\n variant: options.variant ?? 'debug',\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n device,\n buildCache: !!options.buildCache,\n install: !!options.install,\n };\n}\n"],"names":["resolveOptionsAsync","projectRoot","options","device","resolveDeviceAsync","resolveBundlerPropsAsync","resolveGradlePropsAsync","resolveLaunchPropsAsync","variant","buildCache","install"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/android/resolveOptions.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { resolveDeviceAsync } from './resolveDevice';\nimport { GradleProps, resolveGradlePropsAsync } from './resolveGradlePropsAsync';\nimport { LaunchProps, resolveLaunchPropsAsync } from './resolveLaunchProps';\nimport { AndroidDeviceManager } from '../../start/platforms/android/AndroidDeviceManager';\nimport { resolveRemoteBuildCacheProvider } from '../../utils/remote-build-cache-providers';\nimport { RemoteBuildCacheProvider } from '../../utils/remote-build-cache-providers/types';\nimport { BundlerProps, resolveBundlerPropsAsync } from '../resolveBundlerProps';\n\nexport type Options = {\n variant?: string;\n device?: boolean | string;\n port?: number;\n bundler?: boolean;\n install?: boolean;\n buildCache?: boolean;\n allArch?: boolean;\n binary?: string;\n appId?: string;\n};\n\nexport type ResolvedOptions = GradleProps &\n BundlerProps &\n LaunchProps & {\n variant: string;\n buildCache: boolean;\n device: AndroidDeviceManager;\n install: boolean;\n architectures?: string;\n appId?: string;\n buildCacheProvider?: RemoteBuildCacheProvider;\n };\n\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<ResolvedOptions> {\n // Resolve the device before the gradle props because we need the device to be running to get the ABI.\n const device = await resolveDeviceAsync(options.device);\n\n const projectConfig = getConfig(projectRoot);\n const buildCacheProvider = resolveRemoteBuildCacheProvider(\n projectConfig.exp.experiments?.remoteBuildCache?.provider,\n projectRoot\n );\n\n return {\n ...(await resolveBundlerPropsAsync(projectRoot, options)),\n ...(await resolveGradlePropsAsync(projectRoot, options, device.device)),\n ...(await resolveLaunchPropsAsync(projectRoot, options)),\n variant: options.variant ?? 'debug',\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n device,\n buildCache: !!options.buildCache,\n install: !!options.install,\n buildCacheProvider,\n };\n}\n"],"names":["resolveOptionsAsync","projectRoot","options","projectConfig","device","resolveDeviceAsync","getConfig","buildCacheProvider","resolveRemoteBuildCacheProvider","exp","experiments","remoteBuildCache","provider","resolveBundlerPropsAsync","resolveGradlePropsAsync","resolveLaunchPropsAsync","variant","buildCache","install"],"mappings":";;;;+BAkCsBA;;;eAAAA;;;;yBAlCI;;;;;;+BAES;yCACkB;oCACA;2CAEL;qCAEO;AA0BhD,eAAeA,oBACpBC,WAAmB,EACnBC,OAAgB;QAOdC,iDAAAA;IALF,sGAAsG;IACtG,MAAMC,SAAS,MAAMC,IAAAA,iCAAkB,EAACH,QAAQE,MAAM;IAEtD,MAAMD,gBAAgBG,IAAAA,mBAAS,EAACL;IAChC,MAAMM,qBAAqBC,IAAAA,0DAA+B,GACxDL,iCAAAA,cAAcM,GAAG,CAACC,WAAW,sBAA7BP,kDAAAA,+BAA+BQ,gBAAgB,qBAA/CR,gDAAiDS,QAAQ,EACzDX;IAGF,OAAO;QACL,GAAI,MAAMY,IAAAA,6CAAwB,EAACZ,aAAaC,QAAQ;QACxD,GAAI,MAAMY,IAAAA,gDAAuB,EAACb,aAAaC,SAASE,OAAOA,MAAM,CAAC;QACtE,GAAI,MAAMW,IAAAA,2CAAuB,EAACd,aAAaC,QAAQ;QACvDc,SAASd,QAAQc,OAAO,IAAI;QAC5B,+DAA+D;QAC/D,mFAAmF;QACnFZ;QACAa,YAAY,CAAC,CAACf,QAAQe,UAAU;QAChCC,SAAS,CAAC,CAAChB,QAAQgB,OAAO;QAC1BX;IACF;AACF"}
|
|
@@ -8,13 +8,6 @@ Object.defineProperty(exports, "runAndroidAsync", {
|
|
|
8
8
|
return runAndroidAsync;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
function _config() {
|
|
12
|
-
const data = require("@expo/config");
|
|
13
|
-
_config = function() {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
11
|
function _chalk() {
|
|
19
12
|
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
20
13
|
_chalk = function() {
|
|
@@ -44,10 +37,10 @@ const _gradle = require("../../start/platforms/android/gradle");
|
|
|
44
37
|
const _errors = require("../../utils/errors");
|
|
45
38
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
46
39
|
const _port = require("../../utils/port");
|
|
40
|
+
const _remotebuildcacheproviders = require("../../utils/remote-build-cache-providers");
|
|
47
41
|
const _scheme = require("../../utils/scheme");
|
|
48
42
|
const _ensureNativeProject = require("../ensureNativeProject");
|
|
49
43
|
const _hints = require("../hints");
|
|
50
|
-
const _remoteBuildCache = require("../remoteBuildCache");
|
|
51
44
|
const _startBundler = require("../startBundler");
|
|
52
45
|
function _interop_require_default(obj) {
|
|
53
46
|
return obj && obj.__esModule ? obj : {
|
|
@@ -56,28 +49,27 @@ function _interop_require_default(obj) {
|
|
|
56
49
|
}
|
|
57
50
|
const debug = require('debug')('expo:run:android');
|
|
58
51
|
async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
59
|
-
var _options_variant,
|
|
52
|
+
var _options_variant, _this;
|
|
60
53
|
// NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.
|
|
61
54
|
const isProduction = (_options_variant = options.variant) == null ? void 0 : _options_variant.toLowerCase().endsWith('release');
|
|
62
55
|
(0, _nodeEnv.setNodeEnv)(isProduction ? 'production' : 'development');
|
|
63
56
|
require('@expo/env').load(projectRoot);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
await (0, _ensureNativeProject.ensureNativeProjectAsync)(projectRoot, {
|
|
58
|
+
platform: 'android',
|
|
59
|
+
install
|
|
60
|
+
});
|
|
61
|
+
const props = await (0, _resolveOptions.resolveOptionsAsync)(projectRoot, options);
|
|
62
|
+
if (!options.binary && props.buildCacheProvider) {
|
|
63
|
+
const localPath = await (0, _remotebuildcacheproviders.resolveRemoteBuildCache)({
|
|
64
|
+
projectRoot,
|
|
68
65
|
platform: 'android',
|
|
69
|
-
provider:
|
|
66
|
+
provider: props.buildCacheProvider,
|
|
70
67
|
runOptions: options
|
|
71
68
|
});
|
|
72
69
|
if (localPath) {
|
|
73
70
|
options.binary = localPath;
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
|
-
await (0, _ensureNativeProject.ensureNativeProjectAsync)(projectRoot, {
|
|
77
|
-
platform: 'android',
|
|
78
|
-
install
|
|
79
|
-
});
|
|
80
|
-
const props = await (0, _resolveOptions.resolveOptionsAsync)(projectRoot, options);
|
|
81
73
|
debug('Package name: ' + props.packageName);
|
|
82
74
|
_log.Log.log('› Building app...');
|
|
83
75
|
const androidProjectRoot = _path().default.join(projectRoot, 'android');
|
|
@@ -141,12 +133,13 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
|
141
133
|
} else {
|
|
142
134
|
await manager.stopAsync();
|
|
143
135
|
}
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
if (options.binary && shouldUpdateBuildCache && props.buildCacheProvider) {
|
|
137
|
+
await (0, _remotebuildcacheproviders.uploadRemoteBuildCache)({
|
|
138
|
+
projectRoot,
|
|
147
139
|
platform: 'android',
|
|
148
|
-
provider:
|
|
149
|
-
buildPath: options.binary
|
|
140
|
+
provider: props.buildCacheProvider,
|
|
141
|
+
buildPath: options.binary,
|
|
142
|
+
runOptions: options
|
|
150
143
|
});
|
|
151
144
|
}
|
|
152
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport {\n resolveRemoteBuildCache,\n uploadRemoteBuildCache,\n} from '../../utils/remote-build-cache-providers';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n if (!options.binary && props.buildCacheProvider) {\n const localPath = await resolveRemoteBuildCache({\n projectRoot,\n platform: 'android',\n provider: props.buildCacheProvider,\n runOptions: options,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n let shouldUpdateBuildCache = false;\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n shouldUpdateBuildCache = true;\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (!options.binary) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n if (apkFile) {\n // Attempt to install the APK from the file path\n options.binary = path.join(props.apkVariantDirectory, apkFile);\n }\n }\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync<AndroidOpenInCustomProps>(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (options.binary && shouldUpdateBuildCache && props.buildCacheProvider) {\n await uploadRemoteBuildCache({\n projectRoot,\n platform: 'android',\n provider: props.buildCacheProvider,\n buildPath: options.binary,\n runOptions: options,\n });\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","isProduction","variant","toLowerCase","endsWith","setNodeEnv","load","ensureNativeProjectAsync","platform","props","resolveOptionsAsync","binary","buildCacheProvider","localPath","resolveRemoteBuildCache","provider","runOptions","packageName","Log","log","androidProjectRoot","path","join","shouldUpdateBuildCache","eagerBundleOptions","JSON","stringify","exportEagerAsync","dev","assembleAsync","port","appName","buildCache","architectures","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","apkFile","resolveInstallApkNameAsync","device","apkVariantDirectory","binaryPath","fs","existsSync","CommandError","chalk","gray","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","customAppId","launchActivity","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","buildPath","installAsync"],"mappings":";;;;+BAwBsBA;;;eAAAA;;;;gEAxBJ;;;;;;;gEACH;;;;;;;gEACE;;;;;;uCAE0B;gCACmB;6BAC7B;qBACb;wBAEwB;wBACf;yBACF;sBACiB;2CAIrC;wBACmC;qCACD;uBACF;8BACL;;;;;;AAElC,MAAMC,Q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IAAC;IAGhC,IAAIlC,MAAMyB,kBAAkB,EAAE;QAC5BuB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMrB,QAAQsB,SAAS;IACzB;IAEA,IAAI1D,QAAQW,MAAM,IAAIY,0BAA0Bd,MAAMG,kBAAkB,EAAE;QACxE,MAAM+C,IAAAA,iDAAsB,EAAC;YAC3B7D;YACAU,UAAU;YACVO,UAAUN,MAAMG,kBAAkB;YAClCgD,WAAW5D,QAAQW,MAAM;YACzBK,YAAYhB;QACd;IACF;AACF;AAEA,eAAemD,gBAAgB/B,kBAA0B,EAAEX,KAAsB;IAC/E,sFAAsF;IACtF,qFAAqF;IACrFS,QAAG,CAACC,GAAG,CAAC;IACR,MAAM0C,IAAAA,oBAAY,EAACzC,oBAAoB;QACrClB,SAASO,MAAMP,OAAO,IAAI;QAC1B6B,SAAStB,MAAMsB,OAAO,IAAI;QAC1BD,MAAMrB,MAAMqB,IAAI;IAClB;AACF"}
|
|
@@ -8,13 +8,22 @@ Object.defineProperty(exports, "resolveOptionsAsync", {
|
|
|
8
8
|
return resolveOptionsAsync;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
function _config() {
|
|
12
|
+
const data = require("@expo/config");
|
|
13
|
+
_config = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
11
18
|
const _resolveDevice = require("./resolveDevice");
|
|
12
19
|
const _resolveNativeScheme = require("./resolveNativeScheme");
|
|
13
20
|
const _resolveXcodeProject = require("./resolveXcodeProject");
|
|
14
21
|
const _simctl = require("../../../start/platforms/ios/simctl");
|
|
15
22
|
const _profile = require("../../../utils/profile");
|
|
23
|
+
const _remotebuildcacheproviders = require("../../../utils/remote-build-cache-providers");
|
|
16
24
|
const _resolveBundlerProps = require("../../resolveBundlerProps");
|
|
17
25
|
async function resolveOptionsAsync(projectRoot, options) {
|
|
26
|
+
var _projectConfig_exp_experiments_remoteBuildCache, _projectConfig_exp_experiments;
|
|
18
27
|
const xcodeProject = (0, _resolveXcodeProject.resolveXcodeProject)(projectRoot);
|
|
19
28
|
const bundlerProps = await (0, _resolveBundlerProps.resolveBundlerPropsAsync)(projectRoot, options);
|
|
20
29
|
// Resolve the scheme before the device so we can filter devices based on
|
|
@@ -32,6 +41,8 @@ async function resolveOptionsAsync(projectRoot, options) {
|
|
|
32
41
|
configuration
|
|
33
42
|
});
|
|
34
43
|
const isSimulator = (0, _resolveDevice.isSimulatorDevice)(device);
|
|
44
|
+
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
45
|
+
const buildCacheProvider = (0, _remotebuildcacheproviders.resolveRemoteBuildCacheProvider)((_projectConfig_exp_experiments = projectConfig.exp.experiments) == null ? void 0 : (_projectConfig_exp_experiments_remoteBuildCache = _projectConfig_exp_experiments.remoteBuildCache) == null ? void 0 : _projectConfig_exp_experiments_remoteBuildCache.provider, projectRoot);
|
|
35
46
|
// This optimization skips resetting the Metro cache needlessly.
|
|
36
47
|
// The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the
|
|
37
48
|
// project is running in Debug and built onto a physical device. It seems that this is done because
|
|
@@ -47,7 +58,8 @@ async function resolveOptionsAsync(projectRoot, options) {
|
|
|
47
58
|
configuration,
|
|
48
59
|
shouldSkipInitialBundling,
|
|
49
60
|
buildCache: options.buildCache !== false,
|
|
50
|
-
scheme
|
|
61
|
+
scheme,
|
|
62
|
+
buildCacheProvider
|
|
51
63
|
};
|
|
52
64
|
}
|
|
53
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/run/ios/options/resolveOptions.ts"],"sourcesContent":["import { isSimulatorDevice, resolveDeviceAsync } from './resolveDevice';\nimport { resolveNativeSchemePropsAsync } from './resolveNativeScheme';\nimport { resolveXcodeProject } from './resolveXcodeProject';\nimport { isOSType } from '../../../start/platforms/ios/simctl';\nimport { profile } from '../../../utils/profile';\nimport { resolveBundlerPropsAsync } from '../../resolveBundlerProps';\nimport { BuildProps, Options } from '../XcodeBuild.types';\n\n/** Resolve arguments for the `run:ios` command. */\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<BuildProps> {\n const xcodeProject = resolveXcodeProject(projectRoot);\n\n const bundlerProps = await resolveBundlerPropsAsync(projectRoot, options);\n\n // Resolve the scheme before the device so we can filter devices based on\n // whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).\n const { osType, name: scheme } = await resolveNativeSchemePropsAsync(\n projectRoot,\n options,\n xcodeProject\n );\n\n // Use the configuration or `Debug` if none is provided.\n const configuration = options.configuration || 'Debug';\n\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n const device = await profile(resolveDeviceAsync)(options.device, {\n // It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.\n osType: isOSType(osType) ? osType : undefined,\n xcodeProject,\n scheme,\n configuration,\n });\n\n const isSimulator = isSimulatorDevice(device);\n\n // This optimization skips resetting the Metro cache needlessly.\n // The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the\n // project is running in Debug and built onto a physical device. It seems that this is done because\n // the script is run from Xcode and unaware of the CLI instance.\n const shouldSkipInitialBundling = configuration === 'Debug' && !isSimulator;\n\n return {\n ...bundlerProps,\n shouldStartBundler: options.configuration === 'Debug' || bundlerProps.shouldStartBundler,\n projectRoot,\n isSimulator,\n xcodeProject,\n device,\n configuration,\n shouldSkipInitialBundling,\n buildCache: options.buildCache !== false,\n scheme,\n };\n}\n"],"names":["resolveOptionsAsync","projectRoot","options","xcodeProject","resolveXcodeProject","bundlerProps","resolveBundlerPropsAsync","osType","name","scheme","resolveNativeSchemePropsAsync","configuration","device","profile","resolveDeviceAsync","isOSType","undefined","isSimulator","isSimulatorDevice","shouldSkipInitialBundling","shouldStartBundler","buildCache"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/options/resolveOptions.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { isSimulatorDevice, resolveDeviceAsync } from './resolveDevice';\nimport { resolveNativeSchemePropsAsync } from './resolveNativeScheme';\nimport { resolveXcodeProject } from './resolveXcodeProject';\nimport { isOSType } from '../../../start/platforms/ios/simctl';\nimport { profile } from '../../../utils/profile';\nimport { resolveRemoteBuildCacheProvider } from '../../../utils/remote-build-cache-providers';\nimport { resolveBundlerPropsAsync } from '../../resolveBundlerProps';\nimport { BuildProps, Options } from '../XcodeBuild.types';\n\n/** Resolve arguments for the `run:ios` command. */\nexport async function resolveOptionsAsync(\n projectRoot: string,\n options: Options\n): Promise<BuildProps> {\n const xcodeProject = resolveXcodeProject(projectRoot);\n\n const bundlerProps = await resolveBundlerPropsAsync(projectRoot, options);\n\n // Resolve the scheme before the device so we can filter devices based on\n // whichever scheme is selected (i.e. don't present TV devices if the scheme cannot be run on a TV).\n const { osType, name: scheme } = await resolveNativeSchemePropsAsync(\n projectRoot,\n options,\n xcodeProject\n );\n\n // Use the configuration or `Debug` if none is provided.\n const configuration = options.configuration || 'Debug';\n\n // Resolve the device based on the provided device id or prompt\n // from a list of devices (connected or simulated) that are filtered by the scheme.\n const device = await profile(resolveDeviceAsync)(options.device, {\n // It's unclear if there's any value to asserting that we haven't hardcoded the os type in the CLI.\n osType: isOSType(osType) ? osType : undefined,\n xcodeProject,\n scheme,\n configuration,\n });\n\n const isSimulator = isSimulatorDevice(device);\n\n const projectConfig = getConfig(projectRoot);\n const buildCacheProvider = resolveRemoteBuildCacheProvider(\n projectConfig.exp.experiments?.remoteBuildCache?.provider,\n projectRoot\n );\n\n // This optimization skips resetting the Metro cache needlessly.\n // The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the\n // project is running in Debug and built onto a physical device. It seems that this is done because\n // the script is run from Xcode and unaware of the CLI instance.\n const shouldSkipInitialBundling = configuration === 'Debug' && !isSimulator;\n\n return {\n ...bundlerProps,\n shouldStartBundler: options.configuration === 'Debug' || bundlerProps.shouldStartBundler,\n projectRoot,\n isSimulator,\n xcodeProject,\n device,\n configuration,\n shouldSkipInitialBundling,\n buildCache: options.buildCache !== false,\n scheme,\n buildCacheProvider,\n };\n}\n"],"names":["resolveOptionsAsync","projectRoot","options","projectConfig","xcodeProject","resolveXcodeProject","bundlerProps","resolveBundlerPropsAsync","osType","name","scheme","resolveNativeSchemePropsAsync","configuration","device","profile","resolveDeviceAsync","isOSType","undefined","isSimulator","isSimulatorDevice","getConfig","buildCacheProvider","resolveRemoteBuildCacheProvider","exp","experiments","remoteBuildCache","provider","shouldSkipInitialBundling","shouldStartBundler","buildCache"],"mappings":";;;;+BAYsBA;;;eAAAA;;;;yBAZI;;;;;;+BAE4B;qCACR;qCACV;wBACX;yBACD;2CACwB;qCACP;AAIlC,eAAeA,oBACpBC,WAAmB,EACnBC,OAAgB;QA+BdC,iDAAAA;IA7BF,MAAMC,eAAeC,IAAAA,wCAAmB,EAACJ;IAEzC,MAAMK,eAAe,MAAMC,IAAAA,6CAAwB,EAACN,aAAaC;IAEjE,yEAAyE;IACzE,oGAAoG;IACpG,MAAM,EAAEM,MAAM,EAAEC,MAAMC,MAAM,EAAE,GAAG,MAAMC,IAAAA,kDAA6B,EAClEV,aACAC,SACAE;IAGF,wDAAwD;IACxD,MAAMQ,gBAAgBV,QAAQU,aAAa,IAAI;IAE/C,+DAA+D;IAC/D,mFAAmF;IACnF,MAAMC,SAAS,MAAMC,IAAAA,gBAAO,EAACC,iCAAkB,EAAEb,QAAQW,MAAM,EAAE;QAC/D,mGAAmG;QACnGL,QAAQQ,IAAAA,gBAAQ,EAACR,UAAUA,SAASS;QACpCb;QACAM;QACAE;IACF;IAEA,MAAMM,cAAcC,IAAAA,gCAAiB,EAACN;IAEtC,MAAMV,gBAAgBiB,IAAAA,mBAAS,EAACnB;IAChC,MAAMoB,qBAAqBC,IAAAA,0DAA+B,GACxDnB,iCAAAA,cAAcoB,GAAG,CAACC,WAAW,sBAA7BrB,kDAAAA,+BAA+BsB,gBAAgB,qBAA/CtB,gDAAiDuB,QAAQ,EACzDzB;IAGF,gEAAgE;IAChE,8FAA8F;IAC9F,mGAAmG;IACnG,gEAAgE;IAChE,MAAM0B,4BAA4Bf,kBAAkB,WAAW,CAACM;IAEhE,OAAO;QACL,GAAGZ,YAAY;QACfsB,oBAAoB1B,QAAQU,aAAa,KAAK,WAAWN,aAAasB,kBAAkB;QACxF3B;QACAiB;QACAd;QACAS;QACAD;QACAe;QACAE,YAAY3B,QAAQ2B,UAAU,KAAK;QACnCnB;QACAW;IACF;AACF"}
|
|
@@ -43,24 +43,24 @@ function _path() {
|
|
|
43
43
|
};
|
|
44
44
|
return data;
|
|
45
45
|
}
|
|
46
|
+
const _XcodeBuild = /*#__PURE__*/ _interop_require_wildcard(require("./XcodeBuild"));
|
|
47
|
+
const _launchApp = require("./launchApp");
|
|
48
|
+
const _resolveOptions = require("./options/resolveOptions");
|
|
49
|
+
const _validateExternalBinary = require("./validateExternalBinary");
|
|
50
|
+
const _exportEager = require("../../export/embed/exportEager");
|
|
46
51
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
|
|
47
52
|
const _AppleAppIdResolver = require("../../start/platforms/ios/AppleAppIdResolver");
|
|
53
|
+
const _simctl = require("../../start/platforms/ios/simctl");
|
|
48
54
|
const _cocoapods = require("../../utils/cocoapods");
|
|
55
|
+
const _errors = require("../../utils/errors");
|
|
49
56
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
50
57
|
const _port = require("../../utils/port");
|
|
51
58
|
const _profile = require("../../utils/profile");
|
|
59
|
+
const _remotebuildcacheproviders = require("../../utils/remote-build-cache-providers");
|
|
52
60
|
const _scheme = require("../../utils/scheme");
|
|
53
61
|
const _ensureNativeProject = require("../ensureNativeProject");
|
|
54
62
|
const _hints = require("../hints");
|
|
55
|
-
const _remoteBuildCache = require("../remoteBuildCache");
|
|
56
63
|
const _startBundler = require("../startBundler");
|
|
57
|
-
const _XcodeBuild = /*#__PURE__*/ _interop_require_wildcard(require("./XcodeBuild"));
|
|
58
|
-
const _launchApp = require("./launchApp");
|
|
59
|
-
const _resolveOptions = require("./options/resolveOptions");
|
|
60
|
-
const _validateExternalBinary = require("./validateExternalBinary");
|
|
61
|
-
const _exportEager = require("../../export/embed/exportEager");
|
|
62
|
-
const _simctl = require("../../start/platforms/ios/simctl");
|
|
63
|
-
const _errors = require("../../utils/errors");
|
|
64
64
|
function _interop_require_default(obj) {
|
|
65
65
|
return obj && obj.__esModule ? obj : {
|
|
66
66
|
default: obj
|
|
@@ -109,7 +109,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
109
109
|
}
|
|
110
110
|
const debug = require('debug')('expo:run:ios');
|
|
111
111
|
async function runIosAsync(projectRoot, options) {
|
|
112
|
-
var
|
|
112
|
+
var _this;
|
|
113
113
|
(0, _nodeEnv.setNodeEnv)(options.configuration === 'Release' ? 'production' : 'development');
|
|
114
114
|
require('@expo/env').load(projectRoot);
|
|
115
115
|
assertPlatform();
|
|
@@ -123,12 +123,12 @@ async function runIosAsync(projectRoot, options) {
|
|
|
123
123
|
// Resolve the CLI arguments into useable options.
|
|
124
124
|
const props = await (0, _profile.profile)(_resolveOptions.resolveOptionsAsync)(projectRoot, options);
|
|
125
125
|
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
126
|
-
if (!options.binary &&
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
if (!options.binary && props.buildCacheProvider && props.isSimulator) {
|
|
127
|
+
const localPath = await (0, _remotebuildcacheproviders.resolveRemoteBuildCache)({
|
|
128
|
+
projectRoot,
|
|
129
129
|
platform: 'ios',
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
runOptions: options,
|
|
131
|
+
provider: props.buildCacheProvider
|
|
132
132
|
});
|
|
133
133
|
if (localPath) {
|
|
134
134
|
options.binary = localPath;
|
|
@@ -239,12 +239,13 @@ async function runIosAsync(projectRoot, options) {
|
|
|
239
239
|
} else {
|
|
240
240
|
await manager.stopAsync();
|
|
241
241
|
}
|
|
242
|
-
if (shouldUpdateBuildCache &&
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
if (shouldUpdateBuildCache && props.buildCacheProvider) {
|
|
243
|
+
await (0, _remotebuildcacheproviders.uploadRemoteBuildCache)({
|
|
244
|
+
projectRoot,
|
|
245
245
|
platform: 'ios',
|
|
246
|
-
provider:
|
|
247
|
-
buildPath: binaryPath
|
|
246
|
+
provider: props.buildCacheProvider,
|
|
247
|
+
buildPath: binaryPath,
|
|
248
|
+
runOptions: options
|
|
248
249
|
});
|
|
249
250
|
}
|
|
250
251
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../../log';\nimport { hasDirectDevClientDependency } from '../../start/detectDevClient';\nimport { AppleAppIdResolver } from '../../start/platforms/ios/AppleAppIdResolver';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { uploadRemoteBuildCache, resolveRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { getLaunchInfoForBinaryAsync, launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport { getValidBinaryPathAsync } from './validateExternalBinary';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { getContainerPathAsync, simctlAsync } from '../../start/platforms/ios/simctl';\nimport { CommandError } from '../../utils/errors';\n\nconst debug = require('debug')('expo:run:ios');\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await profile(resolveOptionsAsync)(projectRoot, options);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache && props.isSimulator) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n runOptions: options,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n if (options.rebundle) {\n Log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);\n // Get the existing binary path to re-bundle the app.\n\n let binaryPath: string;\n if (!options.binary) {\n if (!props.isSimulator) {\n throw new Error('Re-bundling on physical devices requires the --binary flag.');\n }\n const appId = await new AppleAppIdResolver(projectRoot).getAppIdAsync();\n const possibleBinaryPath = await getContainerPathAsync(props.device, {\n appId,\n });\n if (!possibleBinaryPath) {\n throw new CommandError(\n `Cannot rebundle because no --binary was provided and no existing binary was found on the device for ID: ${appId}.`\n );\n }\n binaryPath = possibleBinaryPath;\n Log.log('Re-using existing binary path:', binaryPath);\n // Set the binary path to the existing binary path.\n options.binary = binaryPath;\n }\n\n Log.log('Rebundling the Expo config file');\n // Re-bundle the config file the same way the app was originally bundled.\n await spawnAsync('node', [\n path.join(require.resolve('expo-constants/package.json'), '../scripts/getAppConfig.js'),\n projectRoot,\n path.join(options.binary, 'EXConstants.bundle'),\n ]);\n // Re-bundle the app.\n\n const possibleBundleOutput = path.join(options.binary, 'main.jsbundle');\n\n if (fs.existsSync(possibleBundleOutput)) {\n Log.log('Rebundling the app...');\n await exportEagerAsync(projectRoot, {\n resetCache: false,\n dev: false,\n platform: 'ios',\n assetsDest: path.join(options.binary, 'assets'),\n bundleOutput: possibleBundleOutput,\n });\n } else {\n Log.warn('Bundle output not found at expected location:', possibleBundleOutput);\n }\n }\n\n let binaryPath: string;\n let shouldUpdateBuildCache = false;\n if (options.binary) {\n binaryPath = await getValidBinaryPathAsync(options.binary, props);\n Log.log('Using custom binary path:', binaryPath);\n } else {\n let eagerBundleOptions: string | undefined;\n\n if (options.configuration === 'Release') {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'ios',\n })\n );\n }\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync({\n ...props,\n eagerBundleOptions,\n });\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n shouldUpdateBuildCache = true;\n }\n debug('Binary path:', binaryPath);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const launchInfo = await getLaunchInfoForBinaryAsync(binaryPath);\n const isCustomBinary = !!options.binary;\n\n // Always close the app before launching on a simulator. Otherwise certain cached resources like the splashscreen will not be available.\n if (props.isSimulator) {\n try {\n await simctlAsync(['terminate', props.device.udid, launchInfo.bundleId]);\n } catch (error) {\n // If we failed it's likely that the app was not running to begin with and we will get an `invalid device` error\n debug('Failed to terminate app (possibly because it was not running):', error);\n }\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n\n scheme: isCustomBinary\n ? // If launching a custom binary, use the schemes in the Info.plist.\n launchInfo.schemes[0]\n : // If a scheme is specified then use that instead of the package name.\n (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(\n binaryPath,\n manager,\n {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n },\n launchInfo.bundleId\n );\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n buildPath: binaryPath,\n });\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","debug","require","projectRoot","options","projectConfig","setNodeEnv","configuration","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","profile","resolveOptionsAsync","getConfig","binary","exp","experiments","remoteBuildCache","isSimulator","localPath","resolveRemoteBuildCache","provider","runOptions","rebundle","Log","warn","binaryPath","Error","appId","AppleAppIdResolver","getAppIdAsync","possibleBinaryPath","getContainerPathAsync","device","CommandError","log","spawnAsync","path","join","resolve","possibleBundleOutput","fs","existsSync","exportEagerAsync","resetCache","dev","assetsDest","bundleOutput","shouldUpdateBuildCache","getValidBinaryPathAsync","eagerBundleOptions","JSON","stringify","buildOutput","XcodeBuild","buildAsync","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","launchInfo","getLaunchInfoForBinaryAsync","isCustomBinary","simctlAsync","udid","bundleId","error","manager","startBundlerAsync","port","headless","scheme","schemes","getSchemesForIosAsync","launchAppAsync","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","buildPath","process","exit","chalk"],"mappings":";;;;+BA6BsBA;;;eAAAA;;;;yBA7BI;;;;;;;gEACH;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;6DAEI;oCAEc;2BACQ;yBAChB;sBACiB;yBACpB;wBACc;qCACG;uBACF;kCACyB;8BAC9B;oEACN;2BA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MAAM+C,kBAAkB;IAC9C,GACAE,WAAWK,QAAQ;IAGrB,kDAAkD;IAClD,IAAItD,MAAM+C,kBAAkB,EAAE;QAC5BiB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMR,QAAQS,SAAS;IACzB;IAEA,IAAI3B,4BAA0B/C,kCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,gCAA+BgB,gBAAgB,GAAE;YAGjEhB;QAFZ,MAAM2E,IAAAA,wCAAsB,EAAC7E,aAAa;YACxCS,UAAU;YACVa,QAAQ,GAAEpB,kCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,gCAA+BgB,gBAAgB,CAACI,QAAQ;YAClEwD,WAAWnD;QACb;IACF;AACF;AAEA,SAASrB;IACP,IAAIyE,QAAQtE,QAAQ,KAAK,UAAU;QACjCgB,KAAIuD,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,+FAA+F,CAAC;IAE1G;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { getLaunchInfoForBinaryAsync, launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport { getValidBinaryPathAsync } from './validateExternalBinary';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport * as Log from '../../log';\nimport { AppleAppIdResolver } from '../../start/platforms/ios/AppleAppIdResolver';\nimport { getContainerPathAsync, simctlAsync } from '../../start/platforms/ios/simctl';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport {\n resolveRemoteBuildCache,\n uploadRemoteBuildCache,\n} from '../../utils/remote-build-cache-providers';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:ios');\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await profile(resolveOptionsAsync)(projectRoot, options);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && props.buildCacheProvider && props.isSimulator) {\n const localPath = await resolveRemoteBuildCache({\n projectRoot,\n platform: 'ios',\n runOptions: options,\n provider: props.buildCacheProvider,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n if (options.rebundle) {\n Log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);\n // Get the existing binary path to re-bundle the app.\n\n let binaryPath: string;\n if (!options.binary) {\n if (!props.isSimulator) {\n throw new Error('Re-bundling on physical devices requires the --binary flag.');\n }\n const appId = await new AppleAppIdResolver(projectRoot).getAppIdAsync();\n const possibleBinaryPath = await getContainerPathAsync(props.device, {\n appId,\n });\n if (!possibleBinaryPath) {\n throw new CommandError(\n `Cannot rebundle because no --binary was provided and no existing binary was found on the device for ID: ${appId}.`\n );\n }\n binaryPath = possibleBinaryPath;\n Log.log('Re-using existing binary path:', binaryPath);\n // Set the binary path to the existing binary path.\n options.binary = binaryPath;\n }\n\n Log.log('Rebundling the Expo config file');\n // Re-bundle the config file the same way the app was originally bundled.\n await spawnAsync('node', [\n path.join(require.resolve('expo-constants/package.json'), '../scripts/getAppConfig.js'),\n projectRoot,\n path.join(options.binary, 'EXConstants.bundle'),\n ]);\n // Re-bundle the app.\n\n const possibleBundleOutput = path.join(options.binary, 'main.jsbundle');\n\n if (fs.existsSync(possibleBundleOutput)) {\n Log.log('Rebundling the app...');\n await exportEagerAsync(projectRoot, {\n resetCache: false,\n dev: false,\n platform: 'ios',\n assetsDest: path.join(options.binary, 'assets'),\n bundleOutput: possibleBundleOutput,\n });\n } else {\n Log.warn('Bundle output not found at expected location:', possibleBundleOutput);\n }\n }\n\n let binaryPath: string;\n let shouldUpdateBuildCache = false;\n if (options.binary) {\n binaryPath = await getValidBinaryPathAsync(options.binary, props);\n Log.log('Using custom binary path:', binaryPath);\n } else {\n let eagerBundleOptions: string | undefined;\n\n if (options.configuration === 'Release') {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'ios',\n })\n );\n }\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync({\n ...props,\n eagerBundleOptions,\n });\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n shouldUpdateBuildCache = true;\n }\n debug('Binary path:', binaryPath);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const launchInfo = await getLaunchInfoForBinaryAsync(binaryPath);\n const isCustomBinary = !!options.binary;\n\n // Always close the app before launching on a simulator. Otherwise certain cached resources like the splashscreen will not be available.\n if (props.isSimulator) {\n try {\n await simctlAsync(['terminate', props.device.udid, launchInfo.bundleId]);\n } catch (error) {\n // If we failed it's likely that the app was not running to begin with and we will get an `invalid device` error\n debug('Failed to terminate app (possibly because it was not running):', error);\n }\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n\n scheme: isCustomBinary\n ? // If launching a custom binary, use the schemes in the Info.plist.\n launchInfo.schemes[0]\n : // If a scheme is specified then use that instead of the package name.\n (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(\n binaryPath,\n manager,\n {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n },\n launchInfo.bundleId\n );\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && props.buildCacheProvider) {\n await uploadRemoteBuildCache({\n projectRoot,\n platform: 'ios',\n provider: props.buildCacheProvider,\n buildPath: binaryPath,\n runOptions: options,\n });\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","debug","require","projectRoot","options","setNodeEnv","configuration","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","profile","resolveOptionsAsync","projectConfig","getConfig","binary","buildCacheProvider","isSimulator","localPath","resolveRemoteBuildCache","runOptions","provider","rebundle","Log","warn","binaryPath","Error","appId","AppleAppIdResolver","getAppIdAsync","possibleBinaryPath","getContainerPathAsync","device","CommandError","log","spawnAsync","path","join","resolve","possibleBundleOutput","fs","existsSync","exportEagerAsync","resetCache","dev","assetsDest","bundleOutput","shouldUpdateBuildCache","getValidBinaryPathAsync","eagerBundleOptions","JSON","stringify","buildOutput","XcodeBuild","buildAsync","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","launchInfo","getLaunchInfoForBinaryAsync","isCustomBinary","simctlAsync","udid","bundleId","error","manager","startBundlerAsync","port","headless","scheme","schemes","getSchemesForIosAsync","launchAppAsync","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","buildPath","process","exit","chalk"],"mappings":";;;;+BA+BsBA;;;eAAAA;;;;y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8C,kBAAkB;IAC9C,GACAE,WAAWK,QAAQ;IAGrB,kDAAkD;IAClD,IAAIrD,MAAM8C,kBAAkB,EAAE;QAC5BiB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMR,QAAQS,SAAS;IACzB;IAEA,IAAI3B,0BAA0BrC,MAAMM,kBAAkB,EAAE;QACtD,MAAM2D,IAAAA,iDAAsB,EAAC;YAC3B3E;YACAQ,UAAU;YACVa,UAAUX,MAAMM,kBAAkB;YAClC4D,WAAWnD;YACXL,YAAYnB;QACd;IACF;AACF;AAEA,SAASI;IACP,IAAIwE,QAAQrE,QAAQ,KAAK,UAAU;QACjCe,KAAIuD,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,+FAA+F,CAAC;IAE1G;AACF"}
|
|
@@ -392,8 +392,8 @@ function pruneCustomTransformOptions(filePath, transformOptions) {
|
|
|
392
392
|
!(filePath.match(/\/expo-router\/_ctx/) || filePath.match(/\/expo-router\/build\//))) {
|
|
393
393
|
delete transformOptions.customTransformOptions.asyncRoutes;
|
|
394
394
|
}
|
|
395
|
-
if (((_transformOptions_customTransformOptions3 = transformOptions.customTransformOptions) == null ? void 0 : _transformOptions_customTransformOptions3.clientBoundaries) && // The client boundaries are only used in
|
|
396
|
-
!filePath.match(
|
|
395
|
+
if (((_transformOptions_customTransformOptions3 = transformOptions.customTransformOptions) == null ? void 0 : _transformOptions_customTransformOptions3.clientBoundaries) && // The client boundaries are only used in `expo/virtual/rsc.js` for production RSC exports.
|
|
396
|
+
!filePath.match(/\/expo\/virtual\/rsc\.js$/)) {
|
|
397
397
|
delete transformOptions.customTransformOptions.clientBoundaries;
|
|
398
398
|
}
|
|
399
399
|
return transformOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { getDefaultConfig, LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport type Metro from 'metro';\nimport { ReadOnlyGraph } from 'metro';\nimport Bundler from 'metro/src/Bundler';\nimport type { TransformOptions } from 'metro/src/DeltaBundler/Worker';\nimport MetroHmrServer from 'metro/src/HmrServer';\nimport RevisionNotFoundError from 'metro/src/IncrementalBundler/RevisionNotFoundError';\nimport formatBundlingError from 'metro/src/lib/formatBundlingError';\nimport { loadConfig, resolveConfig, ConfigT } from 'metro-config';\nimport { Terminal } from 'metro-core';\nimport util from 'node:util';\nimport path from 'path';\n\nimport { createDevToolsPluginWebsocketEndpoint } from './DevToolsPluginWebsocketEndpoint';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { attachAtlasAsync } from './debugging/attachAtlas';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { createMetroMiddleware } from './dev-server/createMetroMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream);\n\n const sendLog = (...args: any[]) => {\n this._logLines.push(\n // format args like console.log\n util.format(...args)\n );\n this._scheduleUpdate();\n\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n const serverActionsEnabled =\n exp.experiments?.reactServerFunctions ?? env.EXPO_UNSTABLE_SERVER_FUNCTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponentRoutes || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n process.env.EXPO_USE_FAST_RESOLVER = '1';\n }\n\n const isReactCanaryEnabled =\n (exp.experiments?.reactServerComponentRoutes ||\n serverActionsEnabled ||\n exp.experiments?.reactCanary) ??\n false;\n\n if (isReactCanaryEnabled) {\n // The fast resolver is required for React canary to work as it can switch the node_modules location for react imports.\n process.env.EXPO_USE_FAST_RESOLVER = '1';\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.\n globalThis.__requireCycleIgnorePatterns = config.resolver?.requireCycleIgnorePatterns;\n\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.warn(`Experimental React Compiler is enabled.`);\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING && !env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n throw new CommandError(\n 'EXPO_UNSTABLE_TREE_SHAKING requires EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH to be enabled.'\n );\n }\n\n if (env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n Log.warn(`Experimental bundle optimization is enabled.`);\n }\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental tree shaking is enabled.`);\n }\n\n if (serverActionsEnabled) {\n Log.warn(\n `React Server Functions (beta) are enabled. Route rendering mode: ${exp.experiments?.reactServerComponentRoutes ? 'server' : 'client'}`\n );\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponentRoutes,\n getMetroBundler,\n });\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<LoadOptions, 'logger'>,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: Metro.Server;\n hmrServer: MetroHmrServer | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const {\n config: metroConfig,\n setEventReporter,\n reporter,\n } = await loadMetroConfigAsync(projectRoot, options, {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n });\n\n // Create the core middleware stack for Metro, including websocket listeners\n const { middleware, messagesSocket, eventsSocket, websocketEndpoints } =\n createMetroMiddleware(metroConfig);\n\n if (!isExporting) {\n // Enable correct CORS headers for Expo Router features\n prependMiddleware(middleware, createCorsMiddleware(exp));\n\n // Enable debug middleware for CDP-related debugging\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware(\n metroBundler,\n reporter\n );\n Object.assign(websocketEndpoints, debugWebsocketEndpoints);\n middleware.use(debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n // TODO(cedric): `enhanceMiddleware` is deprecated, but is currently used to unify the middleware stacks\n // See: https://github.com/facebook/metro/commit/22e85fde85ec454792a1b70eba4253747a2587a9\n // See: https://github.com/facebook/metro/commit/d0d554381f119bb80ab09dbd6a1d310b54737e52\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n }\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n isExporting,\n exp,\n projectRoot,\n middleware,\n metroConfig,\n // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n resetAtlasFile: isExporting,\n });\n\n const { server, hmrServer, metro } = await runServer(\n metroBundler,\n metroConfig,\n {\n websocketEndpoints: {\n ...websocketEndpoints,\n ...createDevToolsPluginWebsocketEndpoint(),\n },\n watch: !isExporting && isWatchEnabled(),\n },\n {\n mockServer: isExporting,\n }\n );\n\n // Patch transform file to remove inconvenient customTransformOptions which are only used in single well-known files.\n const originalTransformFile = metro\n .getBundler()\n .getBundler()\n .transformFile.bind(metro.getBundler().getBundler());\n\n metro.getBundler().getBundler().transformFile = async function (\n filePath: string,\n transformOptions: TransformOptions,\n fileBuffer?: Buffer\n ) {\n return originalTransformFile(\n filePath,\n pruneCustomTransformOptions(\n filePath,\n // Clone the options so we don't mutate the original.\n {\n ...transformOptions,\n customTransformOptions: {\n __proto__: null,\n ...transformOptions.customTransformOptions,\n },\n }\n ),\n fileBuffer\n );\n };\n\n setEventReporter(eventsSocket.reportMetroEvent);\n\n // This function ensures that modules in source maps are sorted in the same\n // order as in a plain JS bundle.\n metro._getSortedModules = function (this: Metro.Server, graph: ReadOnlyGraph) {\n const modules = [...graph.dependencies.values()];\n\n const ctx = {\n platform: graph.transformOptions.platform,\n environment: graph.transformOptions.customTransformOptions?.environment,\n };\n // Assign IDs to modules in a consistent order\n for (const module of modules) {\n // @ts-expect-error\n this._createModuleId(module.path, ctx);\n }\n // Sort by IDs\n return modules.sort(\n // @ts-expect-error\n (a, b) => this._createModuleId(a.path, ctx) - this._createModuleId(b.path, ctx)\n );\n };\n\n if (hmrServer) {\n let hmrJSBundle: typeof import('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n\n try {\n hmrJSBundle = require('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n } catch {\n // Add fallback for monorepo tests up until the fork is merged.\n Log.warn('Failed to load HMR serializer from @expo/metro-config, using fallback version.');\n hmrJSBundle = require('metro/src/DeltaBundler/Serializers/hmrJSBundle');\n }\n\n // Patch HMR Server to send more info to the `_createModuleId` function for deterministic module IDs and add support for serializing HMR updates the same as all other bundles.\n hmrServer._prepareMessage = async function (this: MetroHmrServer, group, options, changeEvent) {\n // Fork of https://github.com/facebook/metro/blob/3b3e0aaf725cfa6907bf2c8b5fbc0da352d29efe/packages/metro/src/HmrServer.js#L327-L393\n // with patch for `_createModuleId`.\n const logger = !options.isInitialUpdate ? changeEvent?.logger : null;\n try {\n const revPromise = this._bundler.getRevision(group.revisionId);\n if (!revPromise) {\n return {\n type: 'error',\n body: formatBundlingError(new RevisionNotFoundError(group.revisionId)),\n };\n }\n logger?.point('updateGraph_start');\n const { revision, delta } = await this._bundler.updateGraph(await revPromise, false);\n logger?.point('updateGraph_end');\n this._clientGroups.delete(group.revisionId);\n group.revisionId = revision.id;\n for (const client of group.clients) {\n client.revisionIds = client.revisionIds.filter(\n (revisionId) => revisionId !== group.revisionId\n );\n client.revisionIds.push(revision.id);\n }\n this._clientGroups.set(group.revisionId, group);\n logger?.point('serialize_start');\n // NOTE(EvanBacon): This is the patch\n const moduleIdContext = {\n platform: revision.graph.transformOptions.platform,\n environment: revision.graph.transformOptions.customTransformOptions?.environment,\n };\n const hmrUpdate = hmrJSBundle(delta, revision.graph, {\n clientUrl: group.clientUrl,\n // NOTE(EvanBacon): This is also the patch\n createModuleId: (moduleId: string) => {\n // @ts-expect-error\n return this._createModuleId(moduleId, moduleIdContext);\n },\n includeAsyncPaths: group.graphOptions.lazy,\n projectRoot: this._config.projectRoot,\n serverRoot: this._config.server.unstable_serverRoot ?? this._config.projectRoot,\n });\n logger?.point('serialize_end');\n return {\n type: 'update',\n body: {\n revisionId: revision.id,\n isInitialUpdate: options.isInitialUpdate,\n ...hmrUpdate,\n },\n };\n } catch (error: any) {\n const formattedError = formatBundlingError(error);\n this._config.reporter.update({\n type: 'bundling_error',\n error,\n });\n return {\n type: 'error',\n body: formattedError,\n };\n }\n };\n }\n\n return {\n metro,\n hmrServer,\n server,\n middleware,\n messageSocket: messagesSocket,\n };\n}\n\n// TODO: Fork the entire transform function so we can simply regex the file contents for keywords instead.\nfunction pruneCustomTransformOptions(\n filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\n // Normalize the filepath for cross platform checking.\n filePath = filePath.split(path.sep).join('/');\n\n if (\n transformOptions.customTransformOptions?.dom &&\n // The only generated file that needs the dom root is `expo/dom/entry.js`\n !filePath.match(/expo\\/dom\\/entry\\.js$/)\n ) {\n // Clear the dom root option if we aren't transforming the magic entry file, this ensures\n // that cached artifacts from other DOM component bundles can be reused.\n transformOptions.customTransformOptions.dom = 'true';\n }\n\n if (\n transformOptions.customTransformOptions?.routerRoot &&\n // The router root is used all over expo-router (`process.env.EXPO_ROUTER_ABS_APP_ROOT`, `process.env.EXPO_ROUTER_APP_ROOT`) so we'll just ignore the entire package.\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n // Set to the default value.\n transformOptions.customTransformOptions.routerRoot = 'app';\n }\n if (\n transformOptions.customTransformOptions?.asyncRoutes &&\n // The async routes settings are also used in `expo-router/_ctx.ios.js` (and other platform variants) via `process.env.EXPO_ROUTER_IMPORT_MODE`\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n delete transformOptions.customTransformOptions.asyncRoutes;\n }\n\n if (\n transformOptions.customTransformOptions?.clientBoundaries &&\n // The client boundaries are only used in `@expo/metro-runtime/src/virtual.js` for production RSC exports.\n !filePath.match(/\\/@expo\\/metro-runtime\\/rsc\\/virtual\\.js$/)\n ) {\n delete transformOptions.customTransformOptions.clientBoundaries;\n }\n\n return transformOptions;\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["instantiateMetroAsync","isWatchEnabled","loadMetroConfigAsync","LogRespectingTerminal","Terminal","constructor","stream","sendLog","args","_logLines","push","util","format","_scheduleUpdate","flush","console","log","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","serverActionsEnabled","experiments","reactServerFunctions","env","EXPO_UNSTABLE_SERVER_FUNCTIONS","reactServerComponentRoutes","EXPO_USE_METRO_REQUIRE","EXPO_USE_FAST_RESOLVER","isReactCanaryEnabled","reactCanary","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","Log","warn","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isFastResolverEnabled","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","server","enhanceMiddleware","metroMiddleware","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","createDevToolsPluginWebsocketEndpoint","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","_getSortedModules","graph","modules","dependencies","values","ctx","platform","environment","module","_createModuleId","path","sort","a","b","hmrJSBundle","require","default","_prepareMessage","group","changeEvent","isInitialUpdate","revision","revPromise","_bundler","getRevision","revisionId","type","body","formatBundlingError","RevisionNotFoundError","point","delta","updateGraph","_clientGroups","delete","id","client","clients","revisionIds","filter","set","moduleIdContext","hmrUpdate","clientUrl","createModuleId","moduleId","includeAsyncPaths","graphOptions","lazy","_config","unstable_serverRoot","error","formattedError","messageSocket","split","sep","join","dom","match","routerRoot","asyncRoutes","clientBoundaries","CI","chalk"],"mappings":";;;;;;;;;;;IAiLsBA,qBAAqB;eAArBA;;IA+QNC,cAAc;eAAdA;;IAlYMC,oBAAoB;eAApBA;;;;yBA9DgB;;;;;;;y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AAA,SAASiE,KAAK,CAAC,0BAA0BjE,SAASiE,KAAK,CAAC,yBAAwB,GAClF;QACA,4BAA4B;QAC5BhE,iBAAiBG,sBAAsB,CAAC8D,UAAU,GAAG;IACvD;IACA,IACEjE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyCkE,WAAW,KACpD,+IAA+I;IAC/I,CAAEnE,CAAAA,SAASiE,KAAK,CAAC,0BAA0BjE,SAASiE,KAAK,CAAC,yBAAwB,GAClF;QACA,OAAOhE,iBAAiBG,sBAAsB,CAAC+D,WAAW;IAC5D;IAEA,IACElE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyCmE,gBAAgB,KACzD,0GAA0G;IAC1G,CAACpE,SAASiE,KAAK,CAAC,8CAChB;QACA,OAAOhE,iBAAiBG,sBAAsB,CAACgE,gBAAgB;IACjE;IAEA,OAAOnE;AACT;AAMO,SAAS7G;IACd,IAAI8B,QAAG,CAACmJ,EAAE,EAAE;QACVpH,QAAG,CAAC9C,GAAG,CACLmK,IAAAA,gBAAK,CAAA,CAAC,8FAA8F,CAAC;IAEzG;IAEA,OAAO,CAACpJ,QAAG,CAACmJ,EAAE;AAChB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { getDefaultConfig, LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport type Metro from 'metro';\nimport { ReadOnlyGraph } from 'metro';\nimport Bundler from 'metro/src/Bundler';\nimport type { TransformOptions } from 'metro/src/DeltaBundler/Worker';\nimport MetroHmrServer from 'metro/src/HmrServer';\nimport RevisionNotFoundError from 'metro/src/IncrementalBundler/RevisionNotFoundError';\nimport formatBundlingError from 'metro/src/lib/formatBundlingError';\nimport { loadConfig, resolveConfig, ConfigT } from 'metro-config';\nimport { Terminal } from 'metro-core';\nimport util from 'node:util';\nimport path from 'path';\n\nimport { createDevToolsPluginWebsocketEndpoint } from './DevToolsPluginWebsocketEndpoint';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { attachAtlasAsync } from './debugging/attachAtlas';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { createMetroMiddleware } from './dev-server/createMetroMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream);\n\n const sendLog = (...args: any[]) => {\n this._logLines.push(\n // format args like console.log\n util.format(...args)\n );\n this._scheduleUpdate();\n\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n const serverActionsEnabled =\n exp.experiments?.reactServerFunctions ?? env.EXPO_UNSTABLE_SERVER_FUNCTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponentRoutes || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n process.env.EXPO_USE_FAST_RESOLVER = '1';\n }\n\n const isReactCanaryEnabled =\n (exp.experiments?.reactServerComponentRoutes ||\n serverActionsEnabled ||\n exp.experiments?.reactCanary) ??\n false;\n\n if (isReactCanaryEnabled) {\n // The fast resolver is required for React canary to work as it can switch the node_modules location for react imports.\n process.env.EXPO_USE_FAST_RESOLVER = '1';\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.\n globalThis.__requireCycleIgnorePatterns = config.resolver?.requireCycleIgnorePatterns;\n\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.warn(`Experimental React Compiler is enabled.`);\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING && !env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n throw new CommandError(\n 'EXPO_UNSTABLE_TREE_SHAKING requires EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH to be enabled.'\n );\n }\n\n if (env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n Log.warn(`Experimental bundle optimization is enabled.`);\n }\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental tree shaking is enabled.`);\n }\n\n if (serverActionsEnabled) {\n Log.warn(\n `React Server Functions (beta) are enabled. Route rendering mode: ${exp.experiments?.reactServerComponentRoutes ? 'server' : 'client'}`\n );\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponentRoutes,\n getMetroBundler,\n });\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: Omit<LoadOptions, 'logger'>,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: Metro.Server;\n hmrServer: MetroHmrServer | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const {\n config: metroConfig,\n setEventReporter,\n reporter,\n } = await loadMetroConfigAsync(projectRoot, options, {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n });\n\n // Create the core middleware stack for Metro, including websocket listeners\n const { middleware, messagesSocket, eventsSocket, websocketEndpoints } =\n createMetroMiddleware(metroConfig);\n\n if (!isExporting) {\n // Enable correct CORS headers for Expo Router features\n prependMiddleware(middleware, createCorsMiddleware(exp));\n\n // Enable debug middleware for CDP-related debugging\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware(\n metroBundler,\n reporter\n );\n Object.assign(websocketEndpoints, debugWebsocketEndpoints);\n middleware.use(debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n // TODO(cedric): `enhanceMiddleware` is deprecated, but is currently used to unify the middleware stacks\n // See: https://github.com/facebook/metro/commit/22e85fde85ec454792a1b70eba4253747a2587a9\n // See: https://github.com/facebook/metro/commit/d0d554381f119bb80ab09dbd6a1d310b54737e52\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n }\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n isExporting,\n exp,\n projectRoot,\n middleware,\n metroConfig,\n // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n resetAtlasFile: isExporting,\n });\n\n const { server, hmrServer, metro } = await runServer(\n metroBundler,\n metroConfig,\n {\n websocketEndpoints: {\n ...websocketEndpoints,\n ...createDevToolsPluginWebsocketEndpoint(),\n },\n watch: !isExporting && isWatchEnabled(),\n },\n {\n mockServer: isExporting,\n }\n );\n\n // Patch transform file to remove inconvenient customTransformOptions which are only used in single well-known files.\n const originalTransformFile = metro\n .getBundler()\n .getBundler()\n .transformFile.bind(metro.getBundler().getBundler());\n\n metro.getBundler().getBundler().transformFile = async function (\n filePath: string,\n transformOptions: TransformOptions,\n fileBuffer?: Buffer\n ) {\n return originalTransformFile(\n filePath,\n pruneCustomTransformOptions(\n filePath,\n // Clone the options so we don't mutate the original.\n {\n ...transformOptions,\n customTransformOptions: {\n __proto__: null,\n ...transformOptions.customTransformOptions,\n },\n }\n ),\n fileBuffer\n );\n };\n\n setEventReporter(eventsSocket.reportMetroEvent);\n\n // This function ensures that modules in source maps are sorted in the same\n // order as in a plain JS bundle.\n metro._getSortedModules = function (this: Metro.Server, graph: ReadOnlyGraph) {\n const modules = [...graph.dependencies.values()];\n\n const ctx = {\n platform: graph.transformOptions.platform,\n environment: graph.transformOptions.customTransformOptions?.environment,\n };\n // Assign IDs to modules in a consistent order\n for (const module of modules) {\n // @ts-expect-error\n this._createModuleId(module.path, ctx);\n }\n // Sort by IDs\n return modules.sort(\n // @ts-expect-error\n (a, b) => this._createModuleId(a.path, ctx) - this._createModuleId(b.path, ctx)\n );\n };\n\n if (hmrServer) {\n let hmrJSBundle: typeof import('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n\n try {\n hmrJSBundle = require('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n } catch {\n // Add fallback for monorepo tests up until the fork is merged.\n Log.warn('Failed to load HMR serializer from @expo/metro-config, using fallback version.');\n hmrJSBundle = require('metro/src/DeltaBundler/Serializers/hmrJSBundle');\n }\n\n // Patch HMR Server to send more info to the `_createModuleId` function for deterministic module IDs and add support for serializing HMR updates the same as all other bundles.\n hmrServer._prepareMessage = async function (this: MetroHmrServer, group, options, changeEvent) {\n // Fork of https://github.com/facebook/metro/blob/3b3e0aaf725cfa6907bf2c8b5fbc0da352d29efe/packages/metro/src/HmrServer.js#L327-L393\n // with patch for `_createModuleId`.\n const logger = !options.isInitialUpdate ? changeEvent?.logger : null;\n try {\n const revPromise = this._bundler.getRevision(group.revisionId);\n if (!revPromise) {\n return {\n type: 'error',\n body: formatBundlingError(new RevisionNotFoundError(group.revisionId)),\n };\n }\n logger?.point('updateGraph_start');\n const { revision, delta } = await this._bundler.updateGraph(await revPromise, false);\n logger?.point('updateGraph_end');\n this._clientGroups.delete(group.revisionId);\n group.revisionId = revision.id;\n for (const client of group.clients) {\n client.revisionIds = client.revisionIds.filter(\n (revisionId) => revisionId !== group.revisionId\n );\n client.revisionIds.push(revision.id);\n }\n this._clientGroups.set(group.revisionId, group);\n logger?.point('serialize_start');\n // NOTE(EvanBacon): This is the patch\n const moduleIdContext = {\n platform: revision.graph.transformOptions.platform,\n environment: revision.graph.transformOptions.customTransformOptions?.environment,\n };\n const hmrUpdate = hmrJSBundle(delta, revision.graph, {\n clientUrl: group.clientUrl,\n // NOTE(EvanBacon): This is also the patch\n createModuleId: (moduleId: string) => {\n // @ts-expect-error\n return this._createModuleId(moduleId, moduleIdContext);\n },\n includeAsyncPaths: group.graphOptions.lazy,\n projectRoot: this._config.projectRoot,\n serverRoot: this._config.server.unstable_serverRoot ?? this._config.projectRoot,\n });\n logger?.point('serialize_end');\n return {\n type: 'update',\n body: {\n revisionId: revision.id,\n isInitialUpdate: options.isInitialUpdate,\n ...hmrUpdate,\n },\n };\n } catch (error: any) {\n const formattedError = formatBundlingError(error);\n this._config.reporter.update({\n type: 'bundling_error',\n error,\n });\n return {\n type: 'error',\n body: formattedError,\n };\n }\n };\n }\n\n return {\n metro,\n hmrServer,\n server,\n middleware,\n messageSocket: messagesSocket,\n };\n}\n\n// TODO: Fork the entire transform function so we can simply regex the file contents for keywords instead.\nfunction pruneCustomTransformOptions(\n filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\n // Normalize the filepath for cross platform checking.\n filePath = filePath.split(path.sep).join('/');\n\n if (\n transformOptions.customTransformOptions?.dom &&\n // The only generated file that needs the dom root is `expo/dom/entry.js`\n !filePath.match(/expo\\/dom\\/entry\\.js$/)\n ) {\n // Clear the dom root option if we aren't transforming the magic entry file, this ensures\n // that cached artifacts from other DOM component bundles can be reused.\n transformOptions.customTransformOptions.dom = 'true';\n }\n\n if (\n transformOptions.customTransformOptions?.routerRoot &&\n // The router root is used all over expo-router (`process.env.EXPO_ROUTER_ABS_APP_ROOT`, `process.env.EXPO_ROUTER_APP_ROOT`) so we'll just ignore the entire package.\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n // Set to the default value.\n transformOptions.customTransformOptions.routerRoot = 'app';\n }\n if (\n transformOptions.customTransformOptions?.asyncRoutes &&\n // The async routes settings are also used in `expo-router/_ctx.ios.js` (and other platform variants) via `process.env.EXPO_ROUTER_IMPORT_MODE`\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n delete transformOptions.customTransformOptions.asyncRoutes;\n }\n\n if (\n transformOptions.customTransformOptions?.clientBoundaries &&\n // The client boundaries are only used in `expo/virtual/rsc.js` for production RSC exports.\n !filePath.match(/\\/expo\\/virtual\\/rsc\\.js$/)\n ) {\n delete transformOptions.customTransformOptions.clientBoundaries;\n }\n\n return transformOptions;\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["instantiateMetroAsync","isWatchEnabled","loadMetroConfigAsync","LogRespectingTerminal","Terminal","constructor","stream","sendLog","args","_logLines","push","util","format","_scheduleUpdate","flush","console","log","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","serverActionsEnabled","experiments","reactServerFunctions","env","EXPO_UNSTABLE_SERVER_FUNCTIONS","reactServerComponentRoutes","EXPO_USE_METRO_REQUIRE","EXPO_USE_FAST_RESOLVER","isReactCanaryEnabled","reactCanary","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","Log","warn","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isFastResolverEnabled","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","server","enhanceMiddleware","metroMiddleware","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","createDevToolsPluginWebsocketEndpoint","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","_getSortedModules","graph","modules","dependencies","values","ctx","platform","environment","module","_createModuleId","path","sort","a","b","hmrJSBundle","require","default","_prepareMessage","group","changeEvent","isInitialUpdate","revision","revPromise","_bundler","getRevision","revisionId","type","body","formatBundlingError","RevisionNotFoundError","point","delta","updateGraph","_clientGroups","delete","id","client","clients","revisionIds","filter","set","moduleIdContext","hmrUpdate","clientUrl","createModuleId","moduleId","includeAsyncPaths","graphOptions","lazy","_config","unstable_serverRoot","error","formattedError","messageSocket","split","sep","join","dom","match","routerRoot","asyncRoutes","clientBoundaries","CI","chalk"],"mappings":";;;;;;;;;;;IAiLsBA,qBAAqB;eAArBA;;IA+QNC,cAAc;eAAdA;;IAlYMC,oBAAoB;eAApBA;;;;yBA9DgB;;;;;;;yBACH;;;;;;;yBACW;;;;;;;gEAC5B;;;;;;;gEAOgB;;;;;;;gEACF;;;;;;;yBACmB;;;;;;;yBAC1B;;;;;;;gEACR;;;;;;;gEACA;;;;;;iDAEqC;uCAEhB;6BACL;uCACK;uCACA;+BACZ;wCACkB;qBACxB;qBACA;wBACS;gCACQ;6CACO;2BACV;kCACE;;;;;;AAOpC,uGAAuG;AACvG,MAAMC,8BAA8BC,qBAAQ;IAC1CC,YAAYC,MAAkE,CAAE;QAC9E,KAAK,CAACA;QAEN,MAAMC,UAAU,CA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AAC+D,WAAW;IAC5D;IAEA,IACElE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyCmE,gBAAgB,KACzD,2FAA2F;IAC3F,CAACpE,SAASiE,KAAK,CAAC,8BAChB;QACA,OAAOhE,iBAAiBG,sBAAsB,CAACgE,gBAAgB;IACjE;IAEA,OAAOnE;AACT;AAMO,SAAS7G;IACd,IAAI8B,QAAG,CAACmJ,EAAE,EAAE;QACVpH,QAAG,CAAC9C,GAAG,CACLmK,IAAAA,gBAAK,CAAA,CAAC,8FAA8F,CAAC;IAEzG;IAEA,OAAO,CAACpJ,QAAG,CAACmJ,EAAE;AAChB"}
|
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
EASRemoteBuildCacheProvider: function() {
|
|
13
|
+
return EASRemoteBuildCacheProvider;
|
|
14
|
+
},
|
|
12
15
|
calculateEASFingerprintHashAsync: function() {
|
|
13
16
|
return calculateEASFingerprintHashAsync;
|
|
14
17
|
},
|
|
@@ -96,8 +99,8 @@ async function resolveEASRemoteBuildCache({ projectRoot, platform, fingerprintHa
|
|
|
96
99
|
async function uploadEASRemoteBuildCache({ projectRoot, platform, fingerprintHash, buildPath }) {
|
|
97
100
|
const easJsonPath = _path().default.join(projectRoot, 'eas.json');
|
|
98
101
|
if (!_fs().default.existsSync(easJsonPath)) {
|
|
99
|
-
debug('eas.json not found, skip
|
|
100
|
-
return;
|
|
102
|
+
debug('eas.json not found, skip uploading builds');
|
|
103
|
+
return null;
|
|
101
104
|
}
|
|
102
105
|
try {
|
|
103
106
|
_log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Uploading build to remote cache}`);
|
|
@@ -117,9 +120,11 @@ async function uploadEASRemoteBuildCache({ projectRoot, platform, fingerprintHas
|
|
|
117
120
|
// }
|
|
118
121
|
const json = JSON.parse(results.stdout.trim());
|
|
119
122
|
_log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Build successfully uploaded: ${json == null ? void 0 : json.url}}`);
|
|
123
|
+
return json == null ? void 0 : json.url;
|
|
120
124
|
} catch (error) {
|
|
121
125
|
debug('eas-cli error:', error);
|
|
122
126
|
}
|
|
127
|
+
return null;
|
|
123
128
|
}
|
|
124
129
|
async function calculateEASFingerprintHashAsync({ projectRoot, platform }) {
|
|
125
130
|
// prefer using `eas fingerprint:generate` because it automatically upload sources
|
|
@@ -143,5 +148,10 @@ async function calculateEASFingerprintHashAsync({ projectRoot, platform }) {
|
|
|
143
148
|
}
|
|
144
149
|
return null;
|
|
145
150
|
}
|
|
151
|
+
const EASRemoteBuildCacheProvider = {
|
|
152
|
+
resolveRemoteBuildCache: resolveEASRemoteBuildCache,
|
|
153
|
+
uploadRemoteBuildCache: uploadEASRemoteBuildCache,
|
|
154
|
+
calculateFingerprintHash: calculateEASFingerprintHashAsync
|
|
155
|
+
};
|
|
146
156
|
|
|
147
157
|
//# sourceMappingURL=eas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/eas.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { isDevClientBuild } from './helpers';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/eas.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { isDevClientBuild } from './helpers';\nimport { CalculateFingerprintHashProps, RemoteBuildCachePlugin, RunOptions } from './types';\nimport { Log } from '../../log';\nimport { isSpawnResultError } from '../../start/platforms/ios/xcrun';\n\nconst debug = require('debug')('expo:eas-remote-build-cache') as typeof console.log;\n\nexport async function resolveEASRemoteBuildCache({\n projectRoot,\n platform,\n fingerprintHash,\n runOptions,\n}: {\n projectRoot: string;\n platform: ModPlatform;\n fingerprintHash: string;\n runOptions: RunOptions;\n}): Promise<string | null> {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return null;\n }\n\n Log.log(\n chalk`{whiteBright \\u203A} {bold Searching builds with matching fingerprint on EAS servers}`\n );\n try {\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'build:download',\n `--platform=${platform}`,\n `--fingerprint=${fingerprintHash}`,\n '--non-interactive',\n isDevClientBuild({ runOptions, projectRoot }) ? '--dev-client' : '--no-dev-client',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n\n Log.log(chalk`{whiteBright \\u203A} {bold Successfully downloaded cached build}`);\n // {\n // \"path\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.path;\n } catch (error) {\n debug('eas-cli error:', error);\n // @TODO(2025-04-11): remove this in a future release\n if (isSpawnResultError(error) && error.stderr.includes('command build:download not found')) {\n Log.warn(\n `To take advantage of remote build cache, upgrade your eas-cli installation to latest.`\n );\n }\n return null;\n }\n}\n\nexport async function uploadEASRemoteBuildCache({\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n}: {\n projectRoot: string;\n runOptions: RunOptions;\n platform: ModPlatform;\n fingerprintHash: string;\n buildPath?: string;\n}) {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip uploading builds');\n return null;\n }\n\n try {\n Log.log(chalk`{whiteBright \\u203A} {bold Uploading build to remote cache}`);\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'upload',\n `--platform=${platform}`,\n `--fingerprint=${fingerprintHash}`,\n buildPath ? `--build-path=${buildPath}` : '',\n '--non-interactive',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"url\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n Log.log(chalk`{whiteBright \\u203A} {bold Build successfully uploaded: ${json?.url}}`);\n return json?.url;\n } catch (error) {\n debug('eas-cli error:', error);\n }\n return null;\n}\n\nexport async function calculateEASFingerprintHashAsync({\n projectRoot,\n platform,\n}: CalculateFingerprintHashProps): Promise<string | null> {\n // prefer using `eas fingerprint:generate` because it automatically upload sources\n try {\n const results = await spawnAsync(\n 'npx',\n ['eas-cli', 'fingerprint:generate', `--platform=${platform}`, '--json', '--non-interactive'],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"hash\": \"203f960b965e154b77dc31c6c42e5582e8d77196\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.hash;\n } catch (error) {\n debug('eas-cli error:', error);\n }\n return null;\n}\n\nexport const EASRemoteBuildCacheProvider: RemoteBuildCachePlugin = {\n resolveRemoteBuildCache: resolveEASRemoteBuildCache,\n uploadRemoteBuildCache: uploadEASRemoteBuildCache,\n calculateFingerprintHash: calculateEASFingerprintHashAsync,\n};\n"],"names":["EASRemoteBuildCacheProvider","calculateEASFingerprintHashAsync","resolveEASRemoteBuildCache","uploadEASRemoteBuildCache","debug","require","projectRoot","platform","fingerprintHash","runOptions","easJsonPath","path","join","fs","existsSync","Log","log","chalk","results","spawnAsync","isDevClientBuild","cwd","json","JSON","parse","stdout","trim","error","isSpawnResultError","stderr","includes","warn","buildPath","url","hash","resolveRemoteBuildCache","uploadRemoteBuildCache","calculateFingerprintHash"],"mappings":";;;;;;;;;;;IA2IaA,2BAA2B;eAA3BA;;IAxBSC,gCAAgC;eAA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IACzBkC,wBAAwBjC;IACxBkC,0BAA0BpC;AAC5B"}
|
|
@@ -2,13 +2,39 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
fileExists: function() {
|
|
13
|
+
return fileExists;
|
|
14
|
+
},
|
|
15
|
+
isDevClientBuild: function() {
|
|
8
16
|
return isDevClientBuild;
|
|
17
|
+
},
|
|
18
|
+
moduleNameIsDirectFileReference: function() {
|
|
19
|
+
return moduleNameIsDirectFileReference;
|
|
20
|
+
},
|
|
21
|
+
moduleNameIsPackageReference: function() {
|
|
22
|
+
return moduleNameIsPackageReference;
|
|
9
23
|
}
|
|
10
24
|
});
|
|
25
|
+
function _fs() {
|
|
26
|
+
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
27
|
+
_fs = function() {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
11
32
|
const _detectDevClient = require("../../start/detectDevClient");
|
|
33
|
+
function _interop_require_default(obj) {
|
|
34
|
+
return obj && obj.__esModule ? obj : {
|
|
35
|
+
default: obj
|
|
36
|
+
};
|
|
37
|
+
}
|
|
12
38
|
function isDevClientBuild({ runOptions, projectRoot }) {
|
|
13
39
|
if (!(0, _detectDevClient.hasDirectDevClientDependency)(projectRoot)) {
|
|
14
40
|
return false;
|
|
@@ -21,5 +47,31 @@ function isDevClientBuild({ runOptions, projectRoot }) {
|
|
|
21
47
|
}
|
|
22
48
|
return true;
|
|
23
49
|
}
|
|
50
|
+
function moduleNameIsDirectFileReference(name) {
|
|
51
|
+
var _name_split;
|
|
52
|
+
// Check if path is a file. Matches lines starting with: . / ~/
|
|
53
|
+
if (name.match(/^(\.|~\/|\/)/g)) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const slashCount = (_name_split = name.split('/')) == null ? void 0 : _name_split.length;
|
|
57
|
+
// Orgs (like @expo/config ) should have more than one slash to be a direct file.
|
|
58
|
+
if (name.startsWith('@')) {
|
|
59
|
+
return slashCount > 2;
|
|
60
|
+
}
|
|
61
|
+
// Regular packages should be considered direct reference if they have more than one slash.
|
|
62
|
+
return slashCount > 1;
|
|
63
|
+
}
|
|
64
|
+
function moduleNameIsPackageReference(name) {
|
|
65
|
+
var _name_split;
|
|
66
|
+
const slashCount = (_name_split = name.split('/')) == null ? void 0 : _name_split.length;
|
|
67
|
+
return name.startsWith('@') ? slashCount === 2 : slashCount === 1;
|
|
68
|
+
}
|
|
69
|
+
function fileExists(file) {
|
|
70
|
+
try {
|
|
71
|
+
return _fs().default.statSync(file).isFile();
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
24
76
|
|
|
25
77
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/helpers.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/helpers.ts"],"sourcesContent":["import fs from 'fs';\n\nimport { RunOptions } from './types';\nimport { hasDirectDevClientDependency } from '../../start/detectDevClient';\n\nexport function isDevClientBuild({\n runOptions,\n projectRoot,\n}: {\n runOptions: RunOptions;\n projectRoot: string;\n}) {\n if (!hasDirectDevClientDependency(projectRoot)) {\n return false;\n }\n\n if ('variant' in runOptions && runOptions.variant !== undefined) {\n return runOptions.variant === 'debug';\n }\n if ('configuration' in runOptions && runOptions.configuration !== undefined) {\n return runOptions.configuration === 'Debug';\n }\n\n return true;\n}\n\nexport function moduleNameIsDirectFileReference(name: string): boolean {\n // Check if path is a file. Matches lines starting with: . / ~/\n if (name.match(/^(\\.|~\\/|\\/)/g)) {\n return true;\n }\n\n const slashCount = name.split('/')?.length;\n // Orgs (like @expo/config ) should have more than one slash to be a direct file.\n if (name.startsWith('@')) {\n return slashCount > 2;\n }\n\n // Regular packages should be considered direct reference if they have more than one slash.\n return slashCount > 1;\n}\n\nexport function moduleNameIsPackageReference(name: string): boolean {\n const slashCount = name.split('/')?.length;\n return name.startsWith('@') ? slashCount === 2 : slashCount === 1;\n}\n\nexport function fileExists(file: string): boolean {\n try {\n return fs.statSync(file).isFile();\n } catch {\n return false;\n }\n}\n"],"names":["fileExists","isDevClientBuild","moduleNameIsDirectFileReference","moduleNameIsPackageReference","runOptions","projectRoot","hasDirectDevClientDependency","variant","undefined","configuration","name","match","slashCount","split","length","startsWith","file","fs","statSync","isFile"],"mappings":";;;;;;;;;;;IA+CgBA,UAAU;eAAVA;;IA1CAC,gBAAgB;eAAhBA;;IAqBAC,+BAA+B;eAA/BA;;IAgBAC,4BAA4B;eAA5BA;;;;gEA1CD;;;;;;iCAG8B;;;;;;AAEtC,SAASF,iBAAiB,EAC/BG,UAAU,EACVC,WAAW,EAIZ;IACC,IAAI,CAACC,IAAAA,6CAA4B,EAACD,cAAc;QAC9C,OAAO;IACT;IAEA,IAAI,aAAaD,cAAcA,WAAWG,OAAO,KAAKC,WAAW;QAC/D,OAAOJ,WAAWG,OAAO,KAAK;IAChC;IACA,IAAI,mBAAmBH,cAAcA,WAAWK,aAAa,KAAKD,WAAW;QAC3E,OAAOJ,WAAWK,aAAa,KAAK;IACtC;IAEA,OAAO;AACT;AAEO,SAASP,gCAAgCQ,IAAY;QAMvCA;IALnB,+DAA+D;IAC/D,IAAIA,KAAKC,KAAK,CAAC,kBAAkB;QAC/B,OAAO;IACT;IAEA,MAAMC,cAAaF,cAAAA,KAAKG,KAAK,CAAC,yBAAXH,YAAiBI,MAAM;IAC1C,iFAAiF;IACjF,IAAIJ,KAAKK,UAAU,CAAC,MAAM;QACxB,OAAOH,aAAa;IACtB;IAEA,2FAA2F;IAC3F,OAAOA,aAAa;AACtB;AAEO,SAAST,6BAA6BO,IAAY;QACpCA;IAAnB,MAAME,cAAaF,cAAAA,KAAKG,KAAK,CAAC,yBAAXH,YAAiBI,MAAM;IAC1C,OAAOJ,KAAKK,UAAU,CAAC,OAAOH,eAAe,IAAIA,eAAe;AAClE;AAEO,SAASZ,WAAWgB,IAAY;IACrC,IAAI;QACF,OAAOC,aAAE,CAACC,QAAQ,CAACF,MAAMG,MAAM;IACjC,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
resolvePluginFunction: function() {
|
|
13
|
+
return resolvePluginFunction;
|
|
14
|
+
},
|
|
15
|
+
resolveRemoteBuildCache: function() {
|
|
16
|
+
return resolveRemoteBuildCache;
|
|
17
|
+
},
|
|
18
|
+
resolveRemoteBuildCacheProvider: function() {
|
|
19
|
+
return resolveRemoteBuildCacheProvider;
|
|
20
|
+
},
|
|
21
|
+
uploadRemoteBuildCache: function() {
|
|
22
|
+
return uploadRemoteBuildCache;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function _resolvefrom() {
|
|
26
|
+
const data = /*#__PURE__*/ _interop_require_default(require("resolve-from"));
|
|
27
|
+
_resolvefrom = function() {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
const _eas = require("./eas");
|
|
33
|
+
const _helpers = require("./helpers");
|
|
34
|
+
function _interop_require_default(obj) {
|
|
35
|
+
return obj && obj.__esModule ? obj : {
|
|
36
|
+
default: obj
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const debug = require('debug')('expo:run:remote-build');
|
|
40
|
+
const resolveRemoteBuildCacheProvider = (provider, projectRoot)=>{
|
|
41
|
+
if (!provider) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (provider === 'eas') {
|
|
45
|
+
return {
|
|
46
|
+
plugin: _eas.EASRemoteBuildCacheProvider,
|
|
47
|
+
options: {}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (typeof provider === 'object' && typeof provider.plugin === 'function') {
|
|
51
|
+
return provider;
|
|
52
|
+
}
|
|
53
|
+
if (typeof provider === 'object' && typeof provider.plugin === 'string') {
|
|
54
|
+
const plugin = resolvePluginFunction(projectRoot, provider.plugin);
|
|
55
|
+
return {
|
|
56
|
+
plugin,
|
|
57
|
+
options: provider.options
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
throw new Error('Invalid remote build cache provider');
|
|
61
|
+
};
|
|
62
|
+
async function resolveRemoteBuildCache({ projectRoot, platform, provider, runOptions }) {
|
|
63
|
+
const fingerprintHash = await calculateFingerprintHashAsync({
|
|
64
|
+
projectRoot,
|
|
65
|
+
platform,
|
|
66
|
+
provider,
|
|
67
|
+
runOptions
|
|
68
|
+
});
|
|
69
|
+
if (!fingerprintHash) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return await provider.plugin.resolveRemoteBuildCache({
|
|
73
|
+
fingerprintHash,
|
|
74
|
+
platform,
|
|
75
|
+
runOptions,
|
|
76
|
+
projectRoot
|
|
77
|
+
}, provider.options);
|
|
78
|
+
}
|
|
79
|
+
async function uploadRemoteBuildCache({ projectRoot, platform, provider, buildPath, runOptions }) {
|
|
80
|
+
const fingerprintHash = await calculateFingerprintHashAsync({
|
|
81
|
+
projectRoot,
|
|
82
|
+
platform,
|
|
83
|
+
provider,
|
|
84
|
+
runOptions
|
|
85
|
+
});
|
|
86
|
+
if (!fingerprintHash) {
|
|
87
|
+
debug('No fingerprint hash found, skipping upload');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
await provider.plugin.uploadRemoteBuildCache({
|
|
91
|
+
projectRoot,
|
|
92
|
+
platform,
|
|
93
|
+
fingerprintHash,
|
|
94
|
+
buildPath,
|
|
95
|
+
runOptions
|
|
96
|
+
}, provider.options);
|
|
97
|
+
}
|
|
98
|
+
async function calculateFingerprintHashAsync({ projectRoot, platform, provider, runOptions }) {
|
|
99
|
+
if (provider.plugin.calculateFingerprintHash) {
|
|
100
|
+
return await provider.plugin.calculateFingerprintHash({
|
|
101
|
+
projectRoot,
|
|
102
|
+
platform,
|
|
103
|
+
runOptions
|
|
104
|
+
}, provider.options);
|
|
105
|
+
}
|
|
106
|
+
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
107
|
+
if (!Fingerprint) {
|
|
108
|
+
debug('@expo/fingerprint is not installed in the project, unable to calculate fingerprint');
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
112
|
+
return fingerprint.hash;
|
|
113
|
+
}
|
|
114
|
+
function importFingerprintForDev(projectRoot) {
|
|
115
|
+
try {
|
|
116
|
+
return require(require.resolve('@expo/fingerprint', {
|
|
117
|
+
paths: [
|
|
118
|
+
projectRoot
|
|
119
|
+
]
|
|
120
|
+
}));
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Resolve the provider plugin from a node module or package.
|
|
127
|
+
* If the module or package does not include a provider plugin, this function throws.
|
|
128
|
+
* The resolution is done in following order:
|
|
129
|
+
* 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?
|
|
130
|
+
* - Resolve the provider plugin as-is
|
|
131
|
+
* 2. Does the module have a valid provider plugin in the `main` field?
|
|
132
|
+
* - Resolve the `main` entry point as provider plugin
|
|
133
|
+
*/ function resolvePluginFilePathForModule(projectRoot, pluginReference) {
|
|
134
|
+
if ((0, _helpers.moduleNameIsDirectFileReference)(pluginReference)) {
|
|
135
|
+
// Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`
|
|
136
|
+
const pluginScriptFile = _resolvefrom().default.silent(projectRoot, pluginReference);
|
|
137
|
+
if (pluginScriptFile) {
|
|
138
|
+
return pluginScriptFile;
|
|
139
|
+
}
|
|
140
|
+
} else if ((0, _helpers.moduleNameIsPackageReference)(pluginReference)) {
|
|
141
|
+
// Try to resole the `main` entry as config plugin
|
|
142
|
+
const packageMainEntry = _resolvefrom().default.silent(projectRoot, pluginReference);
|
|
143
|
+
if (packageMainEntry) {
|
|
144
|
+
return packageMainEntry;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`Failed to resolve provider plugin for module "${pluginReference}" relative to "${projectRoot}". Do you have node modules installed?`);
|
|
148
|
+
}
|
|
149
|
+
function resolvePluginFunction(projectRoot, pluginReference) {
|
|
150
|
+
const pluginFile = resolvePluginFilePathForModule(projectRoot, pluginReference);
|
|
151
|
+
try {
|
|
152
|
+
let plugin = require(pluginFile);
|
|
153
|
+
if ((plugin == null ? void 0 : plugin.default) != null) {
|
|
154
|
+
plugin = plugin.default;
|
|
155
|
+
}
|
|
156
|
+
if (typeof plugin !== 'object' || typeof plugin.resolveRemoteBuildCache !== 'function' || typeof plugin.uploadRemoteBuildCache !== 'function') {
|
|
157
|
+
throw new Error(`
|
|
158
|
+
The provider plugin "${pluginReference}" must export an object containing
|
|
159
|
+
the resolveRemoteBuildCache and uploadRemoteBuildCache functions.
|
|
160
|
+
`);
|
|
161
|
+
}
|
|
162
|
+
return plugin;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
if (error instanceof SyntaxError) {
|
|
165
|
+
// Add error linking to the docs of how create a valid provider plugin
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/index.ts"],"sourcesContent":["import { ExpoConfig, Platform } from '@expo/config';\nimport resolveFrom from 'resolve-from';\n\nimport { EASRemoteBuildCacheProvider } from './eas';\nimport { moduleNameIsDirectFileReference, moduleNameIsPackageReference } from './helpers';\nimport { RemoteBuildCachePlugin, RemoteBuildCacheProvider, RunOptions } from './types';\n\nconst debug = require('debug')('expo:run:remote-build') as typeof console.log;\n\nexport const resolveRemoteBuildCacheProvider = (\n provider:\n | Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider']\n | undefined,\n projectRoot: string\n): RemoteBuildCacheProvider | undefined => {\n if (!provider) {\n return;\n }\n\n if (provider === 'eas') {\n return { plugin: EASRemoteBuildCacheProvider, options: {} };\n }\n\n if (typeof provider === 'object' && typeof provider.plugin === 'function') {\n return provider as RemoteBuildCacheProvider;\n }\n\n if (typeof provider === 'object' && typeof provider.plugin === 'string') {\n const plugin = resolvePluginFunction(projectRoot, provider.plugin);\n\n return { plugin, options: provider.options };\n }\n\n throw new Error('Invalid remote build cache provider');\n};\n\nexport async function resolveRemoteBuildCache({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: Omit<Platform, 'web'>;\n provider: RemoteBuildCacheProvider;\n runOptions: RunOptions;\n}): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n });\n if (!fingerprintHash) {\n return null;\n }\n\n return await provider.plugin.resolveRemoteBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n}\n\nexport async function uploadRemoteBuildCache({\n projectRoot,\n platform,\n provider,\n buildPath,\n runOptions,\n}: {\n projectRoot: string;\n platform: Omit<Platform, 'web'>;\n provider: RemoteBuildCacheProvider;\n buildPath: string;\n runOptions: RunOptions;\n}): Promise<void> {\n const fingerprintHash = await calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n });\n if (!fingerprintHash) {\n debug('No fingerprint hash found, skipping upload');\n return;\n }\n\n await provider.plugin.uploadRemoteBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n}\n\nasync function calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: Omit<Platform, 'web'>;\n provider: RemoteBuildCacheProvider;\n runOptions: RunOptions;\n}): Promise<string | null> {\n if (provider.plugin.calculateFingerprintHash) {\n return await provider.plugin.calculateFingerprintHash(\n { projectRoot, platform, runOptions },\n provider.options\n );\n }\n\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, unable to calculate fingerprint');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n return fingerprint.hash;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch {\n return null;\n }\n}\n\n/**\n * Resolve the provider plugin from a node module or package.\n * If the module or package does not include a provider plugin, this function throws.\n * The resolution is done in following order:\n * 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?\n * - Resolve the provider plugin as-is\n * 2. Does the module have a valid provider plugin in the `main` field?\n * - Resolve the `main` entry point as provider plugin\n */\nfunction resolvePluginFilePathForModule(projectRoot: string, pluginReference: string) {\n if (moduleNameIsDirectFileReference(pluginReference)) {\n // Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`\n const pluginScriptFile = resolveFrom.silent(projectRoot, pluginReference);\n if (pluginScriptFile) {\n return pluginScriptFile;\n }\n } else if (moduleNameIsPackageReference(pluginReference)) {\n // Try to resole the `main` entry as config plugin\n const packageMainEntry = resolveFrom.silent(projectRoot, pluginReference);\n if (packageMainEntry) {\n return packageMainEntry;\n }\n }\n\n throw new Error(\n `Failed to resolve provider plugin for module \"${pluginReference}\" relative to \"${projectRoot}\". Do you have node modules installed?`\n );\n}\n\n// Resolve the module function and assert type\nexport function resolvePluginFunction(\n projectRoot: string,\n pluginReference: string\n): RemoteBuildCachePlugin {\n const pluginFile = resolvePluginFilePathForModule(projectRoot, pluginReference);\n\n try {\n let plugin = require(pluginFile);\n if (plugin?.default != null) {\n plugin = plugin.default;\n }\n\n if (\n typeof plugin !== 'object' ||\n typeof plugin.resolveRemoteBuildCache !== 'function' ||\n typeof plugin.uploadRemoteBuildCache !== 'function'\n ) {\n throw new Error(`\n The provider plugin \"${pluginReference}\" must export an object containing\n the resolveRemoteBuildCache and uploadRemoteBuildCache functions.\n `);\n }\n return plugin;\n } catch (error) {\n if (error instanceof SyntaxError) {\n // Add error linking to the docs of how create a valid provider plugin\n }\n throw error;\n }\n}\n"],"names":["resolvePluginFunction","resolveRemoteBuildCache","resolveRemoteBuildCacheProvider","uploadRemoteBuildCache","debug","require","provider","projectRoot","plugin","EASRemoteBuildCacheProvider","options","Error","platform","runOptions","fingerprintHash","calculateFingerprintHashAsync","buildPath","calculateFingerprintHash","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","hash","resolve","paths","resolvePluginFilePathForModule","pluginReference","moduleNameIsDirectFileReference","pluginScriptFile","resolveFrom","silent","moduleNameIsPackageReference","packageMainEntry","pluginFile","default","error","SyntaxError"],"mappings":";;;;;;;;;;;IAqKgBA,qBAAqB;eAArBA;;IAjIMC,uBAAuB;eAAvBA;;IA3BTC,+BAA+B;eAA/BA;;IAsDSC,sBAAsB;eAAtBA;;;;gEA9DE;;;;;;qBAEoB;yBACkC;;;;;;AAG9E,MAAMC,QAAQC,QAAQ,SAAS;AAExB,MAAMH,kCAAkC,CAC7CI,UAGAC;IAEA,IAAI,CAACD,UAAU;QACb;IACF;IAEA,IAAIA,aAAa,OAAO;QACtB,OAAO;Y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,sEAAsE;QACxE;QACA,MAAMD;IACR;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -33,7 +33,7 @@ class FetchClient {
|
|
|
33
33
|
this.headers = {
|
|
34
34
|
accept: 'application/json',
|
|
35
35
|
'content-type': 'application/json',
|
|
36
|
-
'user-agent': `expo-cli/${"0.24.
|
|
36
|
+
'user-agent': `expo-cli/${"0.24.7"}`,
|
|
37
37
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
38
38
|
};
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.7",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@expo/env": "~1.0.4",
|
|
49
49
|
"@expo/image-utils": "^0.7.3",
|
|
50
50
|
"@expo/json-file": "^9.1.3",
|
|
51
|
-
"@expo/metro-config": "~0.20.
|
|
51
|
+
"@expo/metro-config": "~0.20.9",
|
|
52
52
|
"@expo/osascript": "^2.2.3",
|
|
53
53
|
"@expo/package-manager": "^1.8.3",
|
|
54
54
|
"@expo/plist": "^0.3.3",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"tree-kill": "^1.2.2",
|
|
153
153
|
"tsd": "^0.28.1"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "45bd8a319fb2d6abadac8dcb0c821a55a1f0caa3"
|
|
156
156
|
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
resolveRemoteBuildCache: function() {
|
|
13
|
-
return resolveRemoteBuildCache;
|
|
14
|
-
},
|
|
15
|
-
uploadRemoteBuildCache: function() {
|
|
16
|
-
return uploadRemoteBuildCache;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const _eas = require("../utils/remote-build-cache-providers/eas");
|
|
20
|
-
const debug = require('debug')('expo:run:remote-build');
|
|
21
|
-
async function resolveRemoteBuildCache(projectRoot, { platform, provider, runOptions }) {
|
|
22
|
-
const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);
|
|
23
|
-
if (!fingerprintHash) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
if (provider === 'eas') {
|
|
27
|
-
return await (0, _eas.resolveEASRemoteBuildCache)({
|
|
28
|
-
platform,
|
|
29
|
-
fingerprintHash,
|
|
30
|
-
projectRoot,
|
|
31
|
-
runOptions
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
async function uploadRemoteBuildCache(projectRoot, { platform, provider, buildPath }) {
|
|
37
|
-
const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);
|
|
38
|
-
if (!fingerprintHash) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (provider === 'eas') {
|
|
42
|
-
await (0, _eas.uploadEASRemoteBuildCache)({
|
|
43
|
-
projectRoot,
|
|
44
|
-
platform,
|
|
45
|
-
fingerprintHash,
|
|
46
|
-
buildPath
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function calculateFingerprintHashAsync(projectRoot, platform, provider) {
|
|
51
|
-
if (provider === 'eas') {
|
|
52
|
-
const easFingerprintHash = await (0, _eas.calculateEASFingerprintHashAsync)({
|
|
53
|
-
projectRoot,
|
|
54
|
-
platform
|
|
55
|
-
});
|
|
56
|
-
if (easFingerprintHash) {
|
|
57
|
-
return easFingerprintHash;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
61
|
-
if (!Fingerprint) {
|
|
62
|
-
debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
66
|
-
return fingerprint.hash;
|
|
67
|
-
}
|
|
68
|
-
function importFingerprintForDev(projectRoot) {
|
|
69
|
-
try {
|
|
70
|
-
return require(require.resolve('@expo/fingerprint', {
|
|
71
|
-
paths: [
|
|
72
|
-
projectRoot
|
|
73
|
-
]
|
|
74
|
-
}));
|
|
75
|
-
} catch {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=remoteBuildCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/run/remoteBuildCache.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { type Options as AndroidRunOptions } from './android/resolveOptions';\nimport { type Options as IosRunOptions } from './ios/XcodeBuild.types';\nimport {\n calculateEASFingerprintHashAsync,\n resolveEASRemoteBuildCache,\n uploadEASRemoteBuildCache,\n} from '../utils/remote-build-cache-providers/eas';\nconst debug = require('debug')('expo:run:remote-build') as typeof console.log;\n\nexport async function resolveRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n runOptions,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n runOptions: AndroidRunOptions | IosRunOptions;\n }\n): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);\n if (!fingerprintHash) {\n return null;\n }\n\n if (provider === 'eas') {\n return await resolveEASRemoteBuildCache({ platform, fingerprintHash, projectRoot, runOptions });\n }\n\n return null;\n}\n\nexport async function uploadRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n buildPath,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n buildPath?: string;\n }\n): Promise<void> {\n const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);\n if (!fingerprintHash) {\n return;\n }\n\n if (provider === 'eas') {\n await uploadEASRemoteBuildCache({\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n });\n }\n}\n\nasync function calculateFingerprintHashAsync(\n projectRoot: string,\n platform: ModPlatform,\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider']\n): Promise<string | null> {\n if (provider === 'eas') {\n const easFingerprintHash = await calculateEASFingerprintHashAsync({ projectRoot, platform });\n if (easFingerprintHash) {\n return easFingerprintHash;\n }\n }\n\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n return fingerprint.hash;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch {\n return null;\n }\n}\n"],"names":["resolveRemoteBuildCache","uploadRemoteBuildCache","debug","require","projectRoot","platform","provider","runOptions","fingerprintHash","calculateFingerprintHashAsync","resolveEASRemoteBuildCache","buildPath","uploadEASRemoteBuildCache","easFingerprintHash","calculateEASFingerprintHashAsync","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","hash","resolve","paths"],"mappings":";;;;;;;;;;;IAYsBA,uBAAuB;eAAvBA;;IAwBAC,sBAAsB;eAAtBA;;;qBA3Bf;AACP,MAAMC,QAAQC,QAAQ,SAAS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