@expo/cli 55.0.3 → 55.0.5
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/api/graphql/client.js +133 -68
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +21 -25
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +45 -38
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/rest/cache/FileSystemResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/ResponseCache.js.map +1 -1
- package/build/src/api/rest/cache/wrapFetchWithCache.js +7 -7
- package/build/src/api/rest/cache/wrapFetchWithCache.js.map +1 -1
- package/build/src/api/rest/client.js +3 -7
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithProgress.js +1 -8
- package/build/src/api/rest/wrapFetchWithProgress.js.map +1 -1
- package/build/src/api/user/user.js +6 -36
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/prebuild/renameTemplateAppName.js +2 -6
- package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
- package/build/src/prebuild/resolveLocalTemplate.js +2 -4
- package/build/src/prebuild/resolveLocalTemplate.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +13 -17
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +4 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +2 -8
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js +1 -9
- package/build/src/start/server/metro/DevToolsPluginWebsocketEndpoint.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +13 -8
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +4 -14
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +17 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +1 -13
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +1 -3
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +47 -34
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +27 -4
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +2 -62
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js +1 -1
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/codesigning.js +3 -17
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/createFileTransform.js +3 -38
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/build/src/utils/downloadAppAsync.js +1 -12
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/fetch.js +23 -4
- package/build/src/utils/fetch.js.map +1 -1
- package/build/src/utils/freeport.js +21 -5
- package/build/src/utils/freeport.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -15
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/npm.js +60 -65
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/port.js +4 -4
- package/build/src/utils/port.js.map +1 -1
- package/build/src/utils/resolveGlobal.js +195 -0
- package/build/src/utils/resolveGlobal.js.map +1 -0
- package/build/src/utils/tar.js +138 -69
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +12 -24
- package/build/src/utils/telemetry/clients/FetchClient.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +18 -28
- package/build/src/api/graphql/types/App.js +0 -29
- package/build/src/api/graphql/types/App.js.map +0 -1
- package/build/src/api/rest/wrapFetchWithProxy.js +0 -31
- package/build/src/api/rest/wrapFetchWithProxy.js.map +0 -1
- package/build/src/graphql/generated.js +0 -1196
- package/build/src/graphql/generated.js.map +0 -1
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js +0 -85
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js.map +0 -1
- package/build/src/utils/multipartMixed.js +0 -56
- package/build/src/utils/multipartMixed.js.map +0 -1
|
@@ -202,7 +202,7 @@ async function calculateFingerprintHashAsync({ projectRoot, platform, provider,
|
|
|
202
202
|
}
|
|
203
203
|
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
204
204
|
if (!Fingerprint) {
|
|
205
|
-
|
|
205
|
+
_log.warn('@expo/fingerprint is not installed in the project, skipping build cache.');
|
|
206
206
|
return null;
|
|
207
207
|
}
|
|
208
208
|
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
@@ -1 +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<ExpoConfig>['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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,MAAMJ,4BAA4B,OACvCK,UACAC;IAEA,IAAI,CAACD,UAAU;QACb;IACF;IAEA,IAAIA,aAAa,OAAO;QACtB,IAAI;YACF,MAAME,IAAAA,gDAAuB,EAACD,aAAa;gBACzCE,kBAAkB;gBAClBC,gBACE;gBACFC,gBAAgB;gBAChBC,kBAAkB;oBAChB;wBACEC,KAAK;wBACLC,MAAM;wBACNC,KAAK;oBACP;iBACD;YACH;YAEA,6DAA6D;YAC7D,MAAMC,SAAS,MAAMC,uBAAuBV,aAAa;YAEzD,OAAO;gBACLS,QAAQA,OAAOE,OAAO,IAAIF;gBAC1BG,SAAS,CAAC;YACZ;QACF,EAAE,OAAOC,OAAY;YACnB,IAAIA,iBAAiBC,oBAAY,EAAE;gBACjCC,KAAIC,IAAI,CAACH,MAAMI,OAAO;YACxB,OAAO;gBACL,MAAMJ;YACR;YACA,OAAOK;QACT;IACF;IAEA,IAAI,OAAOnB,aAAa,YAAY,OAAOA,SAASU,MAAM,KAAK,UAAU;QACvE,MAAMA,SAASd,sBAAsBK,aAAaD,SAASU,MAAM;QAEjE,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cACzC,OAAOf,OAAOhB,iBAAiB,KAAK,cACrC,OAAOgB,OAAOiB,sBAAsB,KAAK,cACxC,OAAOjB,OAAOb,gBAAgB,KAAK,YACrC;YACA,MAAM,IAAIuB,MAAM,CAAC;6BACM,EAAEkB,gBAAgB;;MAEzC,CAAC;QACH;QACA,OAAO5B;IACT,EAAE,OAAOI,OAAO;QACd,IAAIA,iBAAiB+B,aAAa;QAChC,sEAAsE;QACxE;QACA,MAAM/B;IACR;AACF;AAEA,eAAeH,uBAAuBV,WAAmB,EAAE6C,WAAmB;IAC5E,MAAMC,gBAAgB;QACpBC,eAAI,CAACC,IAAI,CAAChD,aAAa;WACnBF,QAAQmC,OAAO,CAACC,KAAK,CAACW,gBAAgB,EAAE;KAC7C;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"}
|
|
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<ExpoConfig>['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 Log.warn('@expo/fingerprint is not installed in the project, skipping build cache.');\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,MAAMJ,4BAA4B,OACvCK,UACAC;IAEA,IAAI,CAACD,UAAU;QACb;IACF;IAEA,IAAIA,aAAa,OAAO;QACtB,IAAI;YACF,MAAME,IAAAA,gDAAuB,EAACD,aAAa;gBACzCE,kBAAkB;gBAClBC,gBACE;gBACFC,gBAAgB;gBAChBC,kBAAkB;oBAChB;wBACEC,KAAK;wBACLC,MAAM;wBACNC,KAAK;oBACP;iBACD;YACH;YAEA,6DAA6D;YAC7D,MAAMC,SAAS,MAAMC,uBAAuBV,aAAa;YAEzD,OAAO;gBACLS,QAAQA,OAAOE,OAAO,IAAIF;gBAC1BG,SAAS,CAAC;YACZ;QACF,EAAE,OAAOC,OAAY;YACnB,IAAIA,iBAAiBC,oBAAY,EAAE;gBACjCC,KAAIC,IAAI,CAACH,MAAMI,OA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/D,IAAI;QACF,IAAI5B,SAASX,QAAQ6C;QACrB,IAAIlC,CAAAA,0BAAAA,OAAQE,OAAO,KAAI,MAAM;YAC3BF,SAASA,OAAOE,OAAO;QACzB;QAEA,IACE,OAAOF,WAAW,YACjB,OAAOA,OAAOe,uBAAuB,KAAK,cACzC,OAAOf,OAAOhB,iBAAiB,KAAK,cACrC,OAAOgB,OAAOiB,sBAAsB,KAAK,cACxC,OAAOjB,OAAOb,gBAAgB,KAAK,YACrC;YACA,MAAM,IAAIuB,MAAM,CAAC;6BACM,EAAEkB,gBAAgB;;MAEzC,CAAC;QACH;QACA,OAAO5B;IACT,EAAE,OAAOI,OAAO;QACd,IAAIA,iBAAiB+B,aAAa;QAChC,sEAAsE;QACxE;QACA,MAAM/B;IACR;AACF;AAEA,eAAeH,uBAAuBV,WAAmB,EAAE6C,WAAmB;IAC5E,MAAMC,gBAAgB;QACpBC,eAAI,CAACC,IAAI,CAAChD,aAAa;WACnBF,QAAQmC,OAAO,CAACC,KAAK,CAACW,gBAAgB,EAAE;KAC7C;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"}
|
|
@@ -22,13 +22,6 @@ _export(exports, {
|
|
|
22
22
|
return signManifestString;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
function _graphqlweb() {
|
|
26
|
-
const data = require("@0no-co/graphql.web");
|
|
27
|
-
_graphqlweb = function() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
25
|
function _codesigningcertificates() {
|
|
33
26
|
const data = require("@expo/code-signing-certificates");
|
|
34
27
|
_codesigningcertificates = function() {
|
|
@@ -43,13 +36,6 @@ function _jsonfile() {
|
|
|
43
36
|
};
|
|
44
37
|
return data;
|
|
45
38
|
}
|
|
46
|
-
function _core() {
|
|
47
|
-
const data = require("@urql/core");
|
|
48
|
-
_core = function() {
|
|
49
|
-
return data;
|
|
50
|
-
};
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
39
|
function _fs() {
|
|
54
40
|
const data = require("fs");
|
|
55
41
|
_fs = function() {
|
|
@@ -75,10 +61,10 @@ const _env = require("./env");
|
|
|
75
61
|
const _errors = require("./errors");
|
|
76
62
|
const _getExpoGoIntermediateCertificate = require("../api/getExpoGoIntermediateCertificate");
|
|
77
63
|
const _getProjectDevelopmentCertificate = require("../api/getProjectDevelopmentCertificate");
|
|
64
|
+
const _client = require("../api/graphql/client");
|
|
78
65
|
const _AppQuery = require("../api/graphql/queries/AppQuery");
|
|
79
66
|
const _UserSettings = require("../api/user/UserSettings");
|
|
80
67
|
const _actions = require("../api/user/actions");
|
|
81
|
-
const _generated = require("../graphql/generated");
|
|
82
68
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../log"));
|
|
83
69
|
const _link = require("../utils/link");
|
|
84
70
|
function _interop_require_default(obj) {
|
|
@@ -352,7 +338,7 @@ function actorCanGetProjectDevelopmentCertificate(actor, app) {
|
|
|
352
338
|
var _actor_accounts_find_users_find_permissions, _actor_accounts_find_users_find, _actor_accounts_find_users, _actor_accounts_find;
|
|
353
339
|
const owningAccountId = app.ownerAccount.id;
|
|
354
340
|
const owningAccountIsActorPrimaryAccount = actor.__typename === 'User' || actor.__typename === 'SSOUser' ? actor.primaryAccount.id === owningAccountId : false;
|
|
355
|
-
const userHasPublishPermissionForOwningAccount = !!((_actor_accounts_find = actor.accounts.find((account)=>account.id === owningAccountId)) == null ? void 0 : (_actor_accounts_find_users = _actor_accounts_find.users) == null ? void 0 : (_actor_accounts_find_users_find = _actor_accounts_find_users.find((userPermission)=>userPermission.actor.id === actor.id)) == null ? void 0 : (_actor_accounts_find_users_find_permissions = _actor_accounts_find_users_find.permissions) == null ? void 0 : _actor_accounts_find_users_find_permissions.includes(
|
|
341
|
+
const userHasPublishPermissionForOwningAccount = !!((_actor_accounts_find = actor.accounts.find((account)=>account.id === owningAccountId)) == null ? void 0 : (_actor_accounts_find_users = _actor_accounts_find.users) == null ? void 0 : (_actor_accounts_find_users_find = _actor_accounts_find_users.find((userPermission)=>userPermission.actor.id === actor.id)) == null ? void 0 : (_actor_accounts_find_users_find_permissions = _actor_accounts_find_users_find.permissions) == null ? void 0 : _actor_accounts_find_users_find_permissions.includes('PUBLISH'));
|
|
356
342
|
return owningAccountIsActorPrimaryAccount || userHasPublishPermissionForOwningAccount;
|
|
357
343
|
}
|
|
358
344
|
async function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId) {
|
|
@@ -364,7 +350,7 @@ async function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId) {
|
|
|
364
350
|
try {
|
|
365
351
|
app = await _AppQuery.AppQuery.byIdAsync(easProjectId);
|
|
366
352
|
} catch (e) {
|
|
367
|
-
if (e instanceof
|
|
353
|
+
if (e instanceof _client.UnexpectedServerError || e instanceof _client.UnexpectedServerData) {
|
|
368
354
|
return null;
|
|
369
355
|
}
|
|
370
356
|
throw e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/codesigning.ts"],"sourcesContent":["import { GraphQLError } from '@0no-co/graphql.web';\nimport {\n convertCertificatePEMToCertificate,\n convertKeyPairToPEM,\n convertCSRToCSRPEM,\n generateKeyPair,\n generateCSR,\n convertPrivateKeyPEMToPrivateKey,\n validateSelfSignedCertificate,\n signBufferRSASHA256AndVerify,\n} from '@expo/code-signing-certificates';\nimport { ExpoConfig } from '@expo/config';\nimport JsonFile, { JSONObject } from '@expo/json-file';\nimport { CombinedError } from '@urql/core';\nimport { promises as fs } from 'fs';\nimport { pki as PKI } from 'node-forge';\nimport path from 'path';\nimport { Dictionary, parseDictionary } from 'structured-headers';\n\nimport { env } from './env';\nimport { CommandError } from './errors';\nimport { getExpoGoIntermediateCertificateAsync } from '../api/getExpoGoIntermediateCertificate';\nimport { getProjectDevelopmentCertificateAsync } from '../api/getProjectDevelopmentCertificate';\nimport { AppQuery } from '../api/graphql/queries/AppQuery';\nimport { getExpoHomeDirectory } from '../api/user/UserSettings';\nimport { tryGetUserAsync } from '../api/user/actions';\nimport { Actor } from '../api/user/user';\nimport { AppByIdQuery, Permission } from '../graphql/generated';\nimport * as Log from '../log';\nimport { learnMore } from '../utils/link';\n\nconst debug = require('debug')('expo:codesigning') as typeof console.log;\n\nexport type CodeSigningInfo = {\n keyId: string;\n privateKey: string;\n certificateForPrivateKey: string;\n /**\n * Chain of certificates to serve in the manifest multipart body \"certificate_chain\" part.\n * The leaf certificate must be the 0th element of the array, followed by any intermediate certificates\n * necessary to evaluate the chain of trust ending in the implicitly trusted root certificate embedded in\n * the client.\n *\n * An empty array indicates that there is no need to serve the certificate chain in the multipart response.\n */\n certificateChainForResponse: string[];\n /**\n * Scope key cached for the project when certificate is development Expo Go code signing.\n * For project-specific code signing (keyId == the project's generated keyId) this is undefined.\n */\n scopeKey: string | null;\n};\n\ntype StoredDevelopmentExpoRootCodeSigningInfo = {\n easProjectId: string | null;\n scopeKey: string | null;\n privateKey: string | null;\n certificateChain: string[] | null;\n};\nconst DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME = 'development-code-signing-settings-2.json';\n\nexport function getDevelopmentCodeSigningDirectory(): string {\n return path.join(getExpoHomeDirectory(), 'codesigning');\n}\n\nfunction getProjectDevelopmentCodeSigningInfoFile<T extends JSONObject>(defaults: T) {\n function getFile(easProjectId: string): JsonFile<T> {\n const filePath = path.join(\n getDevelopmentCodeSigningDirectory(),\n easProjectId,\n DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME\n );\n return new JsonFile<T>(filePath);\n }\n\n async function readAsync(easProjectId: string): Promise<T> {\n let projectSettings;\n try {\n projectSettings = await getFile(easProjectId).readAsync();\n } catch {\n projectSettings = await getFile(easProjectId).writeAsync(defaults, { ensureDir: true });\n }\n // Set defaults for any missing fields\n return { ...defaults, ...projectSettings };\n }\n\n async function setAsync(easProjectId: string, json: Partial<T>): Promise<T> {\n try {\n return await getFile(easProjectId).mergeAsync(json, {\n cantReadFileDefault: defaults,\n });\n } catch {\n return await getFile(easProjectId).writeAsync(\n {\n ...defaults,\n ...json,\n },\n { ensureDir: true }\n );\n }\n }\n\n return {\n getFile,\n readAsync,\n setAsync,\n };\n}\n\nexport const DevelopmentCodeSigningInfoFile =\n getProjectDevelopmentCodeSigningInfoFile<StoredDevelopmentExpoRootCodeSigningInfo>({\n easProjectId: null,\n scopeKey: null,\n privateKey: null,\n certificateChain: null,\n });\n\n/**\n * Get info necessary to generate a response `expo-signature` header given a project and incoming request `expo-expect-signature` header.\n * This only knows how to serve two code signing keyids:\n * - `expo-root` indicates that it should use a development certificate in the `expo-root` chain. See {@link getExpoRootDevelopmentCodeSigningInfoAsync}\n * - <developer's expo-updates keyid> indicates that it should sign with the configured certificate. See {@link getProjectCodeSigningCertificateAsync}\n */\nexport async function getCodeSigningInfoAsync(\n exp: ExpoConfig,\n expectSignatureHeader: string | null,\n privateKeyPath: string | undefined\n): Promise<CodeSigningInfo | null> {\n if (!expectSignatureHeader) {\n return null;\n }\n\n let parsedExpectSignature: Dictionary;\n try {\n parsedExpectSignature = parseDictionary(expectSignatureHeader);\n } catch {\n throw new CommandError('Invalid value for expo-expect-signature header');\n }\n\n const expectedKeyIdOuter = parsedExpectSignature.get('keyid');\n if (!expectedKeyIdOuter) {\n throw new CommandError('keyid not present in expo-expect-signature header');\n }\n\n const expectedKeyId = expectedKeyIdOuter[0];\n if (typeof expectedKeyId !== 'string') {\n throw new CommandError(\n `Invalid value for keyid in expo-expect-signature header: ${expectedKeyId}`\n );\n }\n\n let expectedAlg: string | null = null;\n const expectedAlgOuter = parsedExpectSignature.get('alg');\n if (expectedAlgOuter) {\n const expectedAlgTemp = expectedAlgOuter[0];\n if (typeof expectedAlgTemp !== 'string') {\n throw new CommandError('Invalid value for alg in expo-expect-signature header');\n }\n expectedAlg = expectedAlgTemp;\n }\n\n if (expectedKeyId === 'expo-root') {\n return await getExpoRootDevelopmentCodeSigningInfoAsync(exp);\n } else if (expectedKeyId === 'expo-go') {\n throw new CommandError(\n 'Invalid certificate requested: cannot sign with embedded keyid=expo-go key'\n );\n } else {\n return await getProjectCodeSigningCertificateAsync(\n exp,\n privateKeyPath,\n expectedKeyId,\n expectedAlg\n );\n }\n}\n\n/**\n * Get a development code signing certificate for the expo-root -> expo-go -> (development certificate) certificate chain.\n * This requires the user be logged in and online, otherwise try to use the cached development certificate.\n */\nasync function getExpoRootDevelopmentCodeSigningInfoAsync(\n exp: ExpoConfig\n): Promise<CodeSigningInfo | null> {\n const easProjectId = exp.extra?.eas?.projectId;\n // can't check for scope key validity since scope key is derived on the server from projectId and we may be offline.\n // we rely upon the client certificate check to validate the scope key\n if (!easProjectId) {\n debug(\n `WARN: Expo Application Services (EAS) is not configured for your project. Configuring EAS enables a more secure development experience amongst many other benefits. ${learnMore(\n 'https://docs.expo.dev/eas/'\n )}`\n );\n return null;\n }\n\n const developmentCodeSigningInfoFromFile =\n await DevelopmentCodeSigningInfoFile.readAsync(easProjectId);\n const validatedCodeSigningInfo = validateStoredDevelopmentExpoRootCertificateCodeSigningInfo(\n developmentCodeSigningInfoFromFile,\n easProjectId\n );\n\n // 1. If online, ensure logged in, generate key pair and CSR, fetch and cache certificate chain for projectId\n // (overwriting existing dev cert in case projectId changed or it has expired)\n if (!env.EXPO_OFFLINE) {\n try {\n const newCodeSigningInfo =\n await fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId);\n\n if (newCodeSigningInfo) {\n return newCodeSigningInfo;\n // fall back to cached certificate if we couldn't fetch a new one\n } else if (validatedCodeSigningInfo) {\n Log.warn(\n 'Could not fetch new Expo development certificate, falling back to cached certificate'\n );\n return validatedCodeSigningInfo;\n } else {\n return null;\n }\n } catch (e: any) {\n if (validatedCodeSigningInfo) {\n Log.warn(\n 'There was an error fetching the Expo development certificate, falling back to cached certificate'\n );\n return validatedCodeSigningInfo;\n } else {\n // need to return null here and say a message\n throw e;\n }\n }\n }\n\n // 2. check for cached cert/private key matching projectId and scopeKey of project, if found and valid return private key and cert chain including expo-go cert\n if (validatedCodeSigningInfo) {\n return validatedCodeSigningInfo;\n }\n\n // 3. if offline, return null\n Log.warn('Offline and no cached development certificate found, unable to sign manifest');\n return null;\n}\n\n/**\n * Get the certificate configured for expo-updates for this project.\n */\nasync function getProjectCodeSigningCertificateAsync(\n exp: ExpoConfig,\n privateKeyPath: string | undefined,\n expectedKeyId: string,\n expectedAlg: string | null\n): Promise<CodeSigningInfo | null> {\n const codeSigningCertificatePath = exp.updates?.codeSigningCertificate;\n if (!codeSigningCertificatePath) {\n return null;\n }\n\n if (!privateKeyPath) {\n throw new CommandError(\n 'Must specify --private-key-path argument to sign development manifest for requested code signing key'\n );\n }\n\n const codeSigningMetadata = exp.updates?.codeSigningMetadata;\n if (!codeSigningMetadata) {\n throw new CommandError(\n 'Must specify \"codeSigningMetadata\" under the \"updates\" field of your app config file to use EAS code signing'\n );\n }\n\n const { alg, keyid } = codeSigningMetadata;\n if (!alg || !keyid) {\n throw new CommandError(\n 'Must specify \"keyid\" and \"alg\" in the \"codeSigningMetadata\" field under the \"updates\" field of your app config file to use EAS code signing'\n );\n }\n\n if (expectedKeyId !== keyid) {\n throw new CommandError(`keyid mismatch: client=${expectedKeyId}, project=${keyid}`);\n }\n\n if (expectedAlg && expectedAlg !== alg) {\n throw new CommandError(`\"alg\" field mismatch (client=${expectedAlg}, project=${alg})`);\n }\n\n const { privateKeyPEM, certificatePEM } =\n await getProjectPrivateKeyAndCertificateFromFilePathsAsync({\n codeSigningCertificatePath,\n privateKeyPath,\n });\n\n return {\n keyId: keyid,\n privateKey: privateKeyPEM,\n certificateForPrivateKey: certificatePEM,\n certificateChainForResponse: [],\n scopeKey: null,\n };\n}\n\nasync function readFileWithErrorAsync(path: string, errorMessage: string): Promise<string> {\n try {\n return await fs.readFile(path, 'utf8');\n } catch {\n throw new CommandError(errorMessage);\n }\n}\n\nasync function getProjectPrivateKeyAndCertificateFromFilePathsAsync({\n codeSigningCertificatePath,\n privateKeyPath,\n}: {\n codeSigningCertificatePath: string;\n privateKeyPath: string;\n}): Promise<{ privateKeyPEM: string; certificatePEM: string }> {\n const [codeSigningCertificatePEM, privateKeyPEM] = await Promise.all([\n readFileWithErrorAsync(\n codeSigningCertificatePath,\n `Code signing certificate cannot be read from path: ${codeSigningCertificatePath}`\n ),\n readFileWithErrorAsync(\n privateKeyPath,\n `Code signing private key cannot be read from path: ${privateKeyPath}`\n ),\n ]);\n\n const privateKey = convertPrivateKeyPEMToPrivateKey(privateKeyPEM);\n const certificate = convertCertificatePEMToCertificate(codeSigningCertificatePEM);\n validateSelfSignedCertificate(certificate, {\n publicKey: certificate.publicKey as PKI.rsa.PublicKey,\n privateKey,\n });\n\n return { privateKeyPEM, certificatePEM: codeSigningCertificatePEM };\n}\n\n/**\n * Validate that the cached code signing info is still valid for the current project and\n * that it hasn't expired. If invalid, return null.\n */\nfunction validateStoredDevelopmentExpoRootCertificateCodeSigningInfo(\n codeSigningInfo: StoredDevelopmentExpoRootCodeSigningInfo,\n easProjectId: string\n): CodeSigningInfo | null {\n if (codeSigningInfo.easProjectId !== easProjectId) {\n return null;\n }\n\n const {\n privateKey: privateKeyPEM,\n certificateChain: certificatePEMs,\n scopeKey,\n } = codeSigningInfo;\n if (!privateKeyPEM || !certificatePEMs) {\n return null;\n }\n\n const certificateChain = certificatePEMs.map((certificatePEM) =>\n convertCertificatePEMToCertificate(certificatePEM)\n );\n\n // TODO(wschurman): maybe move to @expo/code-signing-certificates\n\n // ensure all intermediate certificates are valid\n for (const certificate of certificateChain) {\n const now = new Date();\n if (certificate.validity.notBefore > now || certificate.validity.notAfter < now) {\n return null;\n }\n }\n\n // TODO(wschurman): maybe do more validation, like validation of projectID and scopeKey within eas certificate extension\n\n return {\n keyId: 'expo-go',\n certificateChainForResponse: certificatePEMs,\n certificateForPrivateKey: certificatePEMs[0],\n privateKey: privateKeyPEM,\n scopeKey,\n };\n}\n\nfunction actorCanGetProjectDevelopmentCertificate(actor: Actor, app: AppByIdQuery['app']['byId']) {\n const owningAccountId = app.ownerAccount.id;\n\n const owningAccountIsActorPrimaryAccount =\n actor.__typename === 'User' || actor.__typename === 'SSOUser'\n ? actor.primaryAccount.id === owningAccountId\n : false;\n const userHasPublishPermissionForOwningAccount = !!actor.accounts\n .find((account) => account.id === owningAccountId)\n ?.users?.find((userPermission) => userPermission.actor.id === actor.id)\n ?.permissions?.includes(Permission.Publish);\n return owningAccountIsActorPrimaryAccount || userHasPublishPermissionForOwningAccount;\n}\n\nasync function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(\n easProjectId: string\n): Promise<CodeSigningInfo | null> {\n const actor = await tryGetUserAsync();\n\n if (!actor) {\n return null;\n }\n\n let app: AppByIdQuery['app']['byId'];\n try {\n app = await AppQuery.byIdAsync(easProjectId);\n } catch (e) {\n if (e instanceof GraphQLError || e instanceof CombinedError) {\n return null;\n }\n throw e;\n }\n if (!actorCanGetProjectDevelopmentCertificate(actor, app)) {\n return null;\n }\n\n const keyPair = generateKeyPair();\n const keyPairPEM = convertKeyPairToPEM(keyPair);\n const csr = generateCSR(keyPair, `Development Certificate for ${easProjectId}`);\n const csrPEM = convertCSRToCSRPEM(csr);\n const [developmentSigningCertificate, expoGoIntermediateCertificate] = await Promise.all([\n getProjectDevelopmentCertificateAsync(easProjectId, csrPEM),\n getExpoGoIntermediateCertificateAsync(easProjectId),\n ]);\n\n await DevelopmentCodeSigningInfoFile.setAsync(easProjectId, {\n easProjectId,\n scopeKey: app.scopeKey,\n privateKey: keyPairPEM.privateKeyPEM,\n certificateChain: [developmentSigningCertificate, expoGoIntermediateCertificate],\n });\n\n return {\n keyId: 'expo-go',\n certificateChainForResponse: [developmentSigningCertificate, expoGoIntermediateCertificate],\n certificateForPrivateKey: developmentSigningCertificate,\n privateKey: keyPairPEM.privateKeyPEM,\n scopeKey: app.scopeKey,\n };\n}\n/**\n * Generate the `expo-signature` header for a manifest and code signing info.\n */\nexport function signManifestString(\n stringifiedManifest: string,\n codeSigningInfo: CodeSigningInfo\n): string {\n const privateKey = convertPrivateKeyPEMToPrivateKey(codeSigningInfo.privateKey);\n const certificate = convertCertificatePEMToCertificate(codeSigningInfo.certificateForPrivateKey);\n return signBufferRSASHA256AndVerify(\n privateKey,\n certificate,\n Buffer.from(stringifiedManifest, 'utf8')\n );\n}\n"],"names":["DevelopmentCodeSigningInfoFile","getCodeSigningInfoAsync","getDevelopmentCodeSigningDirectory","signManifestString","debug","require","DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME","path","join","getExpoHomeDirectory","getProjectDevelopmentCodeSigningInfoFile","defaults","getFile","easProjectId","filePath","JsonFile","readAsync","projectSettings","writeAsync","ensureDir","setAsync","json","mergeAsync","cantReadFileDefault","scopeKey","privateKey","certificateChain","exp","expectSignatureHeader","privateKeyPath","parsedExpectSignature","parseDictionary","CommandError","expectedKeyIdOuter","get","expectedKeyId","expectedAlg","expectedAlgOuter","expectedAlgTemp","getExpoRootDevelopmentCodeSigningInfoAsync","getProjectCodeSigningCertificateAsync","extra","eas","projectId","learnMore","developmentCodeSigningInfoFromFile","validatedCodeSigningInfo","validateStoredDevelopmentExpoRootCertificateCodeSigningInfo","env","EXPO_OFFLINE","newCodeSigningInfo","fetchAndCacheNewDevelopmentCodeSigningInfoAsync","Log","warn","e","codeSigningCertificatePath","updates","codeSigningCertificate","codeSigningMetadata","alg","keyid","privateKeyPEM","certificatePEM","getProjectPrivateKeyAndCertificateFromFilePathsAsync","keyId","certificateForPrivateKey","certificateChainForResponse","readFileWithErrorAsync","errorMessage","fs","readFile","codeSigningCertificatePEM","Promise","all","convertPrivateKeyPEMToPrivateKey","certificate","convertCertificatePEMToCertificate","validateSelfSignedCertificate","publicKey","codeSigningInfo","certificatePEMs","map","now","Date","validity","notBefore","notAfter","actorCanGetProjectDevelopmentCertificate","actor","app","owningAccountId","ownerAccount","id","owningAccountIsActorPrimaryAccount","__typename","primaryAccount","userHasPublishPermissionForOwningAccount","accounts","find","account","users","userPermission","permissions","includes","Permission","Publish","tryGetUserAsync","AppQuery","byIdAsync","GraphQLError","CombinedError","keyPair","generateKeyPair","keyPairPEM","convertKeyPairToPEM","csr","generateCSR","csrPEM","convertCSRToCSRPEM","developmentSigningCertificate","expoGoIntermediateCertificate","getProjectDevelopmentCertificateAsync","getExpoGoIntermediateCertificateAsync","stringifiedManifest","signBufferRSASHA256AndVerify","Buffer","from"],"mappings":";;;;;;;;;;;IA6GaA,8BAA8B;eAA9BA;;IAcSC,uBAAuB;eAAvBA;;IA9DNC,kCAAkC;eAAlCA;;IAiYAC,kBAAkB;eAAlBA;;;;yBA9ba;;;;;;;yBAUtB;;;;;;;gEAE8B;;;;;;;yBACP;;;;;;;yBACC;;;;;;;gEAEd;;;;;;;yBAC2B;;;;;;qBAExB;wBACS;kDACyB;kDACA;0BAC7B;8BACY;yBACL;2BAES;6DACpB;sBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AA4B/B,MAAMC,8CAA8C;AAE7C,SAASJ;IACd,OAAOK,eAAI,CAACC,IAAI,CAACC,IAAAA,kCAAoB,KAAI;AAC3C;AAEA,SAASC,yCAA+DC,QAAW;IACjF,SAASC,QAAQC,YAAoB;QACnC,MAAMC,WAAWP,eAAI,CAACC,IAAI,CACxBN,sCACAW,cACAP;QAEF,OAAO,IAAIS,CAAAA,WAAO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AAQ,CAACP,cAAc;QAC1DA;QACAW,UAAUiE,IAAIjE,QAAQ;QACtBC,YAAYwF,WAAWpD,aAAa;QACpCnC,kBAAkB;YAAC6F;YAA+BC;SAA8B;IAClF;IAEA,OAAO;QACLxD,OAAO;QACPE,6BAA6B;YAACqD;YAA+BC;SAA8B;QAC3FvD,0BAA0BsD;QAC1B9F,YAAYwF,WAAWpD,aAAa;QACpCrC,UAAUiE,IAAIjE,QAAQ;IACxB;AACF;AAIO,SAASrB,mBACdwH,mBAA2B,EAC3B5C,eAAgC;IAEhC,MAAMtD,aAAaiD,IAAAA,2DAAgC,EAACK,gBAAgBtD,UAAU;IAC9E,MAAMkD,cAAcC,IAAAA,6DAAkC,EAACG,gBAAgBd,wBAAwB;IAC/F,OAAO2D,IAAAA,uDAA4B,EACjCnG,YACAkD,aACAkD,OAAOC,IAAI,CAACH,qBAAqB;AAErC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/codesigning.ts"],"sourcesContent":["import {\n convertCertificatePEMToCertificate,\n convertKeyPairToPEM,\n convertCSRToCSRPEM,\n generateKeyPair,\n generateCSR,\n convertPrivateKeyPEMToPrivateKey,\n validateSelfSignedCertificate,\n signBufferRSASHA256AndVerify,\n} from '@expo/code-signing-certificates';\nimport { ExpoConfig } from '@expo/config';\nimport JsonFile, { JSONObject } from '@expo/json-file';\nimport { promises as fs } from 'fs';\nimport { pki as PKI } from 'node-forge';\nimport path from 'path';\nimport { Dictionary, parseDictionary } from 'structured-headers';\n\nimport { env } from './env';\nimport { CommandError } from './errors';\nimport { getExpoGoIntermediateCertificateAsync } from '../api/getExpoGoIntermediateCertificate';\nimport { getProjectDevelopmentCertificateAsync } from '../api/getProjectDevelopmentCertificate';\nimport { UnexpectedServerError, UnexpectedServerData } from '../api/graphql/client';\nimport { AppQuery, type App } from '../api/graphql/queries/AppQuery';\nimport { getExpoHomeDirectory } from '../api/user/UserSettings';\nimport { tryGetUserAsync } from '../api/user/actions';\nimport { Actor } from '../api/user/user';\nimport * as Log from '../log';\nimport { learnMore } from '../utils/link';\n\nconst debug = require('debug')('expo:codesigning') as typeof console.log;\n\nexport type CodeSigningInfo = {\n keyId: string;\n privateKey: string;\n certificateForPrivateKey: string;\n /**\n * Chain of certificates to serve in the manifest multipart body \"certificate_chain\" part.\n * The leaf certificate must be the 0th element of the array, followed by any intermediate certificates\n * necessary to evaluate the chain of trust ending in the implicitly trusted root certificate embedded in\n * the client.\n *\n * An empty array indicates that there is no need to serve the certificate chain in the multipart response.\n */\n certificateChainForResponse: string[];\n /**\n * Scope key cached for the project when certificate is development Expo Go code signing.\n * For project-specific code signing (keyId == the project's generated keyId) this is undefined.\n */\n scopeKey: string | null;\n};\n\ntype StoredDevelopmentExpoRootCodeSigningInfo = {\n easProjectId: string | null;\n scopeKey: string | null;\n privateKey: string | null;\n certificateChain: string[] | null;\n};\nconst DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME = 'development-code-signing-settings-2.json';\n\nexport function getDevelopmentCodeSigningDirectory(): string {\n return path.join(getExpoHomeDirectory(), 'codesigning');\n}\n\nfunction getProjectDevelopmentCodeSigningInfoFile<T extends JSONObject>(defaults: T) {\n function getFile(easProjectId: string): JsonFile<T> {\n const filePath = path.join(\n getDevelopmentCodeSigningDirectory(),\n easProjectId,\n DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME\n );\n return new JsonFile<T>(filePath);\n }\n\n async function readAsync(easProjectId: string): Promise<T> {\n let projectSettings;\n try {\n projectSettings = await getFile(easProjectId).readAsync();\n } catch {\n projectSettings = await getFile(easProjectId).writeAsync(defaults, { ensureDir: true });\n }\n // Set defaults for any missing fields\n return { ...defaults, ...projectSettings };\n }\n\n async function setAsync(easProjectId: string, json: Partial<T>): Promise<T> {\n try {\n return await getFile(easProjectId).mergeAsync(json, {\n cantReadFileDefault: defaults,\n });\n } catch {\n return await getFile(easProjectId).writeAsync(\n {\n ...defaults,\n ...json,\n },\n { ensureDir: true }\n );\n }\n }\n\n return {\n getFile,\n readAsync,\n setAsync,\n };\n}\n\nexport const DevelopmentCodeSigningInfoFile =\n getProjectDevelopmentCodeSigningInfoFile<StoredDevelopmentExpoRootCodeSigningInfo>({\n easProjectId: null,\n scopeKey: null,\n privateKey: null,\n certificateChain: null,\n });\n\n/**\n * Get info necessary to generate a response `expo-signature` header given a project and incoming request `expo-expect-signature` header.\n * This only knows how to serve two code signing keyids:\n * - `expo-root` indicates that it should use a development certificate in the `expo-root` chain. See {@link getExpoRootDevelopmentCodeSigningInfoAsync}\n * - <developer's expo-updates keyid> indicates that it should sign with the configured certificate. See {@link getProjectCodeSigningCertificateAsync}\n */\nexport async function getCodeSigningInfoAsync(\n exp: ExpoConfig,\n expectSignatureHeader: string | null,\n privateKeyPath: string | undefined\n): Promise<CodeSigningInfo | null> {\n if (!expectSignatureHeader) {\n return null;\n }\n\n let parsedExpectSignature: Dictionary;\n try {\n parsedExpectSignature = parseDictionary(expectSignatureHeader);\n } catch {\n throw new CommandError('Invalid value for expo-expect-signature header');\n }\n\n const expectedKeyIdOuter = parsedExpectSignature.get('keyid');\n if (!expectedKeyIdOuter) {\n throw new CommandError('keyid not present in expo-expect-signature header');\n }\n\n const expectedKeyId = expectedKeyIdOuter[0];\n if (typeof expectedKeyId !== 'string') {\n throw new CommandError(\n `Invalid value for keyid in expo-expect-signature header: ${expectedKeyId}`\n );\n }\n\n let expectedAlg: string | null = null;\n const expectedAlgOuter = parsedExpectSignature.get('alg');\n if (expectedAlgOuter) {\n const expectedAlgTemp = expectedAlgOuter[0];\n if (typeof expectedAlgTemp !== 'string') {\n throw new CommandError('Invalid value for alg in expo-expect-signature header');\n }\n expectedAlg = expectedAlgTemp;\n }\n\n if (expectedKeyId === 'expo-root') {\n return await getExpoRootDevelopmentCodeSigningInfoAsync(exp);\n } else if (expectedKeyId === 'expo-go') {\n throw new CommandError(\n 'Invalid certificate requested: cannot sign with embedded keyid=expo-go key'\n );\n } else {\n return await getProjectCodeSigningCertificateAsync(\n exp,\n privateKeyPath,\n expectedKeyId,\n expectedAlg\n );\n }\n}\n\n/**\n * Get a development code signing certificate for the expo-root -> expo-go -> (development certificate) certificate chain.\n * This requires the user be logged in and online, otherwise try to use the cached development certificate.\n */\nasync function getExpoRootDevelopmentCodeSigningInfoAsync(\n exp: ExpoConfig\n): Promise<CodeSigningInfo | null> {\n const easProjectId = exp.extra?.eas?.projectId;\n // can't check for scope key validity since scope key is derived on the server from projectId and we may be offline.\n // we rely upon the client certificate check to validate the scope key\n if (!easProjectId) {\n debug(\n `WARN: Expo Application Services (EAS) is not configured for your project. Configuring EAS enables a more secure development experience amongst many other benefits. ${learnMore(\n 'https://docs.expo.dev/eas/'\n )}`\n );\n return null;\n }\n\n const developmentCodeSigningInfoFromFile =\n await DevelopmentCodeSigningInfoFile.readAsync(easProjectId);\n const validatedCodeSigningInfo = validateStoredDevelopmentExpoRootCertificateCodeSigningInfo(\n developmentCodeSigningInfoFromFile,\n easProjectId\n );\n\n // 1. If online, ensure logged in, generate key pair and CSR, fetch and cache certificate chain for projectId\n // (overwriting existing dev cert in case projectId changed or it has expired)\n if (!env.EXPO_OFFLINE) {\n try {\n const newCodeSigningInfo =\n await fetchAndCacheNewDevelopmentCodeSigningInfoAsync(easProjectId);\n\n if (newCodeSigningInfo) {\n return newCodeSigningInfo;\n // fall back to cached certificate if we couldn't fetch a new one\n } else if (validatedCodeSigningInfo) {\n Log.warn(\n 'Could not fetch new Expo development certificate, falling back to cached certificate'\n );\n return validatedCodeSigningInfo;\n } else {\n return null;\n }\n } catch (e: any) {\n if (validatedCodeSigningInfo) {\n Log.warn(\n 'There was an error fetching the Expo development certificate, falling back to cached certificate'\n );\n return validatedCodeSigningInfo;\n } else {\n // need to return null here and say a message\n throw e;\n }\n }\n }\n\n // 2. check for cached cert/private key matching projectId and scopeKey of project, if found and valid return private key and cert chain including expo-go cert\n if (validatedCodeSigningInfo) {\n return validatedCodeSigningInfo;\n }\n\n // 3. if offline, return null\n Log.warn('Offline and no cached development certificate found, unable to sign manifest');\n return null;\n}\n\n/**\n * Get the certificate configured for expo-updates for this project.\n */\nasync function getProjectCodeSigningCertificateAsync(\n exp: ExpoConfig,\n privateKeyPath: string | undefined,\n expectedKeyId: string,\n expectedAlg: string | null\n): Promise<CodeSigningInfo | null> {\n const codeSigningCertificatePath = exp.updates?.codeSigningCertificate;\n if (!codeSigningCertificatePath) {\n return null;\n }\n\n if (!privateKeyPath) {\n throw new CommandError(\n 'Must specify --private-key-path argument to sign development manifest for requested code signing key'\n );\n }\n\n const codeSigningMetadata = exp.updates?.codeSigningMetadata;\n if (!codeSigningMetadata) {\n throw new CommandError(\n 'Must specify \"codeSigningMetadata\" under the \"updates\" field of your app config file to use EAS code signing'\n );\n }\n\n const { alg, keyid } = codeSigningMetadata;\n if (!alg || !keyid) {\n throw new CommandError(\n 'Must specify \"keyid\" and \"alg\" in the \"codeSigningMetadata\" field under the \"updates\" field of your app config file to use EAS code signing'\n );\n }\n\n if (expectedKeyId !== keyid) {\n throw new CommandError(`keyid mismatch: client=${expectedKeyId}, project=${keyid}`);\n }\n\n if (expectedAlg && expectedAlg !== alg) {\n throw new CommandError(`\"alg\" field mismatch (client=${expectedAlg}, project=${alg})`);\n }\n\n const { privateKeyPEM, certificatePEM } =\n await getProjectPrivateKeyAndCertificateFromFilePathsAsync({\n codeSigningCertificatePath,\n privateKeyPath,\n });\n\n return {\n keyId: keyid,\n privateKey: privateKeyPEM,\n certificateForPrivateKey: certificatePEM,\n certificateChainForResponse: [],\n scopeKey: null,\n };\n}\n\nasync function readFileWithErrorAsync(path: string, errorMessage: string): Promise<string> {\n try {\n return await fs.readFile(path, 'utf8');\n } catch {\n throw new CommandError(errorMessage);\n }\n}\n\nasync function getProjectPrivateKeyAndCertificateFromFilePathsAsync({\n codeSigningCertificatePath,\n privateKeyPath,\n}: {\n codeSigningCertificatePath: string;\n privateKeyPath: string;\n}): Promise<{ privateKeyPEM: string; certificatePEM: string }> {\n const [codeSigningCertificatePEM, privateKeyPEM] = await Promise.all([\n readFileWithErrorAsync(\n codeSigningCertificatePath,\n `Code signing certificate cannot be read from path: ${codeSigningCertificatePath}`\n ),\n readFileWithErrorAsync(\n privateKeyPath,\n `Code signing private key cannot be read from path: ${privateKeyPath}`\n ),\n ]);\n\n const privateKey = convertPrivateKeyPEMToPrivateKey(privateKeyPEM);\n const certificate = convertCertificatePEMToCertificate(codeSigningCertificatePEM);\n validateSelfSignedCertificate(certificate, {\n publicKey: certificate.publicKey as PKI.rsa.PublicKey,\n privateKey,\n });\n\n return { privateKeyPEM, certificatePEM: codeSigningCertificatePEM };\n}\n\n/**\n * Validate that the cached code signing info is still valid for the current project and\n * that it hasn't expired. If invalid, return null.\n */\nfunction validateStoredDevelopmentExpoRootCertificateCodeSigningInfo(\n codeSigningInfo: StoredDevelopmentExpoRootCodeSigningInfo,\n easProjectId: string\n): CodeSigningInfo | null {\n if (codeSigningInfo.easProjectId !== easProjectId) {\n return null;\n }\n\n const {\n privateKey: privateKeyPEM,\n certificateChain: certificatePEMs,\n scopeKey,\n } = codeSigningInfo;\n if (!privateKeyPEM || !certificatePEMs) {\n return null;\n }\n\n const certificateChain = certificatePEMs.map((certificatePEM) =>\n convertCertificatePEMToCertificate(certificatePEM)\n );\n\n // TODO(wschurman): maybe move to @expo/code-signing-certificates\n\n // ensure all intermediate certificates are valid\n for (const certificate of certificateChain) {\n const now = new Date();\n if (certificate.validity.notBefore > now || certificate.validity.notAfter < now) {\n return null;\n }\n }\n\n // TODO(wschurman): maybe do more validation, like validation of projectID and scopeKey within eas certificate extension\n\n return {\n keyId: 'expo-go',\n certificateChainForResponse: certificatePEMs,\n certificateForPrivateKey: certificatePEMs[0],\n privateKey: privateKeyPEM,\n scopeKey,\n };\n}\n\nfunction actorCanGetProjectDevelopmentCertificate(actor: Actor, app: App) {\n const owningAccountId = app.ownerAccount.id;\n\n const owningAccountIsActorPrimaryAccount =\n actor.__typename === 'User' || actor.__typename === 'SSOUser'\n ? actor.primaryAccount.id === owningAccountId\n : false;\n const userHasPublishPermissionForOwningAccount = !!actor.accounts\n .find((account) => account.id === owningAccountId)\n ?.users?.find((userPermission) => userPermission.actor.id === actor.id)\n ?.permissions?.includes('PUBLISH');\n return owningAccountIsActorPrimaryAccount || userHasPublishPermissionForOwningAccount;\n}\n\nasync function fetchAndCacheNewDevelopmentCodeSigningInfoAsync(\n easProjectId: string\n): Promise<CodeSigningInfo | null> {\n const actor = await tryGetUserAsync();\n\n if (!actor) {\n return null;\n }\n\n let app: App;\n try {\n app = await AppQuery.byIdAsync(easProjectId);\n } catch (e) {\n if (e instanceof UnexpectedServerError || e instanceof UnexpectedServerData) {\n return null;\n }\n throw e;\n }\n if (!actorCanGetProjectDevelopmentCertificate(actor, app)) {\n return null;\n }\n\n const keyPair = generateKeyPair();\n const keyPairPEM = convertKeyPairToPEM(keyPair);\n const csr = generateCSR(keyPair, `Development Certificate for ${easProjectId}`);\n const csrPEM = convertCSRToCSRPEM(csr);\n const [developmentSigningCertificate, expoGoIntermediateCertificate] = await Promise.all([\n getProjectDevelopmentCertificateAsync(easProjectId, csrPEM),\n getExpoGoIntermediateCertificateAsync(easProjectId),\n ]);\n\n await DevelopmentCodeSigningInfoFile.setAsync(easProjectId, {\n easProjectId,\n scopeKey: app.scopeKey,\n privateKey: keyPairPEM.privateKeyPEM,\n certificateChain: [developmentSigningCertificate, expoGoIntermediateCertificate],\n });\n\n return {\n keyId: 'expo-go',\n certificateChainForResponse: [developmentSigningCertificate, expoGoIntermediateCertificate],\n certificateForPrivateKey: developmentSigningCertificate,\n privateKey: keyPairPEM.privateKeyPEM,\n scopeKey: app.scopeKey,\n };\n}\n/**\n * Generate the `expo-signature` header for a manifest and code signing info.\n */\nexport function signManifestString(\n stringifiedManifest: string,\n codeSigningInfo: CodeSigningInfo\n): string {\n const privateKey = convertPrivateKeyPEMToPrivateKey(codeSigningInfo.privateKey);\n const certificate = convertCertificatePEMToCertificate(codeSigningInfo.certificateForPrivateKey);\n return signBufferRSASHA256AndVerify(\n privateKey,\n certificate,\n Buffer.from(stringifiedManifest, 'utf8')\n );\n}\n"],"names":["DevelopmentCodeSigningInfoFile","getCodeSigningInfoAsync","getDevelopmentCodeSigningDirectory","signManifestString","debug","require","DEVELOPMENT_CODE_SIGNING_SETTINGS_FILE_NAME","path","join","getExpoHomeDirectory","getProjectDevelopmentCodeSigningInfoFile","defaults","getFile","easProjectId","filePath","JsonFile","readAsync","projectSettings","writeAsync","ensureDir","setAsync","json","mergeAsync","cantReadFileDefault","scopeKey","privateKey","certificateChain","exp","expectSignatureHeader","privateKeyPath","parsedExpectSignature","parseDictionary","CommandError","expectedKeyIdOuter","get","expectedKeyId","expectedAlg","expectedAlgOuter","expectedAlgTemp","getExpoRootDevelopmentCodeSigningInfoAsync","getProjectCodeSigningCertificateAsync","extra","eas","projectId","learnMore","developmentCodeSigningInfoFromFile","validatedCodeSigningInfo","validateStoredDevelopmentExpoRootCertificateCodeSigningInfo","env","EXPO_OFFLINE","newCodeSigningInfo","fetchAndCacheNewDevelopmentCodeSigningInfoAsync","Log","warn","e","codeSigningCertificatePath","updates","codeSigningCertificate","codeSigningMetadata","alg","keyid","privateKeyPEM","certificatePEM","getProjectPrivateKeyAndCertificateFromFilePathsAsync","keyId","certificateForPrivateKey","certificateChainForResponse","readFileWithErrorAsync","errorMessage","fs","readFile","codeSigningCertificatePEM","Promise","all","convertPrivateKeyPEMToPrivateKey","certificate","convertCertificatePEMToCertificate","validateSelfSignedCertificate","publicKey","codeSigningInfo","certificatePEMs","map","now","Date","validity","notBefore","notAfter","actorCanGetProjectDevelopmentCertificate","actor","app","owningAccountId","ownerAccount","id","owningAccountIsActorPrimaryAccount","__typename","primaryAccount","userHasPublishPermissionForOwningAccount","accounts","find","account","users","userPermission","permissions","includes","tryGetUserAsync","AppQuery","byIdAsync","UnexpectedServerError","UnexpectedServerData","keyPair","generateKeyPair","keyPairPEM","convertKeyPairToPEM","csr","generateCSR","csrPEM","convertCSRToCSRPEM","developmentSigningCertificate","expoGoIntermediateCertificate","getProjectDevelopmentCertificateAsync","getExpoGoIntermediateCertificateAsync","stringifiedManifest","signBufferRSASHA256AndVerify","Buffer","from"],"mappings":";;;;;;;;;;;IA2GaA,8BAA8B;eAA9BA;;IAcSC,uBAAuB;eAAvBA;;IA9DNC,kCAAkC;eAAlCA;;IAiYAC,kBAAkB;eAAlBA;;;;yBAnbT;;;;;;;gEAE8B;;;;;;;yBACN;;;;;;;gEAEd;;;;;;;yBAC2B;;;;;;qBAExB;wBACS;kDACyB;kDACA;wBACM;0BACzB;8BACE;yBACL;6DAEX;sBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AA4B/B,MAAMC,8CAA8C;AAE7C,SAASJ;IACd,OAAOK,eAAI,CAACC,IAAI,CAACC,IAAAA,kCAAoB,KAAI;AAC3C;AAEA,SAASC,yCAA+DC,QAAW;IACjF,SAASC,QAAQC,YAAoB;QACnC,MAAMC,WAAWP,eAAI,CAACC,IAAI,CACxBN,sCACAW,cACAP;QAEF,OAAO,IAAIS,CAAAA,WAAO,SAAC,CAAID;IACzB;IAEA,eAAeE,UAAUH,YAAoB;QAC3C,IAAII;QACJ,IAAI;YACFA,kBAAkB,MAAML,QAAQC,cAAcG,SAAS;QACzD,EAAE,OAAM;YACNC,kBAAkB,MAAML,QAAQC,cAAcK,UAAU,CAACP,UAAU;gBAAEQ,WAAW;YAAK;QACvF;QACA,sCAAsC;QACtC,OAAO;YAAE,GAAGR,QAAQ;YAAE,GAAGM,eAAe;QAAC;IAC3C;IAEA,eAAeG,SAASP,YAAoB,EAAEQ,IAAgB;QAC5D,IAAI;YACF,OAAO,MAAMT,QAAQC,cAAcS,UAAU,CAACD,MAAM;gBAClDE,qBAAqBZ;YACvB;QACF,EAAE,OAAM;YACN,OAAO,MAAMC,QAAQC,cAAcK,UAAU,CAC3C;gBACE,GAAGP,QAAQ;gBACX,GAAGU,IAAI;YACT,GACA;gBAAEF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
|
@@ -2,34 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
createEntryResolver: function() {
|
|
13
|
-
return createEntryResolver;
|
|
14
|
-
},
|
|
15
|
-
createGlobFilter: function() {
|
|
5
|
+
Object.defineProperty(exports, "createGlobFilter", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
16
8
|
return createGlobFilter;
|
|
17
9
|
}
|
|
18
10
|
});
|
|
19
|
-
function _configplugins() {
|
|
20
|
-
const data = require("@expo/config-plugins");
|
|
21
|
-
_configplugins = function() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
function _path() {
|
|
27
|
-
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
28
|
-
_path = function() {
|
|
29
|
-
return data;
|
|
30
|
-
};
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
11
|
function _picomatch() {
|
|
34
12
|
const data = /*#__PURE__*/ _interop_require_default(require("picomatch"));
|
|
35
13
|
_picomatch = function() {
|
|
@@ -43,19 +21,6 @@ function _interop_require_default(obj) {
|
|
|
43
21
|
};
|
|
44
22
|
}
|
|
45
23
|
const debug = require('debug')('expo:file-transform');
|
|
46
|
-
function createEntryResolver(name) {
|
|
47
|
-
return (entry)=>{
|
|
48
|
-
if (name) {
|
|
49
|
-
// Rewrite paths for bare workflow
|
|
50
|
-
entry.path = entry.path.replace(/HelloWorld/g, entry.path.includes('android') ? _configplugins().IOSConfig.XcodeUtils.sanitizedName(name.toLowerCase()) : _configplugins().IOSConfig.XcodeUtils.sanitizedName(name)).replace(/helloworld/g, _configplugins().IOSConfig.XcodeUtils.sanitizedName(name).toLowerCase());
|
|
51
|
-
}
|
|
52
|
-
if (entry.type && /^file$/i.test(entry.type) && _path().default.basename(entry.path) === 'gitignore') {
|
|
53
|
-
// Rename `gitignore` because npm ignores files named `.gitignore` when publishing.
|
|
54
|
-
// See: https://github.com/npm/npm/issues/1862
|
|
55
|
-
entry.path = entry.path.replace(/gitignore$/, '.gitignore');
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
24
|
function createGlobFilter(globPattern, options) {
|
|
60
25
|
const matcher = (0, _picomatch().default)(globPattern, options);
|
|
61
26
|
debug('filter: created for pattern(s) "%s" (%s)', Array.isArray(globPattern) ? globPattern.join('", "') : globPattern, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/createFileTransform.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/createFileTransform.ts"],"sourcesContent":["import picomatch from 'picomatch';\n\nconst debug = require('debug')('expo:file-transform') as typeof console.log;\n\nexport function createGlobFilter(\n globPattern: picomatch.Glob,\n options?: picomatch.PicomatchOptions\n) {\n const matcher = picomatch(globPattern, options);\n\n debug(\n 'filter: created for pattern(s) \"%s\" (%s)',\n Array.isArray(globPattern) ? globPattern.join('\", \"') : globPattern,\n options\n );\n\n return (path: string) => {\n const included = matcher(path);\n debug('filter: %s - %s', included ? 'include' : 'exclude', path);\n return included;\n };\n}\n"],"names":["createGlobFilter","debug","require","globPattern","options","matcher","picomatch","Array","isArray","join","path","included"],"mappings":";;;;+BAIgBA;;;eAAAA;;;;gEAJM;;;;;;;;;;;AAEtB,MAAMC,QAAQC,QAAQ,SAAS;AAExB,SAASF,iBACdG,WAA2B,EAC3BC,OAAoC;IAEpC,MAAMC,UAAUC,IAAAA,oBAAS,EAACH,aAAaC;IAEvCH,MACE,4CACAM,MAAMC,OAAO,CAACL,eAAeA,YAAYM,IAAI,CAAC,UAAUN,aACxDC;IAGF,OAAO,CAACM;QACN,MAAMC,WAAWN,QAAQK;QACzBT,MAAM,mBAAmBU,WAAW,YAAY,WAAWD;QAC3D,OAAOC;IACT;AACF"}
|
|
@@ -29,13 +29,6 @@ function _stream() {
|
|
|
29
29
|
};
|
|
30
30
|
return data;
|
|
31
31
|
}
|
|
32
|
-
function _undici() {
|
|
33
|
-
const data = require("undici");
|
|
34
|
-
_undici = function() {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
32
|
function _util() {
|
|
40
33
|
const data = require("util");
|
|
41
34
|
_util = function() {
|
|
@@ -54,7 +47,6 @@ function _interop_require_default(obj) {
|
|
|
54
47
|
};
|
|
55
48
|
}
|
|
56
49
|
const debug = require('debug')('expo:utils:downloadAppAsync');
|
|
57
|
-
const TIMER_DURATION = 30000;
|
|
58
50
|
const pipeline = (0, _util().promisify)(_stream().Stream.pipeline);
|
|
59
51
|
async function downloadAsync({ url, outputPath, cacheDirectory, onProgress }) {
|
|
60
52
|
let fetchInstance = _client.fetchAsync;
|
|
@@ -69,10 +61,7 @@ async function downloadAsync({ url, outputPath, cacheDirectory, onProgress }) {
|
|
|
69
61
|
}
|
|
70
62
|
debug(`Downloading ${url} to ${outputPath}`);
|
|
71
63
|
const res = await fetchInstance(url, {
|
|
72
|
-
onProgress
|
|
73
|
-
dispatcher: new (_undici()).Agent({
|
|
74
|
-
connectTimeout: TIMER_DURATION
|
|
75
|
-
})
|
|
64
|
+
onProgress
|
|
76
65
|
});
|
|
77
66
|
if (!res.ok || !res.body) {
|
|
78
67
|
throw new _errors.CommandError('FILE_DOWNLOAD', `Unexpected response: ${res.statusText}. From url: ${url}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/downloadAppAsync.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { Readable, Stream } from 'stream';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/downloadAppAsync.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport { Readable, Stream } from 'stream';\nimport type { ReadableStream } from 'stream/web';\nimport { promisify } from 'util';\n\nimport { createTempFilePath } from './createTempPath';\nimport { ensureDirectoryAsync } from './dir';\nimport { CommandError } from './errors';\nimport { extractAsync } from './tar';\nimport { createCachedFetch, fetchAsync } from '../api/rest/client';\nimport { FetchLike, ProgressCallback } from '../api/rest/client.types';\n\nconst debug = require('debug')('expo:utils:downloadAppAsync') as typeof console.log;\n\nconst pipeline = promisify(Stream.pipeline);\n\nasync function downloadAsync({\n url,\n outputPath,\n cacheDirectory,\n onProgress,\n}: {\n url: string;\n outputPath: string;\n cacheDirectory?: string;\n onProgress?: ProgressCallback;\n}) {\n let fetchInstance: FetchLike = fetchAsync;\n if (cacheDirectory) {\n // Reconstruct the cached fetch since caching could be disabled.\n fetchInstance = createCachedFetch({\n // We'll use a 1 week cache for versions so older values get flushed out eventually.\n ttl: 1000 * 60 * 60 * 24 * 7,\n // Users can also nuke their `~/.expo` directory to clear the cache.\n cacheDirectory,\n });\n }\n\n debug(`Downloading ${url} to ${outputPath}`);\n const res = await fetchInstance(url, {\n onProgress,\n });\n if (!res.ok || !res.body) {\n throw new CommandError(\n 'FILE_DOWNLOAD',\n `Unexpected response: ${res.statusText}. From url: ${url}`\n );\n }\n return pipeline(Readable.fromWeb(res.body as ReadableStream), fs.createWriteStream(outputPath));\n}\n\nexport async function downloadAppAsync({\n url,\n outputPath,\n extract = false,\n cacheDirectory,\n onProgress,\n}: {\n url: string;\n outputPath: string;\n extract?: boolean;\n cacheDirectory?: string;\n onProgress?: ProgressCallback;\n}): Promise<void> {\n if (extract) {\n // For iOS we download the ipa to a file then pass that file into the extractor.\n // In the future we should just pipe the `res.body -> tar.extract` directly.\n // I tried this and it created some weird errors where observing the data stream\n // would corrupt the file causing tar to fail with `TAR_BAD_ARCHIVE`.\n const tmpPath = createTempFilePath(path.basename(outputPath));\n await downloadAsync({ url, outputPath: tmpPath, cacheDirectory, onProgress });\n debug(`Extracting ${tmpPath} to ${outputPath}`);\n await ensureDirectoryAsync(outputPath);\n await extractAsync(tmpPath, outputPath);\n } else {\n await ensureDirectoryAsync(path.dirname(outputPath));\n await downloadAsync({ url, outputPath, cacheDirectory, onProgress });\n }\n}\n"],"names":["downloadAppAsync","debug","require","pipeline","promisify","Stream","downloadAsync","url","outputPath","cacheDirectory","onProgress","fetchInstance","fetchAsync","createCachedFetch","ttl","res","ok","body","CommandError","statusText","Readable","fromWeb","fs","createWriteStream","extract","tmpPath","createTempFilePath","path","basename","ensureDirectoryAsync","extractAsync","dirname"],"mappings":";;;;+BAoDsBA;;;eAAAA;;;;gEApDP;;;;;;;gEACE;;;;;;;yBACgB;;;;;;;yBAEP;;;;;;gCAES;qBACE;wBACR;qBACA;wBACiB;;;;;;AAG9C,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,WAAWC,IAAAA,iBAAS,EAACC,gBAAM,CAACF,QAAQ;AAE1C,eAAeG,cAAc,EAC3BC,GAAG,EACHC,UAAU,EACVC,cAAc,EACdC,UAAU,EAMX;IACC,IAAIC,gBAA2BC,kBAAU;IACzC,IAAIH,gBAAgB;QAClB,gEAAgE;QAChEE,gBAAgBE,IAAAA,yBAAiB,EAAC;YAChC,oFAAoF;YACpFC,KAAK,OAAO,KAAK,KAAK,KAAK;YAC3B,oEAAoE;YACpEL;QACF;IACF;IAEAR,MAAM,CAAC,YAAY,EAAEM,IAAI,IAAI,EAAEC,YAAY;IAC3C,MAAMO,MAAM,MAAMJ,cAAcJ,KAAK;QACnCG;IACF;IACA,IAAI,CAACK,IAAIC,EAAE,IAAI,CAACD,IAAIE,IAAI,EAAE;QACxB,MAAM,IAAIC,oBAAY,CACpB,iBACA,CAAC,qBAAqB,EAAEH,IAAII,UAAU,CAAC,YAAY,EAAEZ,KAAK;IAE9D;IACA,OAAOJ,SAASiB,kBAAQ,CAACC,OAAO,CAACN,IAAIE,IAAI,GAAqBK,aAAE,CAACC,iBAAiB,CAACf;AACrF;AAEO,eAAeR,iBAAiB,EACrCO,GAAG,EACHC,UAAU,EACVgB,UAAU,KAAK,EACff,cAAc,EACdC,UAAU,EAOX;IACC,IAAIc,SAAS;QACX,gFAAgF;QAChF,4EAA4E;QAC5E,gFAAgF;QAChF,qEAAqE;QACrE,MAAMC,UAAUC,IAAAA,kCAAkB,EAACC,eAAI,CAACC,QAAQ,CAACpB;QACjD,MAAMF,cAAc;YAAEC;YAAKC,YAAYiB;YAAShB;YAAgBC;QAAW;QAC3ET,MAAM,CAAC,WAAW,EAAEwB,QAAQ,IAAI,EAAEjB,YAAY;QAC9C,MAAMqB,IAAAA,yBAAoB,EAACrB;QAC3B,MAAMsB,IAAAA,iBAAY,EAACL,SAASjB;IAC9B,OAAO;QACL,MAAMqB,IAAAA,yBAAoB,EAACF,eAAI,CAACI,OAAO,CAACvB;QACxC,MAAMF,cAAc;YAAEC;YAAKC;YAAYC;YAAgBC;QAAW;IACpE;AACF"}
|
package/build/src/utils/fetch.js
CHANGED
|
@@ -10,13 +10,32 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
Headers: function() {
|
|
13
|
-
return Headers;
|
|
13
|
+
return _fetchnodeshim().Headers;
|
|
14
|
+
},
|
|
15
|
+
Response: function() {
|
|
16
|
+
return _fetchnodeshim().Response;
|
|
14
17
|
},
|
|
15
18
|
fetch: function() {
|
|
16
|
-
return fetch;
|
|
19
|
+
return _fetchnodeshim().fetch;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
|
-
|
|
20
|
-
const
|
|
22
|
+
function _fetchnodeshim() {
|
|
23
|
+
const data = require("fetch-nodeshim");
|
|
24
|
+
_fetchnodeshim = function() {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
// NOTE(@kitten): Protect against accidental use of globals that don't match `fetch-nodeshim`
|
|
30
|
+
Object.assign(globalThis, {
|
|
31
|
+
fetch: _fetchnodeshim().fetch,
|
|
32
|
+
Blob: _fetchnodeshim().Blob,
|
|
33
|
+
URL: _fetchnodeshim().URL,
|
|
34
|
+
URLSearchParams: _fetchnodeshim().URLSearchParams,
|
|
35
|
+
Request: _fetchnodeshim().Request,
|
|
36
|
+
Response: _fetchnodeshim().Response,
|
|
37
|
+
Headers: _fetchnodeshim().Headers,
|
|
38
|
+
FormData: _fetchnodeshim().FormData
|
|
39
|
+
});
|
|
21
40
|
|
|
22
41
|
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/fetch.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/fetch.ts"],"sourcesContent":["import {\n fetch,\n Blob,\n URL,\n URLSearchParams,\n Request,\n Response,\n Headers,\n FormData,\n} from 'fetch-nodeshim';\n\n// NOTE(@kitten): Protect against accidental use of globals that don't match `fetch-nodeshim`\nObject.assign(globalThis, {\n fetch,\n Blob,\n URL,\n URLSearchParams,\n Request,\n Response,\n Headers,\n FormData,\n});\n\nexport { fetch, Headers, Response };\n"],"names":["Headers","Response","fetch","Object","assign","globalThis","Blob","URL","URLSearchParams","Request","FormData"],"mappings":";;;;;;;;;;;IAuBgBA,OAAO;eAAPA,wBAAO;;IAAEC,QAAQ;eAARA,yBAAQ;;IAAxBC,KAAK;eAALA,sBAAK;;;;yBAdP;;;;;;AAEP,6FAA6F;AAC7FC,OAAOC,MAAM,CAACC,YAAY;IACxBH,OAAAA,sBAAK;IACLI,MAAAA,qBAAI;IACJC,KAAAA,oBAAG;IACHC,iBAAAA,gCAAe;IACfC,SAAAA,wBAAO;IACPR,UAAAA,yBAAQ;IACRD,SAAAA,wBAAO;IACPU,UAAAA,yBAAQ;AACV"}
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
freePortAsync: function() {
|
|
13
|
+
return freePortAsync;
|
|
14
|
+
},
|
|
15
|
+
testPortAsync: function() {
|
|
8
16
|
return testPortAsync;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
@@ -45,10 +53,18 @@ async function testPortAsync(port, hostnames) {
|
|
|
45
53
|
}
|
|
46
54
|
for (const host of hostnames){
|
|
47
55
|
if (!await testHostPortAsync(port, host)) {
|
|
48
|
-
return
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
async function freePortAsync(portStart, hostnames) {
|
|
62
|
+
for(let port = portStart; port <= 65535; port++){
|
|
63
|
+
if (await testPortAsync(port, hostnames)) {
|
|
64
|
+
return port;
|
|
49
65
|
}
|
|
50
66
|
}
|
|
51
|
-
return
|
|
67
|
+
return null;
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
//# sourceMappingURL=freeport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/freeport.ts"],"sourcesContent":["import net from 'node:net';\n\nasync function testHostPortAsync(port: number, host: string | null): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer();\n server.listen({ port, host }, () => {\n server.once('close', () => {\n setTimeout(() => resolve(true), 0);\n });\n server.close();\n });\n server.once('error', (_error) => {\n setTimeout(() => resolve(false), 0);\n });\n });\n}\n\nexport async function testPortAsync(
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/freeport.ts"],"sourcesContent":["import net from 'node:net';\n\nasync function testHostPortAsync(port: number, host: string | null): Promise<boolean> {\n return new Promise((resolve) => {\n const server = net.createServer();\n server.listen({ port, host }, () => {\n server.once('close', () => {\n setTimeout(() => resolve(true), 0);\n });\n server.close();\n });\n server.once('error', (_error) => {\n setTimeout(() => resolve(false), 0);\n });\n });\n}\n\nexport async function testPortAsync(port: number, hostnames?: (string | null)[]): Promise<boolean> {\n if (!hostnames?.length) {\n hostnames = [null];\n }\n for (const host of hostnames) {\n if (!(await testHostPortAsync(port, host))) {\n return false;\n }\n }\n return true;\n}\n\nexport async function freePortAsync(\n portStart: number,\n hostnames?: (string | null)[]\n): Promise<number | null> {\n for (let port = portStart; port <= 65_535; port++) {\n if (await testPortAsync(port, hostnames)) {\n return port;\n }\n }\n return null;\n}\n"],"names":["freePortAsync","testPortAsync","testHostPortAsync","port","host","Promise","resolve","server","net","createServer","listen","once","setTimeout","close","_error","hostnames","length","portStart"],"mappings":";;;;;;;;;;;IA6BsBA,aAAa;eAAbA;;IAZAC,aAAa;eAAbA;;;;gEAjBN;;;;;;;;;;;AAEhB,eAAeC,kBAAkBC,IAAY,EAAEC,IAAmB;IAChE,OAAO,IAAIC,QAAQ,CAACC;QAClB,MAAMC,SAASC,kBAAG,CAACC,YAAY;QAC/BF,OAAOG,MAAM,CAAC;YAAEP;YAAMC;QAAK,GAAG;YAC5BG,OAAOI,IAAI,CAAC,SAAS;gBACnBC,WAAW,IAAMN,QAAQ,OAAO;YAClC;YACAC,OAAOM,KAAK;QACd;QACAN,OAAOI,IAAI,CAAC,SAAS,CAACG;YACpBF,WAAW,IAAMN,QAAQ,QAAQ;QACnC;IACF;AACF;AAEO,eAAeL,cAAcE,IAAY,EAAEY,SAA6B;IAC7E,IAAI,EAACA,6BAAAA,UAAWC,MAAM,GAAE;QACtBD,YAAY;YAAC;SAAK;IACpB;IACA,KAAK,MAAMX,QAAQW,UAAW;QAC5B,IAAI,CAAE,MAAMb,kBAAkBC,MAAMC,OAAQ;YAC1C,OAAO;QACT;IACF;IACA,OAAO;AACT;AAEO,eAAeJ,cACpBiB,SAAiB,EACjBF,SAA6B;IAE7B,IAAK,IAAIZ,OAAOc,WAAWd,QAAQ,OAAQA,OAAQ;QACjD,IAAI,MAAMF,cAAcE,MAAMY,YAAY;YACxC,OAAOZ;QACT;IACF;IACA,OAAO;AACT"}
|
|
@@ -16,13 +16,6 @@ _export(exports, {
|
|
|
16
16
|
return getOrPromptForPackageAsync;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
function _graphqlweb() {
|
|
20
|
-
const data = require("@0no-co/graphql.web");
|
|
21
|
-
_graphqlweb = function() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
19
|
function _config() {
|
|
27
20
|
const data = require("@expo/config");
|
|
28
21
|
_config = function() {
|
|
@@ -30,13 +23,6 @@ function _config() {
|
|
|
30
23
|
};
|
|
31
24
|
return data;
|
|
32
25
|
}
|
|
33
|
-
function _core() {
|
|
34
|
-
const data = require("@urql/core");
|
|
35
|
-
_core = function() {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
26
|
function _chalk() {
|
|
41
27
|
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
42
28
|
_chalk = function() {
|
|
@@ -49,6 +35,7 @@ const _link = require("./link");
|
|
|
49
35
|
const _modifyConfigAsync = require("./modifyConfigAsync");
|
|
50
36
|
const _prompts = /*#__PURE__*/ _interop_require_wildcard(require("./prompts"));
|
|
51
37
|
const _validateApplicationId = require("./validateApplicationId");
|
|
38
|
+
const _client = require("../api/graphql/client");
|
|
52
39
|
const _AppQuery = require("../api/graphql/queries/AppQuery");
|
|
53
40
|
const _UserSettings = require("../api/user/UserSettings");
|
|
54
41
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../log"));
|
|
@@ -115,7 +102,7 @@ async function getRecommendedReverseDomainNameSecondPartAsync(exp) {
|
|
|
115
102
|
const app = await _AppQuery.AppQuery.byIdAsync(easProjectId);
|
|
116
103
|
return app.ownerAccount.name;
|
|
117
104
|
} catch (e) {
|
|
118
|
-
if (e instanceof
|
|
105
|
+
if (e instanceof _client.UnexpectedServerData || e instanceof _client.UnexpectedServerError) {
|
|
119
106
|
return null;
|
|
120
107
|
}
|
|
121
108
|
throw e;
|