@expo/cli 56.1.2 → 56.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/events/index.js +1 -1
- package/build/src/run/android/resolveGradlePropsAsync.js +3 -4
- package/build/src/run/android/resolveGradlePropsAsync.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +14 -14
package/build/bin/cli
CHANGED
|
@@ -64,10 +64,10 @@ async function resolveGradlePropsAsync(projectRoot, options, device) {
|
|
|
64
64
|
buildType,
|
|
65
65
|
flavors: parts.map((v)=>v.toLowerCase()),
|
|
66
66
|
apkVariantDirectory,
|
|
67
|
-
architectures: await
|
|
67
|
+
architectures: await getConnectedDeviceABI(buildType, device, options.allArch)
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
async function
|
|
70
|
+
async function getConnectedDeviceABI(buildType, device, allArch) {
|
|
71
71
|
// Follow the same behavior as iOS, only enable this for debug builds
|
|
72
72
|
// Support both 'debug' and 'debugOptimized' build types
|
|
73
73
|
const isDebugBuild = buildType === 'debug' || buildType === 'debugOptimized';
|
|
@@ -75,8 +75,7 @@ async function getConnectedDeviceABIS(buildType, device, allArch) {
|
|
|
75
75
|
return '';
|
|
76
76
|
}
|
|
77
77
|
const abis = await (0, _adb.getDeviceABIsAsync)(device);
|
|
78
|
-
|
|
79
|
-
return validAbis.filter((abi, i, arr)=>arr.indexOf(abi) === i).join(',');
|
|
78
|
+
return abis.find((abi)=>VALID_ARCHITECTURES.includes(abi)) ?? '';
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
//# sourceMappingURL=resolveGradlePropsAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/android/resolveGradlePropsAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport type { Device } from '../../start/platforms/android/adb';\nimport { getDeviceABIsAsync } from '../../start/platforms/android/adb';\nimport { CommandError } from '../../utils/errors';\n\n// Supported ABIs for Android. see https://developer.android.com/ndk/guides/abis\nconst VALID_ARCHITECTURES = ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'];\n\nexport type GradleProps = {\n /** Directory for the APK based on the `variant`. */\n apkVariantDirectory: string;\n /** Name of the app, used in the `apkVariantDirectory`. */\n appName: string;\n /** Last section of the provided `variant`, indicates the starting directory of the file name for the output APK. E.g. \"debug\" or \"release\" */\n buildType: string;\n /** Used to assemble the APK, also included in the output APK filename. */\n flavors?: string[];\n /** Architectures to build for. */\n architectures?: string;\n};\n\nfunction assertVariant(variant?: string) {\n if (variant && typeof variant !== 'string') {\n throw new CommandError('BAD_ARGS', '--variant must be a string');\n }\n return variant ?? 'debug';\n}\n\nexport async function resolveGradlePropsAsync(\n projectRoot: string,\n options: { variant?: string; allArch?: boolean },\n device: Device\n): Promise<GradleProps> {\n const variant = assertVariant(options.variant);\n // NOTE(EvanBacon): Why would this be different? Can we get the different name?\n const appName = 'app';\n\n const apkDirectory = path.join(projectRoot, 'android', appName, 'build', 'outputs', 'apk');\n\n // buildDeveloperTrust -> buildtype: trust, flavors: buildDeveloper\n // developmentDebug -> buildType: debug, flavors: development\n // productionRelease -> buildType: release, flavors: production\n // previewDebugOptimized -> buildType: debugOptimized, flavors: preview\n const parts = variant.split(/(?=[A-Z])/);\n\n // Special case: merge 'Optimized' suffix with preceding part, e.g. into 'debugOptimized'\n let buildType = parts.pop() ?? 'debug';\n if (parts.length > 0 && buildType === 'Optimized') {\n buildType = parts.pop()!.toLowerCase() + buildType;\n } else {\n buildType = buildType.toLowerCase();\n }\n\n let apkVariantDirectory: string;\n if (parts.length > 0) {\n const flavorPath = parts[0]!.toLowerCase() + parts.slice(1).join('');\n apkVariantDirectory = path.join(apkDirectory, flavorPath, buildType);\n } else {\n apkVariantDirectory = path.join(apkDirectory, buildType);\n }\n\n return {\n appName,\n buildType,\n flavors: parts.map((v) => v.toLowerCase()),\n apkVariantDirectory,\n architectures: await
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/android/resolveGradlePropsAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport type { Device } from '../../start/platforms/android/adb';\nimport { getDeviceABIsAsync } from '../../start/platforms/android/adb';\nimport { CommandError } from '../../utils/errors';\n\n// Supported ABIs for Android. see https://developer.android.com/ndk/guides/abis\nconst VALID_ARCHITECTURES = ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'];\n\nexport type GradleProps = {\n /** Directory for the APK based on the `variant`. */\n apkVariantDirectory: string;\n /** Name of the app, used in the `apkVariantDirectory`. */\n appName: string;\n /** Last section of the provided `variant`, indicates the starting directory of the file name for the output APK. E.g. \"debug\" or \"release\" */\n buildType: string;\n /** Used to assemble the APK, also included in the output APK filename. */\n flavors?: string[];\n /** Architectures to build for. */\n architectures?: string;\n};\n\nfunction assertVariant(variant?: string) {\n if (variant && typeof variant !== 'string') {\n throw new CommandError('BAD_ARGS', '--variant must be a string');\n }\n return variant ?? 'debug';\n}\n\nexport async function resolveGradlePropsAsync(\n projectRoot: string,\n options: { variant?: string; allArch?: boolean },\n device: Device\n): Promise<GradleProps> {\n const variant = assertVariant(options.variant);\n // NOTE(EvanBacon): Why would this be different? Can we get the different name?\n const appName = 'app';\n\n const apkDirectory = path.join(projectRoot, 'android', appName, 'build', 'outputs', 'apk');\n\n // buildDeveloperTrust -> buildtype: trust, flavors: buildDeveloper\n // developmentDebug -> buildType: debug, flavors: development\n // productionRelease -> buildType: release, flavors: production\n // previewDebugOptimized -> buildType: debugOptimized, flavors: preview\n const parts = variant.split(/(?=[A-Z])/);\n\n // Special case: merge 'Optimized' suffix with preceding part, e.g. into 'debugOptimized'\n let buildType = parts.pop() ?? 'debug';\n if (parts.length > 0 && buildType === 'Optimized') {\n buildType = parts.pop()!.toLowerCase() + buildType;\n } else {\n buildType = buildType.toLowerCase();\n }\n\n let apkVariantDirectory: string;\n if (parts.length > 0) {\n const flavorPath = parts[0]!.toLowerCase() + parts.slice(1).join('');\n apkVariantDirectory = path.join(apkDirectory, flavorPath, buildType);\n } else {\n apkVariantDirectory = path.join(apkDirectory, buildType);\n }\n\n return {\n appName,\n buildType,\n flavors: parts.map((v) => v.toLowerCase()),\n apkVariantDirectory,\n architectures: await getConnectedDeviceABI(buildType, device, options.allArch),\n };\n}\n\nasync function getConnectedDeviceABI(\n buildType: string,\n device: Device,\n allArch?: boolean\n): Promise<string> {\n // Follow the same behavior as iOS, only enable this for debug builds\n // Support both 'debug' and 'debugOptimized' build types\n const isDebugBuild = buildType === 'debug' || buildType === 'debugOptimized';\n if (allArch || !isDebugBuild) {\n return '';\n }\n\n const abis = await getDeviceABIsAsync(device);\n\n return abis.find((abi) => VALID_ARCHITECTURES.includes(abi)) ?? '';\n}\n"],"names":["resolveGradlePropsAsync","VALID_ARCHITECTURES","assertVariant","variant","CommandError","projectRoot","options","device","appName","apkDirectory","path","join","parts","split","buildType","pop","length","toLowerCase","apkVariantDirectory","flavorPath","slice","flavors","map","v","architectures","getConnectedDeviceABI","allArch","isDebugBuild","abis","getDeviceABIsAsync","find","abi","includes"],"mappings":";;;;+BA6BsBA;;;eAAAA;;;;gEA7BL;;;;;;qBAGkB;wBACN;;;;;;AAE7B,gFAAgF;AAChF,MAAMC,sBAAsB;IAAC;IAAe;IAAa;IAAO;CAAS;AAezE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,WAAW,OAAOA,YAAY,UAAU;QAC1C,MAAM,IAAIC,oBAAY,CAAC,YAAY;IACrC;IACA,OAAOD,WAAW;AACpB;AAEO,eAAeH,wBACpBK,WAAmB,EACnBC,OAAgD,EAChDC,MAAc;IAEd,MAAMJ,UAAUD,cAAcI,QAAQH,OAAO;IAC7C,+EAA+E;IAC/E,MAAMK,UAAU;IAEhB,MAAMC,eAAeC,eAAI,CAACC,IAAI,CAACN,aAAa,WAAWG,SAAS,SAAS,WAAW;IAEpF,mEAAmE;IACnE,6DAA6D;IAC7D,+DAA+D;IAC/D,uEAAuE;IACvE,MAAMI,QAAQT,QAAQU,KAAK,CAAC;IAE5B,yFAAyF;IACzF,IAAIC,YAAYF,MAAMG,GAAG,MAAM;IAC/B,IAAIH,MAAMI,MAAM,GAAG,KAAKF,cAAc,aAAa;QACjDA,YAAYF,MAAMG,GAAG,GAAIE,WAAW,KAAKH;IAC3C,OAAO;QACLA,YAAYA,UAAUG,WAAW;IACnC;IAEA,IAAIC;IACJ,IAAIN,MAAMI,MAAM,GAAG,GAAG;QACpB,MAAMG,aAAaP,KAAK,CAAC,EAAE,CAAEK,WAAW,KAAKL,MAAMQ,KAAK,CAAC,GAAGT,IAAI,CAAC;QACjEO,sBAAsBR,eAAI,CAACC,IAAI,CAACF,cAAcU,YAAYL;IAC5D,OAAO;QACLI,sBAAsBR,eAAI,CAACC,IAAI,CAACF,cAAcK;IAChD;IAEA,OAAO;QACLN;QACAM;QACAO,SAAST,MAAMU,GAAG,CAAC,CAACC,IAAMA,EAAEN,WAAW;QACvCC;QACAM,eAAe,MAAMC,sBAAsBX,WAAWP,QAAQD,QAAQoB,OAAO;IAC/E;AACF;AAEA,eAAeD,sBACbX,SAAiB,EACjBP,MAAc,EACdmB,OAAiB;IAEjB,qEAAqE;IACrE,wDAAwD;IACxD,MAAMC,eAAeb,cAAc,WAAWA,cAAc;IAC5D,IAAIY,WAAW,CAACC,cAAc;QAC5B,OAAO;IACT;IAEA,MAAMC,OAAO,MAAMC,IAAAA,uBAAkB,EAACtB;IAEtC,OAAOqB,KAAKE,IAAI,CAAC,CAACC,MAAQ9B,oBAAoB+B,QAAQ,CAACD,SAAS;AAClE"}
|
|
@@ -55,9 +55,9 @@ const _ExpoMiddleware = require("./ExpoMiddleware");
|
|
|
55
55
|
const _metroOptions = require("./metroOptions");
|
|
56
56
|
const _resolveAssets = require("./resolveAssets");
|
|
57
57
|
const _resolvePlatform = require("./resolvePlatform");
|
|
58
|
+
const _user = require("../../../api/user/user");
|
|
58
59
|
const _exportHermes = require("../../../export/exportHermes");
|
|
59
60
|
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../../../log"));
|
|
60
|
-
const _user = require("../../../api/user/user");
|
|
61
61
|
const _env = require("../../../utils/env");
|
|
62
62
|
const _devices = /*#__PURE__*/ _interop_require_wildcard(require("../../project/devices"));
|
|
63
63
|
const _router = require("../metro/router");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/middleware/ManifestMiddleware.ts"],"sourcesContent":["import type { ExpoConfig, ExpoGoConfig, PackageJSONConfig, ProjectConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport { resolveRelativeEntryPoint } from '@expo/config/paths';\nimport { Readable } from 'node:stream';\nimport { pipeline } from 'node:stream/promises';\nimport { resolve } from 'url';\n\nimport { ExpoMiddleware } from './ExpoMiddleware';\nimport {\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n createBundleUrlPathFromExpoConfig,\n} from './metroOptions';\nimport { resolveGoogleServicesFile, resolveManifestAssets } from './resolveAssets';\nimport type { RuntimePlatform } from './resolvePlatform';\nimport { parsePlatformHeader } from './resolvePlatform';\nimport type { ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { isEnableHermesManaged } from '../../../export/exportHermes';\nimport * as Log from '../../../log';\nimport { getActorDisplayName, getUserAsync } from '../../../api/user/user';\nimport { env } from '../../../utils/env';\nimport * as ProjectDevices from '../../project/devices';\nimport type { UrlCreator } from '../UrlCreator';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\nimport type { PlatformBundlers } from '../platformBundlers';\nimport { getPlatformBundlers } from '../platformBundlers';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../webTemplate';\n\nconst debug = require('debug')('expo:start:server:middleware:manifest') as typeof console.log;\n\n/** Info about the computer hosting the dev server. */\nexport interface HostInfo {\n host: string;\n server: 'expo';\n serverVersion: string;\n serverDriver: string | null;\n serverOS: NodeJS.Platform;\n serverOSVersion: string;\n}\n\n/** Parsed values from the supported request headers. */\nexport interface ManifestRequestInfo {\n /** Platform to serve. */\n platform: RuntimePlatform;\n /** Requested host name. */\n hostname?: string | null;\n /** The protocol used to request the manifest */\n protocol?: 'http' | 'https';\n}\n\n/** Project related info. */\nexport type ResponseProjectSettings = {\n expoGoConfig: ExpoGoConfig;\n hostUri: string;\n bundleUrl: string;\n exp: ExpoConfig;\n};\n\nexport const DEVELOPER_TOOL = 'expo-cli';\n\nexport type ManifestMiddlewareOptions = {\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n constructUrl: UrlCreator['constructUrl'];\n isNativeWebpack?: boolean;\n privateKeyPath?: string;\n};\n\n/** Base middleware creator for serving the Expo manifest (like the index.html but for native runtimes). */\nexport abstract class ManifestMiddleware<\n TManifestRequestInfo extends ManifestRequestInfo,\n> extends ExpoMiddleware {\n private initialProjectConfig: ProjectConfig;\n private platformBundlers: PlatformBundlers;\n\n constructor(\n protected projectRoot: string,\n protected options: ManifestMiddlewareOptions\n ) {\n super(\n projectRoot,\n /**\n * Only support `/`, `/manifest`, `/index.exp` for the manifest middleware.\n */\n ['/', '/manifest', '/index.exp']\n );\n this.initialProjectConfig = getConfig(projectRoot);\n this.platformBundlers = getPlatformBundlers(projectRoot, this.initialProjectConfig.exp);\n }\n\n /** Exposed for testing. */\n public async _resolveProjectSettingsAsync({\n platform,\n hostname,\n protocol,\n }: Pick<\n TManifestRequestInfo,\n 'hostname' | 'platform' | 'protocol'\n >): Promise<ResponseProjectSettings> {\n // Read the config\n const projectConfig = getConfig(this.projectRoot);\n\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: projectConfig.pkg,\n platform,\n });\n\n const isHermesEnabled = isEnableHermesManaged(projectConfig.exp, platform);\n\n // Resolve the signed-in CLI user to pass through the manifest\n const user = await getUserAsync();\n const username = getActorDisplayName(user);\n\n // Create the manifest and set fields within it\n const expoGoConfig = this.getExpoGoConfig({\n mainModuleName,\n hostname,\n username: username !== 'anonymous' ? username : undefined,\n });\n\n const hostUri = this.options.constructUrl({ scheme: '', hostname });\n\n const bundleUrl = this._getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine: isHermesEnabled ? 'hermes' : undefined,\n baseUrl: getBaseUrlFromExpoConfig(projectConfig.exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(\n projectConfig.exp,\n this.options.mode ?? 'development',\n platform\n ),\n routerRoot: getRouterDirectoryModuleIdWithManifest(this.projectRoot, projectConfig.exp),\n protocol,\n reactCompiler: !!projectConfig.exp.experiments?.reactCompiler,\n });\n\n // Resolve all assets and set them on the manifest as URLs\n await this.mutateManifestWithAssetsAsync(projectConfig.exp, bundleUrl);\n\n return {\n expoGoConfig,\n hostUri,\n bundleUrl,\n exp: projectConfig.exp,\n };\n }\n\n /** Get the main entry module ID (file) relative to the project root. */\n private resolveMainModuleName(props: { pkg: PackageJSONConfig; platform: string }): string {\n // NOTE(Bacon): Webpack is currently hardcoded to index.bundle on native\n // in the future (TODO) we should move this logic into a Webpack plugin and use\n // a generated file name like we do on web.\n // const server = getDefaultDevServer();\n // // TODO: Move this into BundlerDevServer and read this info from self.\n // const isNativeWebpack = server instanceof WebpackBundlerDevServer && server.isTargetingNative();\n if (this.options.isNativeWebpack) {\n return 'index';\n }\n\n const entry = resolveRelativeEntryPoint(this.projectRoot, props);\n debug(`Resolved entry point: ${entry} (project root: ${this.projectRoot})`);\n return entry;\n }\n\n /** Parse request headers into options. */\n public abstract getParsedHeaders(req: ServerRequest): TManifestRequestInfo;\n\n /** Store device IDs that were sent in the request headers. */\n private async saveDevicesAsync(req: ServerRequest) {\n const deviceIds = req.headers?.['expo-dev-client-id'];\n if (deviceIds) {\n await ProjectDevices.saveDevicesAsync(this.projectRoot, deviceIds).catch((e) =>\n Log.exception(e)\n );\n }\n }\n\n /** Create the bundle URL (points to the single JS entry file). Exposed for testing. */\n public _getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine,\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n protocol,\n reactCompiler,\n }: {\n platform: string;\n hostname?: string | null;\n mainModuleName: string;\n engine?: 'hermes';\n baseUrl?: string;\n asyncRoutes: boolean;\n isExporting?: boolean;\n routerRoot: string;\n protocol?: 'http' | 'https';\n reactCompiler: boolean;\n }): string {\n const path = createBundleUrlPath({\n mode: this.options.mode ?? 'development',\n minify: this.options.minify,\n platform,\n mainModuleName,\n lazy: !env.EXPO_NO_METRO_LAZY,\n engine,\n bytecode: engine === 'hermes',\n baseUrl,\n isExporting: !!isExporting,\n asyncRoutes,\n routerRoot,\n reactCompiler,\n });\n\n return (\n this.options.constructUrl({\n scheme: protocol ?? 'http',\n // hostType: this.options.location.hostType,\n hostname,\n }) + path\n );\n }\n\n /** Get the manifest response to return to the runtime. This file contains info regarding where the assets can be loaded from. Exposed for testing. */\n public abstract _getManifestResponseAsync(options: TManifestRequestInfo): Promise<Response>;\n\n private getExpoGoConfig({\n mainModuleName,\n hostname,\n username,\n }: {\n mainModuleName: string;\n hostname?: string | null;\n username?: string;\n }): ExpoGoConfig {\n return {\n // localhost:8081\n debuggerHost: this.options.constructUrl({ scheme: '', hostname }),\n // Required for Expo Go to function.\n developer: {\n tool: DEVELOPER_TOOL,\n projectRoot: this.projectRoot,\n },\n packagerOpts: {\n // Required for dev client.\n dev: this.options.mode !== 'production',\n },\n // Indicates the name of the main bundle.\n mainModuleName,\n // The signed-in CLI username, used by Expo Go to verify account match.\n ...(username ? { username } : undefined),\n };\n }\n\n /** Resolve all assets and set them on the manifest as URLs */\n private async mutateManifestWithAssetsAsync(manifest: ExpoConfig, bundleUrl: string) {\n await resolveManifestAssets(this.projectRoot, {\n manifest,\n resolver: async (path) => {\n if (this.options.isNativeWebpack) {\n // When using our custom dev server, just do assets normally\n // without the `assets/` subpath redirect.\n return resolve(bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0], path);\n }\n return bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0] + 'assets/' + path;\n },\n });\n // The server normally inserts this but if we're offline we'll do it here\n await resolveGoogleServicesFile(this.projectRoot, manifest);\n }\n\n public getWebBundleUrl() {\n const platform = 'web';\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: this.initialProjectConfig.pkg,\n platform,\n });\n\n return createBundleUrlPathFromExpoConfig(this.projectRoot, this.initialProjectConfig.exp, {\n platform,\n mainModuleName,\n minify: this.options.minify,\n lazy: !env.EXPO_NO_METRO_LAZY,\n mode: this.options.mode ?? 'development',\n // Hermes doesn't support more modern JS features than most, if not all, modern browser.\n engine: 'hermes',\n isExporting: false,\n bytecode: false,\n });\n }\n\n /**\n * Web platforms should create an index.html response using the same script resolution as native.\n *\n * Instead of adding a `bundleUrl` to a `manifest.json` (native) we'll add a `<script src=\"\">`\n * to an `index.html`, this enables the web platform to load JavaScript from the server.\n */\n private async handleWebRequestAsync(req: ServerRequest, res: ServerResponse) {\n res.setHeader('Content-Type', 'text/html');\n\n res.end(await this.getSingleHtmlTemplateAsync());\n }\n\n getSingleHtmlTemplateAsync() {\n // Read from headers\n const bundleUrl = this.getWebBundleUrl();\n\n return createTemplateHtmlFromExpoConfigAsync(this.projectRoot, {\n exp: this.initialProjectConfig.exp,\n scripts: [bundleUrl],\n });\n }\n\n /** Exposed for testing. */\n async checkBrowserRequestAsync(req: ServerRequest, res: ServerResponse, next: ServerNext) {\n if (\n this.platformBundlers.web === 'metro' &&\n this.initialProjectConfig.exp.platforms?.includes('web')\n ) {\n // NOTE(EvanBacon): This effectively disables the safety check we do on custom runtimes to ensure\n // the `expo-platform` header is included. When `web.bundler=web`, if the user has non-standard Expo\n // code loading then they'll get a web bundle without a clear assertion of platform support.\n const platform = parsePlatformHeader(req);\n // On web, serve the public folder\n if (!platform || platform === 'web') {\n if (['static', 'server'].includes(this.initialProjectConfig.exp.web?.output ?? '')) {\n // Skip the spa-styled index.html when static generation is enabled.\n next();\n return true;\n } else {\n await this.handleWebRequestAsync(req, res);\n return true;\n }\n }\n }\n return false;\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n // First check for standard JavaScript runtimes (aka legacy browsers like Chrome).\n if (await this.checkBrowserRequestAsync(req, res, next)) {\n return;\n }\n\n // Save device IDs for dev client.\n await this.saveDevicesAsync(req);\n\n // Read from headers\n const options = this.getParsedHeaders(req);\n\n const response = await this._getManifestResponseAsync(options);\n // Convert `Response` to node:http response\n if (typeof res.setHeaders === 'function') {\n res.setHeaders(response.headers);\n } else {\n for (const [key, value] of response.headers.entries()) {\n res.appendHeader(key, value);\n }\n }\n if (response.body) {\n await pipeline(Readable.fromWeb(response.body as any), res);\n } else {\n res.end();\n }\n }\n}\n"],"names":["DEVELOPER_TOOL","ManifestMiddleware","debug","require","ExpoMiddleware","projectRoot","options","initialProjectConfig","getConfig","platformBundlers","getPlatformBundlers","exp","_resolveProjectSettingsAsync","platform","hostname","protocol","projectConfig","mainModuleName","resolveMainModuleName","pkg","isHermesEnabled","isEnableHermesManaged","user","getUserAsync","username","getActorDisplayName","expoGoConfig","getExpoGoConfig","undefined","hostUri","constructUrl","scheme","bundleUrl","_getBundleUrl","engine","baseUrl","getBaseUrlFromExpoConfig","asyncRoutes","getAsyncRoutesFromExpoConfig","mode","routerRoot","getRouterDirectoryModuleIdWithManifest","reactCompiler","experiments","mutateManifestWithAssetsAsync","props","isNativeWebpack","entry","resolveRelativeEntryPoint","saveDevicesAsync","req","deviceIds","headers","ProjectDevices","catch","e","Log","exception","isExporting","path","createBundleUrlPath","minify","lazy","env","EXPO_NO_METRO_LAZY","bytecode","debuggerHost","developer","tool","packagerOpts","dev","manifest","resolveManifestAssets","resolver","resolve","match","resolveGoogleServicesFile","getWebBundleUrl","createBundleUrlPathFromExpoConfig","handleWebRequestAsync","res","setHeader","end","getSingleHtmlTemplateAsync","createTemplateHtmlFromExpoConfigAsync","scripts","checkBrowserRequestAsync","next","web","platforms","includes","parsePlatformHeader","output","handleRequestAsync","getParsedHeaders","response","_getManifestResponseAsync","setHeaders","key","value","entries","appendHeader","body","pipeline","Readable","fromWeb"],"mappings":";;;;;;;;;;;QA2DaA;eAAAA;;QAaSC;eAAAA;;;;yBAvEI;;;;;;;yBACgB;;;;;;;yBACjB;;;;;;;yBACA;;;;;;;yBACD;;;;;;gCAEO;8BAMxB;+BAC0D;iCAE7B;8BAEE;6DACjB;sBAC6B;qBAC9B;iEACY;wBAEuB;kCAEnB;6BACkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,MAAMC,QAAQC,QAAQ,SAAS;AA8BxB,MAAMH,iBAAiB;AAavB,MAAeC,2BAEZG,8BAAc;IAItB,YACE,AAAUC,WAAmB,EAC7B,AAAUC,OAAkC,CAC5C;QACA,KAAK,CACHD,aACA;;OAEC,GACD;YAAC;YAAK;YAAa;SAAa,QARxBA,cAAAA,kBACAC,UAAAA;QASV,IAAI,CAACC,oBAAoB,GAAGC,IAAAA,mBAAS,EAACH;QACtC,IAAI,CAACI,gBAAgB,GAAGC,IAAAA,qCAAmB,EAACL,aAAa,IAAI,CAACE,oBAAoB,CAACI,GAAG;IACxF;IAEA,yBAAyB,GACzB,MAAaC,6BAA6B,EACxCC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EAIT,EAAoC;YAsChBC;QArCnB,kBAAkB;QAClB,MAAMA,gBAAgBR,IAAAA,mBAAS,EAAC,IAAI,CAACH,WAAW;QAEhD,oBAAoB;QACpB,MAAMY,iBAAiB,IAAI,CAACC,qBAAqB,CAAC;YAChDC,KAAKH,cAAcG,GAAG;YACtBN;QACF;QAEA,MAAMO,kBAAkBC,IAAAA,mCAAqB,EAACL,cAAcL,GAAG,EAAEE;QAEjE,8DAA8D;QAC9D,MAAMS,OAAO,MAAMC,IAAAA,kBAAY;QAC/B,MA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I,OAAO0E,IAAIiB,UAAU,KAAK,YAAY;YACxCjB,IAAIiB,UAAU,CAACF,SAAS3C,OAAO;QACjC,OAAO;YACL,KAAK,MAAM,CAAC8C,KAAKC,MAAM,IAAIJ,SAAS3C,OAAO,CAACgD,OAAO,GAAI;gBACrDpB,IAAIqB,YAAY,CAACH,KAAKC;YACxB;QACF;QACA,IAAIJ,SAASO,IAAI,EAAE;YACjB,MAAMC,IAAAA,oBAAQ,EAACC,sBAAQ,CAACC,OAAO,CAACV,SAASO,IAAI,GAAUtB;QACzD,OAAO;YACLA,IAAIE,GAAG;QACT;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/ManifestMiddleware.ts"],"sourcesContent":["import type { ExpoConfig, ExpoGoConfig, PackageJSONConfig, ProjectConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport { resolveRelativeEntryPoint } from '@expo/config/paths';\nimport { Readable } from 'node:stream';\nimport { pipeline } from 'node:stream/promises';\nimport { resolve } from 'url';\n\nimport { ExpoMiddleware } from './ExpoMiddleware';\nimport {\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n createBundleUrlPathFromExpoConfig,\n} from './metroOptions';\nimport { resolveGoogleServicesFile, resolveManifestAssets } from './resolveAssets';\nimport type { RuntimePlatform } from './resolvePlatform';\nimport { parsePlatformHeader } from './resolvePlatform';\nimport type { ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { getActorDisplayName, getUserAsync } from '../../../api/user/user';\nimport { isEnableHermesManaged } from '../../../export/exportHermes';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport * as ProjectDevices from '../../project/devices';\nimport type { UrlCreator } from '../UrlCreator';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\nimport type { PlatformBundlers } from '../platformBundlers';\nimport { getPlatformBundlers } from '../platformBundlers';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../webTemplate';\n\nconst debug = require('debug')('expo:start:server:middleware:manifest') as typeof console.log;\n\n/** Info about the computer hosting the dev server. */\nexport interface HostInfo {\n host: string;\n server: 'expo';\n serverVersion: string;\n serverDriver: string | null;\n serverOS: NodeJS.Platform;\n serverOSVersion: string;\n}\n\n/** Parsed values from the supported request headers. */\nexport interface ManifestRequestInfo {\n /** Platform to serve. */\n platform: RuntimePlatform;\n /** Requested host name. */\n hostname?: string | null;\n /** The protocol used to request the manifest */\n protocol?: 'http' | 'https';\n}\n\n/** Project related info. */\nexport type ResponseProjectSettings = {\n expoGoConfig: ExpoGoConfig;\n hostUri: string;\n bundleUrl: string;\n exp: ExpoConfig;\n};\n\nexport const DEVELOPER_TOOL = 'expo-cli';\n\nexport type ManifestMiddlewareOptions = {\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n constructUrl: UrlCreator['constructUrl'];\n isNativeWebpack?: boolean;\n privateKeyPath?: string;\n};\n\n/** Base middleware creator for serving the Expo manifest (like the index.html but for native runtimes). */\nexport abstract class ManifestMiddleware<\n TManifestRequestInfo extends ManifestRequestInfo,\n> extends ExpoMiddleware {\n private initialProjectConfig: ProjectConfig;\n private platformBundlers: PlatformBundlers;\n\n constructor(\n protected projectRoot: string,\n protected options: ManifestMiddlewareOptions\n ) {\n super(\n projectRoot,\n /**\n * Only support `/`, `/manifest`, `/index.exp` for the manifest middleware.\n */\n ['/', '/manifest', '/index.exp']\n );\n this.initialProjectConfig = getConfig(projectRoot);\n this.platformBundlers = getPlatformBundlers(projectRoot, this.initialProjectConfig.exp);\n }\n\n /** Exposed for testing. */\n public async _resolveProjectSettingsAsync({\n platform,\n hostname,\n protocol,\n }: Pick<\n TManifestRequestInfo,\n 'hostname' | 'platform' | 'protocol'\n >): Promise<ResponseProjectSettings> {\n // Read the config\n const projectConfig = getConfig(this.projectRoot);\n\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: projectConfig.pkg,\n platform,\n });\n\n const isHermesEnabled = isEnableHermesManaged(projectConfig.exp, platform);\n\n // Resolve the signed-in CLI user to pass through the manifest\n const user = await getUserAsync();\n const username = getActorDisplayName(user);\n\n // Create the manifest and set fields within it\n const expoGoConfig = this.getExpoGoConfig({\n mainModuleName,\n hostname,\n username: username !== 'anonymous' ? username : undefined,\n });\n\n const hostUri = this.options.constructUrl({ scheme: '', hostname });\n\n const bundleUrl = this._getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine: isHermesEnabled ? 'hermes' : undefined,\n baseUrl: getBaseUrlFromExpoConfig(projectConfig.exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(\n projectConfig.exp,\n this.options.mode ?? 'development',\n platform\n ),\n routerRoot: getRouterDirectoryModuleIdWithManifest(this.projectRoot, projectConfig.exp),\n protocol,\n reactCompiler: !!projectConfig.exp.experiments?.reactCompiler,\n });\n\n // Resolve all assets and set them on the manifest as URLs\n await this.mutateManifestWithAssetsAsync(projectConfig.exp, bundleUrl);\n\n return {\n expoGoConfig,\n hostUri,\n bundleUrl,\n exp: projectConfig.exp,\n };\n }\n\n /** Get the main entry module ID (file) relative to the project root. */\n private resolveMainModuleName(props: { pkg: PackageJSONConfig; platform: string }): string {\n // NOTE(Bacon): Webpack is currently hardcoded to index.bundle on native\n // in the future (TODO) we should move this logic into a Webpack plugin and use\n // a generated file name like we do on web.\n // const server = getDefaultDevServer();\n // // TODO: Move this into BundlerDevServer and read this info from self.\n // const isNativeWebpack = server instanceof WebpackBundlerDevServer && server.isTargetingNative();\n if (this.options.isNativeWebpack) {\n return 'index';\n }\n\n const entry = resolveRelativeEntryPoint(this.projectRoot, props);\n debug(`Resolved entry point: ${entry} (project root: ${this.projectRoot})`);\n return entry;\n }\n\n /** Parse request headers into options. */\n public abstract getParsedHeaders(req: ServerRequest): TManifestRequestInfo;\n\n /** Store device IDs that were sent in the request headers. */\n private async saveDevicesAsync(req: ServerRequest) {\n const deviceIds = req.headers?.['expo-dev-client-id'];\n if (deviceIds) {\n await ProjectDevices.saveDevicesAsync(this.projectRoot, deviceIds).catch((e) =>\n Log.exception(e)\n );\n }\n }\n\n /** Create the bundle URL (points to the single JS entry file). Exposed for testing. */\n public _getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine,\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n protocol,\n reactCompiler,\n }: {\n platform: string;\n hostname?: string | null;\n mainModuleName: string;\n engine?: 'hermes';\n baseUrl?: string;\n asyncRoutes: boolean;\n isExporting?: boolean;\n routerRoot: string;\n protocol?: 'http' | 'https';\n reactCompiler: boolean;\n }): string {\n const path = createBundleUrlPath({\n mode: this.options.mode ?? 'development',\n minify: this.options.minify,\n platform,\n mainModuleName,\n lazy: !env.EXPO_NO_METRO_LAZY,\n engine,\n bytecode: engine === 'hermes',\n baseUrl,\n isExporting: !!isExporting,\n asyncRoutes,\n routerRoot,\n reactCompiler,\n });\n\n return (\n this.options.constructUrl({\n scheme: protocol ?? 'http',\n // hostType: this.options.location.hostType,\n hostname,\n }) + path\n );\n }\n\n /** Get the manifest response to return to the runtime. This file contains info regarding where the assets can be loaded from. Exposed for testing. */\n public abstract _getManifestResponseAsync(options: TManifestRequestInfo): Promise<Response>;\n\n private getExpoGoConfig({\n mainModuleName,\n hostname,\n username,\n }: {\n mainModuleName: string;\n hostname?: string | null;\n username?: string;\n }): ExpoGoConfig {\n return {\n // localhost:8081\n debuggerHost: this.options.constructUrl({ scheme: '', hostname }),\n // Required for Expo Go to function.\n developer: {\n tool: DEVELOPER_TOOL,\n projectRoot: this.projectRoot,\n },\n packagerOpts: {\n // Required for dev client.\n dev: this.options.mode !== 'production',\n },\n // Indicates the name of the main bundle.\n mainModuleName,\n // The signed-in CLI username, used by Expo Go to verify account match.\n ...(username ? { username } : undefined),\n };\n }\n\n /** Resolve all assets and set them on the manifest as URLs */\n private async mutateManifestWithAssetsAsync(manifest: ExpoConfig, bundleUrl: string) {\n await resolveManifestAssets(this.projectRoot, {\n manifest,\n resolver: async (path) => {\n if (this.options.isNativeWebpack) {\n // When using our custom dev server, just do assets normally\n // without the `assets/` subpath redirect.\n return resolve(bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0], path);\n }\n return bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0] + 'assets/' + path;\n },\n });\n // The server normally inserts this but if we're offline we'll do it here\n await resolveGoogleServicesFile(this.projectRoot, manifest);\n }\n\n public getWebBundleUrl() {\n const platform = 'web';\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: this.initialProjectConfig.pkg,\n platform,\n });\n\n return createBundleUrlPathFromExpoConfig(this.projectRoot, this.initialProjectConfig.exp, {\n platform,\n mainModuleName,\n minify: this.options.minify,\n lazy: !env.EXPO_NO_METRO_LAZY,\n mode: this.options.mode ?? 'development',\n // Hermes doesn't support more modern JS features than most, if not all, modern browser.\n engine: 'hermes',\n isExporting: false,\n bytecode: false,\n });\n }\n\n /**\n * Web platforms should create an index.html response using the same script resolution as native.\n *\n * Instead of adding a `bundleUrl` to a `manifest.json` (native) we'll add a `<script src=\"\">`\n * to an `index.html`, this enables the web platform to load JavaScript from the server.\n */\n private async handleWebRequestAsync(req: ServerRequest, res: ServerResponse) {\n res.setHeader('Content-Type', 'text/html');\n\n res.end(await this.getSingleHtmlTemplateAsync());\n }\n\n getSingleHtmlTemplateAsync() {\n // Read from headers\n const bundleUrl = this.getWebBundleUrl();\n\n return createTemplateHtmlFromExpoConfigAsync(this.projectRoot, {\n exp: this.initialProjectConfig.exp,\n scripts: [bundleUrl],\n });\n }\n\n /** Exposed for testing. */\n async checkBrowserRequestAsync(req: ServerRequest, res: ServerResponse, next: ServerNext) {\n if (\n this.platformBundlers.web === 'metro' &&\n this.initialProjectConfig.exp.platforms?.includes('web')\n ) {\n // NOTE(EvanBacon): This effectively disables the safety check we do on custom runtimes to ensure\n // the `expo-platform` header is included. When `web.bundler=web`, if the user has non-standard Expo\n // code loading then they'll get a web bundle without a clear assertion of platform support.\n const platform = parsePlatformHeader(req);\n // On web, serve the public folder\n if (!platform || platform === 'web') {\n if (['static', 'server'].includes(this.initialProjectConfig.exp.web?.output ?? '')) {\n // Skip the spa-styled index.html when static generation is enabled.\n next();\n return true;\n } else {\n await this.handleWebRequestAsync(req, res);\n return true;\n }\n }\n }\n return false;\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n // First check for standard JavaScript runtimes (aka legacy browsers like Chrome).\n if (await this.checkBrowserRequestAsync(req, res, next)) {\n return;\n }\n\n // Save device IDs for dev client.\n await this.saveDevicesAsync(req);\n\n // Read from headers\n const options = this.getParsedHeaders(req);\n\n const response = await this._getManifestResponseAsync(options);\n // Convert `Response` to node:http response\n if (typeof res.setHeaders === 'function') {\n res.setHeaders(response.headers);\n } else {\n for (const [key, value] of response.headers.entries()) {\n res.appendHeader(key, value);\n }\n }\n if (response.body) {\n await pipeline(Readable.fromWeb(response.body as any), res);\n } else {\n res.end();\n }\n }\n}\n"],"names":["DEVELOPER_TOOL","ManifestMiddleware","debug","require","ExpoMiddleware","projectRoot","options","initialProjectConfig","getConfig","platformBundlers","getPlatformBundlers","exp","_resolveProjectSettingsAsync","platform","hostname","protocol","projectConfig","mainModuleName","resolveMainModuleName","pkg","isHermesEnabled","isEnableHermesManaged","user","getUserAsync","username","getActorDisplayName","expoGoConfig","getExpoGoConfig","undefined","hostUri","constructUrl","scheme","bundleUrl","_getBundleUrl","engine","baseUrl","getBaseUrlFromExpoConfig","asyncRoutes","getAsyncRoutesFromExpoConfig","mode","routerRoot","getRouterDirectoryModuleIdWithManifest","reactCompiler","experiments","mutateManifestWithAssetsAsync","props","isNativeWebpack","entry","resolveRelativeEntryPoint","saveDevicesAsync","req","deviceIds","headers","ProjectDevices","catch","e","Log","exception","isExporting","path","createBundleUrlPath","minify","lazy","env","EXPO_NO_METRO_LAZY","bytecode","debuggerHost","developer","tool","packagerOpts","dev","manifest","resolveManifestAssets","resolver","resolve","match","resolveGoogleServicesFile","getWebBundleUrl","createBundleUrlPathFromExpoConfig","handleWebRequestAsync","res","setHeader","end","getSingleHtmlTemplateAsync","createTemplateHtmlFromExpoConfigAsync","scripts","checkBrowserRequestAsync","next","web","platforms","includes","parsePlatformHeader","output","handleRequestAsync","getParsedHeaders","response","_getManifestResponseAsync","setHeaders","key","value","entries","appendHeader","body","pipeline","Readable","fromWeb"],"mappings":";;;;;;;;;;;QA2DaA;eAAAA;;QAaSC;eAAAA;;;;yBAvEI;;;;;;;yBACgB;;;;;;;yBACjB;;;;;;;yBACA;;;;;;;yBACD;;;;;;gCAEO;8BAMxB;+BAC0D;iCAE7B;sBAEc;8BACZ;6DACjB;qBACD;iEACY;wBAEuB;kCAEnB;6BACkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,MAAMC,QAAQC,QAAQ,SAAS;AA8BxB,MAAMH,iBAAiB;AAavB,MAAeC,2BAEZG,8BAAc;IAItB,YACE,AAAUC,WAAmB,EAC7B,AAAUC,OAAkC,CAC5C;QACA,KAAK,CACHD,aACA;;OAEC,GACD;YAAC;YAAK;YAAa;SAAa,QARxBA,cAAAA,kBACAC,UAAAA;QASV,IAAI,CAACC,oBAAoB,GAAGC,IAAAA,mBAAS,EAACH;QACtC,IAAI,CAACI,gBAAgB,GAAGC,IAAAA,qCAAmB,EAACL,aAAa,IAAI,CAACE,oBAAoB,CAACI,GAAG;IACxF;IAEA,yBAAyB,GACzB,MAAaC,6BAA6B,EACxCC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EAIT,EAAoC;YAsChBC;QArCnB,kBAAkB;QAClB,MAAMA,gBAAgBR,IAAAA,mBAAS,EAAC,IAAI,CAACH,WAAW;QAEhD,oBAAoB;QACpB,MAAMY,iBAAiB,IAAI,CAACC,qBAAqB,CAAC;YAChDC,KAAKH,cAAcG,GAAG;YACtBN;QACF;QAEA,MAAMO,kBAAkBC,IAAAA,mCAAqB,EAACL,cAAcL,GAAG,EAAEE;QAE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AW,MAAM,IAAI,CAACC,yBAAyB,CAAC1F;QACtD,2CAA2C;QAC3C,IAAI,OAAO0E,IAAIiB,UAAU,KAAK,YAAY;YACxCjB,IAAIiB,UAAU,CAACF,SAAS3C,OAAO;QACjC,OAAO;YACL,KAAK,MAAM,CAAC8C,KAAKC,MAAM,IAAIJ,SAAS3C,OAAO,CAACgD,OAAO,GAAI;gBACrDpB,IAAIqB,YAAY,CAACH,KAAKC;YACxB;QACF;QACA,IAAIJ,SAASO,IAAI,EAAE;YACjB,MAAMC,IAAAA,oBAAQ,EAACC,sBAAQ,CAACC,OAAO,CAACV,SAASO,IAAI,GAAUtB;QACzD,OAAO;YACLA,IAAIE,GAAG;QACT;IACF;AACF"}
|
|
@@ -26,7 +26,7 @@ class FetchClient {
|
|
|
26
26
|
this.headers = {
|
|
27
27
|
accept: 'application/json',
|
|
28
28
|
'content-type': 'application/json',
|
|
29
|
-
'user-agent': `expo-cli/${"56.1.
|
|
29
|
+
'user-agent': `expo-cli/${"56.1.3"}`,
|
|
30
30
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
31
31
|
};
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "56.1.
|
|
3
|
+
"version": "56.1.3",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,23 +39,23 @@
|
|
|
39
39
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/cli",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@expo/code-signing-certificates": "^0.0.6",
|
|
42
|
-
"@expo/config": "~56.0.
|
|
43
|
-
"@expo/config-plugins": "~56.0.
|
|
42
|
+
"@expo/config": "~56.0.4",
|
|
43
|
+
"@expo/config-plugins": "~56.0.4",
|
|
44
44
|
"@expo/devcert": "^1.2.1",
|
|
45
45
|
"@expo/env": "~2.2.0",
|
|
46
46
|
"@expo/image-utils": "^0.9.2",
|
|
47
|
-
"@expo/inline-modules": "^0.0.
|
|
47
|
+
"@expo/inline-modules": "^0.0.6",
|
|
48
48
|
"@expo/json-file": "^10.1.0",
|
|
49
|
-
"@expo/log-box": "^56.0.
|
|
49
|
+
"@expo/log-box": "^56.0.8",
|
|
50
50
|
"@expo/metro": "~56.0.0",
|
|
51
|
-
"@expo/metro-config": "~56.0.
|
|
51
|
+
"@expo/metro-config": "~56.0.7",
|
|
52
52
|
"@expo/metro-file-map": "^56.0.1",
|
|
53
53
|
"@expo/osascript": "^2.5.0",
|
|
54
54
|
"@expo/package-manager": "^1.11.0",
|
|
55
55
|
"@expo/plist": "^0.6.0",
|
|
56
|
-
"@expo/prebuild-config": "^56.0.
|
|
56
|
+
"@expo/prebuild-config": "^56.0.6",
|
|
57
57
|
"@expo/require-utils": "^56.1.0",
|
|
58
|
-
"@expo/router-server": "^56.0.
|
|
58
|
+
"@expo/router-server": "^56.0.7",
|
|
59
59
|
"@expo/schema-utils": "^56.0.0",
|
|
60
60
|
"@expo/spawn-async": "^1.7.2",
|
|
61
61
|
"@expo/ws-tunnel": "^1.0.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"node-forge": "^1.3.3",
|
|
82
82
|
"npm-package-arg": "^11.0.0",
|
|
83
83
|
"ora": "^3.4.0",
|
|
84
|
-
"picomatch": "^4.0.
|
|
84
|
+
"picomatch": "^4.0.4",
|
|
85
85
|
"pretty-format": "^29.7.0",
|
|
86
86
|
"progress": "^2.0.3",
|
|
87
87
|
"prompts": "^2.3.2",
|
|
@@ -157,13 +157,13 @@
|
|
|
157
157
|
"playwright": "^1.59.0",
|
|
158
158
|
"taskr": "^1.1.0",
|
|
159
159
|
"tree-kill": "^1.2.2",
|
|
160
|
-
"
|
|
161
|
-
"expo": "56.0.
|
|
160
|
+
"expo": "56.0.0-preview.10",
|
|
161
|
+
"expo-modules-autolinking": "56.0.5",
|
|
162
|
+
"expo-router": "56.1.4",
|
|
162
163
|
"expo-module-scripts": "56.0.2",
|
|
163
|
-
"expo
|
|
164
|
-
"expo-router": "56.1.3"
|
|
164
|
+
"@expo/fingerprint": "0.18.0"
|
|
165
165
|
},
|
|
166
|
-
"gitHead": "
|
|
166
|
+
"gitHead": "40f0a6f6711d93762e0506b37e6e077e4bd9a541",
|
|
167
167
|
"scripts": {
|
|
168
168
|
"build": "taskr",
|
|
169
169
|
"clean": "expo-module clean",
|