@expo/cli 0.22.8 → 0.22.10
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/rest/client.js +2 -0
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +3 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/exportServer.js +13 -9
- package/build/src/export/embed/exportServer.js.map +1 -1
- package/build/src/export/embed/index.js +4 -0
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +2 -1
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +1 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -1
- package/build/src/export/exportApp.js +27 -12
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +18 -2
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/publicFolder.js +6 -1
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/saveAssets.js +1 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +2 -1
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +14 -6
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/install/resolveOptions.js +2 -0
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/serve/serveAsync.js +4 -2
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +4 -0
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +2 -1
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +105 -55
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +15 -5
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +28 -4
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +5 -1
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +2 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +6 -3
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +1 -1
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/startAsync.js +1 -1
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/env.js +9 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/ip.js +8 -1
- package/build/src/utils/ip.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 +16 -16
package/build/bin/cli
CHANGED
|
@@ -125,6 +125,7 @@ function wrapFetchWithCredentials(fetchFunction) {
|
|
|
125
125
|
* Determine if the provided error is related to a network issue.
|
|
126
126
|
* When this returns true, offline mode should be enabled.
|
|
127
127
|
* - `ENOTFOUND` is thrown when the DNS lookup failed
|
|
128
|
+
* - `EAI_AGAIN` is thrown when DNS lookup failed due to a server-side error
|
|
128
129
|
* - `UND_ERR_CONNECT_TIMEOUT` is thrown after DNS is resolved, but server can't be reached
|
|
129
130
|
*
|
|
130
131
|
* @see https://nodejs.org/api/errors.html
|
|
@@ -132,6 +133,7 @@ function wrapFetchWithCredentials(fetchFunction) {
|
|
|
132
133
|
*/ function isNetworkError(error) {
|
|
133
134
|
return "code" in error && error.code && [
|
|
134
135
|
"ENOTFOUND",
|
|
136
|
+
"EAI_AGAIN",
|
|
135
137
|
"UND_ERR_CONNECT_TIMEOUT"
|
|
136
138
|
].includes(error.code);
|
|
137
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api/rest/client.ts"],"sourcesContent":["import { getExpoHomeDirectory } from '@expo/config/build/getUserState';\nimport type { JSONValue } from '@expo/json-file';\nimport path from 'path';\n\nimport { wrapFetchWithCache } from './cache/wrapFetchWithCache';\nimport type { FetchLike } from './client.types';\nimport { wrapFetchWithBaseUrl } from './wrapFetchWithBaseUrl';\nimport { wrapFetchWithOffline } from './wrapFetchWithOffline';\nimport { wrapFetchWithProgress } from './wrapFetchWithProgress';\nimport { wrapFetchWithProxy } from './wrapFetchWithProxy';\nimport { wrapFetchWithUserAgent } from './wrapFetchWithUserAgent';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { fetch } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport { disableNetwork } from '../settings';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\nexport class ApiV2Error extends Error {\n readonly name = 'ApiV2Error';\n readonly code: string;\n readonly expoApiV2ErrorCode: string;\n readonly expoApiV2ErrorDetails?: JSONValue;\n readonly expoApiV2ErrorServerStack?: string;\n readonly expoApiV2ErrorMetadata?: object;\n\n constructor(response: {\n message: string;\n code: string;\n stack?: string;\n details?: JSONValue;\n metadata?: object;\n }) {\n super(response.message);\n this.code = response.code;\n this.expoApiV2ErrorCode = response.code;\n this.expoApiV2ErrorDetails = response.details;\n this.expoApiV2ErrorServerStack = response.stack;\n this.expoApiV2ErrorMetadata = response.metadata;\n }\n}\n\n/**\n * An Expo server error that didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the server.\n */\nexport class UnexpectedServerError extends Error {\n readonly name = 'UnexpectedServerError';\n}\n\n/**\n * An error defining that the server didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the client.\n */\nexport class UnexpectedServerData extends Error {\n readonly name = 'UnexpectedServerData';\n}\n\n/** Validate the response json contains `.data` property, or throw an unexpected server data error */\nexport function getResponseDataOrThrow<T = any>(json: unknown): T {\n if (!!json && typeof json === 'object' && 'data' in json) {\n return json.data as T;\n }\n\n throw new UnexpectedServerData(\n !!json && typeof json === 'object' ? JSON.stringify(json) : 'Unknown data received from server.'\n );\n}\n\n/**\n * @returns a `fetch` function that will inject user authentication information and handle errors from the Expo API.\n */\nexport function wrapFetchWithCredentials(fetchFunction: FetchLike): FetchLike {\n return async function fetchWithCredentials(url, options = {}) {\n if (Array.isArray(options.headers)) {\n throw new Error('request headers must be in object form');\n }\n\n const resolvedHeaders = options.headers ?? ({} as any);\n\n const token = getAccessToken();\n if (token) {\n resolvedHeaders.authorization = `Bearer ${token}`;\n } else {\n const sessionSecret = getSession()?.sessionSecret;\n if (sessionSecret) {\n resolvedHeaders['expo-session'] = sessionSecret;\n }\n }\n\n try {\n const response = await fetchFunction(url, {\n ...options,\n headers: resolvedHeaders,\n });\n\n // Handle expected API errors (4xx)\n if (response.status >= 400 && response.status < 500) {\n const body = await response.text();\n try {\n const data = JSON.parse(body);\n if (data?.errors?.length) {\n throw new ApiV2Error(data.errors[0]);\n }\n } catch (error: any) {\n // Server returned non-json response.\n if (error.message.includes('in JSON at position')) {\n throw new UnexpectedServerError(body);\n }\n throw error;\n }\n }\n\n return response;\n } catch (error: any) {\n // When running `expo start`, but wifi or internet has issues\n if (\n isNetworkError(error) || // node-fetch error handling\n ('cause' in error && isNetworkError(error.cause)) // undici error handling\n ) {\n disableNetwork();\n\n throw new CommandError(\n 'OFFLINE',\n 'Network connection is unreliable. Try again with the environment variable `EXPO_OFFLINE=1` to skip network requests.'\n );\n }\n\n throw error;\n }\n };\n}\n\n/**\n * Determine if the provided error is related to a network issue.\n * When this returns true, offline mode should be enabled.\n * - `ENOTFOUND` is thrown when the DNS lookup failed\n * - `UND_ERR_CONNECT_TIMEOUT` is thrown after DNS is resolved, but server can't be reached\n *\n * @see https://nodejs.org/api/errors.html\n * @see https://github.com/nodejs/undici#network-address-family-autoselection\n */\nfunction isNetworkError(error: Error & { code?: string }) {\n return (\n 'code' in error && error.code && ['ENOTFOUND', 'UND_ERR_CONNECT_TIMEOUT'].includes(error.code)\n );\n}\n\nconst fetchWithOffline = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n\nconst fetchWithBaseUrl = wrapFetchWithBaseUrl(fetchWithOffline, getExpoApiBaseUrl() + '/v2/');\n\nconst fetchWithProxy = wrapFetchWithProxy(fetchWithBaseUrl);\n\nconst fetchWithCredentials = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithProxy));\n\n/**\n * Create an instance of the fully qualified fetch command (auto authentication and api) but with caching in the '~/.expo' directory.\n * Caching is disabled automatically if the EXPO_NO_CACHE or EXPO_BETA environment variables are enabled.\n */\nexport function createCachedFetch({\n fetch = fetchWithCredentials,\n cacheDirectory,\n ttl,\n skipCache,\n}: {\n fetch?: FetchLike;\n cacheDirectory: string;\n ttl?: number;\n skipCache?: boolean;\n}): FetchLike {\n // Disable all caching in EXPO_BETA.\n if (skipCache || env.EXPO_BETA || env.EXPO_NO_CACHE) {\n return fetch;\n }\n\n const { FileSystemResponseCache } =\n require('./cache/FileSystemResponseCache') as typeof import('./cache/FileSystemResponseCache');\n\n return wrapFetchWithCache(\n fetch,\n new FileSystemResponseCache({\n cacheDirectory: path.join(getExpoHomeDirectory(), cacheDirectory),\n ttl,\n })\n );\n}\n\n/** Instance of fetch with automatic base URL pointing to the Expo API, user credential injection, and API error handling. Caching not included. */\nexport const fetchAsync = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithProxy));\n"],"names":["ApiV2Error","UnexpectedServerError","UnexpectedServerData","getResponseDataOrThrow","wrapFetchWithCredentials","createCachedFetch","fetchAsync","Error","name","constructor","response","message","code","expoApiV2ErrorCode","expoApiV2ErrorDetails","details","expoApiV2ErrorServerStack","stack","expoApiV2ErrorMetadata","metadata","json","data","JSON","stringify","fetchFunction","fetchWithCredentials","url","options","Array","isArray","headers","resolvedHeaders","token","getAccessToken","authorization","getSession","sessionSecret","status","body","text","parse","errors","length","error","includes","isNetworkError","cause","disableNetwork","CommandError","fetchWithOffline","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","fetchWithBaseUrl","wrapFetchWithBaseUrl","getExpoApiBaseUrl","fetchWithProxy","wrapFetchWithProxy","wrapFetchWithProgress","cacheDirectory","ttl","skipCache","env","EXPO_BETA","EXPO_NO_CACHE","FileSystemResponseCache","require","wrapFetchWithCache","path","join","getExpoHomeDirectory"],"mappings":"AAAA;;;;;;;;;;;IAkBaA,UAAU,MAAVA,UAAU;IA4BVC,qBAAqB,MAArBA,qBAAqB;IAQrBC,oBAAoB,MAApBA,oBAAoB;IAKjBC,sBAAsB,MAAtBA,sBAAsB;IAatBC,wBAAwB,MAAxBA,wBAAwB;IAwFxBC,iBAAiB,MAAjBA,iBAAiB;IA6BpBC,UAAU,MAAVA,UAAU;;;yBA7Lc,iCAAiC;;;;;;;8DAErD,MAAM;;;;;;oCAEY,4BAA4B;sCAE1B,wBAAwB;sCACxB,wBAAwB;uCACvB,yBAAyB;oCAC5B,sBAAsB;wCAClB,0BAA0B;qBAC7C,iBAAiB;wBACR,oBAAoB;uBAC3B,mBAAmB;0BACP,aAAa;0BAChB,aAAa;8BACD,sBAAsB;;;;;;AAE1D,MAAMN,UAAU,SAASO,KAAK;IACnC,AAASC,IAAI,GAAG,YAAY,CAAC;IAO7BC,YAAYC,QAMX,CAAE;QACD,KAAK,CAACA,QAAQ,CAACC,OAAO,CAAC,CAAC;QACxB,IAAI,CAACC,IAAI,GAAGF,QAAQ,CAACE,IAAI,CAAC;QAC1B,IAAI,CAACC,kBAAkB,GAAGH,QAAQ,CAACE,IAAI,CAAC;QACxC,IAAI,CAACE,qBAAqB,GAAGJ,QAAQ,CAACK,OAAO,CAAC;QAC9C,IAAI,CAACC,yBAAyB,GAAGN,QAAQ,CAACO,KAAK,CAAC;QAChD,IAAI,CAACC,sBA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,EAAES,KAAI,EAAA,QAAA,CAACC,IAAI,CAACC,IAAAA,aAAoB,EAAA,qBAAA,GAAE,EAAEX,cAAc,CAAC;QACjEC,GAAG;KACJ,CAAC,CACH,CAAC;AACJ,CAAC;AAGM,MAAMtD,UAAU,GAAGoD,IAAAA,sBAAqB,sBAAA,EAACtD,wBAAwB,CAACoD,cAAc,CAAC,CAAC,AAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/rest/client.ts"],"sourcesContent":["import { getExpoHomeDirectory } from '@expo/config/build/getUserState';\nimport type { JSONValue } from '@expo/json-file';\nimport path from 'path';\n\nimport { wrapFetchWithCache } from './cache/wrapFetchWithCache';\nimport type { FetchLike } from './client.types';\nimport { wrapFetchWithBaseUrl } from './wrapFetchWithBaseUrl';\nimport { wrapFetchWithOffline } from './wrapFetchWithOffline';\nimport { wrapFetchWithProgress } from './wrapFetchWithProgress';\nimport { wrapFetchWithProxy } from './wrapFetchWithProxy';\nimport { wrapFetchWithUserAgent } from './wrapFetchWithUserAgent';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { fetch } from '../../utils/fetch';\nimport { getExpoApiBaseUrl } from '../endpoint';\nimport { disableNetwork } from '../settings';\nimport { getAccessToken, getSession } from '../user/UserSettings';\n\nexport class ApiV2Error extends Error {\n readonly name = 'ApiV2Error';\n readonly code: string;\n readonly expoApiV2ErrorCode: string;\n readonly expoApiV2ErrorDetails?: JSONValue;\n readonly expoApiV2ErrorServerStack?: string;\n readonly expoApiV2ErrorMetadata?: object;\n\n constructor(response: {\n message: string;\n code: string;\n stack?: string;\n details?: JSONValue;\n metadata?: object;\n }) {\n super(response.message);\n this.code = response.code;\n this.expoApiV2ErrorCode = response.code;\n this.expoApiV2ErrorDetails = response.details;\n this.expoApiV2ErrorServerStack = response.stack;\n this.expoApiV2ErrorMetadata = response.metadata;\n }\n}\n\n/**\n * An Expo server error that didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the server.\n */\nexport class UnexpectedServerError extends Error {\n readonly name = 'UnexpectedServerError';\n}\n\n/**\n * An error defining that the server didn't return the expected error JSON information.\n * The only 'expected' place for this is in testing, all other cases are bugs with the client.\n */\nexport class UnexpectedServerData extends Error {\n readonly name = 'UnexpectedServerData';\n}\n\n/** Validate the response json contains `.data` property, or throw an unexpected server data error */\nexport function getResponseDataOrThrow<T = any>(json: unknown): T {\n if (!!json && typeof json === 'object' && 'data' in json) {\n return json.data as T;\n }\n\n throw new UnexpectedServerData(\n !!json && typeof json === 'object' ? JSON.stringify(json) : 'Unknown data received from server.'\n );\n}\n\n/**\n * @returns a `fetch` function that will inject user authentication information and handle errors from the Expo API.\n */\nexport function wrapFetchWithCredentials(fetchFunction: FetchLike): FetchLike {\n return async function fetchWithCredentials(url, options = {}) {\n if (Array.isArray(options.headers)) {\n throw new Error('request headers must be in object form');\n }\n\n const resolvedHeaders = options.headers ?? ({} as any);\n\n const token = getAccessToken();\n if (token) {\n resolvedHeaders.authorization = `Bearer ${token}`;\n } else {\n const sessionSecret = getSession()?.sessionSecret;\n if (sessionSecret) {\n resolvedHeaders['expo-session'] = sessionSecret;\n }\n }\n\n try {\n const response = await fetchFunction(url, {\n ...options,\n headers: resolvedHeaders,\n });\n\n // Handle expected API errors (4xx)\n if (response.status >= 400 && response.status < 500) {\n const body = await response.text();\n try {\n const data = JSON.parse(body);\n if (data?.errors?.length) {\n throw new ApiV2Error(data.errors[0]);\n }\n } catch (error: any) {\n // Server returned non-json response.\n if (error.message.includes('in JSON at position')) {\n throw new UnexpectedServerError(body);\n }\n throw error;\n }\n }\n\n return response;\n } catch (error: any) {\n // When running `expo start`, but wifi or internet has issues\n if (\n isNetworkError(error) || // node-fetch error handling\n ('cause' in error && isNetworkError(error.cause)) // undici error handling\n ) {\n disableNetwork();\n\n throw new CommandError(\n 'OFFLINE',\n 'Network connection is unreliable. Try again with the environment variable `EXPO_OFFLINE=1` to skip network requests.'\n );\n }\n\n throw error;\n }\n };\n}\n\n/**\n * Determine if the provided error is related to a network issue.\n * When this returns true, offline mode should be enabled.\n * - `ENOTFOUND` is thrown when the DNS lookup failed\n * - `EAI_AGAIN` is thrown when DNS lookup failed due to a server-side error\n * - `UND_ERR_CONNECT_TIMEOUT` is thrown after DNS is resolved, but server can't be reached\n *\n * @see https://nodejs.org/api/errors.html\n * @see https://github.com/nodejs/undici#network-address-family-autoselection\n */\nfunction isNetworkError(error: Error & { code?: string }) {\n return (\n 'code' in error &&\n error.code &&\n ['ENOTFOUND', 'EAI_AGAIN', 'UND_ERR_CONNECT_TIMEOUT'].includes(error.code)\n );\n}\n\nconst fetchWithOffline = wrapFetchWithOffline(wrapFetchWithUserAgent(fetch));\n\nconst fetchWithBaseUrl = wrapFetchWithBaseUrl(fetchWithOffline, getExpoApiBaseUrl() + '/v2/');\n\nconst fetchWithProxy = wrapFetchWithProxy(fetchWithBaseUrl);\n\nconst fetchWithCredentials = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithProxy));\n\n/**\n * Create an instance of the fully qualified fetch command (auto authentication and api) but with caching in the '~/.expo' directory.\n * Caching is disabled automatically if the EXPO_NO_CACHE or EXPO_BETA environment variables are enabled.\n */\nexport function createCachedFetch({\n fetch = fetchWithCredentials,\n cacheDirectory,\n ttl,\n skipCache,\n}: {\n fetch?: FetchLike;\n cacheDirectory: string;\n ttl?: number;\n skipCache?: boolean;\n}): FetchLike {\n // Disable all caching in EXPO_BETA.\n if (skipCache || env.EXPO_BETA || env.EXPO_NO_CACHE) {\n return fetch;\n }\n\n const { FileSystemResponseCache } =\n require('./cache/FileSystemResponseCache') as typeof import('./cache/FileSystemResponseCache');\n\n return wrapFetchWithCache(\n fetch,\n new FileSystemResponseCache({\n cacheDirectory: path.join(getExpoHomeDirectory(), cacheDirectory),\n ttl,\n })\n );\n}\n\n/** Instance of fetch with automatic base URL pointing to the Expo API, user credential injection, and API error handling. Caching not included. */\nexport const fetchAsync = wrapFetchWithProgress(wrapFetchWithCredentials(fetchWithProxy));\n"],"names":["ApiV2Error","UnexpectedServerError","UnexpectedServerData","getResponseDataOrThrow","wrapFetchWithCredentials","createCachedFetch","fetchAsync","Error","name","constructor","response","message","code","expoApiV2ErrorCode","expoApiV2ErrorDetails","details","expoApiV2ErrorServerStack","stack","expoApiV2ErrorMetadata","metadata","json","data","JSON","stringify","fetchFunction","fetchWithCredentials","url","options","Array","isArray","headers","resolvedHeaders","token","getAccessToken","authorization","getSession","sessionSecret","status","body","text","parse","errors","length","error","includes","isNetworkError","cause","disableNetwork","CommandError","fetchWithOffline","wrapFetchWithOffline","wrapFetchWithUserAgent","fetch","fetchWithBaseUrl","wrapFetchWithBaseUrl","getExpoApiBaseUrl","fetchWithProxy","wrapFetchWithProxy","wrapFetchWithProgress","cacheDirectory","ttl","skipCache","env","EXPO_BETA","EXPO_NO_CACHE","FileSystemResponseCache","require","wrapFetchWithCache","path","join","getExpoHomeDirectory"],"mappings":"AAAA;;;;;;;;;;;IAkBaA,UAAU,MAAVA,UAAU;IA4BVC,qBAAqB,MAArBA,qBAAqB;IAQrBC,oBAAoB,MAApBA,oBAAoB;IAKjBC,sBAAsB,MAAtBA,sBAAsB;IAatBC,wBAAwB,MAAxBA,wBAAwB;IA2FxBC,iBAAiB,MAAjBA,iBAAiB;IA6BpBC,UAAU,MAAVA,UAAU;;;yBAhMc,iCAAiC;;;;;;;8DAErD,MAAM;;;;;;oCAEY,4BAA4B;sCAE1B,wBAAwB;sCACxB,wBAAwB;uCACvB,yBAAyB;oCAC5B,sBAAsB;wCAClB,0BAA0B;qBAC7C,iBAAiB;wBACR,oBAAoB;uBAC3B,mBAAmB;0BACP,aAAa;0BAChB,aAAa;8BACD,sBAAsB;;;;;;AAE1D,MAAMN,UAAU,SAASO,KAAK;IACnC,AAASC,IAAI,GAAG,YAAY,CAAC;IAO7BC,YAAYC,QAMX,CAAE;QACD,KAAK,CAACA,QAAQ,CAACC,OAAO,CAAC,CAAC;QACxB,IAAI,CAACC,IAAI,GAAGF,QAAQ,CAAC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aAAa,EAAE;QACnD,OAAOZ,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAEa,uBAAuB,CAAA,EAAE,GAC/BC,OAAO,CAAC,iCAAiC,CAAC,AAAoD,AAAC;IAEjG,OAAOC,IAAAA,mBAAkB,mBAAA,EACvBf,KAAK,EACL,IAAIa,uBAAuB,CAAC;QAC1BN,cAAc,EAAES,KAAI,EAAA,QAAA,CAACC,IAAI,CAACC,IAAAA,aAAoB,EAAA,qBAAA,GAAE,EAAEX,cAAc,CAAC;QACjEC,GAAG;KACJ,CAAC,CACH,CAAC;AACJ,CAAC;AAGM,MAAMtD,UAAU,GAAGoD,IAAAA,sBAAqB,sBAAA,EAACtD,wBAAwB,CAACoD,cAAc,CAAC,CAAC,AAAC"}
|
|
@@ -188,6 +188,7 @@ async function exportEmbedInternalAsync(projectRoot, options) {
|
|
|
188
188
|
const hasDomComponents = domComponentProxyOutputDir && files.size > 0;
|
|
189
189
|
// Persist bundle and source maps.
|
|
190
190
|
await Promise.all([
|
|
191
|
+
// @ts-expect-error: The `save()` method from metro is typed to support `code: string` only but it also supports `Buffer` actually.
|
|
191
192
|
_bundle().default.save(bundle, options, _log.Log.log),
|
|
192
193
|
// Write dom components proxy files.
|
|
193
194
|
hasDomComponents ? (0, _saveAssets.persistMetroFilesAsync)(files, domComponentProxyOutputDir) : null,
|
|
@@ -234,8 +235,7 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
234
235
|
mode: options.dev ? "development" : "production",
|
|
235
236
|
engine: isHermes ? "hermes" : undefined,
|
|
236
237
|
serializerIncludeMaps: !!sourceMapUrl,
|
|
237
|
-
|
|
238
|
-
bytecode: false,
|
|
238
|
+
bytecode: options.bytecode ?? false,
|
|
239
239
|
// source map inline
|
|
240
240
|
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler)
|
|
241
241
|
}, files, {
|
|
@@ -283,7 +283,7 @@ async function exportEmbedBundleAndAssetsAsync(projectRoot, options) {
|
|
|
283
283
|
return {
|
|
284
284
|
files,
|
|
285
285
|
bundle: {
|
|
286
|
-
code: bundles.artifacts.filter((a)=>a.type === "js")[0].source
|
|
286
|
+
code: bundles.artifacts.filter((a)=>a.type === "js")[0].source,
|
|
287
287
|
// Can be optional when source maps aren't enabled.
|
|
288
288
|
map: (ref2 = bundles.artifacts.filter((a)=>a.type === "map")[0]) == null ? void 0 : ref2.source.toString()
|
|
289
289
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { assertMetroPrivateServer } from '../../start/server/metro/metroPrivateServer';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: Awaited<ReturnType<Server['build']>>;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source.toString(),\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n // @ts-expect-error: see above\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n bundleType: 'todo',\n });\n\n assertMetroPrivateServer(server);\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["exportEmbedAsync","exportEmbedInternalAsync","exportEmbedBundleAndAssetsAsync","createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","assertMetroPrivateServer","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","Error"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAwDsBA,gBAAgB,MAAhBA,gBAAgB;IAmDhBC,wBAAwB,MAAxBA,wBAAwB;IAkDxBC,+BAA+B,MAA/BA,+BAA+B;IA0I/BC,sCAAsC,MAAtCA,s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,CAAC;IACL,EAAE,OAAOlC,KAAK,EAAO;QACnB,IAAIC,OAAO,CAACD,KAAK,CAAC,EAAE;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI7G,OAAO,CAACoB,QAAQ,KAAK,KAAK,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,SAAS,IAAIyF,KAAK,IAAIE,IAAAA,oBAAyB,0BAAA,GAAE,EAAE;oBACrDF,KAAK,CAACG,OAAO,GAAGC,IAAAA,KAAS,UAAA,EAACJ,KAAK,CAACG,OAAO,CAAC,AAAU,CAAC;gBACrD,CAAC;gBACDE,IAAAA,oBAAoB,qBAAA,EAACnH,WAAW,EAAE8G,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYmC,KAAK,CAAC;AAChC,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport getMetroAssets from '@expo/metro-config/build/transform-worker/getAssets';\nimport assert from 'assert';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport splitBundleOptions from 'metro/src/lib/splitBundleOptions';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { deserializeEagerKey, getExportEmbedOptionsKey, Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { DevServerManager } from '../../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { assertMetroPrivateServer } from '../../start/server/metro/metroPrivateServer';\nimport { DOM_COMPONENTS_BUNDLE_DIR } from '../../start/server/middleware/DomComponentsMiddleware';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { copyAsync, removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { exportDomComponentAsync } from '../exportDomComponents';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { BundleAssetWithFileHashes, ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { exportStandaloneServerAsync } from './exportServer';\nimport { ensureProcessExitsAfterDelay } from '../../utils/exit';\nimport { resolveRealEntryFilePath } from '../../utils/filePath';\n\nconst debug = require('debug')('expo:export:embed');\n\n/**\n * Extended type for the Metro server build result to support the `code` property as a `Buffer`.\n */\ntype ExtendedMetroServerBuildResult =\n | Awaited<ReturnType<Server['build']>>\n | {\n code: string | Buffer;\n };\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (\n !bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//) &&\n !bundleOutput.match(/\\/CoreSimulator\\/Devices\\/.*\\/data\\/Containers\\/Bundle\\/Application\\//)\n ) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(`*.app/${bundleName}`, {\n cwd: bundleParent,\n absolute: true,\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n // The React Native build scripts always enable the cache reset but we shouldn't need this in CI environments.\n // By disabling it, we can eagerly bundle code before the build and reuse the cached artifacts in subsequent builds.\n if (env.CI && options.resetCache) {\n debug('CI environment detected, disabling automatic cache reset');\n options.resetCache = false;\n }\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // This is an optimized codepath that can occur during `npx expo run` and does not occur during builds from Xcode or Android Studio.\n // Here we reconcile a bundle pass that was run before the native build process. This order can fail faster and is show better errors since the logs won't be obscured by Xcode and Android Studio.\n // This path is also used for automatically deploying server bundles to a remote host.\n const eagerBundleOptions = env.__EXPO_EAGER_BUNDLE_OPTIONS\n ? deserializeEagerKey(env.__EXPO_EAGER_BUNDLE_OPTIONS)\n : null;\n if (eagerBundleOptions) {\n // Get the cache key for the current process to compare against the eager key.\n const inputKey = getExportEmbedOptionsKey(options);\n\n // If the app was bundled previously in the same process, then we should reuse the Metro cache.\n options.resetCache = false;\n\n if (eagerBundleOptions.key === inputKey) {\n // Copy the eager bundleOutput and assets to the new locations.\n await removeAsync(options.bundleOutput);\n\n copyAsync(eagerBundleOptions.options.bundleOutput, options.bundleOutput);\n\n if (eagerBundleOptions.options.assetsDest && options.assetsDest) {\n copyAsync(eagerBundleOptions.options.assetsDest, options.assetsDest);\n }\n\n console.log('info: Copied output to binary:', options.bundleOutput);\n return;\n }\n // TODO: sourcemapOutput is set on Android but not during eager. This is tolerable since it doesn't invalidate the Metro cache.\n console.log(' Eager key:', eagerBundleOptions.key);\n console.log('Request key:', inputKey);\n\n // TODO: We may want an analytic event here in the future to understand when this happens.\n console.warn('warning: Eager bundle does not match new options, bundling again.');\n }\n\n await exportEmbedInternalAsync(projectRoot, options);\n\n // Ensure the process closes after bundling\n ensureProcessExitsAfterDelay();\n}\n\nexport async function exportEmbedInternalAsync(projectRoot: string, options: Options) {\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets, files } = await exportEmbedBundleAndAssetsAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // On Android, dom components proxy files should write to the assets directory instead of the res directory.\n // We use the bundleOutput directory to get the assets directory.\n const domComponentProxyOutputDir =\n options.platform === 'android' ? path.dirname(options.bundleOutput) : options.assetsDest;\n const hasDomComponents = domComponentProxyOutputDir && files.size > 0;\n\n // Persist bundle and source maps.\n await Promise.all([\n // @ts-expect-error: The `save()` method from metro is typed to support `code: string` only but it also supports `Buffer` actually.\n output.save(bundle, options, Log.log),\n\n // Write dom components proxy files.\n hasDomComponents ? persistMetroFilesAsync(files, domComponentProxyOutputDir) : null,\n // Copy public folder for dom components only if\n hasDomComponents\n ? copyPublicFolderAsync(\n path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER),\n path.join(domComponentProxyOutputDir, DOM_COMPONENTS_BUNDLE_DIR)\n )\n : null,\n\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(projectRoot, assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAndAssetsAsync(\n projectRoot: string,\n options: Options\n): Promise<{\n bundle: ExtendedMetroServerBuildResult;\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n}> {\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: options.resetCache,\n maxWorkers: options.maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const { exp, pkg } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const files: ExportAssetMap = new Map();\n\n try {\n const bundles = await devServer.nativeExportBundleAsync(\n {\n // TODO: Re-enable when we get bytecode chunk splitting working again.\n splitChunks: false, //devServer.isReactServerComponentsEnabled,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: !!sourceMapUrl,\n bytecode: options.bytecode ?? false,\n // source map inline\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files,\n {\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n }\n );\n\n const apiRoutesEnabled =\n devServer.isReactServerComponentsEnabled || exp.web?.output === 'server';\n\n if (apiRoutesEnabled) {\n await exportStandaloneServerAsync(projectRoot, devServer, {\n exp,\n pkg,\n files,\n options,\n });\n }\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundles.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\n if (expoDomComponentReferences.length > 0) {\n await Promise.all(\n // TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.\n expoDomComponentReferences.map(async (filePath) => {\n const { bundle } = await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev: options.dev,\n devServer,\n isHermes,\n includeSourceMaps: !!sourceMapUrl,\n exp,\n files,\n });\n\n if (options.assetsDest) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // This is saving web-style inside of a native app's binary.\n await persistMetroAssetsAsync(\n projectRoot,\n bundle.assets.map((asset) => ({\n ...asset,\n httpServerLocation: path.join(DOM_COMPONENTS_BUNDLE_DIR, asset.httpServerLocation),\n })),\n {\n files,\n platform: 'web',\n outputDirectory: options.assetsDest,\n }\n );\n }\n })\n );\n }\n\n return {\n files,\n bundle: {\n code: bundles.artifacts.filter((a: any) => a.type === 'js')[0].source,\n // Can be optional when source maps aren't enabled.\n map: bundles.artifacts.filter((a: any) => a.type === 'map')[0]?.source.toString(),\n },\n assets: bundles.assets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n devServerManager.stopAsync();\n }\n}\n\n// Exports for expo-updates\nexport async function createMetroServerAndBundleRequestAsync(\n projectRoot: string,\n options: Pick<\n Options,\n | 'maxWorkers'\n | 'config'\n | 'platform'\n | 'sourcemapOutput'\n | 'sourcemapUseAbsolutePath'\n | 'entryFile'\n | 'minify'\n | 'dev'\n | 'resetCache'\n | 'unstableTransformProfile'\n >\n): Promise<{ server: Server; bundleRequest: BundleOptions }> {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n // TODO: This is always enabled in the native script and there's no way to disable it.\n resetCache: options.resetCache,\n\n maxWorkers: options.maxWorkers,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n getMetroBundler() {\n return server.getBundler().getBundler();\n },\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n // TODO(cedric): check if we can use the proper `bundleType=bundle` and `entryPoint=mainModuleName` properties\n // @ts-expect-error: see above\n const bundleRequest: BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n splitChunks: false,\n mainModuleName: resolveRealEntryFilePath(projectRoot, options.entryFile),\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n // Never output bytecode in the exported bundle since that is hardcoded in the native run script.\n bytecode: false,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n return { server, bundleRequest };\n}\n\nexport async function exportEmbedAssetsAsync(\n server: Server,\n bundleRequest: BundleOptions,\n projectRoot: string,\n options: Pick<Options, 'platform'>\n) {\n try {\n const { entryFile, onProgress, resolverOptions, transformOptions } = splitBundleOptions({\n ...bundleRequest,\n bundleType: 'todo',\n });\n\n assertMetroPrivateServer(server);\n\n const dependencies = await server._bundler.getDependencies(\n [entryFile],\n transformOptions,\n resolverOptions,\n { onProgress, shallow: false, lazy: false }\n );\n\n const config = server._config;\n\n return getMetroAssets(dependencies, {\n processModuleFilter: config.serializer.processModuleFilter,\n assetPlugins: config.transformer.assetPlugins,\n platform: transformOptions.platform!,\n // Forked out of Metro because the `this._getServerRootDir()` doesn't match the development\n // behavior.\n projectRoot: config.projectRoot, // this._getServerRootDir(),\n publicPath: config.transformer.publicPath,\n });\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["exportEmbedAsync","exportEmbedInternalAsync","exportEmbedBundleAndAssetsAsync","createMetroServerAndBundleRequestAsync","exportEmbedAssetsAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","cwd","absolute","dot","projectRoot","options","env","CI","resetCache","setNodeEnv","dev","load","eagerBundleOptions","__EXPO_EAGER_BUNDLE_OPTIONS","deserializeEagerKey","inputKey","getExportEmbedOptionsKey","key","removeAsync","copyAsync","assetsDest","console","log","warn","ensureProcessExitsAfterDelay","platform","previousPath","fs","existsSync","bundle","assets","files","mkdirSync","recursive","mode","domComponentProxyOutputDir","hasDomComponents","size","Promise","all","output","save","Log","persistMetroFilesAsync","copyPublicFolderAsync","resolve","EXPO_PUBLIC_FOLDER","join","DOM_COMPONENTS_BUNDLE_DIR","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","devServerManager","DevServerManager","startMetroAsync","minify","port","isExporting","location","resetDevServer","maxWorkers","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","exp","pkg","getConfig","skipSDKVersionRequirement","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","Map","bundles","nativeExportBundleAsync","splitChunks","mainModuleName","resolveRealEntryFilePath","entryFile","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","unstable_transformProfile","unstableTransformProfile","apiRoutesEnabled","isReactServerComponentsEnabled","web","exportStandaloneServerAsync","expoDomComponentReferences","artifacts","map","artifact","Array","isArray","metadata","flat","length","filePath","exportDomComponentAsync","includeSourceMaps","asset","httpServerLocation","code","filter","a","type","source","toString","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","stopAsync","config","loadMetroConfigAsync","getMetroBundler","server","getBundler","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","watch","onProgress","resolverOptions","transformOptions","splitBundleOptions","bundleType","assertMetroPrivateServer","dependencies","_bundler","getDependencies","shallow","lazy","_config","getMetroAssets","processModuleFilter","serializer","assetPlugins","transformer","publicPath","Error"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAiEsBA,gBAAgB,MAAhBA,gBAAgB;IAmDhBC,wBAAwB,MAAxBA,wBAAwB;IAmDxBC,+BAA+B,MAA/BA,+BAA+B;IAyI/BC,sCAAsC,MAAtCA,sCAAsC;IAuEtCC,sBAAsB,MAAtBA,sBAAsB;;;yBAvXlB,cAAc;;;;;;;8DACb,qDAAqD;;;;;;;8DAC7D,QAAQ;;;;;;;8DACZ,IAAI;;;;;;;yBACc,MAAM;;;;;;;8DACpB,kBAAkB;;;;;;;8DACN,kCAAkC;;;;;;;8DAC9C,gCAAgC;;;;;;;8DAElC,MAAM;;;;;;gCAEgD,kBAAkB;qCACzB,uBAAuB;qBACnE,WAAW;kCACE,qCAAqC;uCAChC,gDAAgD;kCACjD,2CAA2C;oCACvC,6CAA6C;yCAC5C,uDAAuD;8BACxC,4CAA4C;sBAC3E,kBAAkB;qBACL,iBAAiB;qBACpC,iBAAiB;yBACV,qBAAqB;qCACR,wBAAwB;8BAC1B,iBAAiB;oCACf,uBAAuB;8BACzB,iBAAiB;4BAC2B,eAAe;8BACrD,gBAAgB;sBACf,kBAAkB;0BACtB,sBAAsB;;;;;;AAE/D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAC;AAWpD,SAASC,0BAA0B,CAACC,YAAoB,EAAE;IACxD,+CAA+C;IAC/C,IACE,CAACA,YAAY,CAACC,KAAK,+CAA+C,IAClE,CAACD,YAAY,CAACC,KAAK,yEAAyE,EAC5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EC,IAAI,EAAE,KAAK;SAAE,CAC5C,AAAC;QAEF,MAAMpB,MAAM,GAAGG,MAAM,CAACkB,OAAO,AAAC;QAE9B,OAAOC,IAAAA,UAAc,EAAA,QAAA,EAACN,YAAY,EAAE;YAClCO,mBAAmB,EAAEvB,MAAM,CAACwB,UAAU,CAACD,mBAAmB;YAC1DE,YAAY,EAAEzB,MAAM,CAAC0B,WAAW,CAACD,YAAY;YAC7CzH,QAAQ,EAAE4G,gBAAgB,CAAC5G,QAAQ;YACnC,2FAA2F;YAC3F,YAAY;YACZrB,WAAW,EAAEqH,MAAM,CAACrH,WAAW;YAC/BgJ,UAAU,EAAE3B,MAAM,CAAC0B,WAAW,CAACC,UAAU;SAC1C,CAAC,CAAC;IACL,EAAE,OAAOlC,KAAK,EAAO;QACnB,IAAIC,OAAO,CAACD,KAAK,CAAC,EAAE;YAClB,0EAA0E;YAC1E,iIAAiI;YACjI,IAAI7G,OAAO,CAACoB,QAAQ,KAAK,KAAK,EAAE;gBAC9B,8FAA8F;gBAC9F,IAAI,SAAS,IAAIyF,KAAK,IAAIE,IAAAA,oBAAyB,0BAAA,GAAE,EAAE;oBACrDF,KAAK,CAACG,OAAO,GAAGC,IAAAA,KAAS,UAAA,EAACJ,KAAK,CAACG,OAAO,CAAC,AAAU,CAAC;gBACrD,CAAC;gBACDE,IAAAA,oBAAoB,qBAAA,EAACnH,WAAW,EAAE8G,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QACD,MAAMA,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAASC,OAAO,CAACD,KAAU,EAAkB;IAC3C,OAAOA,KAAK,YAAYmC,KAAK,CAAC;AAChC,CAAC"}
|
|
@@ -186,14 +186,18 @@ async function runServerDeployCommandAsync(projectRoot, { distDirectory , deploy
|
|
|
186
186
|
if (!_env.env.EXPO_UNSTABLE_DEPLOY_SERVER) {
|
|
187
187
|
return false;
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
(
|
|
194
|
-
|
|
189
|
+
if (!_env.env.EAS_BUILD) {
|
|
190
|
+
// This check helps avoid running EAS if the user isn't a user of EAS.
|
|
191
|
+
// We only need to run it when building outside of EAS.
|
|
192
|
+
const globalBin = getCommandBin("eas");
|
|
193
|
+
if (!globalBin) {
|
|
194
|
+
// This should never happen from EAS Builds.
|
|
195
|
+
// Possible to happen when building locally with `npx expo run`
|
|
196
|
+
(0, _xcodeCompilerLogger.logMetroErrorInXcode)(projectRoot, `eas-cli is not installed globally, skipping server deployment. Install EAS CLI with 'npm install -g eas-cli'.`);
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
debug("Found eas-cli:", globalBin);
|
|
195
200
|
}
|
|
196
|
-
debug("Found eas-cli:", globalBin);
|
|
197
201
|
let json;
|
|
198
202
|
try {
|
|
199
203
|
let results;
|
|
@@ -215,8 +219,8 @@ async function runServerDeployCommandAsync(projectRoot, { distDirectory , deploy
|
|
|
215
219
|
} else {
|
|
216
220
|
(0, _xcodeCompilerLogger.logInXcode)("Deploying server to link with client");
|
|
217
221
|
// results = DEPLOYMENT_SUCCESS_FIXTURE;
|
|
218
|
-
results = await (0, _spawnAsync().default)("
|
|
219
|
-
|
|
222
|
+
results = await (0, _spawnAsync().default)("npx", [
|
|
223
|
+
"eas-cli",
|
|
220
224
|
"deploy",
|
|
221
225
|
"--non-interactive",
|
|
222
226
|
"--json",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/exportServer.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig, modifyConfigAsync, PackageJSONConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { execSync } from 'node:child_process';\nimport path from 'path';\n\nimport { disableNetwork } from '../../api/settings';\nimport { Log } from '../../log';\nimport { isSpawnResultError } from '../../start/platforms/ios/xcrun';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { exportApiRoutesStandaloneAsync } from '../exportStaticAsync';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { Options } from './resolveOptions';\nimport {\n isExecutingFromXcodebuild,\n logInXcode,\n logMetroErrorInXcode,\n warnInXcode,\n} from './xcodeCompilerLogger';\n\nconst debug = require('debug')('expo:export:server');\n\ntype ServerDeploymentResults = {\n url: string;\n dashboardUrl?: string;\n};\n\nexport async function exportStandaloneServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n exp,\n pkg,\n files,\n options,\n }: { exp: ExpoConfig; pkg: PackageJSONConfig; files: ExportAssetMap; options: Options }\n) {\n if (!options.eager) {\n await tryRemovingGeneratedOriginAsync(projectRoot, exp);\n }\n\n logInXcode('Exporting server');\n\n // Store the server output in the project's .expo directory.\n const serverOutput = path.join(projectRoot, '.expo/server', options.platform);\n\n // Remove the previous server output to prevent stale files.\n await removeAsync(serverOutput);\n\n // Export the API routes for server rendering the React Server Components.\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n // Copy over public folder items\n await copyPublicFolderAsync(publicPath, serverOutput);\n\n // Copy over the server output on top of the public folder.\n await persistMetroFilesAsync(files, serverOutput);\n\n [...files.entries()].forEach(([key, value]) => {\n if (value.targetDomain === 'server') {\n // Delete server resources to prevent them from being exposed in the binary.\n files.delete(key);\n }\n });\n\n // TODO: Deprecate this in favor of a built-in prop that users should avoid setting.\n const userDefinedServerUrl = exp.extra?.router?.origin;\n let serverUrl = userDefinedServerUrl;\n\n const shouldSkipServerDeployment = (() => {\n if (!options.eager) {\n logInXcode('Skipping server deployment because the script is not running in eager mode.');\n return true;\n }\n\n // Add an opaque flag to disable server deployment.\n if (env.EXPO_NO_DEPLOY) {\n warnInXcode('Skipping server deployment because environment variable EXPO_NO_DEPLOY is set.');\n return true;\n }\n\n // Can't safely deploy from Xcode since the PATH isn't set up correctly. We could amend this in the future and allow users who customize the PATH to deploy from Xcode.\n if (isExecutingFromXcodebuild()) {\n // TODO: Don't warn when the eager bundle has been run.\n warnInXcode(\n 'Skipping server deployment because the build is running from an Xcode run script. Build with Expo CLI or EAS Build to deploy the server automatically.'\n );\n return true;\n }\n\n return false;\n })();\n\n // Deploy the server output to a hosting provider.\n const deployedServerUrl = shouldSkipServerDeployment\n ? false\n : await runServerDeployCommandAsync(projectRoot, {\n distDirectory: serverOutput,\n deployScript: getServerDeploymentScript(pkg.scripts, options.platform),\n });\n\n if (!deployedServerUrl) {\n return;\n }\n\n if (serverUrl) {\n logInXcode(\n `Using custom server URL: ${serverUrl} (ignoring deployment URL: ${deployedServerUrl})`\n );\n }\n\n // If the user-defined server URL is not defined, use the deployed server URL.\n // This allows for overwriting the server URL in the project's native files.\n serverUrl ||= deployedServerUrl;\n\n // If the user hasn't manually defined the server URL, write the deployed server URL to the app.json.\n if (userDefinedServerUrl) {\n Log.log('Skip automatically linking server origin to native container');\n return;\n }\n Log.log('Writing generated server URL to app.json');\n\n // NOTE: Is is it possible to assert that the config needs to be modifiable before building the app?\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: serverUrl,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n throw new CommandError(\n `Failed to write generated server origin to app.json because the file is dynamic and does not extend the static config. The client will not be able to make server requests to API routes or static files. You can disable server linking with EXPO_NO_DEPLOY=1 or by disabling server output in the app.json.`\n );\n }\n}\n\nasync function dumpDeploymentLogs(projectRoot: string, logs: string, name = 'deploy') {\n const outputPath = path.join(projectRoot, `.expo/logs/${name}.log`);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n debug('Dumping server deployment logs to: ' + outputPath);\n await fs.promises.writeFile(outputPath, logs);\n return outputPath;\n}\n\nfunction getCommandBin(command: string) {\n try {\n return execSync(`command -v ${command}`, { stdio: 'pipe' }).toString().trim();\n } catch {\n return null;\n }\n}\n\nasync function runServerDeployCommandAsync(\n projectRoot: string,\n {\n distDirectory,\n deployScript,\n }: { distDirectory: string; deployScript: { scriptName: string; script: string } | null }\n): Promise<string | false> {\n const logOfflineError = () => {\n const manualScript = deployScript\n ? `npm run ${deployScript.scriptName}`\n : `npx eas deploy --export-dir ${distDirectory}`;\n\n logMetroErrorInXcode(\n projectRoot,\n chalk.red`Running CLI in offline mode, skipping server deployment. Deploy manually with: ${manualScript}`\n );\n };\n if (env.EXPO_OFFLINE) {\n logOfflineError();\n return false;\n }\n\n // TODO: Only allow EAS deployments when staging is enabled, this is because the feature is still staging-only.\n if (!env.EXPO_UNSTABLE_DEPLOY_SERVER) {\n return false;\n }\n\n const globalBin = getCommandBin('eas');\n if (!globalBin) {\n // This should never happen from EAS Builds.\n // Possible to happen when building locally with `npx expo run`\n logMetroErrorInXcode(\n projectRoot,\n `eas-cli is not installed globally, skipping server deployment. Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n debug('Found eas-cli:', globalBin);\n\n let json: any;\n try {\n let results: spawnAsync.SpawnResult;\n\n const spawnOptions: spawnAsync.SpawnOptions = {\n cwd: projectRoot,\n // Ensures that errors can be caught.\n stdio: 'pipe',\n };\n // TODO: Support absolute paths in EAS CLI\n const exportDir = path.relative(projectRoot, distDirectory);\n if (deployScript) {\n logInXcode(`Using custom server deploy script: ${deployScript.scriptName}`);\n // Amend the path to try and make the custom scripts work.\n\n results = await spawnAsync(\n 'npm',\n ['run', deployScript.scriptName, `--export-dir=${exportDir}`],\n spawnOptions\n );\n } else {\n logInXcode('Deploying server to link with client');\n\n // results = DEPLOYMENT_SUCCESS_FIXTURE;\n results = await spawnAsync(\n 'node',\n [globalBin, 'deploy', '--non-interactive', '--json', `--export-dir=${exportDir}`],\n spawnOptions\n );\n\n debug('Server deployment stdout:', results.stdout);\n\n // Send stderr to stderr. stdout is parsed as JSON.\n if (results.stderr) {\n process.stderr.write(results.stderr);\n }\n }\n\n const logPath = await dumpDeploymentLogs(projectRoot, results.output.join('\\n'));\n\n try {\n // {\n // \"dashboardUrl\": \"https://staging.expo.dev/projects/6460c11c-e1bc-4084-882a-fd9f57b825b1/hosting/deployments\",\n // \"identifier\": \"8a1pwbv6c5\",\n // \"url\": \"https://sep30--8a1pwbv6c5.staging.expo.app\"\n // }\n json = JSON.parse(results.stdout.trim());\n } catch {\n logMetroErrorInXcode(\n projectRoot,\n `Failed to parse server deployment JSON output. Check the logs for more information: ${logPath}`\n );\n return false;\n }\n } catch (error) {\n if (isSpawnResultError(error)) {\n const output = error.output.join('\\n').trim() || error.toString();\n Log.log(\n chalk.dim(\n 'An error occurred while deploying server. Logs stored at: ' +\n (await dumpDeploymentLogs(projectRoot, output, 'deploy-error'))\n )\n );\n\n // Likely a server offline or network error.\n if (output.match(/ENOTFOUND/)) {\n logOfflineError();\n // Print the raw error message to help provide more context.\n Log.log(chalk.dim(output));\n // Prevent any other network requests (unlikely for this command).\n disableNetwork();\n return false;\n }\n\n logInXcode(output);\n if (output.match(/spawn eas ENOENT/)) {\n // EAS not installed.\n logMetroErrorInXcode(\n projectRoot,\n `Server deployment failed because eas-cli cannot be accessed from the build script's environment (ENOENT). Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n\n if (error.stderr.match(/Must configure EAS project by running/)) {\n // EAS not configured, this can happen when building a project locally before building in EAS.\n // User must run `eas init`, `eas deploy`, or `eas build` first.\n\n // TODO: Should we fail the build here or just warn users?\n logMetroErrorInXcode(\n projectRoot,\n `Skipping server deployment because EAS is not configured. Run 'eas init' before trying again, or disable server output in the project.`\n );\n return false;\n }\n }\n\n // Throw unhandled server deployment errors.\n throw error;\n }\n\n // Assert json format\n assertDeploymentJsonOutput(json);\n\n // Warn about the URL not being valid. This should never happen, but might be possible with third-parties.\n if (!canParseURL(json.url)) {\n warnInXcode(`The server deployment URL is not a valid URL: ${json.url}`);\n }\n\n if (json.dashboardUrl) {\n logInXcode(`Server dashboard: ${json.dashboardUrl}`);\n }\n\n logInXcode(`Server deployed to: ${json.url}`);\n\n return json.url;\n}\n\nfunction canParseURL(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction assertDeploymentJsonOutput(json: any): asserts json is ServerDeploymentResults {\n if (!json || typeof json !== 'object' || typeof json.url !== 'string') {\n throw new Error(\n 'JSON output of server deployment command are not in the expected format: { url: \"https://...\" }'\n );\n }\n}\n\nfunction getServerDeploymentScript(\n scripts: Record<string, string> | undefined,\n platform: string\n): { scriptName: string; script: string } | null {\n // Users can overwrite the default deployment script with:\n // { scripts: { \"native:deploy\": \"eas deploy --json --non-interactive\" } }\n // A quick search on GitHub showed that `native:deploy` is not used in any public repos yet.\n // https://github.com/search?q=%22native%3Adeploy%22+path%3Apackage.json&type=code\n const DEFAULT_SCRIPT_NAME = 'native:deploy';\n\n const scriptNames = [\n // DEFAULT_SCRIPT_NAME + ':' + platform,\n DEFAULT_SCRIPT_NAME,\n ];\n\n for (const scriptName of scriptNames) {\n if (scripts?.[scriptName]) {\n return { scriptName, script: scripts[scriptName] };\n }\n }\n\n return null;\n}\n\n/** We can try to remove the generated origin from the manifest when running outside of eager mode. Bundling is the last operation to run so the config will already be embedded with the origin. */\nasync function tryRemovingGeneratedOriginAsync(projectRoot: string, exp: ExpoConfig) {\n if (env.CI) {\n // Skip in CI since nothing is committed.\n return;\n }\n if (exp.extra?.router?.generatedOrigin == null) {\n debug('No generated origin needs removing');\n return;\n }\n\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: undefined,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n debug('Could not remove generated origin from manifest');\n } else {\n debug('Generated origin has been removed from manifest');\n }\n}\n"],"names":["exportStandaloneServerAsync","debug","require","projectRoot","devServer","exp","pkg","files","options","eager","tryRemovingGeneratedOriginAsync","logInXcode","serverOutput","path","join","platform","removeAsync","exportApiRoutesStandaloneAsync","apiRoutesOnly","publicPath","resolve","env","EXPO_PUBLIC_FOLDER","copyPublicFolderAsync","persistMetroFilesAsync","entries","forEach","key","value","targetDomain","delete","userDefinedServerUrl","extra","router","origin","serverUrl","shouldSkipServerDeployment","EXPO_NO_DEPLOY","warnInXcode","isExecutingFromXcodebuild","deployedServerUrl","runServerDeployCommandAsync","distDirectory","deployScript","getServerDeploymentScript","scripts","Log","log","modification","modifyConfigAsync","generatedOrigin","skipSDKVersionRequirement","type","CommandError","dumpDeploymentLogs","logs","name","outputPath","fs","promises","mkdir","dirname","recursive","writeFile","getCommandBin","command","execSync","stdio","toString","trim","logOfflineError","manualScript","scriptName","logMetroErrorInXcode","chalk","red","EXPO_OFFLINE","EXPO_UNSTABLE_DEPLOY_SERVER","globalBin","json","results","spawnOptions","cwd","exportDir","relative","spawnAsync","stdout","stderr","process","write","logPath","output","JSON","parse","error","isSpawnResultError","dim","match","disableNetwork","assertDeploymentJsonOutput","canParseURL","url","dashboardUrl","URL","Error","DEFAULT_SCRIPT_NAME","scriptNames","script","CI","undefined"],"mappings":"AAAA;;;;;CAKC,GACD;;;;+BAgCsBA,6BAA2B;;aAA3BA,2BAA2B;;;yBAhCgB,cAAc;;;;;;;8DACxD,mBAAmB;;;;;;;8DACxB,OAAO;;;;;;;8DACV,IAAI;;;;;;;yBACM,oBAAoB;;;;;;;8DAC5B,MAAM;;;;;;0BAEQ,oBAAoB;qBAC/B,WAAW;uBACI,iCAAiC;qBAExC,iBAAiB;q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MAAM,SAAA,GAAjB5B,KAAAA,CAAiB,QAAE6C,eAAe,AAAjB,CAAA,IAAqB,IAAI,EAAE;QAC9CjD,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC5C,OAAO;IACT,CAAC;IAED,MAAM+C,YAAY,GAAG,MAAMC,IAAAA,OAAiB,EAAA,kBAAA,EAC1C9C,WAAW,EACX;QACE6B,KAAK,EAAE;YACL,GAAI3B,GAAG,CAAC2B,KAAK,IAAI,EAAE;YACnBC,MAAM,EAAE;gBACN,GAAI5B,CAAAA,CAAAA,IAAS,GAATA,GAAG,CAAC2B,KAAK,SAAQ,GAAjB3B,KAAAA,CAAiB,GAAjBA,IAAS,CAAE4B,MAAM,CAAA,IAAI,EAAE;gBAC3BiB,eAAe,EAAE2D,SAAS;aAC3B;SACF;KACF,EACD;QACE1D,yBAAyB,EAAE,IAAI;KAChC,CACF,AAAC;IAEF,IAAIH,YAAY,CAACI,IAAI,KAAK,SAAS,EAAE;QACnCnD,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,OAAO;QACLA,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportServer.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig, modifyConfigAsync, PackageJSONConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { execSync } from 'node:child_process';\nimport path from 'path';\n\nimport { disableNetwork } from '../../api/settings';\nimport { Log } from '../../log';\nimport { isSpawnResultError } from '../../start/platforms/ios/xcrun';\nimport { MetroBundlerDevServer } from '../../start/server/metro/MetroBundlerDevServer';\nimport { removeAsync } from '../../utils/dir';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { exportApiRoutesStandaloneAsync } from '../exportStaticAsync';\nimport { copyPublicFolderAsync } from '../publicFolder';\nimport { ExportAssetMap, persistMetroFilesAsync } from '../saveAssets';\nimport { Options } from './resolveOptions';\nimport {\n isExecutingFromXcodebuild,\n logInXcode,\n logMetroErrorInXcode,\n warnInXcode,\n} from './xcodeCompilerLogger';\n\nconst debug = require('debug')('expo:export:server');\n\ntype ServerDeploymentResults = {\n url: string;\n dashboardUrl?: string;\n};\n\nexport async function exportStandaloneServerAsync(\n projectRoot: string,\n devServer: MetroBundlerDevServer,\n {\n exp,\n pkg,\n files,\n options,\n }: { exp: ExpoConfig; pkg: PackageJSONConfig; files: ExportAssetMap; options: Options }\n) {\n if (!options.eager) {\n await tryRemovingGeneratedOriginAsync(projectRoot, exp);\n }\n\n logInXcode('Exporting server');\n\n // Store the server output in the project's .expo directory.\n const serverOutput = path.join(projectRoot, '.expo/server', options.platform);\n\n // Remove the previous server output to prevent stale files.\n await removeAsync(serverOutput);\n\n // Export the API routes for server rendering the React Server Components.\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n // Copy over public folder items\n await copyPublicFolderAsync(publicPath, serverOutput);\n\n // Copy over the server output on top of the public folder.\n await persistMetroFilesAsync(files, serverOutput);\n\n [...files.entries()].forEach(([key, value]) => {\n if (value.targetDomain === 'server') {\n // Delete server resources to prevent them from being exposed in the binary.\n files.delete(key);\n }\n });\n\n // TODO: Deprecate this in favor of a built-in prop that users should avoid setting.\n const userDefinedServerUrl = exp.extra?.router?.origin;\n let serverUrl = userDefinedServerUrl;\n\n const shouldSkipServerDeployment = (() => {\n if (!options.eager) {\n logInXcode('Skipping server deployment because the script is not running in eager mode.');\n return true;\n }\n\n // Add an opaque flag to disable server deployment.\n if (env.EXPO_NO_DEPLOY) {\n warnInXcode('Skipping server deployment because environment variable EXPO_NO_DEPLOY is set.');\n return true;\n }\n\n // Can't safely deploy from Xcode since the PATH isn't set up correctly. We could amend this in the future and allow users who customize the PATH to deploy from Xcode.\n if (isExecutingFromXcodebuild()) {\n // TODO: Don't warn when the eager bundle has been run.\n warnInXcode(\n 'Skipping server deployment because the build is running from an Xcode run script. Build with Expo CLI or EAS Build to deploy the server automatically.'\n );\n return true;\n }\n\n return false;\n })();\n\n // Deploy the server output to a hosting provider.\n const deployedServerUrl = shouldSkipServerDeployment\n ? false\n : await runServerDeployCommandAsync(projectRoot, {\n distDirectory: serverOutput,\n deployScript: getServerDeploymentScript(pkg.scripts, options.platform),\n });\n\n if (!deployedServerUrl) {\n return;\n }\n\n if (serverUrl) {\n logInXcode(\n `Using custom server URL: ${serverUrl} (ignoring deployment URL: ${deployedServerUrl})`\n );\n }\n\n // If the user-defined server URL is not defined, use the deployed server URL.\n // This allows for overwriting the server URL in the project's native files.\n serverUrl ||= deployedServerUrl;\n\n // If the user hasn't manually defined the server URL, write the deployed server URL to the app.json.\n if (userDefinedServerUrl) {\n Log.log('Skip automatically linking server origin to native container');\n return;\n }\n Log.log('Writing generated server URL to app.json');\n\n // NOTE: Is is it possible to assert that the config needs to be modifiable before building the app?\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: serverUrl,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n throw new CommandError(\n `Failed to write generated server origin to app.json because the file is dynamic and does not extend the static config. The client will not be able to make server requests to API routes or static files. You can disable server linking with EXPO_NO_DEPLOY=1 or by disabling server output in the app.json.`\n );\n }\n}\n\nasync function dumpDeploymentLogs(projectRoot: string, logs: string, name = 'deploy') {\n const outputPath = path.join(projectRoot, `.expo/logs/${name}.log`);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n debug('Dumping server deployment logs to: ' + outputPath);\n await fs.promises.writeFile(outputPath, logs);\n return outputPath;\n}\n\nfunction getCommandBin(command: string) {\n try {\n return execSync(`command -v ${command}`, { stdio: 'pipe' }).toString().trim();\n } catch {\n return null;\n }\n}\n\nasync function runServerDeployCommandAsync(\n projectRoot: string,\n {\n distDirectory,\n deployScript,\n }: { distDirectory: string; deployScript: { scriptName: string; script: string } | null }\n): Promise<string | false> {\n const logOfflineError = () => {\n const manualScript = deployScript\n ? `npm run ${deployScript.scriptName}`\n : `npx eas deploy --export-dir ${distDirectory}`;\n\n logMetroErrorInXcode(\n projectRoot,\n chalk.red`Running CLI in offline mode, skipping server deployment. Deploy manually with: ${manualScript}`\n );\n };\n if (env.EXPO_OFFLINE) {\n logOfflineError();\n return false;\n }\n\n // TODO: Only allow EAS deployments when staging is enabled, this is because the feature is still staging-only.\n if (!env.EXPO_UNSTABLE_DEPLOY_SERVER) {\n return false;\n }\n\n if (!env.EAS_BUILD) {\n // This check helps avoid running EAS if the user isn't a user of EAS.\n // We only need to run it when building outside of EAS.\n const globalBin = getCommandBin('eas');\n if (!globalBin) {\n // This should never happen from EAS Builds.\n // Possible to happen when building locally with `npx expo run`\n logMetroErrorInXcode(\n projectRoot,\n `eas-cli is not installed globally, skipping server deployment. Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n debug('Found eas-cli:', globalBin);\n }\n\n let json: any;\n try {\n let results: spawnAsync.SpawnResult;\n\n const spawnOptions: spawnAsync.SpawnOptions = {\n cwd: projectRoot,\n // Ensures that errors can be caught.\n stdio: 'pipe',\n };\n // TODO: Support absolute paths in EAS CLI\n const exportDir = path.relative(projectRoot, distDirectory);\n if (deployScript) {\n logInXcode(`Using custom server deploy script: ${deployScript.scriptName}`);\n // Amend the path to try and make the custom scripts work.\n\n results = await spawnAsync(\n 'npm',\n ['run', deployScript.scriptName, `--export-dir=${exportDir}`],\n spawnOptions\n );\n } else {\n logInXcode('Deploying server to link with client');\n\n // results = DEPLOYMENT_SUCCESS_FIXTURE;\n results = await spawnAsync(\n 'npx',\n ['eas-cli', 'deploy', '--non-interactive', '--json', `--export-dir=${exportDir}`],\n spawnOptions\n );\n\n debug('Server deployment stdout:', results.stdout);\n\n // Send stderr to stderr. stdout is parsed as JSON.\n if (results.stderr) {\n process.stderr.write(results.stderr);\n }\n }\n\n const logPath = await dumpDeploymentLogs(projectRoot, results.output.join('\\n'));\n\n try {\n // {\n // \"dashboardUrl\": \"https://staging.expo.dev/projects/6460c11c-e1bc-4084-882a-fd9f57b825b1/hosting/deployments\",\n // \"identifier\": \"8a1pwbv6c5\",\n // \"url\": \"https://sep30--8a1pwbv6c5.staging.expo.app\"\n // }\n json = JSON.parse(results.stdout.trim());\n } catch {\n logMetroErrorInXcode(\n projectRoot,\n `Failed to parse server deployment JSON output. Check the logs for more information: ${logPath}`\n );\n return false;\n }\n } catch (error) {\n if (isSpawnResultError(error)) {\n const output = error.output.join('\\n').trim() || error.toString();\n Log.log(\n chalk.dim(\n 'An error occurred while deploying server. Logs stored at: ' +\n (await dumpDeploymentLogs(projectRoot, output, 'deploy-error'))\n )\n );\n\n // Likely a server offline or network error.\n if (output.match(/ENOTFOUND/)) {\n logOfflineError();\n // Print the raw error message to help provide more context.\n Log.log(chalk.dim(output));\n // Prevent any other network requests (unlikely for this command).\n disableNetwork();\n return false;\n }\n\n logInXcode(output);\n if (output.match(/spawn eas ENOENT/)) {\n // EAS not installed.\n logMetroErrorInXcode(\n projectRoot,\n `Server deployment failed because eas-cli cannot be accessed from the build script's environment (ENOENT). Install EAS CLI with 'npm install -g eas-cli'.`\n );\n return false;\n }\n\n if (error.stderr.match(/Must configure EAS project by running/)) {\n // EAS not configured, this can happen when building a project locally before building in EAS.\n // User must run `eas init`, `eas deploy`, or `eas build` first.\n\n // TODO: Should we fail the build here or just warn users?\n logMetroErrorInXcode(\n projectRoot,\n `Skipping server deployment because EAS is not configured. Run 'eas init' before trying again, or disable server output in the project.`\n );\n return false;\n }\n }\n\n // Throw unhandled server deployment errors.\n throw error;\n }\n\n // Assert json format\n assertDeploymentJsonOutput(json);\n\n // Warn about the URL not being valid. This should never happen, but might be possible with third-parties.\n if (!canParseURL(json.url)) {\n warnInXcode(`The server deployment URL is not a valid URL: ${json.url}`);\n }\n\n if (json.dashboardUrl) {\n logInXcode(`Server dashboard: ${json.dashboardUrl}`);\n }\n\n logInXcode(`Server deployed to: ${json.url}`);\n\n return json.url;\n}\n\nfunction canParseURL(url: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction assertDeploymentJsonOutput(json: any): asserts json is ServerDeploymentResults {\n if (!json || typeof json !== 'object' || typeof json.url !== 'string') {\n throw new Error(\n 'JSON output of server deployment command are not in the expected format: { url: \"https://...\" }'\n );\n }\n}\n\nfunction getServerDeploymentScript(\n scripts: Record<string, string> | undefined,\n platform: string\n): { scriptName: string; script: string } | null {\n // Users can overwrite the default deployment script with:\n // { scripts: { \"native:deploy\": \"eas deploy --json --non-interactive\" } }\n // A quick search on GitHub showed that `native:deploy` is not used in any public repos yet.\n // https://github.com/search?q=%22native%3Adeploy%22+path%3Apackage.json&type=code\n const DEFAULT_SCRIPT_NAME = 'native:deploy';\n\n const scriptNames = [\n // DEFAULT_SCRIPT_NAME + ':' + platform,\n DEFAULT_SCRIPT_NAME,\n ];\n\n for (const scriptName of scriptNames) {\n if (scripts?.[scriptName]) {\n return { scriptName, script: scripts[scriptName] };\n }\n }\n\n return null;\n}\n\n/** We can try to remove the generated origin from the manifest when running outside of eager mode. Bundling is the last operation to run so the config will already be embedded with the origin. */\nasync function tryRemovingGeneratedOriginAsync(projectRoot: string, exp: ExpoConfig) {\n if (env.CI) {\n // Skip in CI since nothing is committed.\n return;\n }\n if (exp.extra?.router?.generatedOrigin == null) {\n debug('No generated origin needs removing');\n return;\n }\n\n const modification = await modifyConfigAsync(\n projectRoot,\n {\n extra: {\n ...(exp.extra ?? {}),\n router: {\n ...(exp.extra?.router ?? {}),\n generatedOrigin: undefined,\n },\n },\n },\n {\n skipSDKVersionRequirement: true,\n }\n );\n\n if (modification.type !== 'success') {\n debug('Could not remove generated origin from manifest');\n } else {\n debug('Generated origin has been removed from manifest');\n }\n}\n"],"names":["exportStandaloneServerAsync","debug","require","projectRoot","devServer","exp","pkg","files","options","eager","tryRemovingGeneratedOriginAsync","logInXcode","serverOutput","path","join","platform","removeAsync","exportApiRoutesStandaloneAsync","apiRoutesOnly","publicPath","resolve","env","EXPO_PUBLIC_FOLDER","copyPublicFolderAsync","persistMetroFilesAsync","entries","forEach","key","value","targetDomain","delete","userDefinedServerUrl","extra","router","origin","serverUrl","shouldSkipServerDeployment","EXPO_NO_DEPLOY","warnInXcode","isExecutingFromXcodebuild","deployedServerUrl","runServerDeployCommandAsync","distDirectory","deployScript","getServerDeploymentScript","scripts","Log","log","modification","modifyConfigAsync","generatedOrigin","skipSDKVersionRequirement","type","CommandError","dumpDeploymentLogs","logs","name","outputPath","fs","promises","mkdir","dirname","recursive","writeFile","getCommandBin","command","execSync","stdio","toString","trim","logOfflineError","manualScript","scriptName","logMetroErrorInXcode","chalk","red","EXPO_OFFLINE","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","globalBin","json","results","spawnOptions","cwd","exportDir","relative","spawnAsync","stdout","stderr","process","write","logPath","output","JSON","parse","error","isSpawnResultError","dim","match","disableNetwork","assertDeploymentJsonOutput","canParseURL","url","dashboardUrl","URL","Error","DEFAULT_SCRIPT_NAME","scriptNames","script","CI","undefined"],"mappings":"AAAA;;;;;CAKC,GACD;;;;+BAgCsBA,6BAA2B;;aAA3BA,2BAA2B;;;yBAhCgB,cAAc;;;;;;;8DACxD,mBAAmB;;;;;;;8DACxB,OAAO;;;;;;;8DACV,IAAI;;;;;;;yBACM,oBAAoB;;;;;;;8DAC5B,MAAM;;;;;;0BAEQ,oBAAoB;qBAC/B,WAAW;uBACI,iCAAiC;qBAExC,iBAAiB;qBACzB,iBAAiB;wBACR,oBAAoB;mCACF,sBAAsB;8BAC/B,iBAAiB;4BACA,eAAe;qCAO/D,uBAAuB;;;;;;AAE9B,MAAMC,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AAAA,CAAiB,QAAE6C,eAAe,AAAjB,CAAA,IAAqB,IAAI,EAAE;QAC9CjD,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC5C,OAAO;IACT,CAAC;IAED,MAAM+C,YAAY,GAAG,MAAMC,IAAAA,OAAiB,EAAA,kBAAA,EAC1C9C,WAAW,EACX;QACE6B,KAAK,EAAE;YACL,GAAI3B,GAAG,CAAC2B,KAAK,IAAI,EAAE;YACnBC,MAAM,EAAE;gBACN,GAAI5B,CAAAA,CAAAA,IAAS,GAATA,GAAG,CAAC2B,KAAK,SAAQ,GAAjB3B,KAAAA,CAAiB,GAAjBA,IAAS,CAAE4B,MAAM,CAAA,IAAI,EAAE;gBAC3BiB,eAAe,EAAE4D,SAAS;aAC3B;SACF;KACF,EACD;QACE3D,yBAAyB,EAAE,IAAI;KAChC,CACF,AAAC;IAEF,IAAIH,YAAY,CAACI,IAAI,KAAK,SAAS,EAAE;QACnCnD,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,OAAO;QACLA,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
|
|
@@ -87,6 +87,8 @@ const expoExportEmbed = async (argv)=>{
|
|
|
87
87
|
"--config-cmd": String,
|
|
88
88
|
// New flag to guess the other flags based on the environment.
|
|
89
89
|
"--eager": Boolean,
|
|
90
|
+
// Export the bundle as Hermes bytecode bundle
|
|
91
|
+
"--bytecode": Boolean,
|
|
90
92
|
// This is here for compatibility with the `npx react-native bundle` command.
|
|
91
93
|
// devs should use `DEBUG=expo:*` instead.
|
|
92
94
|
"--verbose": Boolean,
|
|
@@ -118,6 +120,7 @@ const expoExportEmbed = async (argv)=>{
|
|
|
118
120
|
`--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,
|
|
119
121
|
`--reset-cache Removes cached files`,
|
|
120
122
|
`--eager Eagerly export the bundle with default options`,
|
|
123
|
+
`--bytecode Export the bundle as Hermes bytecode bundle`,
|
|
121
124
|
`-v, --verbose Enables debug logging`,
|
|
122
125
|
`--config <string> Path to the CLI configuration file`,
|
|
123
126
|
// This is seemingly unused.
|
|
@@ -134,6 +137,7 @@ const expoExportEmbed = async (argv)=>{
|
|
|
134
137
|
return (async ()=>{
|
|
135
138
|
const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {
|
|
136
139
|
"--eager": Boolean,
|
|
140
|
+
"--bytecode": Boolean,
|
|
137
141
|
"--dev": Boolean,
|
|
138
142
|
"--minify": Boolean,
|
|
139
143
|
"--sourcemap-use-absolute-path": Boolean,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { Command } from '../../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../../utils/args';\n\nexport const expoExportEmbed: Command = async (argv) => {\n const rawArgsMap: arg.Spec = {\n // Types\n '--entry-file': String,\n '--platform': String,\n '--transformer': String,\n '--bundle-output': String,\n '--bundle-encoding': String,\n '--max-workers': Number,\n '--sourcemap-output': String,\n '--sourcemap-sources-root': String,\n '--assets-dest': String,\n '--asset-catalog-dest': String,\n '--unstable-transform-profile': String,\n '--config': String,\n\n // Hack: This is added because react-native-xcode.sh script always includes this value.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--config-cmd': String,\n\n // New flag to guess the other flags based on the environment.\n '--eager': Boolean,\n\n // This is here for compatibility with the `npx react-native bundle` command.\n // devs should use `DEBUG=expo:*` instead.\n '--verbose': Boolean,\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n '-v': '--verbose',\n };\n const args = assertWithOptionsArgs(rawArgsMap, {\n argv,\n permissive: true,\n });\n\n if (args['--help']) {\n printHelp(\n `(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`,\n chalk`npx expo export:embed {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--entry-file <path> Path to the root JS file, either absolute or relative to JS root`,\n `--platform <string> Either \"ios\" or \"android\" (default: \"ios\")`,\n `--transformer <string> Specify a custom transformer to be used`,\n `--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,\n `--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,\n `--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,\n `--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: \"utf8\")`,\n `--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,\n `--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,\n `--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,\n `--sourcemap-use-absolute-path Report SourceMapURL using its full path`,\n `--assets-dest <string> Directory name where to store assets referenced in the bundle`,\n `--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,\n `--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,\n `--reset-cache Removes cached files`,\n `--eager Eagerly export the bundle with default options`,\n `-v, --verbose Enables debug logging`,\n\n `--config <string> Path to the CLI configuration file`,\n // This is seemingly unused.\n `--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,\n\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const [\n { exportEmbedAsync },\n { resolveOptions },\n { logCmdError },\n { resolveCustomBooleanArgsAsync },\n ] = await Promise.all([\n import('./exportEmbedAsync.js'),\n import('./resolveOptions.js'),\n import('../../utils/errors.js'),\n import('../../utils/resolveArgs.js'),\n ]);\n\n return (async () => {\n const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {\n '--eager': Boolean,\n '--dev': Boolean,\n '--minify': Boolean,\n '--sourcemap-use-absolute-path': Boolean,\n '--reset-cache': Boolean,\n '--read-global-cache': Boolean,\n });\n\n const projectRoot = path.resolve(parsed.projectRoot);\n return exportEmbedAsync(projectRoot, resolveOptions(projectRoot, args, parsed));\n })().catch(logCmdError);\n};\n"],"names":["expoExportEmbed","argv","rawArgsMap","String","Number","Boolean","args","assertWithOptionsArgs","permissive","printHelp","chalk","join","exportEmbedAsync","resolveOptions","logCmdError","resolveCustomBooleanArgsAsync","Promise","all","parsed","projectRoot","path","resolve","catch"],"mappings":"AAAA;;;;;+BAQaA,iBAAe;;aAAfA,eAAe;;;8DANV,OAAO;;;;;;;8DACR,MAAM;;;;;;sBAG0B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5D,MAAMA,eAAe,GAAY,OAAOC,IAAI,GAAK;IACtD,MAAMC,UAAU,GAAa;QAC3B,QAAQ;QACR,cAAc,EAAEC,MAAM;QACtB,YAAY,EAAEA,MAAM;QACpB,eAAe,EAAEA,MAAM;QACvB,iBAAiB,EAAEA,MAAM;QACzB,mBAAmB,EAAEA,MAAM;QAC3B,eAAe,EAAEC,MAAM;QACvB,oBAAoB,EAAED,MAAM;QAC5B,0BAA0B,EAAEA,MAAM;QAClC,eAAe,EAAEA,MAAM;QACvB,sBAAsB,EAAEA,MAAM;QAC9B,8BAA8B,EAAEA,MAAM;QACtC,UAAU,EAAEA,MAAM;QAElB,uFAAuF;QACvF,sFAAsF;QACtF,uGAAuG;QACvG,cAAc,EAAEA,MAAM;QAEtB,8DAA8D;QAC9D,SAAS,EAAEE,OAAO;
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { Command } from '../../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../../utils/args';\n\nexport const expoExportEmbed: Command = async (argv) => {\n const rawArgsMap: arg.Spec = {\n // Types\n '--entry-file': String,\n '--platform': String,\n '--transformer': String,\n '--bundle-output': String,\n '--bundle-encoding': String,\n '--max-workers': Number,\n '--sourcemap-output': String,\n '--sourcemap-sources-root': String,\n '--assets-dest': String,\n '--asset-catalog-dest': String,\n '--unstable-transform-profile': String,\n '--config': String,\n\n // Hack: This is added because react-native-xcode.sh script always includes this value.\n // If supplied, we'll do nothing with the value, but at least the process won't crash.\n // Note that we also don't show this value in the `--help` prompt since we don't want people to use it.\n '--config-cmd': String,\n\n // New flag to guess the other flags based on the environment.\n '--eager': Boolean,\n // Export the bundle as Hermes bytecode bundle\n '--bytecode': Boolean,\n\n // This is here for compatibility with the `npx react-native bundle` command.\n // devs should use `DEBUG=expo:*` instead.\n '--verbose': Boolean,\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n '-v': '--verbose',\n };\n const args = assertWithOptionsArgs(rawArgsMap, {\n argv,\n permissive: true,\n });\n\n if (args['--help']) {\n printHelp(\n `(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`,\n chalk`npx expo export:embed {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--entry-file <path> Path to the root JS file, either absolute or relative to JS root`,\n `--platform <string> Either \"ios\" or \"android\" (default: \"ios\")`,\n `--transformer <string> Specify a custom transformer to be used`,\n `--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,\n `--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,\n `--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,\n `--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: \"utf8\")`,\n `--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,\n `--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,\n `--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,\n `--sourcemap-use-absolute-path Report SourceMapURL using its full path`,\n `--assets-dest <string> Directory name where to store assets referenced in the bundle`,\n `--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,\n `--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,\n `--reset-cache Removes cached files`,\n `--eager Eagerly export the bundle with default options`,\n `--bytecode Export the bundle as Hermes bytecode bundle`,\n `-v, --verbose Enables debug logging`,\n\n `--config <string> Path to the CLI configuration file`,\n // This is seemingly unused.\n `--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,\n\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const [\n { exportEmbedAsync },\n { resolveOptions },\n { logCmdError },\n { resolveCustomBooleanArgsAsync },\n ] = await Promise.all([\n import('./exportEmbedAsync.js'),\n import('./resolveOptions.js'),\n import('../../utils/errors.js'),\n import('../../utils/resolveArgs.js'),\n ]);\n\n return (async () => {\n const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {\n '--eager': Boolean,\n '--bytecode': Boolean,\n '--dev': Boolean,\n '--minify': Boolean,\n '--sourcemap-use-absolute-path': Boolean,\n '--reset-cache': Boolean,\n '--read-global-cache': Boolean,\n });\n\n const projectRoot = path.resolve(parsed.projectRoot);\n return exportEmbedAsync(projectRoot, resolveOptions(projectRoot, args, parsed));\n })().catch(logCmdError);\n};\n"],"names":["expoExportEmbed","argv","rawArgsMap","String","Number","Boolean","args","assertWithOptionsArgs","permissive","printHelp","chalk","join","exportEmbedAsync","resolveOptions","logCmdError","resolveCustomBooleanArgsAsync","Promise","all","parsed","projectRoot","path","resolve","catch"],"mappings":"AAAA;;;;;+BAQaA,iBAAe;;aAAfA,eAAe;;;8DANV,OAAO;;;;;;;8DACR,MAAM;;;;;;sBAG0B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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rD,OAAOP,gBAAgB,CAACO,WAAW,EAAEN,cAAc,CAACM,WAAW,EAAEb,IAAI,EAAEY,MAAM,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC,EAAE,CAACI,KAAK,CAACR,WAAW,CAAC,CAAC;AAC1B,CAAC,AAAC"}
|
|
@@ -88,7 +88,8 @@ function resolveOptions(projectRoot, args, parsed) {
|
|
|
88
88
|
config: args["--config"] ? _path().default.resolve(args["--config"]) : undefined,
|
|
89
89
|
dev,
|
|
90
90
|
minify: parsed.args["--minify"],
|
|
91
|
-
eager: !!parsed.args["--eager"]
|
|
91
|
+
eager: !!parsed.args["--eager"],
|
|
92
|
+
bytecode: parsed.args["--bytecode"]
|
|
92
93
|
};
|
|
93
94
|
if (commonOptions.eager) {
|
|
94
95
|
return resolveEagerOptionsAsync(projectRoot, commonOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport arg from 'arg';\nimport type { OutputOptions } from 'metro/src/shared/types';\nimport canonicalize from 'metro-core/src/canonicalize';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n bundleOutput =\n platform === 'ios'\n ? path.join(destination, 'main.jsbundle')\n : path.join(destination, 'index.js');\n }\n\n return {\n ...options,\n eager: options.eager ?? true,\n bundleOutput,\n assetsDest,\n entryFile: options.entryFile ?? resolveEntryPoint(projectRoot, { platform }),\n resetCache: !!options.resetCache,\n platform,\n minify,\n dev,\n bundleEncoding: 'utf8',\n sourcemapUseAbsolutePath: false,\n verbose: env.EXPO_DEBUG,\n };\n}\n\nexport function getExportEmbedOptionsKey({\n // Extract all values that won't change the Metro results.\n resetCache,\n assetsDest,\n bundleOutput,\n verbose,\n maxWorkers,\n eager,\n ...options\n}: Options) {\n // Create a sorted key for the options, removing values that won't change the Metro results.\n return JSON.stringify(options, canonicalize);\n}\n\nexport function deserializeEagerKey(key: string) {\n return JSON.parse(key) as { options: Options; key: string };\n}\n"],"names":["resolveOptions","resolveEagerOptionsAsync","getExportEmbedOptionsKey","deserializeEagerKey","assertIsBoolean","val","CommandError","getBundleEncoding","encoding","undefined","projectRoot","args","parsed","dev","platform","bundleOutput","commonOptions","entryFile","resolveEntryPoint","assetCatalogDest","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","minify","eager","getTemporaryPath","join","os","tmpdir","Math","random","toString","substring","options","isAndroidUs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AAA,CAACK,IAAI,CAACU,WAAW,EAAE,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO;QACL,GAAGH,OAAO;QACVT,KAAK,EAAES,OAAO,CAACT,KAAK,IAAI,IAAI;QAC5BrB,YAAY;QACZW,UAAU;QACVT,SAAS,EAAE4B,OAAO,CAAC5B,SAAS,IAAIC,IAAAA,MAAiB,EAAA,kBAAA,EAACR,WAAW,EAAE;YAAEI,QAAQ;SAAE,CAAC;QAC5Ec,UAAU,EAAE,CAAC,CAACiB,OAAO,CAACjB,UAAU;QAChCd,QAAQ;QACRqB,MAAM;QACNtB,GAAG;QACHQ,cAAc,EAAE,MAAM;QACtBI,wBAAwB,EAAE,KAAK;QAC/BI,OAAO,EAAEC,IAAG,IAAA,CAACC,UAAU;KACxB,CAAC;AACJ,CAAC;AAEM,SAAS7B,wBAAwB,CAAC,EACvC,0DAA0D;AAC1D0B,UAAU,CAAA,EACVF,UAAU,CAAA,EACVX,YAAY,CAAA,EACZc,OAAO,CAAA,EACPP,UAAU,CAAA,EACVc,KAAK,CAAA,EACL,GAAGS,OAAO,EACF,EAAE;IACV,4FAA4F;IAC5F,OAAOI,IAAI,CAACC,SAAS,CAACL,OAAO,EAAEM,aAAY,EAAA,QAAA,CAAC,CAAC;AAC/C,CAAC;AAEM,SAAShD,mBAAmB,CAACiD,GAAW,EAAE;IAC/C,OAAOH,IAAI,CAACI,KAAK,CAACD,GAAG,CAAC,CAAsC;AAC9D,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import { resolveEntryPoint } from '@expo/config/paths';\nimport arg from 'arg';\nimport type { OutputOptions } from 'metro/src/shared/types';\nimport canonicalize from 'metro-core/src/canonicalize';\nimport os from 'os';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\nimport { isAndroidUsingHermes, isIosUsingHermes } from '../exportHermes';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: OutputOptions['bundleEncoding'];\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile?: string;\n eager?: boolean;\n bytecode?: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nfunction getBundleEncoding(encoding: string | undefined): OutputOptions['bundleEncoding'] {\n return encoding === 'utf8' || encoding === 'utf16le' || encoding === 'ascii'\n ? encoding\n : undefined;\n}\n\nexport function resolveOptions(\n projectRoot: string,\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const platform = args['--platform'];\n if (!platform) {\n throw new CommandError(`Missing required argument: --platform`);\n }\n\n const bundleOutput = args['--bundle-output'];\n\n const commonOptions = {\n entryFile: args['--entry-file'] ?? resolveEntryPoint(projectRoot, { platform }),\n assetCatalogDest: args['--asset-catalog-dest'],\n platform,\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: getBundleEncoding(args['--bundle-encoding']) ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'],\n resetCache: !!parsed.args['--reset-cache'],\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n minify: parsed.args['--minify'] as boolean | undefined,\n eager: !!parsed.args['--eager'],\n bytecode: parsed.args['--bytecode'] as boolean | undefined,\n };\n\n if (commonOptions.eager) {\n return resolveEagerOptionsAsync(projectRoot, commonOptions);\n }\n\n // Perform extra assertions after the eager options are resolved.\n\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n\n const minify = parsed.args['--minify'] ?? !dev;\n assertIsBoolean(minify);\n\n return { ...commonOptions, minify, bundleOutput };\n}\n\nfunction getTemporaryPath() {\n return path.join(os.tmpdir(), Math.random().toString(36).substring(2));\n}\n\n/** Best effort guess of which options will be used for the export:embed invocation that is called from the native build scripts. */\nexport function resolveEagerOptionsAsync(\n projectRoot: string,\n {\n dev,\n platform,\n assetsDest,\n bundleOutput,\n minify,\n ...options\n }: Partial<Omit<Options, 'platform' | 'dev'>> & {\n platform: string;\n dev: boolean;\n }\n): Options {\n // If the minify prop is undefined, then check if the project is using hermes.\n minify ??= !(platform === 'android'\n ? isAndroidUsingHermes(projectRoot)\n : isIosUsingHermes(projectRoot));\n\n let destination: string | undefined;\n\n if (!assetsDest) {\n destination ??= getTemporaryPath();\n assetsDest = path.join(destination, 'assets');\n }\n\n if (!bundleOutput) {\n destination ??= getTemporaryPath();\n bundleOutput =\n platform === 'ios'\n ? path.join(destination, 'main.jsbundle')\n : path.join(destination, 'index.js');\n }\n\n return {\n ...options,\n eager: options.eager ?? true,\n bundleOutput,\n assetsDest,\n entryFile: options.entryFile ?? resolveEntryPoint(projectRoot, { platform }),\n resetCache: !!options.resetCache,\n platform,\n minify,\n dev,\n bundleEncoding: 'utf8',\n sourcemapUseAbsolutePath: false,\n verbose: env.EXPO_DEBUG,\n };\n}\n\nexport function getExportEmbedOptionsKey({\n // Extract all values that won't change the Metro results.\n resetCache,\n assetsDest,\n bundleOutput,\n verbose,\n maxWorkers,\n eager,\n ...options\n}: Options) {\n // Create a sorted key for the options, removing values that won't change the Metro results.\n return JSON.stringify(options, canonicalize);\n}\n\nexport function deserializeEagerKey(key: string) {\n return JSON.parse(key) as { options: Options; key: string };\n}\n"],"names":["resolveOptions","resolveEagerOptionsAsync","getExportEmbedOptionsKey","deserializeEagerKey","assertIsBoolean","val","CommandError","getBundleEncoding","encoding","undefined","projectRoot","args","parsed","dev","platform","bundleOutput","commonOptions","entryFile","resolveEntryPoint","assetCatalogDest","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","resetCache","verbose","env","EXPO_DEBUG","config","path","resolve","minify","eager","bytecode","getTemporaryPath","join","os","tmpdir","Math","random","toString","substring","options","isAndroidUsingHermes","isIosUsingHermes","destination","JSON","stringify","canonicalize","key","parse"],"mappings":"AAAA;;;;;;;;;;;IA8CgBA,cAAc,MAAdA,cAAc;IA4DdC,wBAAwB,MAAxBA,wBAAwB;IAkDxBC,wBAAwB,MAAxBA,wBAAwB;IAcxBC,mBAAmB,MAAnBA,mBAAmB;;;yBA1KD,oBAAoB;;;;;;;8DAG7B,6BAA6B;;;;;;;8DACvC,IAAI;;;;;;;8DACF,MAAM;;;;;;qBAEH,iBAAiB;wBACR,oBAAoB;8BAEM,iBAAiB;;;;;;AAwBxE,SAASC,eAAe,CAACC,GAAQ,EAA0B;IACzD,IAAI,OAAOA,GAAG,KAAK,SAAS,EAAE;QAC5B,MAAM,IAAIC,OAAY,aAAA,CAAC,CAAC,sBAAsB,EAAE,OAAOD,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAASE,iBAAiB,CAACC,QAA4B,EAAmC;IACxF,OAAOA,QAAQ,KAAK,MAAM,IAAIA,QAAQ,KAAK,SAAS,IAAIA,QAAQ,KAAK,OAAO,GACxEA,QAAQ,GACRC,SAAS,CAAC;AAChB,CAAC;AAEM,SAAST,cAAc,CAC5BU,WAAmB,EACnBC,IAA0B,EAC1BC,MAAiE,EACxD;IACT,MAAMC,GAAG,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ACL,OAAO,EAAEM,aAAY,EAAA,QAAA,CAAC,CAAC;AAC/C,CAAC;AAEM,SAASjD,mBAAmB,CAACkD,GAAW,EAAE;IAC/C,OAAOH,IAAI,CAACI,KAAK,CAACD,GAAG,CAAC,CAAsC;AAC9D,CAAC"}
|
|
@@ -14,6 +14,7 @@ function _export(target, all) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
_export(exports, {
|
|
17
|
+
isPossiblyUnableToResolveError: ()=>isPossiblyUnableToResolveError,
|
|
17
18
|
getXcodeCompilerErrorMessage: ()=>getXcodeCompilerErrorMessage,
|
|
18
19
|
logMetroErrorInXcode: ()=>logMetroErrorInXcode,
|
|
19
20
|
logInXcode: ()=>logInXcode,
|