@expo/cli 0.24.11 → 0.24.13
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 +3 -3
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +3 -3
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +3 -3
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +3 -3
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/utils/{remote-build-cache-providers → build-cache-providers}/helpers.js +0 -16
- package/build/src/utils/build-cache-providers/helpers.js.map +1 -0
- package/build/src/utils/build-cache-providers/index.js +283 -0
- package/build/src/utils/build-cache-providers/index.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 +7 -7
- package/build/src/utils/remote-build-cache-providers/eas.js +0 -157
- package/build/src/utils/remote-build-cache-providers/eas.js.map +0 -1
- package/build/src/utils/remote-build-cache-providers/helpers.js.map +0 -1
- package/build/src/utils/remote-build-cache-providers/index.js +0 -168
- package/build/src/utils/remote-build-cache-providers/index.js.map +0 -1
package/build/bin/cli
CHANGED
|
@@ -18,14 +18,14 @@ function _config() {
|
|
|
18
18
|
const _resolveDevice = require("./resolveDevice");
|
|
19
19
|
const _resolveGradlePropsAsync = require("./resolveGradlePropsAsync");
|
|
20
20
|
const _resolveLaunchProps = require("./resolveLaunchProps");
|
|
21
|
-
const
|
|
21
|
+
const _buildcacheproviders = require("../../utils/build-cache-providers");
|
|
22
22
|
const _resolveBundlerProps = require("../resolveBundlerProps");
|
|
23
23
|
async function resolveOptionsAsync(projectRoot, options) {
|
|
24
|
-
var _projectConfig_exp_experiments_remoteBuildCache,
|
|
24
|
+
var _projectConfig_exp_experiments, _projectConfig_exp_experiments_remoteBuildCache, _projectConfig_exp_experiments1;
|
|
25
25
|
// Resolve the device before the gradle props because we need the device to be running to get the ABI.
|
|
26
26
|
const device = await (0, _resolveDevice.resolveDeviceAsync)(options.device);
|
|
27
27
|
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
28
|
-
const buildCacheProvider = (0,
|
|
28
|
+
const buildCacheProvider = await (0, _buildcacheproviders.resolveBuildCacheProvider)(((_projectConfig_exp_experiments = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments.buildCacheProvider) ?? ((_projectConfig_exp_experiments1 = projectConfig.exp.experiments) == null ? void 0 : (_projectConfig_exp_experiments_remoteBuildCache = _projectConfig_exp_experiments1.remoteBuildCache) == null ? void 0 : _projectConfig_exp_experiments_remoteBuildCache.provider), projectRoot);
|
|
29
29
|
return {
|
|
30
30
|
...await (0, _resolveBundlerProps.resolveBundlerPropsAsync)(projectRoot, options),
|
|
31
31
|
...await (0, _resolveGradlePropsAsync.resolveGradlePropsAsync)(projectRoot, options, device.device),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/android/resolveOptions.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/android/resolveOptions.ts"],"sourcesContent":["import { BuildCacheProvider, 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 { resolveBuildCacheProvider } from '../../utils/build-cache-providers';\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?: BuildCacheProvider;\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 = await resolveBuildCacheProvider(\n projectConfig.exp.experiments?.buildCacheProvider ??\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","resolveBuildCacheProvider","exp","experiments","remoteBuildCache","provider","resolveBundlerPropsAsync","resolveGradlePropsAsync","resolveLaunchPropsAsync","variant","buildCache","install"],"mappings":";;;;+BAiCsBA;;;eAAAA;;;;yBAjCwB;;;;;;+BAEX;yCACkB;oCACA;qCAEX;qCACa;AA0BhD,eAAeA,oBACpBC,WAAmB,EACnBC,OAAgB;QAOdC,gCACEA,iDAAAA;IANJ,sGAAsG;IACtG,MAAMC,SAAS,MAAMC,IAAAA,iCAAkB,EAACH,QAAQE,MAAM;IAEtD,MAAMD,gBAAgBG,IAAAA,mBAAS,EAACL;IAChC,MAAMM,qBAAqB,MAAMC,IAAAA,8CAAyB,EACxDL,EAAAA,iCAAAA,cAAcM,GAAG,CAACC,WAAW,qBAA7BP,+BAA+BI,kBAAkB,OAC/CJ,kCAAAA,cAAcM,GAAG,CAACC,WAAW,sBAA7BP,kDAAAA,gCAA+BQ,gBAAgB,qBAA/CR,gDAAiDS,QAAQ,GAC3DX;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"}
|
|
@@ -34,10 +34,10 @@ const _resolveOptions = require("./resolveOptions");
|
|
|
34
34
|
const _exportEager = require("../../export/embed/exportEager");
|
|
35
35
|
const _log = require("../../log");
|
|
36
36
|
const _gradle = require("../../start/platforms/android/gradle");
|
|
37
|
+
const _buildcacheproviders = require("../../utils/build-cache-providers");
|
|
37
38
|
const _errors = require("../../utils/errors");
|
|
38
39
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
39
40
|
const _port = require("../../utils/port");
|
|
40
|
-
const _remotebuildcacheproviders = require("../../utils/remote-build-cache-providers");
|
|
41
41
|
const _scheme = require("../../utils/scheme");
|
|
42
42
|
const _ensureNativeProject = require("../ensureNativeProject");
|
|
43
43
|
const _hints = require("../hints");
|
|
@@ -60,7 +60,7 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
|
60
60
|
});
|
|
61
61
|
const props = await (0, _resolveOptions.resolveOptionsAsync)(projectRoot, options);
|
|
62
62
|
if (!options.binary && props.buildCacheProvider) {
|
|
63
|
-
const localPath = await (0,
|
|
63
|
+
const localPath = await (0, _buildcacheproviders.resolveBuildCache)({
|
|
64
64
|
projectRoot,
|
|
65
65
|
platform: 'android',
|
|
66
66
|
provider: props.buildCacheProvider,
|
|
@@ -134,7 +134,7 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
|
134
134
|
await manager.stopAsync();
|
|
135
135
|
}
|
|
136
136
|
if (options.binary && shouldUpdateBuildCache && props.buildCacheProvider) {
|
|
137
|
-
await (0,
|
|
137
|
+
await (0, _buildcacheproviders.uploadBuildCache)({
|
|
138
138
|
projectRoot,
|
|
139
139
|
platform: 'android',
|
|
140
140
|
provider: props.buildCacheProvider,
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 { resolveBuildCache, uploadBuildCache } from '../../utils/build-cache-providers';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\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 resolveBuildCache({\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 uploadBuildCache({\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","resolveBuildCache","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","uploadBuildCache","buildPath","installAsync"],"mappings":";;;;+BAqBsBA;;;eAAAA;;;;gEArBJ;;;;;;;gEACH;;;;;;;gEACE;;;;;;uCAE0B;gCACmB;6BA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W;QAC9BC,gBAAgB/C,MAAM+C,cAAc;IACtC,GACA;QAAEb,QAAQlC,MAAMkC,MAAM,CAACA,MAAM;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,qCAAgB,EAAC;YACrB7D;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"}
|
|
@@ -19,11 +19,11 @@ const _resolveDevice = require("./resolveDevice");
|
|
|
19
19
|
const _resolveNativeScheme = require("./resolveNativeScheme");
|
|
20
20
|
const _resolveXcodeProject = require("./resolveXcodeProject");
|
|
21
21
|
const _simctl = require("../../../start/platforms/ios/simctl");
|
|
22
|
+
const _buildcacheproviders = require("../../../utils/build-cache-providers");
|
|
22
23
|
const _profile = require("../../../utils/profile");
|
|
23
|
-
const _remotebuildcacheproviders = require("../../../utils/remote-build-cache-providers");
|
|
24
24
|
const _resolveBundlerProps = require("../../resolveBundlerProps");
|
|
25
25
|
async function resolveOptionsAsync(projectRoot, options) {
|
|
26
|
-
var _projectConfig_exp_experiments_remoteBuildCache,
|
|
26
|
+
var _projectConfig_exp_experiments, _projectConfig_exp_experiments_remoteBuildCache, _projectConfig_exp_experiments1;
|
|
27
27
|
const xcodeProject = (0, _resolveXcodeProject.resolveXcodeProject)(projectRoot);
|
|
28
28
|
const bundlerProps = await (0, _resolveBundlerProps.resolveBundlerPropsAsync)(projectRoot, options);
|
|
29
29
|
// Resolve the scheme before the device so we can filter devices based on
|
|
@@ -42,7 +42,7 @@ async function resolveOptionsAsync(projectRoot, options) {
|
|
|
42
42
|
});
|
|
43
43
|
const isSimulator = (0, _resolveDevice.isSimulatorDevice)(device);
|
|
44
44
|
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
45
|
-
const buildCacheProvider = (0,
|
|
45
|
+
const buildCacheProvider = await (0, _buildcacheproviders.resolveBuildCacheProvider)(((_projectConfig_exp_experiments = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments.buildCacheProvider) ?? ((_projectConfig_exp_experiments1 = projectConfig.exp.experiments) == null ? void 0 : (_projectConfig_exp_experiments_remoteBuildCache = _projectConfig_exp_experiments1.remoteBuildCache) == null ? void 0 : _projectConfig_exp_experiments_remoteBuildCache.provider), projectRoot);
|
|
46
46
|
// This optimization skips resetting the Metro cache needlessly.
|
|
47
47
|
// The cache is reset in `../node_modules/react-native/scripts/react-native-xcode.sh` when the
|
|
48
48
|
// project is running in Debug and built onto a physical device. It seems that this is done because
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 { resolveBuildCacheProvider } from '../../../utils/build-cache-providers';\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 const projectConfig = getConfig(projectRoot);\n const buildCacheProvider = await resolveBuildCacheProvider(\n projectConfig.exp.experiments?.buildCacheProvider ??\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","resolveBuildCacheProvider","exp","experiments","remoteBuildCache","provider","shouldSkipInitialBundling","shouldStartBundler","buildCache"],"mappings":";;;;+BAYsBA;;;eAAAA;;;;yBAZI;;;;;;+BAE4B;qCACR;qCACV;wBACX;qCACiB;yBAClB;qCACiB;AAIlC,eAAeA,oBACpBC,WAAmB,EACnBC,OAAgB;QA+BdC,gCACEA,iDAAAA;IA9BJ,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,qBAAqB,MAAMC,IAAAA,8CAAyB,EACxDnB,EAAAA,iCAAAA,cAAcoB,GAAG,CAACC,WAAW,qBAA7BrB,+BAA+BkB,kBAAkB,OAC/ClB,kCAAAA,cAAcoB,GAAG,CAACC,WAAW,sBAA7BrB,kDAAAA,gCAA+BsB,gBAAgB,qBAA/CtB,gDAAiDuB,QAAQ,GAC3DzB;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"}
|
|
@@ -51,12 +51,12 @@ const _exportEager = require("../../export/embed/exportEager");
|
|
|
51
51
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
|
|
52
52
|
const _AppleAppIdResolver = require("../../start/platforms/ios/AppleAppIdResolver");
|
|
53
53
|
const _simctl = require("../../start/platforms/ios/simctl");
|
|
54
|
+
const _buildcacheproviders = require("../../utils/build-cache-providers");
|
|
54
55
|
const _cocoapods = require("../../utils/cocoapods");
|
|
55
56
|
const _errors = require("../../utils/errors");
|
|
56
57
|
const _nodeEnv = require("../../utils/nodeEnv");
|
|
57
58
|
const _port = require("../../utils/port");
|
|
58
59
|
const _profile = require("../../utils/profile");
|
|
59
|
-
const _remotebuildcacheproviders = require("../../utils/remote-build-cache-providers");
|
|
60
60
|
const _scheme = require("../../utils/scheme");
|
|
61
61
|
const _ensureNativeProject = require("../ensureNativeProject");
|
|
62
62
|
const _hints = require("../hints");
|
|
@@ -124,7 +124,7 @@ async function runIosAsync(projectRoot, options) {
|
|
|
124
124
|
const props = await (0, _profile.profile)(_resolveOptions.resolveOptionsAsync)(projectRoot, options);
|
|
125
125
|
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
126
126
|
if (!options.binary && props.buildCacheProvider && props.isSimulator) {
|
|
127
|
-
const localPath = await (0,
|
|
127
|
+
const localPath = await (0, _buildcacheproviders.resolveBuildCache)({
|
|
128
128
|
projectRoot,
|
|
129
129
|
platform: 'ios',
|
|
130
130
|
runOptions: options,
|
|
@@ -240,7 +240,7 @@ async function runIosAsync(projectRoot, options) {
|
|
|
240
240
|
await manager.stopAsync();
|
|
241
241
|
}
|
|
242
242
|
if (shouldUpdateBuildCache && props.buildCacheProvider) {
|
|
243
|
-
await (0,
|
|
243
|
+
await (0, _buildcacheproviders.uploadBuildCache)({
|
|
244
244
|
projectRoot,
|
|
245
245
|
platform: 'ios',
|
|
246
246
|
provider: props.buildCacheProvider,
|
|
@@ -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 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;;;;yBA/BI;;;;;;;gEACH;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;oEAEW;2BAEgC;gCACxB;wCACI;6BACP;6DACZ;oCACc;wBACgB;2BACR;wBACd;yBACF;sBACiB;yBACpB;2CAIjB;wBAC+B;qCACG;uBACF;8BACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,YAAYG,WAAmB,EAAEC,OAAgB;QA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YnB;QACd;IACF;AACF;AAEA,SAASI;IACP,IAAIwE,QAAQrE,QAAQ,KAAK,UAAU;QACjCe,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 { resolveBuildCache, uploadBuildCache } from '../../utils/build-cache-providers';\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 { 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 resolveBuildCache({\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 uploadBuildCache({\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","resolveBuildCache","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","uploadBuildCache","buildPath","process","exit","chalk"],"mappings":";;;;+BA4BsBA;;;eAAAA;;;;yBA5BI;;;;;;;gEACH;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;oEAEW;2BAEgC;gCACxB;wCACI;6BACP;6DACZ;oCACc;wBACgB;qCACC;2BACT;wBACd;yBACF;sBACiB;yBACpB;wBACc;qCACG;uBACF;8BACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,YAAYG,WAAmB,EAAEC,OAAgB;QAwI9D;IAvIPC,IAAAA,mBAAU,EAACD,QAAQE,aAAa,KAAK,YAAY,eAAe;IAChEJ,QAAQ,aAAaK,IAAI,CAACJ;IAE1BK;IAEA,MAAMC,UAAU,CAAC,CAACL,QAAQK,OAAO;IAEjC,IA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9 +12,6 @@ _export(exports, {
|
|
|
12
12
|
fileExists: function() {
|
|
13
13
|
return fileExists;
|
|
14
14
|
},
|
|
15
|
-
isDevClientBuild: function() {
|
|
16
|
-
return isDevClientBuild;
|
|
17
|
-
},
|
|
18
15
|
moduleNameIsDirectFileReference: function() {
|
|
19
16
|
return moduleNameIsDirectFileReference;
|
|
20
17
|
},
|
|
@@ -29,24 +26,11 @@ function _fs() {
|
|
|
29
26
|
};
|
|
30
27
|
return data;
|
|
31
28
|
}
|
|
32
|
-
const _detectDevClient = require("../../start/detectDevClient");
|
|
33
29
|
function _interop_require_default(obj) {
|
|
34
30
|
return obj && obj.__esModule ? obj : {
|
|
35
31
|
default: obj
|
|
36
32
|
};
|
|
37
33
|
}
|
|
38
|
-
function isDevClientBuild({ runOptions, projectRoot }) {
|
|
39
|
-
if (!(0, _detectDevClient.hasDirectDevClientDependency)(projectRoot)) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
if ('variant' in runOptions && runOptions.variant !== undefined) {
|
|
43
|
-
return runOptions.variant === 'debug';
|
|
44
|
-
}
|
|
45
|
-
if ('configuration' in runOptions && runOptions.configuration !== undefined) {
|
|
46
|
-
return runOptions.configuration === 'Debug';
|
|
47
|
-
}
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
34
|
function moduleNameIsDirectFileReference(name) {
|
|
51
35
|
var _name_split;
|
|
52
36
|
// Check if path is a file. Matches lines starting with: . / ~/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/build-cache-providers/helpers.ts"],"sourcesContent":["import fs from 'fs';\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","moduleNameIsDirectFileReference","moduleNameIsPackageReference","name","match","slashCount","split","length","startsWith","file","fs","statSync","isFile"],"mappings":";;;;;;;;;;;IAuBgBA,UAAU;eAAVA;;IArBAC,+BAA+B;eAA/BA;;IAgBAC,4BAA4B;eAA5BA;;;;gEAlBD;;;;;;;;;;;AAER,SAASD,gCAAgCE,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,SAASH,6BAA6BC,IAAY;QACpCA;IAAnB,MAAME,cAAaF,cAAAA,KAAKG,KAAK,CAAC,yBAAXH,YAAiBI,MAAM;IAC1C,OAAOJ,KAAKK,UAAU,CAAC,OAAOH,eAAe,IAAIA,eAAe;AAClE;AAEO,SAASL,WAAWS,IAAY;IACrC,IAAI;QACF,OAAOC,aAAE,CAACC,QAAQ,CAACF,MAAMG,MAAM;IACjC,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
|
@@ -0,0 +1,283 @@
|
|
|
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
|
+
resolveBuildCache: function() {
|
|
13
|
+
return resolveBuildCache;
|
|
14
|
+
},
|
|
15
|
+
resolveBuildCacheProvider: function() {
|
|
16
|
+
return resolveBuildCacheProvider;
|
|
17
|
+
},
|
|
18
|
+
resolvePluginFunction: function() {
|
|
19
|
+
return resolvePluginFunction;
|
|
20
|
+
},
|
|
21
|
+
uploadBuildCache: function() {
|
|
22
|
+
return uploadBuildCache;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function _fs() {
|
|
26
|
+
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
27
|
+
_fs = function() {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
function _path() {
|
|
33
|
+
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
34
|
+
_path = function() {
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
function _resolvefrom() {
|
|
40
|
+
const data = /*#__PURE__*/ _interop_require_default(require("resolve-from"));
|
|
41
|
+
_resolvefrom = function() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
const _helpers = require("./helpers");
|
|
47
|
+
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../log"));
|
|
48
|
+
const _ensureDependenciesAsync = require("../../start/doctor/dependencies/ensureDependenciesAsync");
|
|
49
|
+
const _errors = require("../errors");
|
|
50
|
+
function _interop_require_default(obj) {
|
|
51
|
+
return obj && obj.__esModule ? obj : {
|
|
52
|
+
default: obj
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
56
|
+
if (typeof WeakMap !== "function") return null;
|
|
57
|
+
var cacheBabelInterop = new WeakMap();
|
|
58
|
+
var cacheNodeInterop = new WeakMap();
|
|
59
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
60
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
61
|
+
})(nodeInterop);
|
|
62
|
+
}
|
|
63
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
64
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
65
|
+
return obj;
|
|
66
|
+
}
|
|
67
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
68
|
+
return {
|
|
69
|
+
default: obj
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
73
|
+
if (cache && cache.has(obj)) {
|
|
74
|
+
return cache.get(obj);
|
|
75
|
+
}
|
|
76
|
+
var newObj = {
|
|
77
|
+
__proto__: null
|
|
78
|
+
};
|
|
79
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
80
|
+
for(var key in obj){
|
|
81
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
82
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
83
|
+
if (desc && (desc.get || desc.set)) {
|
|
84
|
+
Object.defineProperty(newObj, key, desc);
|
|
85
|
+
} else {
|
|
86
|
+
newObj[key] = obj[key];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
newObj.default = obj;
|
|
91
|
+
if (cache) {
|
|
92
|
+
cache.set(obj, newObj);
|
|
93
|
+
}
|
|
94
|
+
return newObj;
|
|
95
|
+
}
|
|
96
|
+
const debug = require('debug')('expo:run:build-cache-provider');
|
|
97
|
+
const resolveBuildCacheProvider = async (provider, projectRoot)=>{
|
|
98
|
+
if (!provider) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (provider === 'eas') {
|
|
102
|
+
try {
|
|
103
|
+
await (0, _ensureDependenciesAsync.ensureDependenciesAsync)(projectRoot, {
|
|
104
|
+
isProjectMutable: true,
|
|
105
|
+
installMessage: 'eas-build-cache-provider package is required to use the EAS build cache.\n',
|
|
106
|
+
warningMessage: 'Unable to to use the EAS remote build cache.',
|
|
107
|
+
requiredPackages: [
|
|
108
|
+
{
|
|
109
|
+
pkg: 'eas-build-cache-provider',
|
|
110
|
+
file: 'eas-build-cache-provider/package.json',
|
|
111
|
+
dev: true
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
// We need to manually load dependencies installed on the fly
|
|
116
|
+
const plugin = await manuallyLoadDependency(projectRoot, 'eas-build-cache-provider');
|
|
117
|
+
return {
|
|
118
|
+
plugin: plugin.default ?? plugin,
|
|
119
|
+
options: {}
|
|
120
|
+
};
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (error instanceof _errors.CommandError) {
|
|
123
|
+
_log.warn(error.message);
|
|
124
|
+
} else {
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (typeof provider === 'object' && typeof provider.plugin === 'string') {
|
|
131
|
+
const plugin = resolvePluginFunction(projectRoot, provider.plugin);
|
|
132
|
+
return {
|
|
133
|
+
plugin,
|
|
134
|
+
options: provider.options
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
throw new Error('Invalid build cache provider');
|
|
138
|
+
};
|
|
139
|
+
async function resolveBuildCache({ projectRoot, platform, provider, runOptions }) {
|
|
140
|
+
const fingerprintHash = await calculateFingerprintHashAsync({
|
|
141
|
+
projectRoot,
|
|
142
|
+
platform,
|
|
143
|
+
provider,
|
|
144
|
+
runOptions
|
|
145
|
+
});
|
|
146
|
+
if (!fingerprintHash) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
if ('resolveRemoteBuildCache' in provider.plugin) {
|
|
150
|
+
_log.warn('The resolveRemoteBuildCache function is deprecated. Use resolveBuildCache instead.');
|
|
151
|
+
return await provider.plugin.resolveRemoteBuildCache({
|
|
152
|
+
fingerprintHash,
|
|
153
|
+
platform,
|
|
154
|
+
runOptions,
|
|
155
|
+
projectRoot
|
|
156
|
+
}, provider.options);
|
|
157
|
+
}
|
|
158
|
+
return await provider.plugin.resolveBuildCache({
|
|
159
|
+
fingerprintHash,
|
|
160
|
+
platform,
|
|
161
|
+
runOptions,
|
|
162
|
+
projectRoot
|
|
163
|
+
}, provider.options);
|
|
164
|
+
}
|
|
165
|
+
async function uploadBuildCache({ projectRoot, platform, provider, buildPath, runOptions }) {
|
|
166
|
+
const fingerprintHash = await calculateFingerprintHashAsync({
|
|
167
|
+
projectRoot,
|
|
168
|
+
platform,
|
|
169
|
+
provider,
|
|
170
|
+
runOptions
|
|
171
|
+
});
|
|
172
|
+
if (!fingerprintHash) {
|
|
173
|
+
debug('No fingerprint hash found, skipping upload');
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if ('uploadRemoteBuildCache' in provider.plugin) {
|
|
177
|
+
_log.warn('The uploadRemoteBuildCache function is deprecated. Use uploadBuildCache instead.');
|
|
178
|
+
await provider.plugin.uploadRemoteBuildCache({
|
|
179
|
+
projectRoot,
|
|
180
|
+
platform,
|
|
181
|
+
fingerprintHash,
|
|
182
|
+
buildPath,
|
|
183
|
+
runOptions
|
|
184
|
+
}, provider.options);
|
|
185
|
+
} else {
|
|
186
|
+
await provider.plugin.uploadBuildCache({
|
|
187
|
+
projectRoot,
|
|
188
|
+
platform,
|
|
189
|
+
fingerprintHash,
|
|
190
|
+
buildPath,
|
|
191
|
+
runOptions
|
|
192
|
+
}, provider.options);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async function calculateFingerprintHashAsync({ projectRoot, platform, provider, runOptions }) {
|
|
196
|
+
if (provider.plugin.calculateFingerprintHash) {
|
|
197
|
+
return await provider.plugin.calculateFingerprintHash({
|
|
198
|
+
projectRoot,
|
|
199
|
+
platform,
|
|
200
|
+
runOptions
|
|
201
|
+
}, provider.options);
|
|
202
|
+
}
|
|
203
|
+
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
204
|
+
if (!Fingerprint) {
|
|
205
|
+
debug('@expo/fingerprint is not installed in the project, unable to calculate fingerprint');
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
209
|
+
return fingerprint.hash;
|
|
210
|
+
}
|
|
211
|
+
function importFingerprintForDev(projectRoot) {
|
|
212
|
+
try {
|
|
213
|
+
return require(require.resolve('@expo/fingerprint', {
|
|
214
|
+
paths: [
|
|
215
|
+
projectRoot
|
|
216
|
+
]
|
|
217
|
+
}));
|
|
218
|
+
} catch (error) {
|
|
219
|
+
if ('code' in error && error.code === 'MODULE_NOT_FOUND') {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Resolve the provider plugin from a node module or package.
|
|
227
|
+
* If the module or package does not include a provider plugin, this function throws.
|
|
228
|
+
* The resolution is done in following order:
|
|
229
|
+
* 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`?
|
|
230
|
+
* - Resolve the provider plugin as-is
|
|
231
|
+
* 2. Does the module have a valid provider plugin in the `main` field?
|
|
232
|
+
* - Resolve the `main` entry point as provider plugin
|
|
233
|
+
*/ function resolvePluginFilePathForModule(projectRoot, pluginReference) {
|
|
234
|
+
if ((0, _helpers.moduleNameIsDirectFileReference)(pluginReference)) {
|
|
235
|
+
// Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`
|
|
236
|
+
const pluginScriptFile = _resolvefrom().default.silent(projectRoot, pluginReference);
|
|
237
|
+
if (pluginScriptFile) {
|
|
238
|
+
return pluginScriptFile;
|
|
239
|
+
}
|
|
240
|
+
} else if ((0, _helpers.moduleNameIsPackageReference)(pluginReference)) {
|
|
241
|
+
// Try to resole the `main` entry as config plugin
|
|
242
|
+
return (0, _resolvefrom().default)(projectRoot, pluginReference);
|
|
243
|
+
}
|
|
244
|
+
throw new Error(`Failed to resolve provider plugin for module "${pluginReference}" relative to "${projectRoot}". Do you have node modules installed?`);
|
|
245
|
+
}
|
|
246
|
+
function resolvePluginFunction(projectRoot, pluginReference) {
|
|
247
|
+
const pluginFile = resolvePluginFilePathForModule(projectRoot, pluginReference);
|
|
248
|
+
try {
|
|
249
|
+
let plugin = require(pluginFile);
|
|
250
|
+
if ((plugin == null ? void 0 : plugin.default) != null) {
|
|
251
|
+
plugin = plugin.default;
|
|
252
|
+
}
|
|
253
|
+
if (typeof plugin !== 'object' || typeof plugin.resolveRemoteBuildCache !== 'function' && typeof plugin.resolveBuildCache !== 'function' || typeof plugin.uploadRemoteBuildCache !== 'function' && typeof plugin.uploadBuildCache !== 'function') {
|
|
254
|
+
throw new Error(`
|
|
255
|
+
The provider plugin "${pluginReference}" must export an object containing
|
|
256
|
+
the resolveBuildCache and uploadBuildCache functions.
|
|
257
|
+
`);
|
|
258
|
+
}
|
|
259
|
+
return plugin;
|
|
260
|
+
} catch (error) {
|
|
261
|
+
if (error instanceof SyntaxError) {
|
|
262
|
+
// Add error linking to the docs of how create a valid provider plugin
|
|
263
|
+
}
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
async function manuallyLoadDependency(projectRoot, packageName) {
|
|
268
|
+
const possiblePaths = [
|
|
269
|
+
_path().default.join(projectRoot, 'node_modules'),
|
|
270
|
+
...require.resolve.paths(packageName) ?? []
|
|
271
|
+
];
|
|
272
|
+
const nodeModulesFolder = possiblePaths == null ? void 0 : possiblePaths.find((p)=>{
|
|
273
|
+
const packagePath = _path().default.join(p, packageName);
|
|
274
|
+
return _fs().default.existsSync(packagePath);
|
|
275
|
+
});
|
|
276
|
+
if (!nodeModulesFolder) {
|
|
277
|
+
throw new Error(`Package ${packageName} not found in ${possiblePaths}`);
|
|
278
|
+
}
|
|
279
|
+
const { main } = await Promise.resolve(_path().default.join(nodeModulesFolder, packageName, 'package.json')).then((p)=>/*#__PURE__*/ _interop_require_wildcard(require(p)));
|
|
280
|
+
return Promise.resolve(_path().default.join(nodeModulesFolder, packageName, main)).then((p)=>/*#__PURE__*/ _interop_require_wildcard(require(p)));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/build-cache-providers/index.ts"],"sourcesContent":["import { ExpoConfig, BuildCacheProviderPlugin, BuildCacheProvider, RunOptions } from '@expo/config';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { moduleNameIsDirectFileReference, moduleNameIsPackageReference } from './helpers';\nimport * as Log from '../../log';\nimport { ensureDependenciesAsync } from '../../start/doctor/dependencies/ensureDependenciesAsync';\nimport { CommandError } from '../errors';\n\nconst debug = require('debug')('expo:run:build-cache-provider') as typeof console.log;\n\nexport const resolveBuildCacheProvider = async (\n provider: Required<Required<ExpoConfig>['experiments']>['buildCacheProvider'] | undefined,\n projectRoot: string\n): Promise<BuildCacheProvider | undefined> => {\n if (!provider) {\n return;\n }\n\n if (provider === 'eas') {\n try {\n await ensureDependenciesAsync(projectRoot, {\n isProjectMutable: true,\n installMessage:\n 'eas-build-cache-provider package is required to use the EAS build cache.\\n',\n warningMessage: 'Unable to to use the EAS remote build cache.',\n requiredPackages: [\n {\n pkg: 'eas-build-cache-provider',\n file: 'eas-build-cache-provider/package.json',\n dev: true,\n },\n ],\n });\n\n // We need to manually load dependencies installed on the fly\n const plugin = await manuallyLoadDependency(projectRoot, 'eas-build-cache-provider');\n\n return {\n plugin: plugin.default ?? plugin,\n options: {},\n };\n } catch (error: any) {\n if (error instanceof CommandError) {\n Log.warn(error.message);\n } else {\n throw error;\n }\n return undefined;\n }\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 build cache provider');\n};\n\nexport async function resolveBuildCache({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\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 if ('resolveRemoteBuildCache' in provider.plugin) {\n Log.warn('The resolveRemoteBuildCache function is deprecated. Use resolveBuildCache instead.');\n return await provider.plugin.resolveRemoteBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n }\n return await provider.plugin.resolveBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n}\n\nexport async function uploadBuildCache({\n projectRoot,\n platform,\n provider,\n buildPath,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\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 if ('uploadRemoteBuildCache' in provider.plugin) {\n Log.warn('The uploadRemoteBuildCache function is deprecated. Use uploadBuildCache instead.');\n await provider.plugin.uploadRemoteBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n } else {\n await provider.plugin.uploadBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n }\n}\n\nasync function calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\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 (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n return null;\n }\n throw error;\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 return resolveFrom(projectRoot, pluginReference);\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): BuildCacheProviderPlugin {\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.resolveBuildCache !== 'function') ||\n (typeof plugin.uploadRemoteBuildCache !== 'function' &&\n typeof plugin.uploadBuildCache !== 'function')\n ) {\n throw new Error(`\n The provider plugin \"${pluginReference}\" must export an object containing\n the resolveBuildCache and uploadBuildCache 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\nasync function manuallyLoadDependency(projectRoot: string, packageName: string) {\n const possiblePaths = [\n path.join(projectRoot, 'node_modules'),\n ...(require.resolve.paths(packageName) ?? []),\n ];\n const nodeModulesFolder = possiblePaths?.find((p) => {\n const packagePath = path.join(p, packageName);\n return fs.existsSync(packagePath);\n });\n if (!nodeModulesFolder) {\n throw new Error(`Package ${packageName} not found in ${possiblePaths}`);\n }\n\n const { main } = await import(path.join(nodeModulesFolder, packageName, 'package.json'));\n return import(path.join(nodeModulesFolder, packageName, main));\n}\n"],"names":["resolveBuildCache","resolveBuildCacheProvider","resolvePluginFunction","uploadBuildCache","debug","require","provider","projectRoot","ensureDependenciesAsync","isProjectMutable","installMessage","warningMessage","requiredPackages","pkg","file","dev","plugin","manuallyLoadDependency","default","options","error","CommandError","Log","warn","message","undefined","Error","platform","runOptions","fingerprintHash","calculateFingerprintHashAsync","resolveRemoteBuildCache","buildPath","uploadRemoteBuildCache","calculateFingerprintHash","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","hash","resolve","paths","code","resolvePluginFilePathForModule","pluginReference","moduleNameIsDirectFileReference","pluginScriptFile","resolveFrom","silent","moduleNameIsPackageReference","pluginFile","SyntaxError","packageName","possiblePaths","path","join","nodeModulesFolder","find","p","packagePath","fs","existsSync","main"],"mappings":";;;;;;;;;;;IA8DsBA,iBAAiB;eAAjBA;;IAlDTC,yBAAyB;eAAzBA;;IAwMGC,qBAAqB;eAArBA;;IApHMC,gBAAgB;eAAhBA;;;;gEA/FP;;;;;;;gEACE;;;;;;;gEACO;;;;;;yBAEsD;6DACzD;yCACmB;wBACX;;;;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;IACD,MAAMI,oBAAoBH,iCAAAA,cAAeI,IAAI,CAAC,CAACC;QAC7C,MAAMC,cAAcL,eAAI,CAACC,IAAI,CAACG,GAAGN;QACjC,OAAOQ,aAAE,CAACC,UAAU,CAACF;IACvB;IACA,IAAI,CAACH,mBAAmB;QACtB,MAAM,IAAI9B,MAAM,CAAC,QAAQ,EAAE0B,YAAY,cAAc,EAAEC,eAAe;IACxE;IAEA,MAAM,EAAES,IAAI,EAAE,GAAG,MAAM,gBAAOR,eAAI,CAACC,IAAI,CAACC,mBAAmBJ,aAAa,mEAAjD;IACvB,OAAO,gBAAOE,eAAI,CAACC,IAAI,CAACC,mBAAmBJ,aAAaU,yDAAjD;AACT"}
|
|
@@ -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.13"}`,
|
|
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.13",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -42,17 +42,17 @@
|
|
|
42
42
|
"@0no-co/graphql.web": "^1.0.8",
|
|
43
43
|
"@babel/runtime": "^7.20.0",
|
|
44
44
|
"@expo/code-signing-certificates": "^0.0.5",
|
|
45
|
-
"@expo/config": "~11.0.
|
|
45
|
+
"@expo/config": "~11.0.10",
|
|
46
46
|
"@expo/config-plugins": "~10.0.2",
|
|
47
47
|
"@expo/devcert": "^1.1.2",
|
|
48
48
|
"@expo/env": "~1.0.5",
|
|
49
49
|
"@expo/image-utils": "^0.7.4",
|
|
50
50
|
"@expo/json-file": "^9.1.4",
|
|
51
|
-
"@expo/metro-config": "~0.20.
|
|
51
|
+
"@expo/metro-config": "~0.20.14",
|
|
52
52
|
"@expo/osascript": "^2.2.4",
|
|
53
53
|
"@expo/package-manager": "^1.8.4",
|
|
54
54
|
"@expo/plist": "^0.3.4",
|
|
55
|
-
"@expo/prebuild-config": "^9.0.
|
|
55
|
+
"@expo/prebuild-config": "^9.0.6",
|
|
56
56
|
"@expo/spawn-async": "^1.7.2",
|
|
57
57
|
"@expo/ws-tunnel": "^1.0.1",
|
|
58
58
|
"@expo/xcpretty": "^4.3.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"getenv": "^1.0.0",
|
|
75
75
|
"glob": "^10.4.2",
|
|
76
76
|
"minimatch": "^9.0.0",
|
|
77
|
-
"lan-network": "^0.1.
|
|
77
|
+
"lan-network": "^0.1.6",
|
|
78
78
|
"node-forge": "^1.3.1",
|
|
79
79
|
"npm-package-arg": "^11.0.0",
|
|
80
80
|
"ora": "^3.4.0",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"@types/ws": "^8.5.4",
|
|
140
140
|
"devtools-protocol": "^0.0.1113120",
|
|
141
141
|
"expo-atlas": "^0.4.0",
|
|
142
|
-
"expo-module-scripts": "^4.1.
|
|
142
|
+
"expo-module-scripts": "^4.1.7",
|
|
143
143
|
"find-process": "^1.4.7",
|
|
144
144
|
"jest-runner-tsd": "^6.0.0",
|
|
145
145
|
"klaw-sync": "^6.0.0",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"tree-kill": "^1.2.2",
|
|
153
153
|
"tsd": "^0.28.1"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "49c9d53cf0a9fc8179d1c8f5268beadd141f70ca"
|
|
156
156
|
}
|
|
@@ -1,157 +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
|
-
EASRemoteBuildCacheProvider: function() {
|
|
13
|
-
return EASRemoteBuildCacheProvider;
|
|
14
|
-
},
|
|
15
|
-
calculateEASFingerprintHashAsync: function() {
|
|
16
|
-
return calculateEASFingerprintHashAsync;
|
|
17
|
-
},
|
|
18
|
-
resolveEASRemoteBuildCache: function() {
|
|
19
|
-
return resolveEASRemoteBuildCache;
|
|
20
|
-
},
|
|
21
|
-
uploadEASRemoteBuildCache: function() {
|
|
22
|
-
return uploadEASRemoteBuildCache;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
function _spawnasync() {
|
|
26
|
-
const data = /*#__PURE__*/ _interop_require_default(require("@expo/spawn-async"));
|
|
27
|
-
_spawnasync = function() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
function _chalk() {
|
|
33
|
-
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
34
|
-
_chalk = function() {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
function _fs() {
|
|
40
|
-
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
41
|
-
_fs = function() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
return data;
|
|
45
|
-
}
|
|
46
|
-
function _path() {
|
|
47
|
-
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
48
|
-
_path = function() {
|
|
49
|
-
return data;
|
|
50
|
-
};
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
const _helpers = require("./helpers");
|
|
54
|
-
const _log = require("../../log");
|
|
55
|
-
const _xcrun = require("../../start/platforms/ios/xcrun");
|
|
56
|
-
function _interop_require_default(obj) {
|
|
57
|
-
return obj && obj.__esModule ? obj : {
|
|
58
|
-
default: obj
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const debug = require('debug')('expo:eas-remote-build-cache');
|
|
62
|
-
async function resolveEASRemoteBuildCache({ projectRoot, platform, fingerprintHash, runOptions }) {
|
|
63
|
-
const easJsonPath = _path().default.join(projectRoot, 'eas.json');
|
|
64
|
-
if (!_fs().default.existsSync(easJsonPath)) {
|
|
65
|
-
debug('eas.json not found, skip checking for remote builds');
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
_log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Searching builds with matching fingerprint on EAS servers}`);
|
|
69
|
-
try {
|
|
70
|
-
const results = await (0, _spawnasync().default)('npx', [
|
|
71
|
-
'eas-cli',
|
|
72
|
-
'build:download',
|
|
73
|
-
`--platform=${platform}`,
|
|
74
|
-
`--fingerprint=${fingerprintHash}`,
|
|
75
|
-
'--non-interactive',
|
|
76
|
-
(0, _helpers.isDevClientBuild)({
|
|
77
|
-
runOptions,
|
|
78
|
-
projectRoot
|
|
79
|
-
}) ? '--dev-client' : '--no-dev-client',
|
|
80
|
-
'--json'
|
|
81
|
-
], {
|
|
82
|
-
cwd: projectRoot
|
|
83
|
-
});
|
|
84
|
-
_log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Successfully downloaded cached build}`);
|
|
85
|
-
// {
|
|
86
|
-
// "path": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
|
|
87
|
-
// }
|
|
88
|
-
const json = JSON.parse(results.stdout.trim());
|
|
89
|
-
return json == null ? void 0 : json.path;
|
|
90
|
-
} catch (error) {
|
|
91
|
-
debug('eas-cli error:', error);
|
|
92
|
-
// @TODO(2025-04-11): remove this in a future release
|
|
93
|
-
if ((0, _xcrun.isSpawnResultError)(error) && error.stderr.includes('command build:download not found')) {
|
|
94
|
-
_log.Log.warn(`To take advantage of remote build cache, upgrade your eas-cli installation to latest.`);
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async function uploadEASRemoteBuildCache({ projectRoot, platform, fingerprintHash, buildPath }) {
|
|
100
|
-
const easJsonPath = _path().default.join(projectRoot, 'eas.json');
|
|
101
|
-
if (!_fs().default.existsSync(easJsonPath)) {
|
|
102
|
-
debug('eas.json not found, skip uploading builds');
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
_log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Uploading build to remote cache}`);
|
|
107
|
-
const results = await (0, _spawnasync().default)('npx', [
|
|
108
|
-
'eas-cli',
|
|
109
|
-
'upload',
|
|
110
|
-
`--platform=${platform}`,
|
|
111
|
-
`--fingerprint=${fingerprintHash}`,
|
|
112
|
-
buildPath ? `--build-path=${buildPath}` : '',
|
|
113
|
-
'--non-interactive',
|
|
114
|
-
'--json'
|
|
115
|
-
], {
|
|
116
|
-
cwd: projectRoot
|
|
117
|
-
});
|
|
118
|
-
// {
|
|
119
|
-
// "url": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
|
|
120
|
-
// }
|
|
121
|
-
const json = JSON.parse(results.stdout.trim());
|
|
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;
|
|
124
|
-
} catch (error) {
|
|
125
|
-
debug('eas-cli error:', error);
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
async function calculateEASFingerprintHashAsync({ projectRoot, platform }) {
|
|
130
|
-
// prefer using `eas fingerprint:generate` because it automatically upload sources
|
|
131
|
-
try {
|
|
132
|
-
const results = await (0, _spawnasync().default)('npx', [
|
|
133
|
-
'eas-cli',
|
|
134
|
-
'fingerprint:generate',
|
|
135
|
-
`--platform=${platform}`,
|
|
136
|
-
'--json',
|
|
137
|
-
'--non-interactive'
|
|
138
|
-
], {
|
|
139
|
-
cwd: projectRoot
|
|
140
|
-
});
|
|
141
|
-
// {
|
|
142
|
-
// "hash": "203f960b965e154b77dc31c6c42e5582e8d77196"
|
|
143
|
-
// }
|
|
144
|
-
const json = JSON.parse(results.stdout.trim());
|
|
145
|
-
return json == null ? void 0 : json.hash;
|
|
146
|
-
} catch (error) {
|
|
147
|
-
debug('eas-cli error:', error);
|
|
148
|
-
}
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
const EASRemoteBuildCacheProvider = {
|
|
152
|
-
resolveRemoteBuildCache: resolveEASRemoteBuildCache,
|
|
153
|
-
uploadRemoteBuildCache: uploadEASRemoteBuildCache,
|
|
154
|
-
calculateFingerprintHash: calculateEASFingerprintHashAsync
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
//# sourceMappingURL=eas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/eas.ts"],"sourcesContent":["import { CalculateFingerprintHashProps, RemoteBuildCachePlugin, RunOptions } from '@expo/config';\nimport { 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 { 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;eAAhCA;;IAtGAC,0BAA0B;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kC,0BAA0BpC;AAC5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/helpers.ts"],"sourcesContent":["import { RunOptions } from '@expo/config';\nimport fs from 'fs';\n\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;;;;gEAzCD;;;;;;iCAE8B;;;;;;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"}
|
|
@@ -1,168 +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
|
-
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 === 'string') {
|
|
51
|
-
const plugin = resolvePluginFunction(projectRoot, provider.plugin);
|
|
52
|
-
return {
|
|
53
|
-
plugin,
|
|
54
|
-
options: provider.options
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
throw new Error('Invalid remote build cache provider');
|
|
58
|
-
};
|
|
59
|
-
async function resolveRemoteBuildCache({ projectRoot, platform, provider, runOptions }) {
|
|
60
|
-
const fingerprintHash = await calculateFingerprintHashAsync({
|
|
61
|
-
projectRoot,
|
|
62
|
-
platform,
|
|
63
|
-
provider,
|
|
64
|
-
runOptions
|
|
65
|
-
});
|
|
66
|
-
if (!fingerprintHash) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return await provider.plugin.resolveRemoteBuildCache({
|
|
70
|
-
fingerprintHash,
|
|
71
|
-
platform,
|
|
72
|
-
runOptions,
|
|
73
|
-
projectRoot
|
|
74
|
-
}, provider.options);
|
|
75
|
-
}
|
|
76
|
-
async function uploadRemoteBuildCache({ projectRoot, platform, provider, buildPath, runOptions }) {
|
|
77
|
-
const fingerprintHash = await calculateFingerprintHashAsync({
|
|
78
|
-
projectRoot,
|
|
79
|
-
platform,
|
|
80
|
-
provider,
|
|
81
|
-
runOptions
|
|
82
|
-
});
|
|
83
|
-
if (!fingerprintHash) {
|
|
84
|
-
debug('No fingerprint hash found, skipping upload');
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
await provider.plugin.uploadRemoteBuildCache({
|
|
88
|
-
projectRoot,
|
|
89
|
-
platform,
|
|
90
|
-
fingerprintHash,
|
|
91
|
-
buildPath,
|
|
92
|
-
runOptions
|
|
93
|
-
}, provider.options);
|
|
94
|
-
}
|
|
95
|
-
async function calculateFingerprintHashAsync({ projectRoot, platform, provider, runOptions }) {
|
|
96
|
-
if (provider.plugin.calculateFingerprintHash) {
|
|
97
|
-
return await provider.plugin.calculateFingerprintHash({
|
|
98
|
-
projectRoot,
|
|
99
|
-
platform,
|
|
100
|
-
runOptions
|
|
101
|
-
}, provider.options);
|
|
102
|
-
}
|
|
103
|
-
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
104
|
-
if (!Fingerprint) {
|
|
105
|
-
debug('@expo/fingerprint is not installed in the project, unable to calculate fingerprint');
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
109
|
-
return fingerprint.hash;
|
|
110
|
-
}
|
|
111
|
-
function importFingerprintForDev(projectRoot) {
|
|
112
|
-
try {
|
|
113
|
-
return require(require.resolve('@expo/fingerprint', {
|
|
114
|
-
paths: [
|
|
115
|
-
projectRoot
|
|
116
|
-
]
|
|
117
|
-
}));
|
|
118
|
-
} catch {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Resolve the provider plugin from a node module or package.
|
|
124
|
-
* If the module or package does not include a provider plugin, this function throws.
|
|
125
|
-
* The resolution is done in following order:
|
|
126
|
-
* 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`?
|
|
127
|
-
* - Resolve the provider plugin as-is
|
|
128
|
-
* 2. Does the module have a valid provider plugin in the `main` field?
|
|
129
|
-
* - Resolve the `main` entry point as provider plugin
|
|
130
|
-
*/ function resolvePluginFilePathForModule(projectRoot, pluginReference) {
|
|
131
|
-
if ((0, _helpers.moduleNameIsDirectFileReference)(pluginReference)) {
|
|
132
|
-
// Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`
|
|
133
|
-
const pluginScriptFile = _resolvefrom().default.silent(projectRoot, pluginReference);
|
|
134
|
-
if (pluginScriptFile) {
|
|
135
|
-
return pluginScriptFile;
|
|
136
|
-
}
|
|
137
|
-
} else if ((0, _helpers.moduleNameIsPackageReference)(pluginReference)) {
|
|
138
|
-
// Try to resole the `main` entry as config plugin
|
|
139
|
-
const packageMainEntry = _resolvefrom().default.silent(projectRoot, pluginReference);
|
|
140
|
-
if (packageMainEntry) {
|
|
141
|
-
return packageMainEntry;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
throw new Error(`Failed to resolve provider plugin for module "${pluginReference}" relative to "${projectRoot}". Do you have node modules installed?`);
|
|
145
|
-
}
|
|
146
|
-
function resolvePluginFunction(projectRoot, pluginReference) {
|
|
147
|
-
const pluginFile = resolvePluginFilePathForModule(projectRoot, pluginReference);
|
|
148
|
-
try {
|
|
149
|
-
let plugin = require(pluginFile);
|
|
150
|
-
if ((plugin == null ? void 0 : plugin.default) != null) {
|
|
151
|
-
plugin = plugin.default;
|
|
152
|
-
}
|
|
153
|
-
if (typeof plugin !== 'object' || typeof plugin.resolveRemoteBuildCache !== 'function' || typeof plugin.uploadRemoteBuildCache !== 'function') {
|
|
154
|
-
throw new Error(`
|
|
155
|
-
The provider plugin "${pluginReference}" must export an object containing
|
|
156
|
-
the resolveRemoteBuildCache and uploadRemoteBuildCache functions.
|
|
157
|
-
`);
|
|
158
|
-
}
|
|
159
|
-
return plugin;
|
|
160
|
-
} catch (error) {
|
|
161
|
-
if (error instanceof SyntaxError) {
|
|
162
|
-
// Add error linking to the docs of how create a valid provider plugin
|
|
163
|
-
}
|
|
164
|
-
throw error;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/index.ts"],"sourcesContent":["import {\n ExpoConfig,\n RemoteBuildCachePlugin,\n RemoteBuildCacheProvider,\n RunOptions,\n} from '@expo/config';\nimport resolveFrom from 'resolve-from';\n\nimport { EASRemoteBuildCacheProvider } from './eas';\nimport { moduleNameIsDirectFileReference, moduleNameIsPackageReference } from './helpers';\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 === '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: 'android' | 'ios';\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: 'android' | 'ios';\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: 'android' | 'ios';\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","packageMain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