@expo/cli 0.22.18 → 0.22.20
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/export/exportApp.js +10 -6
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportDomComponents.js +41 -41
- package/build/src/export/exportDomComponents.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +7 -0
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js +2 -1
- package/build/src/run/ios/appleDevice/client/UsbmuxdClient.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +3 -2
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/utils/telemetry/Telemetry.js +5 -6
- package/build/src/utils/telemetry/Telemetry.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/FetchDetachedClient.js +82 -0
- package/build/src/utils/telemetry/clients/FetchDetachedClient.js.map +1 -0
- package/build/src/utils/telemetry/clients/flushFetchDetached.js +39 -0
- package/build/src/utils/telemetry/clients/flushFetchDetached.js.map +1 -0
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +7 -7
package/build/bin/cli
CHANGED
|
@@ -200,7 +200,6 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
200
200
|
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler)
|
|
201
201
|
}, files);
|
|
202
202
|
bundles[platform] = bundle;
|
|
203
|
-
domComponentAssetsMetadata[platform] = [];
|
|
204
203
|
(0, _saveAssets.getFilesFromSerialAssets)(bundle.artifacts, {
|
|
205
204
|
includeSourceMaps: sourceMaps,
|
|
206
205
|
files,
|
|
@@ -210,7 +209,6 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
210
209
|
const expoDomComponentReferences = bundle.artifacts.map((artifact)=>Array.isArray(artifact.metadata.expoDomComponentReferences) ? artifact.metadata.expoDomComponentReferences : []).flat();
|
|
211
210
|
await Promise.all(// TODO: Make a version of this which uses `this.metro.getBundler().buildGraphForEntries([])` to bundle all the DOM components at once.
|
|
212
211
|
expoDomComponentReferences.map(async (filePath)=>{
|
|
213
|
-
var ref;
|
|
214
212
|
const { bundle: platformDomComponentsBundle , htmlOutputName } = await (0, _exportDomComponents.exportDomComponentAsync)({
|
|
215
213
|
filePath,
|
|
216
214
|
projectRoot,
|
|
@@ -219,19 +217,25 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
219
217
|
isHermes,
|
|
220
218
|
includeSourceMaps: sourceMaps,
|
|
221
219
|
exp,
|
|
222
|
-
files
|
|
220
|
+
files,
|
|
221
|
+
useMd5Filename: true
|
|
223
222
|
});
|
|
224
223
|
// Merge the assets from the DOM component into the output assets.
|
|
225
224
|
// @ts-expect-error: mutate assets
|
|
226
225
|
bundle.assets.push(...platformDomComponentsBundle.assets);
|
|
227
|
-
|
|
226
|
+
(0, _exportDomComponents.transformNativeBundleForMd5Filename)({
|
|
228
227
|
domComponentReference: filePath,
|
|
229
228
|
nativeBundle: bundle,
|
|
230
|
-
domComponentBundle: platformDomComponentsBundle,
|
|
231
229
|
files,
|
|
232
230
|
htmlOutputName
|
|
233
231
|
});
|
|
234
|
-
|
|
232
|
+
domComponentAssetsMetadata[platform] = [
|
|
233
|
+
...await (0, _exportDomComponents.addDomBundleToMetadataAsync)(platformDomComponentsBundle),
|
|
234
|
+
...(0, _exportDomComponents.transformDomEntryForMd5Filename)({
|
|
235
|
+
files,
|
|
236
|
+
htmlOutputName
|
|
237
|
+
}),
|
|
238
|
+
];
|
|
235
239
|
}));
|
|
236
240
|
if (platform === "web") {
|
|
237
241
|
// TODO: Unify with exportStaticAsync
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n exportDomComponentAsync,\n updateDomComponentAssetsForMD5Naming,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport {\n ExportAssetMap,\n BundleOutput,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n} from './saveAssets';\nimport { createAssetMap } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {\n Log.warn(\n `Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`\n );\n }\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const mode = dev ? 'development' : 'production';\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.nativeExportBundleAsync(\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: getEntryWithServerRoot(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files\n );\n\n bundles[platform] = bundle;\n domComponentAssetsMetadata[platform] = [];\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled,\n });\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\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: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n });\n\n // Merge the assets from the DOM component into the output assets.\n // @ts-expect-error: mutate assets\n bundle.assets.push(...platformDomComponentsBundle.assets);\n\n const assetsMetadata = updateDomComponentAssetsForMD5Naming({\n domComponentReference: filePath,\n nativeBundle: bundle,\n domComponentBundle: platformDomComponentsBundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform]?.push(...assetsMetadata);\n })\n );\n\n if (platform === 'web') {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","minify","bytecode","maxWorkers","skipSSG","exp","setNodeEnv","require","load","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","platform","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","reactCompiler","experiments","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","assets","push","assetsMetadata","updateDomComponentAssetsForMD5Naming","domComponentReference","nativeBundle","domComponentBundle","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":"AAAA;;;;+BAuCsBA,gBAAc;;aAAdA,cAAc;;;yBAvCV,cAAc;;;;;;;8DAErB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;oCAEmC,sBAAsB;8BAC9C,gBAAgB;qCAI3C,uBAAuB;8BACmC,gBAAgB;mCACX,qBAAqB;yBAC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Y,EAAE,QAAQ;qBACvB,CAAC,CAAC;gBACL,CAAC;YACH,OAAO,IACL,wCAAwC;YACxC,CAAChE,SAAS,CAACO,8BAA8B,EACzC;oBAUmBhD,IAAe;gBATlC,MAAM8H,IAAAA,kBAAqB,sBAAA,EAACzI,WAAW,EAAEoD,SAAS,EAAE;oBAClDhB,IAAI;oBACJO,KAAK;oBACLxC,KAAK,EAAE,CAAC,CAACA,KAAK;oBACdD,SAAS,EAAEwC,UAAU;oBACrBnC,MAAM;oBACNoB,OAAO;oBACP2D,iBAAiB,EAAEhF,UAAU;oBAC7BoI,UAAU,EAAEC,IAAAA,OAAsC,uCAAA,EAAC3I,WAAW,EAAEW,GAAG,CAAC;oBACpEuE,aAAa,EAAE,CAAC,CAACvE,CAAAA,CAAAA,IAAe,GAAfA,GAAG,CAACwE,WAAW,SAAe,GAA9BxE,KAAAA,CAA8B,GAA9BA,IAAe,CAAEuE,aAAa,CAAA;oBAC/CmD,YAAY;oBACZ5H,UAAU;oBACVwC,WAAW,EAAE,IAAI;oBACjBtC,GAAG,EAAEI,aAAa,CAACJ,GAAG;iBACvB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,SAAU;QACR,MAAMkC,gBAAgB,CAAC+F,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,kDAAkD;IAClD,MAAMC,IAAAA,WAAsB,uBAAA,EAAClG,KAAK,EAAED,UAAU,CAAC,CAAC;AAClD,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type { Platform } from '@expo/config';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { type PlatformMetadata, createMetadataJson } from './createMetadataJson';\nimport { exportAssetsAsync } from './exportAssets';\nimport {\n addDomBundleToMetadataAsync,\n exportDomComponentAsync,\n transformNativeBundleForMd5Filename,\n transformDomEntryForMd5Filename,\n} from './exportDomComponents';\nimport { assertEngineMismatchAsync, isEnableHermesManaged } from './exportHermes';\nimport { exportApiRoutesStandaloneAsync, exportFromServerAsync } from './exportStaticAsync';\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { copyPublicFolderAsync } from './publicFolder';\nimport { Options } from './resolveOptions';\nimport {\n ExportAssetMap,\n BundleOutput,\n getFilesFromSerialAssets,\n persistMetroFilesAsync,\n} from './saveAssets';\nimport { createAssetMap } from './writeContents';\nimport * as Log from '../log';\nimport { WebSupportProjectPrerequisite } from '../start/doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { getEntryWithServerRoot } from '../start/server/middleware/ManifestMiddleware';\nimport { getBaseUrlFromExpoConfig } from '../start/server/middleware/metroOptions';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { env } from '../utils/env';\nimport { CommandError } from '../utils/errors';\nimport { setNodeEnv } from '../utils/nodeEnv';\n\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n sourceMaps,\n minify,\n bytecode,\n maxWorkers,\n skipSSG,\n }: Pick<\n Options,\n | 'dumpAssetmap'\n | 'sourceMaps'\n | 'dev'\n | 'clear'\n | 'outputDir'\n | 'platforms'\n | 'minify'\n | 'bytecode'\n | 'maxWorkers'\n | 'skipSSG'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n const exp = await getPublicExpoManifestAsync(projectRoot, {\n // Web doesn't require validation.\n skipValidation: platforms.length === 1 && platforms[0] === 'web',\n });\n\n if (platforms.includes('web')) {\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n }\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n if (skipSSG && exp.web?.output !== 'server') {\n throw new CommandError('--no-ssg can only be used with `web.output: server`');\n }\n\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n\n if (!bytecode && (platforms.includes('ios') || platforms.includes('android'))) {\n Log.warn(\n `Bytecode makes the app startup faster, disabling bytecode is highly discouraged and should only be used for debugging purposes.`\n );\n }\n\n // Print out logs\n if (baseUrl) {\n Log.log();\n Log.log(chalk.gray`Using (experimental) base path: ${baseUrl}`);\n // Warn if not using an absolute path.\n if (!baseUrl.startsWith('/')) {\n Log.log(\n chalk.yellow` Base path does not start with a slash. Requests will not be absolute.`\n );\n }\n }\n\n const mode = dev ? 'development' : 'production';\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n const outputPath = path.resolve(projectRoot, outputDir);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n\n const files: ExportAssetMap = new Map();\n\n const devServerManager = await DevServerManager.startMetroAsync(projectRoot, {\n minify,\n mode,\n port: 8081,\n isExporting: true,\n location: {},\n resetDevServer: clear,\n maxWorkers,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const bundles: Partial<Record<Platform, BundleOutput>> = {};\n const domComponentAssetsMetadata: Partial<Record<Platform, PlatformMetadata['assets']>> = {};\n\n const spaPlatforms =\n // TODO: Support server and static rendering for server component exports.\n useServerRendering && !devServer.isReactServerComponentsEnabled\n ? platforms.filter((platform) => platform !== 'web')\n : platforms;\n\n try {\n if (devServer.isReactServerComponentsEnabled) {\n // In RSC mode, we only need these to be in the client dir.\n // TODO: Merge back with other copy after we add SSR.\n try {\n await copyPublicFolderAsync(publicPath, path.join(outputPath, 'client'));\n } catch (error) {\n Log.error('Failed to copy public directory to dist directory');\n throw error;\n }\n } else {\n // NOTE(kitten): The public folder is currently always copied, regardless of targetDomain\n // split. Hence, there's another separate `copyPublicFolderAsync` call below for `web`\n await copyPublicFolderAsync(publicPath, outputPath);\n }\n\n let templateHtml: string | undefined;\n // Can be empty during web-only SSG.\n if (spaPlatforms.length) {\n await Promise.all(\n spaPlatforms.map(async (platform) => {\n // Assert early so the user doesn't have to wait until bundling is complete to find out that\n // Hermes won't be available.\n const isHermes = isEnableHermesManaged(exp, platform);\n if (isHermes) {\n await assertEngineMismatchAsync(projectRoot, exp, platform);\n }\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.nativeExportBundleAsync(\n {\n platform,\n splitChunks:\n !env.EXPO_NO_BUNDLE_SPLITTING &&\n ((devServer.isReactServerComponentsEnabled && !bytecode) || platform === 'web'),\n mainModuleName: getEntryWithServerRoot(projectRoot, {\n platform,\n pkg: projectConfig.pkg,\n }),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: sourceMaps,\n bytecode: bytecode && isHermes,\n reactCompiler: !!exp.experiments?.reactCompiler,\n },\n files\n );\n\n bundles[platform] = bundle;\n\n getFilesFromSerialAssets(bundle.artifacts, {\n includeSourceMaps: sourceMaps,\n files,\n isServerHosted: devServer.isReactServerComponentsEnabled,\n });\n\n // TODO: Remove duplicates...\n const expoDomComponentReferences = bundle.artifacts\n .map((artifact) =>\n Array.isArray(artifact.metadata.expoDomComponentReferences)\n ? artifact.metadata.expoDomComponentReferences\n : []\n )\n .flat();\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: platformDomComponentsBundle, htmlOutputName } =\n await exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps: sourceMaps,\n exp,\n files,\n useMd5Filename: true,\n });\n\n // Merge the assets from the DOM component into the output assets.\n // @ts-expect-error: mutate assets\n bundle.assets.push(...platformDomComponentsBundle.assets);\n\n transformNativeBundleForMd5Filename({\n domComponentReference: filePath,\n nativeBundle: bundle,\n files,\n htmlOutputName,\n });\n domComponentAssetsMetadata[platform] = [\n ...(await addDomBundleToMetadataAsync(platformDomComponentsBundle)),\n ...transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n }),\n ];\n })\n );\n\n if (platform === 'web') {\n // TODO: Unify with exportStaticAsync\n // TODO: Maybe move to the serializer.\n let html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [],\n cssLinks: [],\n exp: projectConfig.exp,\n }),\n baseUrl,\n });\n\n // Add the favicon assets to the HTML.\n const modifyHtml = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n exp: projectConfig.exp,\n });\n if (modifyHtml) {\n html = modifyHtml(html);\n }\n\n // HACK: This is used for adding SSR shims in React Server Components.\n templateHtml = html;\n\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n files.set('index.html', {\n contents: html,\n targetDomain: devServer.isReactServerComponentsEnabled ? 'server' : 'client',\n });\n }\n })\n );\n\n if (devServer.isReactServerComponentsEnabled) {\n const isWeb = platforms.includes('web');\n\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: !isWeb,\n templateHtml,\n });\n }\n\n // TODO: Use same asset system across platforms again.\n const { assets, embeddedHashSet } = await exportAssetsAsync(projectRoot, {\n files,\n exp,\n outputDir: outputPath,\n bundles,\n baseUrl,\n });\n\n if (dumpAssetmap) {\n Log.log('Creating asset map');\n files.set('assetmap.json', { contents: JSON.stringify(createAssetMap({ assets })) });\n }\n\n const targetDomain = devServer.isReactServerComponentsEnabled ? 'client/' : '';\n const fileNames = Object.fromEntries(\n Object.entries(bundles).map(([platform, bundle]) => [\n platform,\n bundle.artifacts\n .filter((asset) => asset.type === 'js')\n .map((asset) => targetDomain + asset.filename),\n ])\n );\n\n // Generate a `metadata.json` for EAS Update.\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n domComponentAssetsMetadata,\n });\n files.set('metadata.json', { contents: JSON.stringify(contents) });\n }\n\n // Additional web-only steps...\n\n if (platforms.includes('web') && useServerRendering) {\n const exportServer = exp.web?.output === 'server';\n\n if (exportServer) {\n // TODO: Remove when this is abstracted into the files map\n await copyPublicFolderAsync(publicPath, path.resolve(outputPath, 'client'));\n }\n\n if (skipSSG) {\n Log.log('Skipping static site generation');\n await exportApiRoutesStandaloneAsync(devServer, {\n files,\n platform: 'web',\n apiRoutesOnly: true,\n });\n\n // Output a placeholder index.html if one doesn't exist in the public directory.\n // This ensures native + API routes have some content at the root URL.\n const placeholderIndex = path.resolve(outputPath, 'client/index.html');\n if (!fs.existsSync(placeholderIndex)) {\n files.set('index.html', {\n contents: `<html><body></body></html>`,\n targetDomain: 'client',\n });\n }\n } else if (\n // TODO: Support static export with RSC.\n !devServer.isReactServerComponentsEnabled\n ) {\n await exportFromServerAsync(projectRoot, devServer, {\n mode,\n files,\n clear: !!clear,\n outputDir: outputPath,\n minify,\n baseUrl,\n includeSourceMaps: sourceMaps,\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n reactCompiler: !!exp.experiments?.reactCompiler,\n exportServer,\n maxWorkers,\n isExporting: true,\n exp: projectConfig.exp,\n });\n }\n }\n } finally {\n await devServerManager.stopAsync();\n }\n\n // Write all files at the end for unified logging.\n await persistMetroFilesAsync(files, outputPath);\n}\n"],"names":["exportAppAsync","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","sourceMaps","minify","bytecode","maxWorkers","skipSSG","exp","setNodeEnv","require","load","projectConfig","getConfig","getPublicExpoManifestAsync","skipValidation","length","includes","WebSupportProjectPrerequisite","assertAsync","useServerRendering","web","output","CommandError","baseUrl","getBaseUrlFromExpoConfig","Log","warn","log","chalk","gray","startsWith","yellow","mode","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","files","Map","devServerManager","DevServerManager","startMetroAsync","port","isExporting","location","resetDevServer","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","bundles","domComponentAssetsMetadata","spaPlatforms","isReactServerComponentsEnabled","filter","platform","copyPublicFolderAsync","join","error","templateHtml","Promise","all","map","isHermes","isEnableHermesManaged","assertEngineMismatchAsync","bundle","nativeExportBundleAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","getEntryWithServerRoot","pkg","engine","undefined","serializerIncludeMaps","reactCompiler","experiments","getFilesFromSerialAssets","artifacts","includeSourceMaps","isServerHosted","expoDomComponentReferences","artifact","Array","isArray","metadata","flat","filePath","platformDomComponentsBundle","htmlOutputName","exportDomComponentAsync","useMd5Filename","assets","push","transformNativeBundleForMd5Filename","domComponentReference","nativeBundle","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","html","serializeHtmlWithAssets","resources","template","createTemplateHtmlFromExpoConfigAsync","scripts","cssLinks","modifyHtml","getVirtualFaviconAssetsAsync","set","contents","targetDomain","isWeb","exportApiRoutesStandaloneAsync","apiRoutesOnly","embeddedHashSet","exportAssetsAsync","JSON","stringify","createAssetMap","fileNames","Object","fromEntries","entries","asset","type","filename","createMetadataJson","exportServer","placeholderIndex","fs","existsSync","exportFromServerAsync","routerRoot","getRouterDirectoryModuleIdWithManifest","stopAsync","persistMetroFilesAsync"],"mappings":"AAAA;;;;+BAyCsBA,gBAAc;;aAAdA,cAAc;;;yBAzCV,cAAc;;;;;;;8DAErB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DACV,IAAI;;;;;;;8DACF,MAAM;;;;;;oCAEmC,sBAAsB;8BAC9C,gBAAgB;qCAM3C,uBAAuB;8BACmC,gBAAgB;mCACX,qBAAqB;yBAC9C,WAAW;uCACb,yBAAyB;8BAC9B,gBAAgB;4BAO/C,cAAc;+BACU,iBAAiB;2DAC3B,QAAQ;+CACiB,mDAAmD;kCAChE,kCAAkC;uCAC7B,6CAA6C;wBAC5B,8BAA8B;+BAC7C,qCAAqC;o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,KAAK;oBACLxC,KAAK,EAAE,CAAC,CAACA,KAAK;oBACdD,SAAS,EAAEwC,UAAU;oBACrBnC,MAAM;oBACNoB,OAAO;oBACP2D,iBAAiB,EAAEhF,UAAU;oBAC7BqI,UAAU,EAAEC,IAAAA,OAAsC,uCAAA,EAAC5I,WAAW,EAAEW,GAAG,CAAC;oBACpEuE,aAAa,EAAE,CAAC,CAACvE,CAAAA,CAAAA,IAAe,GAAfA,GAAG,CAACwE,WAAW,SAAe,GAA9BxE,KAAAA,CAA8B,GAA9BA,IAAe,CAAEuE,aAAa,CAAA;oBAC/CoD,YAAY;oBACZ7H,UAAU;oBACVwC,WAAW,EAAE,IAAI;oBACjBtC,GAAG,EAAEI,aAAa,CAACJ,GAAG;iBACvB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,SAAU;QACR,MAAMkC,gBAAgB,CAACgG,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,kDAAkD;IAClD,MAAMC,IAAAA,WAAsB,uBAAA,EAACnG,KAAK,EAAED,UAAU,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -10,7 +10,9 @@ function _export(target, all) {
|
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
12
|
exportDomComponentAsync: ()=>exportDomComponentAsync,
|
|
13
|
-
|
|
13
|
+
addDomBundleToMetadataAsync: ()=>addDomBundleToMetadataAsync,
|
|
14
|
+
transformDomEntryForMd5Filename: ()=>transformDomEntryForMd5Filename,
|
|
15
|
+
transformNativeBundleForMd5Filename: ()=>transformNativeBundleForMd5Filename
|
|
14
16
|
});
|
|
15
17
|
function _assert() {
|
|
16
18
|
const data = /*#__PURE__*/ _interopRequireDefault(require("assert"));
|
|
@@ -58,7 +60,7 @@ function _interopRequireDefault(obj) {
|
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
const debug = require("debug")("expo:export:exportDomComponents");
|
|
61
|
-
async function exportDomComponentAsync({ filePath , projectRoot , dev , devServer , isHermes , includeSourceMaps , exp , files }) {
|
|
63
|
+
async function exportDomComponentAsync({ filePath , projectRoot , dev , devServer , isHermes , includeSourceMaps , exp , files , useMd5Filename =false }) {
|
|
62
64
|
var ref;
|
|
63
65
|
const virtualEntry = (0, _filePath.toPosixPath)((0, _resolveFrom().default)(projectRoot, "expo/dom/entry.js"));
|
|
64
66
|
debug("Bundle DOM Component:", filePath);
|
|
@@ -81,9 +83,16 @@ async function exportDomComponentAsync({ filePath , projectRoot , dev , devServe
|
|
|
81
83
|
bytecode: false,
|
|
82
84
|
reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler),
|
|
83
85
|
baseUrl: "./",
|
|
86
|
+
useMd5Filename,
|
|
84
87
|
// Minify may be false because it's skipped on native when Hermes is enabled, default to true.
|
|
85
88
|
minify: true
|
|
86
89
|
});
|
|
90
|
+
if (useMd5Filename) {
|
|
91
|
+
for (const artifact of bundle.artifacts){
|
|
92
|
+
const md5 = _crypto().default.createHash("md5").update(artifact.source).digest("hex");
|
|
93
|
+
artifact.filename = `${md5}.${artifact.type}`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
87
96
|
const html = await (0, _serializeHtml.serializeHtmlWithAssets)({
|
|
88
97
|
isExporting: true,
|
|
89
98
|
resources: bundle.artifacts,
|
|
@@ -109,56 +118,52 @@ async function exportDomComponentAsync({ filePath , projectRoot , dev , devServe
|
|
|
109
118
|
htmlOutputName: outputName
|
|
110
119
|
};
|
|
111
120
|
}
|
|
112
|
-
function
|
|
121
|
+
function addDomBundleToMetadataAsync(bundle) {
|
|
113
122
|
const assetsMetadata = [];
|
|
114
|
-
for (const artifact of
|
|
115
|
-
if (artifact.type
|
|
123
|
+
for (const artifact of bundle.artifacts){
|
|
124
|
+
if (artifact.type === "map") {
|
|
116
125
|
continue;
|
|
117
126
|
}
|
|
118
|
-
const artifactAssetName = `/${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`;
|
|
119
|
-
let source = artifact.source;
|
|
120
|
-
// [0] Updates asset paths in the DOM component JS bundle (which is a web bundle)
|
|
121
|
-
for (const asset of domComponentBundle.assets){
|
|
122
|
-
const prefix = asset.httpServerLocation.startsWith("./") ? asset.httpServerLocation.slice(2) : asset.httpServerLocation;
|
|
123
|
-
const uri = `${prefix}/${asset.name}.${asset.type}`;
|
|
124
|
-
const regexp = new RegExp(`(uri:")(${uri})(")`, "g");
|
|
125
|
-
const index = asset.scales.findIndex((s)=>s === 1) ?? 0; // DOM components (web) uses 1x assets
|
|
126
|
-
const md5 = asset.fileHashes[index];
|
|
127
|
-
source = source.replace(regexp, `$1${md5}.${asset.type}$3`);
|
|
128
|
-
const domJsAssetEntity = files.get(artifactAssetName);
|
|
129
|
-
(0, _assert().default)(domJsAssetEntity);
|
|
130
|
-
domJsAssetEntity.contents = source;
|
|
131
|
-
}
|
|
132
|
-
// [1] Updates JS artifacts in HTML
|
|
133
|
-
const md51 = _crypto().default.createHash("md5").update(source).digest("hex");
|
|
134
|
-
const htmlAssetEntity = files.get(htmlOutputName);
|
|
135
|
-
(0, _assert().default)(htmlAssetEntity);
|
|
136
|
-
const regexp1 = new RegExp(`(<script src=")(.*${artifact.filename})(" defer></script>)`, "g");
|
|
137
|
-
htmlAssetEntity.contents = htmlAssetEntity.contents.toString().replace(regexp1, `$1${md51}.js$3`);
|
|
138
127
|
assetsMetadata.push({
|
|
139
|
-
path:
|
|
140
|
-
ext:
|
|
128
|
+
path: `${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`,
|
|
129
|
+
ext: artifact.type
|
|
141
130
|
});
|
|
142
131
|
}
|
|
143
|
-
|
|
132
|
+
return assetsMetadata;
|
|
133
|
+
}
|
|
134
|
+
function transformDomEntryForMd5Filename({ files , htmlOutputName }) {
|
|
135
|
+
const htmlContent = files.get(htmlOutputName);
|
|
136
|
+
(0, _assert().default)(htmlContent);
|
|
137
|
+
const htmlMd5 = _crypto().default.createHash("md5").update(htmlContent.contents.toString()).digest("hex");
|
|
138
|
+
const htmlMd5Filename = `${_domComponentsMiddleware.DOM_COMPONENTS_BUNDLE_DIR}/${htmlMd5}.html`;
|
|
139
|
+
files.set(htmlMd5Filename, htmlContent);
|
|
140
|
+
files.delete(htmlOutputName);
|
|
141
|
+
return [
|
|
142
|
+
{
|
|
143
|
+
path: htmlMd5Filename,
|
|
144
|
+
ext: "html"
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
function transformNativeBundleForMd5Filename({ domComponentReference , nativeBundle , files , htmlOutputName }) {
|
|
144
149
|
const htmlContent = files.get(htmlOutputName);
|
|
145
150
|
(0, _assert().default)(htmlContent);
|
|
146
151
|
const htmlMd5 = _crypto().default.createHash("md5").update(htmlContent.contents.toString()).digest("hex");
|
|
147
152
|
const hash = _crypto().default.createHash("md5").update(domComponentReference).digest("hex");
|
|
148
|
-
for (const
|
|
149
|
-
if (
|
|
153
|
+
for (const artifact of nativeBundle.artifacts){
|
|
154
|
+
if (artifact.type !== "js") {
|
|
150
155
|
continue;
|
|
151
156
|
}
|
|
152
|
-
const assetEntity = files.get(
|
|
157
|
+
const assetEntity = files.get(artifact.filename);
|
|
153
158
|
(0, _assert().default)(assetEntity);
|
|
154
159
|
if (Buffer.isBuffer(assetEntity.contents)) {
|
|
155
160
|
const searchBuffer = Buffer.from(`${hash}.html`, "utf8");
|
|
156
161
|
const replaceBuffer = Buffer.from(`${htmlMd5}.html`, "utf8");
|
|
157
162
|
(0, _assert().default)(searchBuffer.length === replaceBuffer.length);
|
|
158
|
-
let
|
|
159
|
-
while(
|
|
160
|
-
replaceBuffer.copy(assetEntity.contents,
|
|
161
|
-
|
|
163
|
+
let index = assetEntity.contents.indexOf(searchBuffer, 0);
|
|
164
|
+
while(index !== -1){
|
|
165
|
+
replaceBuffer.copy(assetEntity.contents, index);
|
|
166
|
+
index = assetEntity.contents.indexOf(searchBuffer, index + searchBuffer.length);
|
|
162
167
|
}
|
|
163
168
|
} else {
|
|
164
169
|
const search = `${hash}.html`;
|
|
@@ -167,11 +172,6 @@ function updateDomComponentAssetsForMD5Naming({ domComponentReference , nativeBu
|
|
|
167
172
|
assetEntity.contents = assetEntity.contents.toString().replaceAll(search, replace);
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
|
-
|
|
171
|
-
path: htmlOutputName,
|
|
172
|
-
ext: "html"
|
|
173
|
-
});
|
|
174
|
-
return assetsMetadata;
|
|
175
|
-
}
|
|
175
|
+
} //#endregion `npx export` for updates
|
|
176
176
|
|
|
177
177
|
//# sourceMappingURL=exportDomComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportDomComponents.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport assert from 'assert';\nimport crypto from 'crypto';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport url from 'url';\n\nimport { type PlatformMetadata } from './createMetadataJson';\nimport { type BundleOutput, type ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport { type MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getDomComponentHtml,\n DOM_COMPONENTS_BUNDLE_DIR,\n} from '../start/server/middleware/DomComponentsMiddleware';\nimport { env } from '../utils/env';\nimport { resolveRealEntryFilePath, toPosixPath } from '../utils/filePath';\n\nconst debug = require('debug')('expo:export:exportDomComponents') as typeof console.log;\n\n// TODO(EvanBacon): determine how to support DOM Components with hosting.\nexport async function exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps,\n exp,\n files,\n}: {\n filePath: string;\n projectRoot: string;\n dev: boolean;\n devServer: MetroBundlerDevServer;\n isHermes: boolean;\n includeSourceMaps: boolean;\n exp: ExpoConfig;\n files: ExportAssetMap;\n}): Promise<{\n bundle: BundleOutput;\n htmlOutputName: string;\n}> {\n const virtualEntry = toPosixPath(resolveFrom(projectRoot, 'expo/dom/entry.js'));\n debug('Bundle DOM Component:', filePath);\n // MUST MATCH THE BABEL PLUGIN!\n const hash = crypto.createHash('md5').update(filePath).digest('hex');\n const outputName = `${DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;\n const generatedEntryPath = toPosixPath(\n filePath.startsWith('file://') ? url.fileURLToPath(filePath) : filePath\n );\n const baseUrl = `/${DOM_COMPONENTS_BUNDLE_DIR}`;\n // The relative import path will be used like URI so it must be POSIX.\n const relativeImport = './' + path.posix.relative(path.dirname(virtualEntry), generatedEntryPath);\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.legacySinglePageExportBundleAsync({\n platform: 'web',\n domRoot: encodeURI(relativeImport),\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING,\n mainModuleName: resolveRealEntryFilePath(projectRoot, virtualEntry),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: includeSourceMaps,\n bytecode: false,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: './',\n // Minify may be false because it's skipped on native when Hermes is enabled, default to true.\n minify: true,\n });\n\n const html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: getDomComponentHtml(),\n baseUrl: './',\n });\n\n const serialAssets = bundle.artifacts.map((a) => {\n return {\n ...a,\n filename: path.join(baseUrl, a.filename),\n };\n });\n\n getFilesFromSerialAssets(serialAssets, {\n includeSourceMaps,\n files,\n platform: 'web',\n });\n\n files.set(outputName, {\n contents: html,\n });\n\n return {\n bundle,\n htmlOutputName: outputName,\n };\n}\n\n/**\n * For EAS Updates exports,\n * post-processes the DOM component bundle and updates the asset paths to use flattened MD5 naming.\n */\nexport function updateDomComponentAssetsForMD5Naming({\n domComponentReference,\n nativeBundle,\n domComponentBundle,\n files,\n htmlOutputName,\n}: {\n domComponentReference: string;\n nativeBundle: BundleOutput;\n domComponentBundle: BundleOutput;\n files: ExportAssetMap;\n htmlOutputName: string;\n}): PlatformMetadata['assets'] {\n const assetsMetadata: PlatformMetadata['assets'] = [];\n\n for (const artifact of domComponentBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n const artifactAssetName = `/${DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`;\n let source = artifact.source;\n\n // [0] Updates asset paths in the DOM component JS bundle (which is a web bundle)\n for (const asset of domComponentBundle.assets) {\n const prefix = asset.httpServerLocation.startsWith('./')\n ? asset.httpServerLocation.slice(2)\n : asset.httpServerLocation;\n const uri = `${prefix}/${asset.name}.${asset.type}`;\n const regexp = new RegExp(`(uri:\")(${uri})(\")`, 'g');\n const index = asset.scales.findIndex((s) => s === 1) ?? 0; // DOM components (web) uses 1x assets\n const md5 = asset.fileHashes[index];\n source = source.replace(regexp, `$1${md5}.${asset.type}$3`);\n\n const domJsAssetEntity = files.get(artifactAssetName);\n assert(domJsAssetEntity);\n domJsAssetEntity.contents = source;\n }\n\n // [1] Updates JS artifacts in HTML\n const md5 = crypto.createHash('md5').update(source).digest('hex');\n const htmlAssetEntity = files.get(htmlOutputName);\n assert(htmlAssetEntity);\n const regexp = new RegExp(`(<script src=\")(.*${artifact.filename})(\" defer></script>)`, 'g');\n htmlAssetEntity.contents = htmlAssetEntity.contents.toString().replace(regexp, `$1${md5}.js$3`);\n\n assetsMetadata.push({\n path: artifactAssetName.slice(1),\n ext: 'js',\n });\n }\n\n // [2] Updates HTML names from native bundle\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const hash = crypto.createHash('md5').update(domComponentReference).digest('hex');\n for (const artifact of nativeBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n const assetEntity = files.get(artifact.filename);\n assert(assetEntity);\n if (Buffer.isBuffer(assetEntity.contents)) {\n const searchBuffer = Buffer.from(`${hash}.html`, 'utf8');\n const replaceBuffer = Buffer.from(`${htmlMd5}.html`, 'utf8');\n assert(searchBuffer.length === replaceBuffer.length);\n let index = assetEntity.contents.indexOf(searchBuffer, 0);\n while (index !== -1) {\n replaceBuffer.copy(assetEntity.contents, index);\n index = assetEntity.contents.indexOf(searchBuffer, index + searchBuffer.length);\n }\n } else {\n const search = `${hash}.html`;\n const replace = `${htmlMd5}.html`;\n assert(search.length === replace.length);\n assetEntity.contents = assetEntity.contents.toString().replaceAll(search, replace);\n }\n }\n assetsMetadata.push({\n path: htmlOutputName,\n ext: 'html',\n });\n\n return assetsMetadata;\n}\n"],"names":["exportDomComponentAsync","updateDomComponentAssetsForMD5Naming","debug","require","filePath","projectRoot","dev","devServer","isHermes","includeSourceMaps","exp","files","virtualEntry","toPosixPath","resolveFrom","hash","crypto","createHash","update","digest","outputName","DOM_COMPONENTS_BUNDLE_DIR","generatedEntryPath","startsWith","url","fileURLToPath","baseUrl","relativeImport","path","posix","relative","dirname","bundle","legacySinglePageExportBundleAsync","platform","domRoot","encodeURI","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","resolveRealEntryFilePath","mode","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","minify","html","serializeHtmlWithAssets","isExporting","resources","artifacts","template","getDomComponentHtml","serialAssets","map","a","filename","join","getFilesFromSerialAssets","set","contents","htmlOutputName","domComponentReference","nativeBundle","domComponentBundle","assetsMetadata","artifact","type","artifactAssetName","source","asset","assets","prefix","httpServerLocation","slice","uri","name","regexp","RegExp","index","scales","findIndex","s","md5","fileHashes","replace","domJsAssetEntity","get","assert","htmlAssetEntity","toString","push","ext","htmlContent","htmlMd5","assetEntity","Buffer","isBuffer","searchBuffer","from","replaceBuffer","length","indexOf","copy","search","replaceAll"],"mappings":"AAAA;;;;;;;;;;;IAqBsBA,uBAAuB,MAAvBA,uBAAuB;IAmF7BC,oCAAoC,MAApCA,oCAAoC;;;8DAvGjC,QAAQ;;;;;;;8DACR,QAAQ;;;;;;;8DACV,MAAM;;;;;;;8DACC,cAAc;;;;;;;8DACtB,KAAK;;;;;;4BAG4D,cAAc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CAACnC,QAAQ,CAAC0C,OAAO,CAACJ,YAAY,EAAE,CAAC,CAAC,AAAC;YAC1D,MAAOnB,MAAK,KAAK,CAAC,CAAC,CAAE;gBACnBqB,aAAa,CAACG,IAAI,CAACR,WAAW,CAACnC,QAAQ,EAAEmB,MAAK,CAAC,CAAC;gBAChDA,MAAK,GAAGgB,WAAW,CAACnC,QAAQ,CAAC0C,OAAO,CAACJ,YAAY,EAAEnB,MAAK,GAAGmB,YAAY,CAACG,MAAM,CAAC,CAAC;YAClF,CAAC;QACH,OAAO;YACL,MAAMG,MAAM,GAAG,CAAC,EAAE7F,IAAI,CAAC,KAAK,CAAC,AAAC;YAC9B,MAAM0E,OAAO,GAAG,CAAC,EAAES,OAAO,CAAC,KAAK,CAAC,AAAC;YAClCN,IAAAA,OAAM,EAAA,QAAA,EAACgB,MAAM,CAACH,MAAM,KAAKhB,OAAO,CAACgB,MAAM,CAAC,CAAC;YACzCN,WAAW,CAACnC,QAAQ,GAAGmC,WAAW,CAACnC,QAAQ,CAAC8B,QAAQ,EAAE,CAACe,UAAU,CAACD,MAAM,EAAEnB,OAAO,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IACDpB,cAAc,CAAC0B,IAAI,CAAC;QAClBnE,IAAI,EAAEqC,cAAc;QACpB+B,GAAG,EAAE,MAAM;KACZ,CAAC,CAAC;IAEH,OAAO3B,cAAc,CAAC;AACxB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportDomComponents.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport assert from 'assert';\nimport crypto from 'crypto';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport url from 'url';\n\nimport { type PlatformMetadata } from './createMetadataJson';\nimport { type BundleOutput, type ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport { type MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getDomComponentHtml,\n DOM_COMPONENTS_BUNDLE_DIR,\n} from '../start/server/middleware/DomComponentsMiddleware';\nimport { env } from '../utils/env';\nimport { resolveRealEntryFilePath, toPosixPath } from '../utils/filePath';\n\nconst debug = require('debug')('expo:export:exportDomComponents') as typeof console.log;\n\n// TODO(EvanBacon): determine how to support DOM Components with hosting.\nexport async function exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps,\n exp,\n files,\n useMd5Filename = false,\n}: {\n filePath: string;\n projectRoot: string;\n dev: boolean;\n devServer: MetroBundlerDevServer;\n isHermes: boolean;\n includeSourceMaps: boolean;\n exp: ExpoConfig;\n files: ExportAssetMap;\n useMd5Filename?: boolean;\n}): Promise<{\n bundle: BundleOutput;\n htmlOutputName: string;\n}> {\n const virtualEntry = toPosixPath(resolveFrom(projectRoot, 'expo/dom/entry.js'));\n debug('Bundle DOM Component:', filePath);\n // MUST MATCH THE BABEL PLUGIN!\n const hash = crypto.createHash('md5').update(filePath).digest('hex');\n const outputName = `${DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;\n const generatedEntryPath = toPosixPath(\n filePath.startsWith('file://') ? url.fileURLToPath(filePath) : filePath\n );\n const baseUrl = `/${DOM_COMPONENTS_BUNDLE_DIR}`;\n // The relative import path will be used like URI so it must be POSIX.\n const relativeImport = './' + path.posix.relative(path.dirname(virtualEntry), generatedEntryPath);\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.legacySinglePageExportBundleAsync({\n platform: 'web',\n domRoot: encodeURI(relativeImport),\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING,\n mainModuleName: resolveRealEntryFilePath(projectRoot, virtualEntry),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: includeSourceMaps,\n bytecode: false,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: './',\n useMd5Filename,\n // Minify may be false because it's skipped on native when Hermes is enabled, default to true.\n minify: true,\n });\n\n if (useMd5Filename) {\n for (const artifact of bundle.artifacts) {\n const md5 = crypto.createHash('md5').update(artifact.source).digest('hex');\n artifact.filename = `${md5}.${artifact.type}`;\n }\n }\n\n const html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: getDomComponentHtml(),\n baseUrl: './',\n });\n\n const serialAssets = bundle.artifacts.map((a) => {\n return {\n ...a,\n filename: path.join(baseUrl, a.filename),\n };\n });\n\n getFilesFromSerialAssets(serialAssets, {\n includeSourceMaps,\n files,\n platform: 'web',\n });\n\n files.set(outputName, {\n contents: html,\n });\n\n return {\n bundle,\n htmlOutputName: outputName,\n };\n}\n\n//#region `npx export` for updates\n\n/**\n * Add the DOM component bundle to the metadata for updates.\n */\nexport function addDomBundleToMetadataAsync(bundle: BundleOutput): PlatformMetadata['assets'] {\n const assetsMetadata: PlatformMetadata['assets'] = [];\n for (const artifact of bundle.artifacts) {\n if (artifact.type === 'map') {\n continue;\n }\n assetsMetadata.push({\n path: `${DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`,\n ext: artifact.type,\n });\n }\n return assetsMetadata;\n}\n\n/**\n * Transform the DOM component entry (*.html) to use MD5 filename by its content.\n */\nexport function transformDomEntryForMd5Filename({\n files,\n htmlOutputName,\n}: {\n files: ExportAssetMap;\n htmlOutputName: string;\n}): PlatformMetadata['assets'] {\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const htmlMd5Filename = `${DOM_COMPONENTS_BUNDLE_DIR}/${htmlMd5}.html`;\n files.set(htmlMd5Filename, htmlContent);\n files.delete(htmlOutputName);\n return [\n {\n path: htmlMd5Filename,\n ext: 'html',\n },\n ];\n}\n\n/**\n * Post-transform the native bundle to use MD5 filename based on DOM component entry content.\n */\nexport function transformNativeBundleForMd5Filename({\n domComponentReference,\n nativeBundle,\n files,\n htmlOutputName,\n}: {\n domComponentReference: string;\n nativeBundle: BundleOutput;\n files: ExportAssetMap;\n htmlOutputName: string;\n}) {\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const hash = crypto.createHash('md5').update(domComponentReference).digest('hex');\n for (const artifact of nativeBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n const assetEntity = files.get(artifact.filename);\n assert(assetEntity);\n if (Buffer.isBuffer(assetEntity.contents)) {\n const searchBuffer = Buffer.from(`${hash}.html`, 'utf8');\n const replaceBuffer = Buffer.from(`${htmlMd5}.html`, 'utf8');\n assert(searchBuffer.length === replaceBuffer.length);\n let index = assetEntity.contents.indexOf(searchBuffer, 0);\n while (index !== -1) {\n replaceBuffer.copy(assetEntity.contents, index);\n index = assetEntity.contents.indexOf(searchBuffer, index + searchBuffer.length);\n }\n } else {\n const search = `${hash}.html`;\n const replace = `${htmlMd5}.html`;\n assert(search.length === replace.length);\n assetEntity.contents = assetEntity.contents.toString().replaceAll(search, replace);\n }\n }\n}\n\n//#endregion `npx export` for updates\n"],"names":["exportDomComponentAsync","addDomBundleToMetadataAsync","transformDomEntryForMd5Filename","transformNativeBundleForMd5Filename","debug","require","filePath","projectRoot","dev","devServer","isHermes","includeSourceMaps","exp","files","useMd5Filename","virtualEntry","toPosixPath","resolveFrom","hash","crypto","createHash","update","digest","outputName","DOM_COMPONENTS_BUNDLE_DIR","generatedEntryPath","startsWith","url","fileURLToPath","baseUrl","relativeImport","path","posix","relative","dirname","bundle","legacySinglePageExportBundleAsync","platform","domRoot","encodeURI","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","resolveRealEntryFilePath","mode","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","minify","artifact","artifacts","md5","source","filename","type","html","serializeHtmlWithAssets","isExporting","resources","template","getDomComponentHtml","serialAssets","map","a","join","getFilesFromSerialAssets","set","contents","htmlOutputName","assetsMetadata","push","ext","htmlContent","get","assert","htmlMd5","toString","htmlMd5Filename","delete","domComponentReference","nativeBundle","assetEntity","Buffer","isBuffer","searchBuffer","from","replaceBuffer","length","index","indexOf","copy","search","replace","replaceAll"],"mappings":"AAAA;;;;;;;;;;;IAqBsBA,uBAAuB,MAAvBA,uBAAuB;IA8F7BC,2BAA2B,MAA3BA,2BAA2B;IAiB3BC,+BAA+B,MAA/BA,+BAA+B;IAwB/BC,mCAAmC,MAAnCA,mCAAmC;;;8DA3JhC,QAAQ;;;;;;;8DACR,QAAQ;;;;;;;8DACV,MAAM;;;;;;;8DACC,cAAc;;;;;;;8DACtB,KAAK;;;;;;4BAG4D,cAAc;+BAEvD,qCAAqC;yCAItE,oDAAoD;qBACvC,cAAc;0BACoB,mBAAmB;;;;;;AAEzE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,AAAsB,AAAC;AAGjF,eAAeL,uBAAuB,CAAC,EAC5CM,QAAQ,CAAA,EACRC,WAAW,CAAA,EACXC,GAAG,CAAA,EACHC,SAAS,CAAA,EACTC,QAAQ,CAAA,EACRC,iBAAiB,CAAA,EACjBC,GAAG,CAAA,EACHC,KAAK,CAAA,EACLC,cAAc,EAAG,KAAK,CAAA,EAWvB,EAGE;QAsBkBF,GAAe;IArBlC,MAAMG,YAAY,GAAGC,IAAAA,SAAW,YAAA,EAACC,IAAAA,YAAW,EAAA,QAAA,EAACV,WAAW,EAAE,mBAAmB,CAAC,CAAC,AAAC;IAChFH,KAAK,CAAC,uBAAuB,EAAEE,QAAQ,CAAC,CAAC;IACzC,+BAA+B;IAC/B,MAAMY,IAAI,GAAGC,OAAM,EAAA,QAAA,CAACC,UAAU,CAAC,KAAK,CAAC,CAACC,MAAM,CAACf,QAAQ,CAAC,CAACgB,MAAM,CAAC,KAAK,CAAC,AAAC;IACrE,MAAMC,UAAU,GAAG,CAAC,EAAEC,wBAAyB,0BAAA,CAAC,CAAC,EAAEN,IAAI,CAAC,KAAK,CAAC,AAAC;IAC/D,M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W,CAACd,QAAQ,CAACsB,OAAO,CAACL,YAAY,EAAEI,KAAK,GAAGJ,YAAY,CAACG,MAAM,CAAC,CAAC;YAClF,CAAC;QACH,OAAO;YACL,MAAMI,MAAM,GAAG,CAAC,EAAE7E,IAAI,CAAC,KAAK,CAAC,AAAC;YAC9B,MAAM8E,OAAO,GAAG,CAAC,EAAEjB,OAAO,CAAC,KAAK,CAAC,AAAC;YAClCD,IAAAA,OAAM,EAAA,QAAA,EAACiB,MAAM,CAACJ,MAAM,KAAKK,OAAO,CAACL,MAAM,CAAC,CAAC;YACzCN,WAAW,CAACd,QAAQ,GAAGc,WAAW,CAACd,QAAQ,CAACS,QAAQ,EAAE,CAACiB,UAAU,CAACF,MAAM,EAAEC,OAAO,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;AACH,CAAC,CAED,qCAAqC"}
|
|
@@ -55,6 +55,13 @@ async function persistMetroAssetsAsync(projectRoot, assets, { platform , outputD
|
|
|
55
55
|
_log.Log.warn("Assets destination folder is not set, skipping...");
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
+
// For iOS, we need to ensure that the outputDirectory exists.
|
|
59
|
+
// The bundle code and images build phase script always tries to access this folder
|
|
60
|
+
if (platform === "ios" && !_fs().default.existsSync(outputDirectory)) {
|
|
61
|
+
_fs().default.mkdirSync(outputDirectory, {
|
|
62
|
+
recursive: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
58
65
|
let assetsToCopy = [];
|
|
59
66
|
// TODO: Use `files` as below to defer writing files
|
|
60
67
|
if (platform === "ios" && iosAssetCatalogDirectory != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/persistMetroAssets.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\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 *\n * Based on the community asset persisting for Metro but with base path and web support:\n * https://github.com/facebook/react-native/blob/d6e0bc714ad4d215ede4949d3c4f44af6dea5dd3/packages/community-cli-plugin/src/commands/bundle/saveAssets.js#L1\n */\nimport fs from 'fs';\nimport type { AssetData } from 'metro';\nimport path from 'path';\n\nimport { getAssetLocalPath } from './metroAssetLocalPath';\nimport { ExportAssetMap } from './saveAssets';\nimport { Log } from '../log';\n\nfunction cleanAssetCatalog(catalogDir: string): void {\n const files = fs.readdirSync(catalogDir).filter((file) => file.endsWith('.imageset'));\n for (const file of files) {\n fs.rmSync(path.join(catalogDir, file));\n }\n}\n\nexport async function persistMetroAssetsAsync(\n projectRoot: string,\n assets: readonly AssetData[],\n {\n platform,\n outputDirectory,\n baseUrl,\n iosAssetCatalogDirectory,\n files,\n }: {\n platform: string;\n outputDirectory: string;\n baseUrl?: string;\n iosAssetCatalogDirectory?: string;\n files?: ExportAssetMap;\n }\n) {\n if (outputDirectory == null) {\n Log.warn('Assets destination folder is not set, skipping...');\n return;\n }\n\n let assetsToCopy: AssetData[] = [];\n\n // TODO: Use `files` as below to defer writing files\n if (platform === 'ios' && iosAssetCatalogDirectory != null) {\n // Use iOS Asset Catalog for images. This will allow Apple app thinning to\n // remove unused scales from the optimized bundle.\n const catalogDir = path.join(iosAssetCatalogDirectory, 'RNAssets.xcassets');\n if (!fs.existsSync(catalogDir)) {\n Log.error(\n `Could not find asset catalog 'RNAssets.xcassets' in ${iosAssetCatalogDirectory}. Make sure to create it if it does not exist.`\n );\n return;\n }\n\n Log.log('Adding images to asset catalog', catalogDir);\n cleanAssetCatalog(catalogDir);\n for (const asset of assets) {\n if (isCatalogAsset(asset)) {\n const imageSet = getImageSet(\n catalogDir,\n asset,\n filterPlatformAssetScales(platform, asset.scales)\n );\n writeImageSet(imageSet);\n } else {\n assetsToCopy.push(asset);\n }\n }\n Log.log('Done adding images to asset catalog');\n } else {\n assetsToCopy = [...assets];\n }\n\n const batches: Record<string, string> = {};\n\n for (const asset of assetsToCopy) {\n const validScales = new Set(filterPlatformAssetScales(platform, asset.scales));\n for (let idx = 0; idx < asset.scales.length; idx++) {\n const scale = asset.scales[idx];\n if (validScales.has(scale)) {\n const src = asset.files[idx];\n const dest = getAssetLocalPath(asset, { platform, scale, baseUrl });\n if (files) {\n const data = await fs.promises.readFile(src);\n files.set(dest, {\n contents: data,\n assetId: getAssetIdForLogGrouping(projectRoot, asset),\n targetDomain: platform === 'web' ? 'client' : undefined,\n });\n } else {\n batches[src] = path.join(outputDirectory, dest);\n }\n }\n }\n }\n\n if (!files) {\n await copyInBatchesAsync(batches);\n }\n}\n\nexport function getAssetIdForLogGrouping(\n projectRoot: string,\n asset: Partial<Pick<AssetData, 'fileSystemLocation' | 'name' | 'type'>>\n): string | undefined {\n return 'fileSystemLocation' in asset && asset.fileSystemLocation != null && asset.name != null\n ? path.relative(projectRoot, path.join(asset.fileSystemLocation, asset.name)) +\n (asset.type ? '.' + asset.type : '')\n : undefined;\n}\n\nfunction writeImageSet(imageSet: ImageSet): void {\n fs.mkdirSync(imageSet.baseUrl, { recursive: true });\n\n for (const file of imageSet.files) {\n const dest = path.join(imageSet.baseUrl, file.name);\n fs.copyFileSync(file.src, dest);\n }\n\n fs.writeFileSync(\n path.join(imageSet.baseUrl, 'Contents.json'),\n JSON.stringify({\n images: imageSet.files.map((file) => ({\n filename: file.name,\n idiom: 'universal',\n scale: `${file.scale}x`,\n })),\n info: {\n author: 'expo',\n version: 1,\n },\n })\n );\n}\n\nfunction isCatalogAsset(asset: Pick<AssetData, 'type'>): boolean {\n return asset.type === 'png' || asset.type === 'jpg' || asset.type === 'jpeg';\n}\n\ntype ImageSet = {\n baseUrl: string;\n files: { name: string; src: string; scale: number }[];\n};\n\nfunction getImageSet(\n catalogDir: string,\n asset: Pick<AssetData, 'httpServerLocation' | 'name' | 'type' | 'files'>,\n scales: number[]\n): ImageSet {\n const fileName = getResourceIdentifier(asset);\n return {\n baseUrl: path.join(catalogDir, `${fileName}.imageset`),\n files: scales.map((scale, idx) => {\n const suffix = scale === 1 ? '' : `@${scale}x`;\n return {\n name: `${fileName + suffix}.${asset.type}`,\n scale,\n src: asset.files[idx],\n };\n }),\n };\n}\n\nexport function copyInBatchesAsync(filesToCopy: Record<string, string>) {\n const queue = Object.keys(filesToCopy);\n if (queue.length === 0) {\n return;\n }\n\n Log.log(`Copying ${queue.length} asset files`);\n return new Promise<void>((resolve, reject) => {\n const copyNext = (error?: NodeJS.ErrnoException) => {\n if (error) {\n return reject(error);\n }\n if (queue.length) {\n // queue.length === 0 is checked in previous branch, so this is string\n const src = queue.shift() as string;\n const dest = filesToCopy[src];\n copy(src, dest, copyNext);\n } else {\n resolve();\n }\n };\n copyNext();\n });\n}\n\nfunction copy(src: string, dest: string, callback: (error: NodeJS.ErrnoException) => void): void {\n fs.mkdir(path.dirname(dest), { recursive: true }, (err?) => {\n if (err) {\n callback(err);\n return;\n }\n fs.createReadStream(src).pipe(fs.createWriteStream(dest)).on('finish', callback);\n });\n}\n\nconst ALLOWED_SCALES: { [key: string]: number[] } = {\n ios: [1, 2, 3],\n};\n\nexport function filterPlatformAssetScales(platform: string, scales: number[]): number[] {\n const whitelist: number[] = ALLOWED_SCALES[platform];\n if (!whitelist) {\n return scales;\n }\n const result = scales.filter((scale) => whitelist.includes(scale));\n if (!result.length && scales.length) {\n // No matching scale found, but there are some available. Ideally we don't\n // want to be in this situation and should throw, but for now as a fallback\n // let's just use the closest larger image\n const maxScale = whitelist[whitelist.length - 1];\n for (const scale of scales) {\n if (scale > maxScale) {\n result.push(scale);\n break;\n }\n }\n\n // There is no larger scales available, use the largest we have\n if (!result.length) {\n result.push(scales[scales.length - 1]);\n }\n }\n return result;\n}\n\nfunction getResourceIdentifier(asset: Pick<AssetData, 'httpServerLocation' | 'name'>): string {\n const folderPath = getBaseUrl(asset);\n return `${folderPath}/${asset.name}`\n .toLowerCase()\n .replace(/\\//g, '_') // Encode folder structure in file name\n .replace(/([^a-z0-9_])/g, '') // Remove illegal chars\n .replace(/^assets_/, ''); // Remove \"assets_\" prefix\n}\n\nfunction getBaseUrl(asset: Pick<AssetData, 'httpServerLocation'>): string {\n let baseUrl = asset.httpServerLocation;\n if (baseUrl[0] === '/') {\n baseUrl = baseUrl.substring(1);\n }\n return baseUrl;\n}\n"],"names":["persistMetroAssetsAsync","getAssetIdForLogGrouping","copyInBatchesAsync","filterPlatformAssetScales","cleanAssetCatalog","catalogDir","files","fs","readdirSync","filter","file","endsWith","rmSync","path","join","projectRoot","assets","platform","outputDirectory","baseUrl","iosAssetCatalogDirectory","Log","warn","assetsToCopy","existsSync","error","log","asset","isCatalogAsset","imageSet","getImageSet","scales","writeImageSet","push","batches","validScales","Set","idx","length","scale","has","src","dest","getAssetLocalPath","data","promises","readFile","set","contents","assetId","targetDomain","undefined","fileSystemLocation","name","relative","type","mkdirSync","recursive","copyFileSync","writeFileSync","JSON","stringify","images","map","filename","idiom","info","author","version","fileName","getResourceIdentifier","suffix","filesToCopy","queue","Object","keys","Promise","resolve","reject","copyNext","shift","copy","callback","mkdir","dirname","err","createReadStream","pipe","createWriteStream","on","ALLOWED_SCALES","ios","whitelist","result","includes","maxScale","folderPath","getBaseUrl","toLowerCase","replace","httpServerLocation","substring"],"mappings":"AAAA;;;;;;;;;CASC,GACD;;;;;;;;;;;IAesBA,uBAAuB,MAAvBA,uBAAuB;IAmF7BC,wBAAwB,MAAxBA,wBAAwB;IA8DxBC,kBAAkB,MAAlBA,kBAAkB;IAuClBC,yBAAyB,MAAzBA,yBAAyB;;;8DAvM1B,IAAI;;;;;;;8DAEF,MAAM;;;;;;qCAEW,uBAAuB;qBAErC,QAAQ;;;;;;AAE5B,SAASC,iBAAiB,CAACC,UAAkB,EAAQ;IACnD,MAAMC,KAAK,GAAGC,GAAE,EAAA,QAAA,CAACC,WAAW,CAACH,UAAU,CAAC,CAACI,MAAM,CAAC,CAACC,IAAI,GAAKA,IAAI,CAACC,QAAQ,CAAC,WAAW,CAAC,CAAC,AAAC;IACtF,KAAK,MAAMD,IAAI,IAAIJ,KAAK,CAAE;QACxBC,GAAE,EAAA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CAAC;IACD,OAAOuD,MAAM,CAAC;AAChB,CAAC;AAED,SAASvB,qBAAqB,CAAC3C,KAAqD,EAAU;IAC5F,MAAMqE,UAAU,GAAGC,UAAU,CAACtE,KAAK,CAAC,AAAC;IACrC,OAAO,CAAC,EAAEqE,UAAU,CAAC,CAAC,EAAErE,KAAK,CAAC0B,IAAI,CAAC,CAAC,CACjC6C,WAAW,EAAE,CACbC,OAAO,QAAQ,GAAG,CAAC,CAAC,uCAAuC;KAC3DA,OAAO,kBAAkB,EAAE,CAAC,CAAC,uBAAuB;KACpDA,OAAO,aAAa,EAAE,CAAC,CAAC,CAAC,0BAA0B;AACxD,CAAC;AAED,SAASF,UAAU,CAACtE,KAA4C,EAAU;IACxE,IAAIR,OAAO,GAAGQ,KAAK,CAACyE,kBAAkB,AAAC;IACvC,IAAIjF,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACtBA,OAAO,GAAGA,OAAO,CAACkF,SAAS,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAOlF,OAAO,CAAC;AACjB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/persistMetroAssets.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\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 *\n * Based on the community asset persisting for Metro but with base path and web support:\n * https://github.com/facebook/react-native/blob/d6e0bc714ad4d215ede4949d3c4f44af6dea5dd3/packages/community-cli-plugin/src/commands/bundle/saveAssets.js#L1\n */\nimport fs from 'fs';\nimport type { AssetData } from 'metro';\nimport path from 'path';\n\nimport { getAssetLocalPath } from './metroAssetLocalPath';\nimport { ExportAssetMap } from './saveAssets';\nimport { Log } from '../log';\n\nfunction cleanAssetCatalog(catalogDir: string): void {\n const files = fs.readdirSync(catalogDir).filter((file) => file.endsWith('.imageset'));\n for (const file of files) {\n fs.rmSync(path.join(catalogDir, file));\n }\n}\n\nexport async function persistMetroAssetsAsync(\n projectRoot: string,\n assets: readonly AssetData[],\n {\n platform,\n outputDirectory,\n baseUrl,\n iosAssetCatalogDirectory,\n files,\n }: {\n platform: string;\n outputDirectory: string;\n baseUrl?: string;\n iosAssetCatalogDirectory?: string;\n files?: ExportAssetMap;\n }\n) {\n if (outputDirectory == null) {\n Log.warn('Assets destination folder is not set, skipping...');\n return;\n }\n\n // For iOS, we need to ensure that the outputDirectory exists.\n // The bundle code and images build phase script always tries to access this folder\n if (platform === 'ios' && !fs.existsSync(outputDirectory)) {\n fs.mkdirSync(outputDirectory, { recursive: true });\n }\n\n let assetsToCopy: AssetData[] = [];\n\n // TODO: Use `files` as below to defer writing files\n if (platform === 'ios' && iosAssetCatalogDirectory != null) {\n // Use iOS Asset Catalog for images. This will allow Apple app thinning to\n // remove unused scales from the optimized bundle.\n const catalogDir = path.join(iosAssetCatalogDirectory, 'RNAssets.xcassets');\n if (!fs.existsSync(catalogDir)) {\n Log.error(\n `Could not find asset catalog 'RNAssets.xcassets' in ${iosAssetCatalogDirectory}. Make sure to create it if it does not exist.`\n );\n return;\n }\n\n Log.log('Adding images to asset catalog', catalogDir);\n cleanAssetCatalog(catalogDir);\n for (const asset of assets) {\n if (isCatalogAsset(asset)) {\n const imageSet = getImageSet(\n catalogDir,\n asset,\n filterPlatformAssetScales(platform, asset.scales)\n );\n writeImageSet(imageSet);\n } else {\n assetsToCopy.push(asset);\n }\n }\n Log.log('Done adding images to asset catalog');\n } else {\n assetsToCopy = [...assets];\n }\n\n const batches: Record<string, string> = {};\n\n for (const asset of assetsToCopy) {\n const validScales = new Set(filterPlatformAssetScales(platform, asset.scales));\n for (let idx = 0; idx < asset.scales.length; idx++) {\n const scale = asset.scales[idx];\n if (validScales.has(scale)) {\n const src = asset.files[idx];\n const dest = getAssetLocalPath(asset, { platform, scale, baseUrl });\n if (files) {\n const data = await fs.promises.readFile(src);\n files.set(dest, {\n contents: data,\n assetId: getAssetIdForLogGrouping(projectRoot, asset),\n targetDomain: platform === 'web' ? 'client' : undefined,\n });\n } else {\n batches[src] = path.join(outputDirectory, dest);\n }\n }\n }\n }\n\n if (!files) {\n await copyInBatchesAsync(batches);\n }\n}\n\nexport function getAssetIdForLogGrouping(\n projectRoot: string,\n asset: Partial<Pick<AssetData, 'fileSystemLocation' | 'name' | 'type'>>\n): string | undefined {\n return 'fileSystemLocation' in asset && asset.fileSystemLocation != null && asset.name != null\n ? path.relative(projectRoot, path.join(asset.fileSystemLocation, asset.name)) +\n (asset.type ? '.' + asset.type : '')\n : undefined;\n}\n\nfunction writeImageSet(imageSet: ImageSet): void {\n fs.mkdirSync(imageSet.baseUrl, { recursive: true });\n\n for (const file of imageSet.files) {\n const dest = path.join(imageSet.baseUrl, file.name);\n fs.copyFileSync(file.src, dest);\n }\n\n fs.writeFileSync(\n path.join(imageSet.baseUrl, 'Contents.json'),\n JSON.stringify({\n images: imageSet.files.map((file) => ({\n filename: file.name,\n idiom: 'universal',\n scale: `${file.scale}x`,\n })),\n info: {\n author: 'expo',\n version: 1,\n },\n })\n );\n}\n\nfunction isCatalogAsset(asset: Pick<AssetData, 'type'>): boolean {\n return asset.type === 'png' || asset.type === 'jpg' || asset.type === 'jpeg';\n}\n\ntype ImageSet = {\n baseUrl: string;\n files: { name: string; src: string; scale: number }[];\n};\n\nfunction getImageSet(\n catalogDir: string,\n asset: Pick<AssetData, 'httpServerLocation' | 'name' | 'type' | 'files'>,\n scales: number[]\n): ImageSet {\n const fileName = getResourceIdentifier(asset);\n return {\n baseUrl: path.join(catalogDir, `${fileName}.imageset`),\n files: scales.map((scale, idx) => {\n const suffix = scale === 1 ? '' : `@${scale}x`;\n return {\n name: `${fileName + suffix}.${asset.type}`,\n scale,\n src: asset.files[idx],\n };\n }),\n };\n}\n\nexport function copyInBatchesAsync(filesToCopy: Record<string, string>) {\n const queue = Object.keys(filesToCopy);\n if (queue.length === 0) {\n return;\n }\n\n Log.log(`Copying ${queue.length} asset files`);\n return new Promise<void>((resolve, reject) => {\n const copyNext = (error?: NodeJS.ErrnoException) => {\n if (error) {\n return reject(error);\n }\n if (queue.length) {\n // queue.length === 0 is checked in previous branch, so this is string\n const src = queue.shift() as string;\n const dest = filesToCopy[src];\n copy(src, dest, copyNext);\n } else {\n resolve();\n }\n };\n copyNext();\n });\n}\n\nfunction copy(src: string, dest: string, callback: (error: NodeJS.ErrnoException) => void): void {\n fs.mkdir(path.dirname(dest), { recursive: true }, (err?) => {\n if (err) {\n callback(err);\n return;\n }\n fs.createReadStream(src).pipe(fs.createWriteStream(dest)).on('finish', callback);\n });\n}\n\nconst ALLOWED_SCALES: { [key: string]: number[] } = {\n ios: [1, 2, 3],\n};\n\nexport function filterPlatformAssetScales(platform: string, scales: number[]): number[] {\n const whitelist: number[] = ALLOWED_SCALES[platform];\n if (!whitelist) {\n return scales;\n }\n const result = scales.filter((scale) => whitelist.includes(scale));\n if (!result.length && scales.length) {\n // No matching scale found, but there are some available. Ideally we don't\n // want to be in this situation and should throw, but for now as a fallback\n // let's just use the closest larger image\n const maxScale = whitelist[whitelist.length - 1];\n for (const scale of scales) {\n if (scale > maxScale) {\n result.push(scale);\n break;\n }\n }\n\n // There is no larger scales available, use the largest we have\n if (!result.length) {\n result.push(scales[scales.length - 1]);\n }\n }\n return result;\n}\n\nfunction getResourceIdentifier(asset: Pick<AssetData, 'httpServerLocation' | 'name'>): string {\n const folderPath = getBaseUrl(asset);\n return `${folderPath}/${asset.name}`\n .toLowerCase()\n .replace(/\\//g, '_') // Encode folder structure in file name\n .replace(/([^a-z0-9_])/g, '') // Remove illegal chars\n .replace(/^assets_/, ''); // Remove \"assets_\" prefix\n}\n\nfunction getBaseUrl(asset: Pick<AssetData, 'httpServerLocation'>): string {\n let baseUrl = asset.httpServerLocation;\n if (baseUrl[0] === '/') {\n baseUrl = baseUrl.substring(1);\n }\n return baseUrl;\n}\n"],"names":["persistMetroAssetsAsync","getAssetIdForLogGrouping","copyInBatchesAsync","filterPlatformAssetScales","cleanAssetCatalog","catalogDir","files","fs","readdirSync","filter","file","endsWith","rmSync","path","join","projectRoot","assets","platform","outputDirectory","baseUrl","iosAssetCatalogDirectory","Log","warn","existsSync","mkdirSync","recursive","assetsToCopy","error","log","asset","isCatalogAsset","imageSet","getImageSet","scales","writeImageSet","push","batches","validScales","Set","idx","length","scale","has","src","dest","getAssetLocalPath","data","promises","readFile","set","contents","assetId","targetDomain","undefined","fileSystemLocation","name","relative","type","copyFileSync","writeFileSync","JSON","stringify","images","map","filename","idiom","info","author","version","fileName","getResourceIdentifier","suffix","filesToCopy","queue","Object","keys","Promise","resolve","reject","copyNext","shift","copy","callback","mkdir","dirname","err","createReadStream","pipe","createWriteStream","on","ALLOWED_SCALES","ios","whitelist","result","includes","maxScale","folderPath","getBaseUrl","toLowerCase","replace","httpServerLocation","substring"],"mappings":"AAAA;;;;;;;;;CASC,GACD;;;;;;;;;;;IAesBA,uBAAuB,MAAvBA,uBAAuB;IAyF7BC,wBAAwB,MAAxBA,wBAAwB;IA8DxBC,kBAAkB,MAAlBA,kBAAkB;IAuClBC,yBAAyB,MAAzBA,yBAAyB;;;8DA7M1B,IAAI;;;;;;;8DAEF,MAAM;;;;;;qCAEW,uBAAuB;qBAErC,QAAQ;;;;;;AAE5B,SAASC,iBAAiB,CAACC,UAAkB,EAAQ;IACnD,MAAMC,KAAK,GAAGC,GAAE,EAAA,QAAA,CAACC,WAAW,CAACH,UAAU,CAAC,CAACI,MAAM,CAAC,CAACC,IAAI,GAAKA,IAAI,CAACC,QAAQ,CAAC,WAAW,CAAC,CAAC,AAAC;IACtF,KAAK,MAAMD,IAAI,IAAIJ,KAAK,CAAE;QACxBC,GAAE,EAAA,QAAA,CAACK,MAAM,CAACC,KAAI,EAAA,QAAA,CAACC,IAAI,CAACT,UAAU,EAAEK,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AAEM,eAAeV,uBAAuB,CAC3Ce,WAAmB,EACnBC,MAA4B,EAC5B,EACEC,QAAQ,CAAA,E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AC,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IACD,OAAOqD,MAAM,CAAC;AAChB,CAAC;AAED,SAASvB,qBAAqB,CAACzC,KAAqD,EAAU;IAC5F,MAAMmE,UAAU,GAAGC,UAAU,CAACpE,KAAK,CAAC,AAAC;IACrC,OAAO,CAAC,EAAEmE,UAAU,CAAC,CAAC,EAAEnE,KAAK,CAAC0B,IAAI,CAAC,CAAC,CACjC2C,WAAW,EAAE,CACbC,OAAO,QAAQ,GAAG,CAAC,CAAC,uCAAuC;KAC3DA,OAAO,kBAAkB,EAAE,CAAC,CAAC,uBAAuB;KACpDA,OAAO,aAAa,EAAE,CAAC,CAAC,CAAC,0BAA0B;AACxD,CAAC;AAED,SAASF,UAAU,CAACpE,KAA4C,EAAU;IACxE,IAAIV,OAAO,GAAGU,KAAK,CAACuE,kBAAkB,AAAC;IACvC,IAAIjF,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACtBA,OAAO,GAAGA,OAAO,CAACkF,SAAS,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAOlF,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -127,7 +127,8 @@ class UsbmuxdClient extends _serviceClient.ServiceClient {
|
|
|
127
127
|
const BPLIST_MAGIC = Buffer.from("bplist00");
|
|
128
128
|
if (BPLIST_MAGIC.compare(resp.PairRecordData, 0, 8) === 0) {
|
|
129
129
|
debug("Binary plist pair record detected.");
|
|
130
|
-
|
|
130
|
+
const pairRecords = (0, _plist1.parsePlistBuffer)(resp.PairRecordData);
|
|
131
|
+
return Array.isArray(pairRecords) ? pairRecords[0] : pairRecords;
|
|
131
132
|
} else {
|
|
132
133
|
// TODO: use parsePlistBuffer
|
|
133
134
|
return _plist().default.parse(resp.PairRecordData.toString()); // TODO: type guard
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/client/UsbmuxdClient.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\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 plist from '@expo/plist';\nimport Debug from 'debug';\nimport { Socket, connect } from 'net';\n\nimport { ResponseError, ServiceClient } from './ServiceClient';\nimport { CommandError } from '../../../../utils/errors';\nimport { parsePlistBuffer } from '../../../../utils/plist';\nimport { UsbmuxProtocolClient } from '../protocol/UsbmuxProtocol';\n\nconst debug = Debug('expo:apple-device:client:usbmuxd');\n\nexport interface UsbmuxdDeviceProperties {\n /** @example 'USB' */\n ConnectionType: 'USB' | 'Network';\n /** @example 7 */\n DeviceID: number;\n /** @example 339738624 */\n LocationID?: number;\n /** @example '00008101-001964A22629003A' */\n SerialNumber: string;\n /**\n * Only available for USB connection.\n * @example 480000000\n */\n ConnectionSpeed?: number;\n /**\n * Only available for USB connection.\n * @example 4776\n */\n ProductID?: number;\n /**\n * Only available for USB connection.\n * @example '00008101-001964A22629003A'\n */\n UDID?: string;\n /**\n * Only available for USB connection.\n * @example '00008101001964A22629003A'\n */\n USBSerialNumber?: string;\n /**\n * Only available for Network connection.\n * @example '08:c7:29:05:f2:30@fe80::ac7:29ff:fe05:f230-supportsRP._apple-mobdev2._tcp.local.'\n */\n EscapedFullServiceName?: string;\n /**\n * Only available for Network connection.\n * @example 5\n */\n InterfaceIndex?: number;\n /**\n * Only available for Network connection.\n */\n NetworkAddress?: Buffer;\n}\n\nexport interface UsbmuxdDevice {\n /** @example 7 */\n DeviceID: number;\n MessageType: 'Attached'; // TODO: what else?\n Properties: UsbmuxdDeviceProperties;\n}\n\nexport interface UsbmuxdConnectResponse {\n MessageType: 'Result';\n Number: number;\n}\n\nexport interface UsbmuxdDeviceResponse {\n DeviceList: UsbmuxdDevice[];\n}\n\nexport interface UsbmuxdPairRecordResponse {\n PairRecordData: Buffer;\n}\n\nexport interface UsbmuxdPairRecord {\n DeviceCertificate: Buffer;\n EscrowBag: Buffer;\n HostCertificate: Buffer;\n HostID: string;\n HostPrivateKey: Buffer;\n RootCertificate: Buffer;\n RootPrivateKey: Buffer;\n SystemBUID: string;\n WiFiMACAddress: string;\n}\n\nfunction isUsbmuxdConnectResponse(resp: any): resp is UsbmuxdConnectResponse {\n return resp.MessageType === 'Result' && resp.Number !== undefined;\n}\n\nfunction isUsbmuxdDeviceResponse(resp: any): resp is UsbmuxdDeviceResponse {\n return resp.DeviceList !== undefined;\n}\n\nfunction isUsbmuxdPairRecordResponse(resp: any): resp is UsbmuxdPairRecordResponse {\n return resp.PairRecordData !== undefined;\n}\n\nexport class UsbmuxdClient extends ServiceClient<UsbmuxProtocolClient> {\n constructor(public socket: Socket) {\n super(socket, new UsbmuxProtocolClient(socket));\n }\n\n static connectUsbmuxdSocket(): Socket {\n debug('connectUsbmuxdSocket');\n if (process.platform === 'win32') {\n return connect({ port: 27015, host: 'localhost' });\n } else {\n return connect({ path: '/var/run/usbmuxd' });\n }\n }\n\n async connect(device: Pick<UsbmuxdDevice, 'DeviceID'>, port: number): Promise<Socket> {\n debug(`connect: ${device.DeviceID} on port ${port}`);\n debug(`connect:device: %O`, device);\n\n const response = await this.protocolClient.sendMessage({\n messageType: 'Connect',\n extraFields: {\n DeviceID: device.DeviceID,\n PortNumber: htons(port),\n },\n });\n debug(`connect:device:response: %O`, response);\n\n if (isUsbmuxdConnectResponse(response) && response.Number === 0) {\n return this.protocolClient.socket;\n } else {\n throw new ResponseError(\n `There was an error connecting to the USB connected device (id: ${device.DeviceID}, port: ${port})`,\n response\n );\n }\n }\n\n async getDevices(): Promise<UsbmuxdDevice[]> {\n debug('getDevices');\n\n const resp = await this.protocolClient.sendMessage({\n messageType: 'ListDevices',\n });\n\n if (isUsbmuxdDeviceResponse(resp)) {\n return resp.DeviceList;\n } else {\n throw new ResponseError('Invalid response from getDevices', resp);\n }\n }\n\n async getDevice(udid?: string): Promise<UsbmuxdDevice> {\n debug(`getDevice ${udid ? 'udid: ' + udid : ''}`);\n const devices = await this.getDevices();\n\n if (!devices.length) {\n throw new CommandError('APPLE_DEVICE_USBMUXD', 'No devices found');\n }\n\n if (!udid) {\n return devices[0];\n }\n\n for (const device of devices) {\n if (device.Properties && device.Properties.SerialNumber === udid) {\n return device;\n }\n }\n\n throw new CommandError('APPLE_DEVICE_USBMUXD', `No device found (udid: ${udid})`);\n }\n\n async readPairRecord(udid: string): Promise<UsbmuxdPairRecord> {\n debug(`readPairRecord: ${udid}`);\n\n const resp = await this.protocolClient.sendMessage({\n messageType: 'ReadPairRecord',\n extraFields: { PairRecordID: udid },\n });\n\n if (isUsbmuxdPairRecordResponse(resp)) {\n // the pair record can be created as a binary plist\n const BPLIST_MAGIC = Buffer.from('bplist00');\n if (BPLIST_MAGIC.compare(resp.PairRecordData, 0, 8) === 0) {\n debug('Binary plist pair record detected.');\n return parsePlistBuffer(resp.PairRecordData)[0];\n } else {\n // TODO: use parsePlistBuffer\n return plist.parse(resp.PairRecordData.toString()) as any; // TODO: type guard\n }\n } else {\n throw new ResponseError(\n `There was an error reading pair record for device (udid: ${udid})`,\n resp\n );\n }\n }\n}\n\nfunction htons(n: number): number {\n return ((n & 0xff) << 8) | ((n >> 8) & 0xff);\n}\n"],"names":["UsbmuxdClient","debug","Debug","isUsbmuxdConnectResponse","resp","MessageType","Number","undefined","isUsbmuxdDeviceResponse","DeviceList","isUsbmuxdPairRecordResponse","PairRecordData","ServiceClient","constructor","socket","UsbmuxProtocolClient","connectUsbmuxdSocket","process","platform","connect","port","host","path","device","DeviceID","response","protocolClient","sendMessage","messageType","extraFields","PortNumber","htons","ResponseError","getDevices","getDevice","udid","devices","length","CommandError","Properties","SerialNumber","readPairRecord","PairRecordID","BPLIST_MAGIC","Buffer","from","compare","parsePlistBuffer","plist","parse","toString","n"],"mappings":"AAAA;;;;;;CAMC,GACD;;;;+BAoGaA,eAAa;;aAAbA,aAAa;;;8DApGR,aAAa;;;;;;;8DACb,OAAO;;;;;;;yBACO,KAAK;;;;;;+BAEQ,iBAAiB;wBACjC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AAQ,CAAC,mBAAmB;YAChF,CAAC;QACH,OAAO;YACL,MAAM,IAAIlB,cAAa,cAAA,CACrB,CAAC,yDAAyD,EAAEG,IAAI,CAAC,CAAC,CAAC,EACnE/B,IAAI,CACL,CAAC;QACJ,CAAC;IACH;CACD;AAED,SAAS2B,KAAK,CAACoB,CAAS,EAAU;IAChC,OAAO,AAAC,CAACA,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAK,AAACA,CAAC,IAAI,CAAC,GAAI,IAAI,AAAC,CAAC;AAC/C,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/run/ios/appleDevice/client/UsbmuxdClient.ts"],"sourcesContent":["/**\n * Copyright (c) 2021 Expo, Inc.\n * Copyright (c) 2018 Drifty Co.\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 plist from '@expo/plist';\nimport Debug from 'debug';\nimport { Socket, connect } from 'net';\n\nimport { ResponseError, ServiceClient } from './ServiceClient';\nimport { CommandError } from '../../../../utils/errors';\nimport { parsePlistBuffer } from '../../../../utils/plist';\nimport { UsbmuxProtocolClient } from '../protocol/UsbmuxProtocol';\n\nconst debug = Debug('expo:apple-device:client:usbmuxd');\n\nexport interface UsbmuxdDeviceProperties {\n /** @example 'USB' */\n ConnectionType: 'USB' | 'Network';\n /** @example 7 */\n DeviceID: number;\n /** @example 339738624 */\n LocationID?: number;\n /** @example '00008101-001964A22629003A' */\n SerialNumber: string;\n /**\n * Only available for USB connection.\n * @example 480000000\n */\n ConnectionSpeed?: number;\n /**\n * Only available for USB connection.\n * @example 4776\n */\n ProductID?: number;\n /**\n * Only available for USB connection.\n * @example '00008101-001964A22629003A'\n */\n UDID?: string;\n /**\n * Only available for USB connection.\n * @example '00008101001964A22629003A'\n */\n USBSerialNumber?: string;\n /**\n * Only available for Network connection.\n * @example '08:c7:29:05:f2:30@fe80::ac7:29ff:fe05:f230-supportsRP._apple-mobdev2._tcp.local.'\n */\n EscapedFullServiceName?: string;\n /**\n * Only available for Network connection.\n * @example 5\n */\n InterfaceIndex?: number;\n /**\n * Only available for Network connection.\n */\n NetworkAddress?: Buffer;\n}\n\nexport interface UsbmuxdDevice {\n /** @example 7 */\n DeviceID: number;\n MessageType: 'Attached'; // TODO: what else?\n Properties: UsbmuxdDeviceProperties;\n}\n\nexport interface UsbmuxdConnectResponse {\n MessageType: 'Result';\n Number: number;\n}\n\nexport interface UsbmuxdDeviceResponse {\n DeviceList: UsbmuxdDevice[];\n}\n\nexport interface UsbmuxdPairRecordResponse {\n PairRecordData: Buffer;\n}\n\nexport interface UsbmuxdPairRecord {\n DeviceCertificate: Buffer;\n EscrowBag: Buffer;\n HostCertificate: Buffer;\n HostID: string;\n HostPrivateKey: Buffer;\n RootCertificate: Buffer;\n RootPrivateKey: Buffer;\n SystemBUID: string;\n WiFiMACAddress: string;\n}\n\nfunction isUsbmuxdConnectResponse(resp: any): resp is UsbmuxdConnectResponse {\n return resp.MessageType === 'Result' && resp.Number !== undefined;\n}\n\nfunction isUsbmuxdDeviceResponse(resp: any): resp is UsbmuxdDeviceResponse {\n return resp.DeviceList !== undefined;\n}\n\nfunction isUsbmuxdPairRecordResponse(resp: any): resp is UsbmuxdPairRecordResponse {\n return resp.PairRecordData !== undefined;\n}\n\nexport class UsbmuxdClient extends ServiceClient<UsbmuxProtocolClient> {\n constructor(public socket: Socket) {\n super(socket, new UsbmuxProtocolClient(socket));\n }\n\n static connectUsbmuxdSocket(): Socket {\n debug('connectUsbmuxdSocket');\n if (process.platform === 'win32') {\n return connect({ port: 27015, host: 'localhost' });\n } else {\n return connect({ path: '/var/run/usbmuxd' });\n }\n }\n\n async connect(device: Pick<UsbmuxdDevice, 'DeviceID'>, port: number): Promise<Socket> {\n debug(`connect: ${device.DeviceID} on port ${port}`);\n debug(`connect:device: %O`, device);\n\n const response = await this.protocolClient.sendMessage({\n messageType: 'Connect',\n extraFields: {\n DeviceID: device.DeviceID,\n PortNumber: htons(port),\n },\n });\n debug(`connect:device:response: %O`, response);\n\n if (isUsbmuxdConnectResponse(response) && response.Number === 0) {\n return this.protocolClient.socket;\n } else {\n throw new ResponseError(\n `There was an error connecting to the USB connected device (id: ${device.DeviceID}, port: ${port})`,\n response\n );\n }\n }\n\n async getDevices(): Promise<UsbmuxdDevice[]> {\n debug('getDevices');\n\n const resp = await this.protocolClient.sendMessage({\n messageType: 'ListDevices',\n });\n\n if (isUsbmuxdDeviceResponse(resp)) {\n return resp.DeviceList;\n } else {\n throw new ResponseError('Invalid response from getDevices', resp);\n }\n }\n\n async getDevice(udid?: string): Promise<UsbmuxdDevice> {\n debug(`getDevice ${udid ? 'udid: ' + udid : ''}`);\n const devices = await this.getDevices();\n\n if (!devices.length) {\n throw new CommandError('APPLE_DEVICE_USBMUXD', 'No devices found');\n }\n\n if (!udid) {\n return devices[0];\n }\n\n for (const device of devices) {\n if (device.Properties && device.Properties.SerialNumber === udid) {\n return device;\n }\n }\n\n throw new CommandError('APPLE_DEVICE_USBMUXD', `No device found (udid: ${udid})`);\n }\n\n async readPairRecord(udid: string): Promise<UsbmuxdPairRecord> {\n debug(`readPairRecord: ${udid}`);\n\n const resp = await this.protocolClient.sendMessage({\n messageType: 'ReadPairRecord',\n extraFields: { PairRecordID: udid },\n });\n\n if (isUsbmuxdPairRecordResponse(resp)) {\n // the pair record can be created as a binary plist\n const BPLIST_MAGIC = Buffer.from('bplist00');\n if (BPLIST_MAGIC.compare(resp.PairRecordData, 0, 8) === 0) {\n debug('Binary plist pair record detected.');\n const pairRecords = parsePlistBuffer(resp.PairRecordData);\n return Array.isArray(pairRecords) ? pairRecords[0] : pairRecords;\n } else {\n // TODO: use parsePlistBuffer\n return plist.parse(resp.PairRecordData.toString()) as any; // TODO: type guard\n }\n } else {\n throw new ResponseError(\n `There was an error reading pair record for device (udid: ${udid})`,\n resp\n );\n }\n }\n}\n\nfunction htons(n: number): number {\n return ((n & 0xff) << 8) | ((n >> 8) & 0xff);\n}\n"],"names":["UsbmuxdClient","debug","Debug","isUsbmuxdConnectResponse","resp","MessageType","Number","undefined","isUsbmuxdDeviceResponse","DeviceList","isUsbmuxdPairRecordResponse","PairRecordData","ServiceClient","constructor","socket","UsbmuxProtocolClient","connectUsbmuxdSocket","process","platform","connect","port","host","path","device","DeviceID","response","protocolClient","sendMessage","messageType","extraFields","PortNumber","htons","ResponseError","getDevices","getDevice","udid","devices","length","CommandError","Properties","SerialNumber","readPairRecord","PairRecordID","BPLIST_MAGIC","Buffer","from","compare","pairRecords","parsePlistBuffer","Array","isArray","plist","parse","toString","n"],"mappings":"AAAA;;;;;;CAMC,GACD;;;;+BAoGaA,eAAa;;aAAbA,aAAa;;;8DApGR,aAAa;;;;;;;8DACb,OAAO;;;;;;;yBACO,KAAK;;;;;;+BAEQ,iBAAiB;wBACjC,0BAA0B;wBACtB,yBAAyB;gCACrB,4BAA4B;;;;;;AAEjE,MAAMC,KAAK,GAAGC,IAAAA,MAAK,EAAA,QAAA,EAAC,kCAAkC,CAAC,AAAC;AA+ExD,SAASC,wBAAwB,CAACC,IAAS,EAAkC;IAC3E,OAAOA,IAAI,CAACC,WAAW,KAAK,QAAQ,IAAID,IAAI,CAACE,MAAM,KAAKC,SAAS,CAAC;AACpE,CAAC;AAED,SAASC,uBAAuB,CAACJ,IAAS,EAAiC;IACzE,OAAOA,IAAI,CAACK,UAAU,KAAKF,SAAS,CAAC;AACvC,CAAC;AAED,SAASG,2BAA2B,CAACN,IAAS,EAAqC;IACjF,OAAOA,IAAI,CAACO,cAAc,KAAKJ,SAAS,CAAC;AAC3C,CAAC;AAEM,MAAMP,aAAa,SAASY,cAAa,cAAA;IAC9CC,YAAmBC,MAAc,CAAE;QACjC,KAAK,CAACA,MAAM,EAAE,IAAIC,eAAoB,qBAAA,CAACD,MAAM,CAAC,CAAC,CAAC;QAD/BA,cAAAA,MAAc,CAAA;IAEjC;WAEOE,oBAAoB,GAAW;QACpCf,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC9B,IAAIgB,OAAO,CA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,2BAA2B,CAACN,IAAI,CAAC,EAAE;YACrC,mDAAmD;YACnD,MAAMuC,YAAY,GAAGC,MAAM,CAACC,IAAI,CAAC,UAAU,CAAC,AAAC;YAC7C,IAAIF,YAAY,CAACG,OAAO,CAAC1C,IAAI,CAACO,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE;gBACzDV,KAAK,CAAC,oCAAoC,CAAC,CAAC;gBAC5C,MAAM8C,WAAW,GAAGC,IAAAA,OAAgB,iBAAA,EAAC5C,IAAI,CAACO,cAAc,CAAC,AAAC;gBAC1D,OAAOsC,KAAK,CAACC,OAAO,CAACH,WAAW,CAAC,GAAGA,WAAW,CAAC,CAAC,CAAC,GAAGA,WAAW,CAAC;YACnE,OAAO;gBACL,6BAA6B;gBAC7B,OAAOI,MAAK,EAAA,QAAA,CAACC,KAAK,CAAChD,IAAI,CAACO,cAAc,CAAC0C,QAAQ,EAAE,CAAC,CAAQ,CAAC,mBAAmB;YAChF,CAAC;QACH,OAAO;YACL,MAAM,IAAIrB,cAAa,cAAA,CACrB,CAAC,yDAAyD,EAAEG,IAAI,CAAC,CAAC,CAAC,EACnE/B,IAAI,CACL,CAAC;QACJ,CAAC;IACH;CACD;AAED,SAAS2B,KAAK,CAACuB,CAAS,EAAU;IAChC,OAAO,AAAC,CAACA,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAK,AAACA,CAAC,IAAI,CAAC,GAAI,IAAI,AAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -108,7 +108,7 @@ function getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, options) {
|
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
function getMetroDirectBundleOptions(options) {
|
|
111
|
-
const { mainModuleName , platform , mode , minify , environment , serializerOutput , serializerIncludeMaps , bytecode , lazy , engine , preserveEnvVars , asyncRoutes , baseUrl , routerRoot , isExporting , inlineSourceMap , splitChunks , usedExports , reactCompiler , optimize , domRoot , clientBoundaries , runModule , modulesOnly , } = withDefaults(options);
|
|
111
|
+
const { mainModuleName , platform , mode , minify , environment , serializerOutput , serializerIncludeMaps , bytecode , lazy , engine , preserveEnvVars , asyncRoutes , baseUrl , routerRoot , isExporting , inlineSourceMap , splitChunks , usedExports , reactCompiler , optimize , domRoot , clientBoundaries , runModule , modulesOnly , useMd5Filename , } = withDefaults(options);
|
|
112
112
|
const dev = mode !== "production";
|
|
113
113
|
const isHermes = engine === "hermes";
|
|
114
114
|
if (isExporting) {
|
|
@@ -137,7 +137,8 @@ function getMetroDirectBundleOptions(options) {
|
|
|
137
137
|
routerRoot,
|
|
138
138
|
bytecode: bytecode ? "1" : undefined,
|
|
139
139
|
reactCompiler: reactCompiler ? String(reactCompiler) : undefined,
|
|
140
|
-
dom: domRoot
|
|
140
|
+
dom: domRoot,
|
|
141
|
+
useMd5Filename: useMd5Filename || undefined
|
|
141
142
|
};
|
|
142
143
|
// Iterate and delete undefined values
|
|
143
144
|
for(const key in customTransformOptions){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/middleware/metroOptions.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { BundleOptions as MetroBundleOptions } from 'metro/src/shared/types';\nimport resolveFrom from 'resolve-from';\n\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\n\nconst debug = require('debug')('expo:metro:options') as typeof console.log;\n\nexport type MetroEnvironment = 'node' | 'react-server' | 'client';\n\nexport type ExpoMetroOptions = {\n platform: string;\n mainModuleName: string;\n mode: string;\n minify?: boolean;\n environment?: MetroEnvironment;\n serializerOutput?: 'static';\n serializerIncludeMaps?: boolean;\n lazy?: boolean;\n engine?: 'hermes';\n preserveEnvVars?: boolean;\n bytecode: boolean;\n /** Enable async routes (route-based bundle splitting) in Expo Router. */\n asyncRoutes?: boolean;\n /** Module ID relative to the projectRoot for the Expo Router app directory. */\n routerRoot: string;\n /** Enable React compiler support in Babel. */\n reactCompiler: boolean;\n baseUrl?: string;\n isExporting: boolean;\n /** Is bundling a DOM Component (\"use dom\"). Requires the entry dom component file path. */\n domRoot?: string;\n inlineSourceMap?: boolean;\n clientBoundaries?: string[];\n splitChunks?: boolean;\n usedExports?: boolean;\n /** Enable optimized bundling (required for tree shaking). */\n optimize?: boolean;\n\n modulesOnly?: boolean;\n runModule?: boolean;\n};\n\nexport type SerializerOptions = {\n includeSourceMaps?: boolean;\n output?: 'static';\n splitChunks?: boolean;\n usedExports?: boolean;\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\n};\n\nexport function isServerEnvironment(environment?: any): boolean {\n return environment === 'node' || environment === 'react-server';\n}\n\nexport function shouldEnableAsyncImports(projectRoot: string): boolean {\n if (env.EXPO_NO_METRO_LAZY) {\n return false;\n }\n\n // `@expo/metro-runtime` includes support for the fetch + eval runtime code required\n // to support async imports. If it's not installed, we can't support async imports.\n // If it is installed, the user MUST import it somewhere in their project.\n // Expo Router automatically pulls this in, so we can check for it.\n return resolveFrom.silent(projectRoot, '@expo/metro-runtime') != null;\n}\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = mode !== 'development' && env.EXPO_NO_CLIENT_ENV_VARS,\n lazy,\n environment,\n ...props\n}: ExpoMetroOptions): ExpoMetroOptions {\n if (props.bytecode) {\n if (props.platform === 'web') {\n throw new CommandError('Cannot use bytecode with the web platform');\n }\n if (props.engine !== 'hermes') {\n throw new CommandError('Bytecode is only supported with the Hermes engine');\n }\n }\n\n const optimize =\n props.optimize ??\n (environment !== 'node' && mode === 'production' && env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH);\n\n return {\n mode,\n minify,\n preserveEnvVars,\n optimize,\n usedExports: optimize && env.EXPO_UNSTABLE_TREE_SHAKING,\n lazy: !props.isExporting && lazy,\n environment: environment === 'client' ? undefined : environment,\n ...props,\n };\n}\n\nexport function getBaseUrlFromExpoConfig(exp: ExpoConfig) {\n return exp.experiments?.baseUrl?.trim().replace(/\\/+$/, '') ?? '';\n}\n\nexport function getAsyncRoutesFromExpoConfig(exp: ExpoConfig, mode: string, platform: string) {\n let asyncRoutesSetting;\n\n if (exp.extra?.router?.asyncRoutes) {\n const asyncRoutes = exp.extra?.router?.asyncRoutes;\n if (['boolean', 'string'].includes(typeof asyncRoutes)) {\n asyncRoutesSetting = asyncRoutes;\n } else if (typeof asyncRoutes === 'object') {\n asyncRoutesSetting = asyncRoutes[platform] ?? asyncRoutes.default;\n }\n }\n\n return [mode, true].includes(asyncRoutesSetting);\n}\n\nexport function getMetroDirectBundleOptionsForExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'baseUrl' | 'reactCompiler' | 'routerRoot' | 'asyncRoutes'>\n): Partial<ExpoMetroBundleOptions> {\n return getMetroDirectBundleOptions({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(exp, options.mode, options.platform),\n });\n}\n\nexport function getMetroDirectBundleOptions(\n options: ExpoMetroOptions\n): Partial<ExpoMetroBundleOptions> {\n const {\n mainModuleName,\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n bytecode,\n lazy,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n inlineSourceMap,\n splitChunks,\n usedExports,\n reactCompiler,\n optimize,\n domRoot,\n clientBoundaries,\n runModule,\n modulesOnly,\n } = withDefaults(options);\n\n const dev = mode !== 'production';\n const isHermes = engine === 'hermes';\n\n if (isExporting) {\n debug('Disabling lazy bundling for export build');\n options.lazy = false;\n }\n\n let fakeSourceUrl: string | undefined;\n let fakeSourceMapUrl: string | undefined;\n\n // TODO: Upstream support to Metro for passing custom serializer options.\n if (serializerIncludeMaps != null || serializerOutput != null) {\n fakeSourceUrl = new URL(\n createBundleUrlPath(options).replace(/^\\//, ''),\n 'http://localhost:8081'\n ).toString();\n if (serializerIncludeMaps) {\n fakeSourceMapUrl = fakeSourceUrl.replace('.bundle?', '.map?');\n }\n }\n\n const customTransformOptions: ExpoMetroBundleOptions['customTransformOptions'] = {\n __proto__: null,\n optimize: optimize || undefined,\n engine,\n clientBoundaries,\n preserveEnvVars: preserveEnvVars || undefined,\n // Use string to match the query param behavior.\n asyncRoutes: asyncRoutes ? String(asyncRoutes) : undefined,\n environment,\n baseUrl: baseUrl || undefined,\n routerRoot,\n bytecode: bytecode ? '1' : undefined,\n reactCompiler: reactCompiler ? String(reactCompiler) : undefined,\n dom: domRoot,\n };\n\n // Iterate and delete undefined values\n for (const key in customTransformOptions) {\n if (customTransformOptions[key] === undefined) {\n delete customTransformOptions[key];\n }\n }\n\n const bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: minify ?? !dev,\n inlineSourceMap: inlineSourceMap ?? false,\n lazy: (!isExporting && lazy) || undefined,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions,\n runModule,\n modulesOnly,\n customResolverOptions: {\n __proto__: null,\n environment,\n exporting: isExporting || undefined,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n splitChunks,\n usedExports: usedExports || undefined,\n output: serializerOutput,\n includeSourceMaps: serializerIncludeMaps,\n },\n };\n\n return bundleOptions;\n}\n\nexport function createBundleUrlPathFromExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'reactCompiler' | 'baseUrl' | 'routerRoot'>\n): string {\n return createBundleUrlPath({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n });\n}\n\nexport function createBundleUrlPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n return `/${encodeURI(options.mainModuleName.replace(/^\\/+/, ''))}.bundle?${queryParams.toString()}`;\n}\n\n/**\n * Create a bundle URL, containing all required query parameters, using a valid \"os path\".\n * On POSIX systems, this would look something like `/Users/../project/file.js?dev=false&..`.\n * On UNIX systems, this would look something like `C:\\Users\\..\\project\\file.js?dev=false&..`.\n * This path can safely be used with `path.*` modifiers and resolved.\n */\nexport function createBundleUrlOsPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n const mainModuleName = encodeURI(toPosixPath(options.mainModuleName));\n return `${mainModuleName}.bundle?${queryParams.toString()}`;\n}\n\nexport function createBundleUrlSearchParams(options: ExpoMetroOptions): URLSearchParams {\n const {\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n lazy,\n bytecode,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n reactCompiler,\n inlineSourceMap,\n isExporting,\n clientBoundaries,\n splitChunks,\n usedExports,\n optimize,\n domRoot,\n modulesOnly,\n runModule,\n } = withDefaults(options);\n\n const dev = String(mode !== 'production');\n const queryParams = new URLSearchParams({\n platform: encodeURIComponent(platform),\n dev,\n // TODO: Is this still needed?\n hot: String(false),\n });\n\n // Lazy bundling must be disabled for bundle splitting to work.\n if (!isExporting && lazy) {\n queryParams.append('lazy', String(lazy));\n }\n\n if (inlineSourceMap) {\n queryParams.append('inlineSourceMap', String(inlineSourceMap));\n }\n\n if (minify) {\n queryParams.append('minify', String(minify));\n }\n\n // We split bytecode from the engine since you could technically use Hermes without bytecode.\n // Hermes indicates the type of language features you want to transform out of the JS, whereas bytecode\n // indicates whether you want to use the Hermes bytecode format.\n if (engine) {\n queryParams.append('transform.engine', engine);\n }\n if (bytecode) {\n queryParams.append('transform.bytecode', '1');\n }\n if (asyncRoutes) {\n queryParams.append('transform.asyncRoutes', String(asyncRoutes));\n }\n if (preserveEnvVars) {\n queryParams.append('transform.preserveEnvVars', String(preserveEnvVars));\n }\n if (baseUrl) {\n queryParams.append('transform.baseUrl', baseUrl);\n }\n if (clientBoundaries?.length) {\n queryParams.append('transform.clientBoundaries', JSON.stringify(clientBoundaries));\n }\n if (routerRoot != null) {\n queryParams.append('transform.routerRoot', routerRoot);\n }\n if (reactCompiler) {\n queryParams.append('transform.reactCompiler', String(reactCompiler));\n }\n if (domRoot) {\n queryParams.append('transform.dom', domRoot);\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (isExporting) {\n queryParams.append('resolver.exporting', String(isExporting));\n }\n\n if (splitChunks) {\n queryParams.append('serializer.splitChunks', String(splitChunks));\n }\n if (usedExports) {\n queryParams.append('serializer.usedExports', String(usedExports));\n }\n if (optimize) {\n queryParams.append('transform.optimize', String(optimize));\n }\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n if (engine === 'hermes') {\n queryParams.append('unstable_transformProfile', 'hermes-stable');\n }\n\n if (modulesOnly != null) {\n queryParams.set('modulesOnly', String(modulesOnly));\n }\n if (runModule != null) {\n queryParams.set('runModule', String(runModule));\n }\n\n return queryParams;\n}\n\n/**\n * Convert all path separators to `/`, including on Windows.\n * Metro asumes that all module specifiers are posix paths.\n * References to directories can still be Windows-style paths in Metro.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_features_into_your_script\n * @see https://github.com/facebook/metro/pull/1286\n */\nexport function convertPathToModuleSpecifier(pathLike: string) {\n return toPosixPath(pathLike);\n}\n\nexport function getMetroOptionsFromUrl(urlFragment: string) {\n const url = new URL(urlFragment, 'http://localhost:0');\n const getStringParam = (key: string) => {\n const param = url.searchParams.get(key);\n if (Array.isArray(param)) {\n throw new Error(`Expected single value for ${key}`);\n }\n return param;\n };\n\n let pathname = url.pathname;\n if (pathname.endsWith('.bundle')) {\n pathname = pathname.slice(0, -'.bundle'.length);\n }\n\n const options: ExpoMetroOptions = {\n mode: isTruthy(getStringParam('dev') ?? 'true') ? 'development' : 'production',\n minify: isTruthy(getStringParam('minify') ?? 'false'),\n lazy: isTruthy(getStringParam('lazy') ?? 'false'),\n routerRoot: getStringParam('transform.routerRoot') ?? 'app',\n isExporting: isTruthy(getStringParam('resolver.exporting') ?? 'false'),\n environment: assertEnvironment(getStringParam('transform.environment') ?? 'node'),\n platform: url.searchParams.get('platform') ?? 'web',\n bytecode: isTruthy(getStringParam('transform.bytecode') ?? 'false'),\n mainModuleName: convertPathToModuleSpecifier(pathname),\n reactCompiler: isTruthy(getStringParam('transform.reactCompiler') ?? 'false'),\n asyncRoutes: isTruthy(getStringParam('transform.asyncRoutes') ?? 'false'),\n baseUrl: getStringParam('transform.baseUrl') ?? undefined,\n // clientBoundaries: JSON.parse(getStringParam('transform.clientBoundaries') ?? '[]'),\n engine: assertEngine(getStringParam('transform.engine')),\n runModule: isTruthy(getStringParam('runModule') ?? 'true'),\n modulesOnly: isTruthy(getStringParam('modulesOnly') ?? 'false'),\n };\n\n return options;\n}\n\nfunction isTruthy(value: string | null): boolean {\n return value === 'true' || value === '1';\n}\n\nfunction assertEnvironment(environment: string | undefined): MetroEnvironment | undefined {\n if (!environment) {\n return undefined;\n }\n if (!['node', 'react-server', 'client'].includes(environment)) {\n throw new Error(`Expected transform.environment to be one of: node, react-server, client`);\n }\n return environment as MetroEnvironment;\n}\nfunction assertEngine(engine: string | undefined | null): 'hermes' | undefined {\n if (!engine) {\n return undefined;\n }\n if (!['hermes'].includes(engine)) {\n throw new Error(`Expected transform.engine to be one of: hermes`);\n }\n return engine as 'hermes';\n}\n"],"names":["isServerEnvironment","shouldEnableAsyncImports","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getMetroDirectBundleOptionsForExpoConfig","getMetroDirectBundleOptions","createBundleUrlPathFromExpoConfig","createBundleUrlPath","createBundleUrlOsPath","createBundleUrlSearchParams","convertPathToModuleSpecifier","getMetroOptionsFromUrl","debug","require","environment","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","lazy","props","bytecode","platform","CommandError","engine","optimize","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","usedExports","EXPO_UNSTABLE_TREE_SHAKING","isExporting","undefined","exp","experiments","baseUrl","trim","replace","asyncRoutesSetting","extra","router","asyncRoutes","includes","default","options","reactCompiler","routerRoot","getRouterDirectoryModuleIdWithManifest","mainModuleName","serializerOutput","serializerIncludeMaps","inlineSourceMap","splitChunks","domRoot","clientBoundaries","runModule","modulesOnly","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","customTransformOptions","__proto__","String","dom","key","bundleOptions","entryFile","unstable_transformProfile","customResolverOptions","exporting","sourceMapUrl","sourceUrl","serializerOptions","output","includeSourceMaps","queryParams","encodeURI","toPosixPath","URLSearchParams","encodeURIComponent","hot","append","length","JSON","stringify","set","pathLike","urlFragment","url","getStringParam","param","searchParams","get","Array","isArray","Error","pathname","endsWith","slice","isTruthy","assertEnvironment","assertEngine","value"],"mappings":"AAAA;;;;;;;;;;;IAyDgBA,mBAAmB,MAAnBA,mBAAmB;IAInBC,wBAAwB,MAAxBA,wBAAwB;IA6CxBC,wBAAwB,MAAxBA,wBAAwB;IAIxBC,4BAA4B,MAA5BA,4BAA4B;IAe5BC,wCAAwC,MAAxCA,wCAAwC;IAcxCC,2BAA2B,MAA3BA,2BAA2B;IAwG3BC,iCAAiC,MAAjCA,iCAAiC;IAajCC,mBAAmB,MAAnBA,mBAAmB;IAWnBC,qBAAqB,MAArBA,qBAAqB;IAMrBC,2BAA2B,MAA3BA,2BAA2B;IA6H3BC,4BAA4B,MAA5BA,4BAA4B;IAI5BC,sBAAsB,MAAtBA,sBAAsB;;;8DA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Z,cAAc,CAAC,kBAAkB,CAAC,CAAC;QACxDrC,SAAS,EAAE+C,QAAQ,CAACV,cAAc,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC;QAC1DpC,WAAW,EAAE8C,QAAQ,CAACV,cAAc,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC;KAChE,AAAC;IAEF,OAAOhD,OAAO,CAAC;AACjB,CAAC;AAED,SAAS0D,QAAQ,CAACG,KAAoB,EAAW;IAC/C,OAAOA,KAAK,KAAK,MAAM,IAAIA,KAAK,KAAK,GAAG,CAAC;AAC3C,CAAC;AAED,SAASF,iBAAiB,CAAC7F,WAA+B,EAAgC;IACxF,IAAI,CAACA,WAAW,EAAE;QAChB,OAAOsB,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QAAC,MAAM;QAAE,cAAc;QAAE,QAAQ;KAAC,CAACU,QAAQ,CAAChC,WAAW,CAAC,EAAE;QAC7D,MAAM,IAAIwF,KAAK,CAAC,CAAC,uEAAuE,CAAC,CAAC,CAAC;IAC7F,CAAC;IACD,OAAOxF,WAAW,CAAqB;AACzC,CAAC;AACD,SAAS8F,YAAY,CAAC9E,MAAiC,EAAwB;IAC7E,IAAI,CAACA,MAAM,EAAE;QACX,OAAOM,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QAAC,QAAQ;KAAC,CAACU,QAAQ,CAAChB,MAAM,CAAC,EAAE;QAChC,MAAM,IAAIwE,KAAK,CAAC,CAAC,8CAA8C,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,OAAOxE,MAAM,CAAa;AAC5B,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/metroOptions.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { BundleOptions as MetroBundleOptions } from 'metro/src/shared/types';\nimport resolveFrom from 'resolve-from';\n\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\n\nconst debug = require('debug')('expo:metro:options') as typeof console.log;\n\nexport type MetroEnvironment = 'node' | 'react-server' | 'client';\n\nexport type ExpoMetroOptions = {\n platform: string;\n mainModuleName: string;\n mode: string;\n minify?: boolean;\n environment?: MetroEnvironment;\n serializerOutput?: 'static';\n serializerIncludeMaps?: boolean;\n lazy?: boolean;\n engine?: 'hermes';\n preserveEnvVars?: boolean;\n bytecode: boolean;\n /** Enable async routes (route-based bundle splitting) in Expo Router. */\n asyncRoutes?: boolean;\n /** Module ID relative to the projectRoot for the Expo Router app directory. */\n routerRoot: string;\n /** Enable React compiler support in Babel. */\n reactCompiler: boolean;\n baseUrl?: string;\n isExporting: boolean;\n /** Is bundling a DOM Component (\"use dom\"). Requires the entry dom component file path. */\n domRoot?: string;\n /** Exporting MD5 filename based on file contents, for EAS Update. */\n useMd5Filename?: boolean;\n inlineSourceMap?: boolean;\n clientBoundaries?: string[];\n splitChunks?: boolean;\n usedExports?: boolean;\n /** Enable optimized bundling (required for tree shaking). */\n optimize?: boolean;\n\n modulesOnly?: boolean;\n runModule?: boolean;\n};\n\nexport type SerializerOptions = {\n includeSourceMaps?: boolean;\n output?: 'static';\n splitChunks?: boolean;\n usedExports?: boolean;\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\n};\n\nexport function isServerEnvironment(environment?: any): boolean {\n return environment === 'node' || environment === 'react-server';\n}\n\nexport function shouldEnableAsyncImports(projectRoot: string): boolean {\n if (env.EXPO_NO_METRO_LAZY) {\n return false;\n }\n\n // `@expo/metro-runtime` includes support for the fetch + eval runtime code required\n // to support async imports. If it's not installed, we can't support async imports.\n // If it is installed, the user MUST import it somewhere in their project.\n // Expo Router automatically pulls this in, so we can check for it.\n return resolveFrom.silent(projectRoot, '@expo/metro-runtime') != null;\n}\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = mode !== 'development' && env.EXPO_NO_CLIENT_ENV_VARS,\n lazy,\n environment,\n ...props\n}: ExpoMetroOptions): ExpoMetroOptions {\n if (props.bytecode) {\n if (props.platform === 'web') {\n throw new CommandError('Cannot use bytecode with the web platform');\n }\n if (props.engine !== 'hermes') {\n throw new CommandError('Bytecode is only supported with the Hermes engine');\n }\n }\n\n const optimize =\n props.optimize ??\n (environment !== 'node' && mode === 'production' && env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH);\n\n return {\n mode,\n minify,\n preserveEnvVars,\n optimize,\n usedExports: optimize && env.EXPO_UNSTABLE_TREE_SHAKING,\n lazy: !props.isExporting && lazy,\n environment: environment === 'client' ? undefined : environment,\n ...props,\n };\n}\n\nexport function getBaseUrlFromExpoConfig(exp: ExpoConfig) {\n return exp.experiments?.baseUrl?.trim().replace(/\\/+$/, '') ?? '';\n}\n\nexport function getAsyncRoutesFromExpoConfig(exp: ExpoConfig, mode: string, platform: string) {\n let asyncRoutesSetting;\n\n if (exp.extra?.router?.asyncRoutes) {\n const asyncRoutes = exp.extra?.router?.asyncRoutes;\n if (['boolean', 'string'].includes(typeof asyncRoutes)) {\n asyncRoutesSetting = asyncRoutes;\n } else if (typeof asyncRoutes === 'object') {\n asyncRoutesSetting = asyncRoutes[platform] ?? asyncRoutes.default;\n }\n }\n\n return [mode, true].includes(asyncRoutesSetting);\n}\n\nexport function getMetroDirectBundleOptionsForExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'baseUrl' | 'reactCompiler' | 'routerRoot' | 'asyncRoutes'>\n): Partial<ExpoMetroBundleOptions> {\n return getMetroDirectBundleOptions({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(exp, options.mode, options.platform),\n });\n}\n\nexport function getMetroDirectBundleOptions(\n options: ExpoMetroOptions\n): Partial<ExpoMetroBundleOptions> {\n const {\n mainModuleName,\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n bytecode,\n lazy,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n inlineSourceMap,\n splitChunks,\n usedExports,\n reactCompiler,\n optimize,\n domRoot,\n clientBoundaries,\n runModule,\n modulesOnly,\n useMd5Filename,\n } = withDefaults(options);\n\n const dev = mode !== 'production';\n const isHermes = engine === 'hermes';\n\n if (isExporting) {\n debug('Disabling lazy bundling for export build');\n options.lazy = false;\n }\n\n let fakeSourceUrl: string | undefined;\n let fakeSourceMapUrl: string | undefined;\n\n // TODO: Upstream support to Metro for passing custom serializer options.\n if (serializerIncludeMaps != null || serializerOutput != null) {\n fakeSourceUrl = new URL(\n createBundleUrlPath(options).replace(/^\\//, ''),\n 'http://localhost:8081'\n ).toString();\n if (serializerIncludeMaps) {\n fakeSourceMapUrl = fakeSourceUrl.replace('.bundle?', '.map?');\n }\n }\n\n const customTransformOptions: ExpoMetroBundleOptions['customTransformOptions'] = {\n __proto__: null,\n optimize: optimize || undefined,\n engine,\n clientBoundaries,\n preserveEnvVars: preserveEnvVars || undefined,\n // Use string to match the query param behavior.\n asyncRoutes: asyncRoutes ? String(asyncRoutes) : undefined,\n environment,\n baseUrl: baseUrl || undefined,\n routerRoot,\n bytecode: bytecode ? '1' : undefined,\n reactCompiler: reactCompiler ? String(reactCompiler) : undefined,\n dom: domRoot,\n useMd5Filename: useMd5Filename || undefined,\n };\n\n // Iterate and delete undefined values\n for (const key in customTransformOptions) {\n if (customTransformOptions[key] === undefined) {\n delete customTransformOptions[key];\n }\n }\n\n const bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: minify ?? !dev,\n inlineSourceMap: inlineSourceMap ?? false,\n lazy: (!isExporting && lazy) || undefined,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions,\n runModule,\n modulesOnly,\n customResolverOptions: {\n __proto__: null,\n environment,\n exporting: isExporting || undefined,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n splitChunks,\n usedExports: usedExports || undefined,\n output: serializerOutput,\n includeSourceMaps: serializerIncludeMaps,\n },\n };\n\n return bundleOptions;\n}\n\nexport function createBundleUrlPathFromExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'reactCompiler' | 'baseUrl' | 'routerRoot'>\n): string {\n return createBundleUrlPath({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n });\n}\n\nexport function createBundleUrlPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n return `/${encodeURI(options.mainModuleName.replace(/^\\/+/, ''))}.bundle?${queryParams.toString()}`;\n}\n\n/**\n * Create a bundle URL, containing all required query parameters, using a valid \"os path\".\n * On POSIX systems, this would look something like `/Users/../project/file.js?dev=false&..`.\n * On UNIX systems, this would look something like `C:\\Users\\..\\project\\file.js?dev=false&..`.\n * This path can safely be used with `path.*` modifiers and resolved.\n */\nexport function createBundleUrlOsPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n const mainModuleName = encodeURI(toPosixPath(options.mainModuleName));\n return `${mainModuleName}.bundle?${queryParams.toString()}`;\n}\n\nexport function createBundleUrlSearchParams(options: ExpoMetroOptions): URLSearchParams {\n const {\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n lazy,\n bytecode,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n reactCompiler,\n inlineSourceMap,\n isExporting,\n clientBoundaries,\n splitChunks,\n usedExports,\n optimize,\n domRoot,\n modulesOnly,\n runModule,\n } = withDefaults(options);\n\n const dev = String(mode !== 'production');\n const queryParams = new URLSearchParams({\n platform: encodeURIComponent(platform),\n dev,\n // TODO: Is this still needed?\n hot: String(false),\n });\n\n // Lazy bundling must be disabled for bundle splitting to work.\n if (!isExporting && lazy) {\n queryParams.append('lazy', String(lazy));\n }\n\n if (inlineSourceMap) {\n queryParams.append('inlineSourceMap', String(inlineSourceMap));\n }\n\n if (minify) {\n queryParams.append('minify', String(minify));\n }\n\n // We split bytecode from the engine since you could technically use Hermes without bytecode.\n // Hermes indicates the type of language features you want to transform out of the JS, whereas bytecode\n // indicates whether you want to use the Hermes bytecode format.\n if (engine) {\n queryParams.append('transform.engine', engine);\n }\n if (bytecode) {\n queryParams.append('transform.bytecode', '1');\n }\n if (asyncRoutes) {\n queryParams.append('transform.asyncRoutes', String(asyncRoutes));\n }\n if (preserveEnvVars) {\n queryParams.append('transform.preserveEnvVars', String(preserveEnvVars));\n }\n if (baseUrl) {\n queryParams.append('transform.baseUrl', baseUrl);\n }\n if (clientBoundaries?.length) {\n queryParams.append('transform.clientBoundaries', JSON.stringify(clientBoundaries));\n }\n if (routerRoot != null) {\n queryParams.append('transform.routerRoot', routerRoot);\n }\n if (reactCompiler) {\n queryParams.append('transform.reactCompiler', String(reactCompiler));\n }\n if (domRoot) {\n queryParams.append('transform.dom', domRoot);\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (isExporting) {\n queryParams.append('resolver.exporting', String(isExporting));\n }\n\n if (splitChunks) {\n queryParams.append('serializer.splitChunks', String(splitChunks));\n }\n if (usedExports) {\n queryParams.append('serializer.usedExports', String(usedExports));\n }\n if (optimize) {\n queryParams.append('transform.optimize', String(optimize));\n }\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n if (engine === 'hermes') {\n queryParams.append('unstable_transformProfile', 'hermes-stable');\n }\n\n if (modulesOnly != null) {\n queryParams.set('modulesOnly', String(modulesOnly));\n }\n if (runModule != null) {\n queryParams.set('runModule', String(runModule));\n }\n\n return queryParams;\n}\n\n/**\n * Convert all path separators to `/`, including on Windows.\n * Metro asumes that all module specifiers are posix paths.\n * References to directories can still be Windows-style paths in Metro.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_features_into_your_script\n * @see https://github.com/facebook/metro/pull/1286\n */\nexport function convertPathToModuleSpecifier(pathLike: string) {\n return toPosixPath(pathLike);\n}\n\nexport function getMetroOptionsFromUrl(urlFragment: string) {\n const url = new URL(urlFragment, 'http://localhost:0');\n const getStringParam = (key: string) => {\n const param = url.searchParams.get(key);\n if (Array.isArray(param)) {\n throw new Error(`Expected single value for ${key}`);\n }\n return param;\n };\n\n let pathname = url.pathname;\n if (pathname.endsWith('.bundle')) {\n pathname = pathname.slice(0, -'.bundle'.length);\n }\n\n const options: ExpoMetroOptions = {\n mode: isTruthy(getStringParam('dev') ?? 'true') ? 'development' : 'production',\n minify: isTruthy(getStringParam('minify') ?? 'false'),\n lazy: isTruthy(getStringParam('lazy') ?? 'false'),\n routerRoot: getStringParam('transform.routerRoot') ?? 'app',\n isExporting: isTruthy(getStringParam('resolver.exporting') ?? 'false'),\n environment: assertEnvironment(getStringParam('transform.environment') ?? 'node'),\n platform: url.searchParams.get('platform') ?? 'web',\n bytecode: isTruthy(getStringParam('transform.bytecode') ?? 'false'),\n mainModuleName: convertPathToModuleSpecifier(pathname),\n reactCompiler: isTruthy(getStringParam('transform.reactCompiler') ?? 'false'),\n asyncRoutes: isTruthy(getStringParam('transform.asyncRoutes') ?? 'false'),\n baseUrl: getStringParam('transform.baseUrl') ?? undefined,\n // clientBoundaries: JSON.parse(getStringParam('transform.clientBoundaries') ?? '[]'),\n engine: assertEngine(getStringParam('transform.engine')),\n runModule: isTruthy(getStringParam('runModule') ?? 'true'),\n modulesOnly: isTruthy(getStringParam('modulesOnly') ?? 'false'),\n };\n\n return options;\n}\n\nfunction isTruthy(value: string | null): boolean {\n return value === 'true' || value === '1';\n}\n\nfunction assertEnvironment(environment: string | undefined): MetroEnvironment | undefined {\n if (!environment) {\n return undefined;\n }\n if (!['node', 'react-server', 'client'].includes(environment)) {\n throw new Error(`Expected transform.environment to be one of: node, react-server, client`);\n }\n return environment as MetroEnvironment;\n}\nfunction assertEngine(engine: string | undefined | null): 'hermes' | undefined {\n if (!engine) {\n return undefined;\n }\n if (!['hermes'].includes(engine)) {\n throw new Error(`Expected transform.engine to be one of: hermes`);\n }\n return engine as 'hermes';\n}\n"],"names":["isServerEnvironment","shouldEnableAsyncImports","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getMetroDirectBundleOptionsForExpoConfig","getMetroDirectBundleOptions","createBundleUrlPathFromExpoConfig","createBundleUrlPath","createBundleUrlOsPath","createBundleUrlSearchParams","convertPathToModuleSpecifier","getMetroOptionsFromUrl","debug","require","environment","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","lazy","props","bytecode","platform","CommandError","engine","optimize","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","usedExports","EXPO_UNSTABLE_TREE_SHAKING","isExporting","undefined","exp","experiments","baseUrl","trim","replace","asyncRoutesSetting","extra","router","asyncRoutes","includes","default","options","reactCompiler","routerRoot","getRouterDirectoryModuleIdWithManifest","mainModuleName","serializerOutput","serializerIncludeMaps","inlineSourceMap","splitChunks","domRoot","clientBoundaries","runModule","modulesOnly","useMd5Filename","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","customTransformOptions","__proto__","String","dom","key","bundleOptions","entryFile","unstable_transformProfile","customResolverOptions","exporting","sourceMapUrl","sourceUrl","serializerOptions","output","includeSourceMaps","queryParams","encodeURI","toPosixPath","URLSearchParams","encodeURIComponent","hot","append","length","JSON","stringify","set","pathLike","urlFragment","url","getStringParam","param","searchParams","get","Array","isArray","Error","pathname","endsWith","slice","isTruthy","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C/E,MAAiC,EAAwB;IAC7E,IAAI,CAACA,MAAM,EAAE;QACX,OAAOM,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QAAC,QAAQ;KAAC,CAACU,QAAQ,CAAChB,MAAM,CAAC,EAAE;QAChC,MAAM,IAAIyE,KAAK,CAAC,CAAC,8CAA8C,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,OAAOzE,MAAM,CAAa;AAC5B,CAAC"}
|
|
@@ -14,7 +14,7 @@ function _nodeCrypto() {
|
|
|
14
14
|
return data;
|
|
15
15
|
}
|
|
16
16
|
const _fetchClient = require("./clients/FetchClient");
|
|
17
|
-
const
|
|
17
|
+
const _fetchDetachedClient = require("./clients/FetchDetachedClient");
|
|
18
18
|
const _context = require("./utils/context");
|
|
19
19
|
const _userSettings = require("../../api/user/UserSettings");
|
|
20
20
|
const _env = require("../env");
|
|
@@ -26,7 +26,7 @@ function _interopRequireDefault(obj) {
|
|
|
26
26
|
const debug = require("debug")("expo:telemetry");
|
|
27
27
|
class Telemetry {
|
|
28
28
|
context = (0, _context.createContext)();
|
|
29
|
-
client = new
|
|
29
|
+
client = new _fetchDetachedClient.FetchDetachedClient();
|
|
30
30
|
/** A list of all events, recorded before the telemetry was fully initialized */ earlyRecords = [];
|
|
31
31
|
constructor({ anonymousId =(0, _userSettings.getAnonymousId)() , sessionId =_nodeCrypto().default.randomUUID() , userId , strategy ="detached" } = {}){
|
|
32
32
|
this.actor = {
|
|
@@ -112,11 +112,10 @@ class Telemetry {
|
|
|
112
112
|
}
|
|
113
113
|
function createClientFromStrategy(strategy) {
|
|
114
114
|
// When debugging, use the actual Rudderstack client, but lazy load it
|
|
115
|
-
if (_env.env.EXPO_NO_TELEMETRY_DETACH || strategy === "debug") {
|
|
116
|
-
|
|
117
|
-
return new RudderClient();
|
|
115
|
+
if (_env.env.EXPO_NO_TELEMETRY_DETACH || strategy === "debug" || strategy === "instant") {
|
|
116
|
+
return new _fetchClient.FetchClient();
|
|
118
117
|
}
|
|
119
|
-
return
|
|
118
|
+
return new _fetchDetachedClient.FetchDetachedClient();
|
|
120
119
|
}
|
|
121
120
|
/** Generate a unique message ID using a random hash and UUID */ function createMessageId(record) {
|
|
122
121
|
const uuid = _nodeCrypto().default.randomUUID();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/telemetry/Telemetry.ts"],"sourcesContent":["import crypto from 'node:crypto';\n\nimport { FetchClient } from './clients/FetchClient';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/telemetry/Telemetry.ts"],"sourcesContent":["import crypto from 'node:crypto';\n\nimport { FetchClient } from './clients/FetchClient';\nimport { FetchDetachedClient } from './clients/FetchDetachedClient';\nimport { TelemetryClient, TelemetryClientStrategy, TelemetryRecord } from './types';\nimport { createContext } from './utils/context';\nimport { getAnonymousId } from '../../api/user/UserSettings';\nimport { env } from '../env';\n\nconst debug = require('debug')('expo:telemetry') as typeof console.log;\n\ntype TelemetryOptions = {\n /** A locally generated ID, untracable to an actual user */\n anonymousId?: string;\n /** A locally generated ID, per CLI invocation */\n sessionId?: string;\n /** The authenticated user ID, this is used to generate an untracable hash */\n userId?: string;\n /** The underlying telemetry strategy to use */\n strategy?: TelemetryClientStrategy;\n};\n\ntype TelemetryActor = Required<Pick<TelemetryOptions, 'anonymousId' | 'sessionId'>> & {\n /**\n * Hashed version of the user ID, untracable to an actual user.\n * If this value is set to `undefined`, telemetry is considered uninitialized and will wait until its set.\n * If this value is set to `null`, telemetry is considered initialized without an authenticated user.\n * If this value is set to a string, telemetry is considered initialized with an authenticated user.\n */\n userHash?: string | null;\n};\n\nexport class Telemetry {\n private context = createContext();\n private client: TelemetryClient = new FetchDetachedClient();\n private actor: TelemetryActor;\n\n /** A list of all events, recorded before the telemetry was fully initialized */\n private earlyRecords: TelemetryRecord[] = [];\n\n constructor({\n anonymousId = getAnonymousId(),\n sessionId = crypto.randomUUID(),\n userId,\n strategy = 'detached',\n }: TelemetryOptions = {}) {\n this.actor = { anonymousId, sessionId };\n this.setStrategy(env.EXPO_NO_TELEMETRY_DETACH ? 'debug' : strategy);\n\n if (userId) {\n this.initialize({ userId });\n }\n }\n\n get strategy() {\n return this.client.strategy;\n }\n\n setStrategy(strategy: TelemetryOptions['strategy']) {\n // Abort when client is already using the correct strategy\n if (this.client.strategy === strategy) return;\n // Abort when debugging the telemetry\n if (env.EXPO_NO_TELEMETRY_DETACH && strategy !== 'debug') return;\n\n debug('Switching strategy from %s to %s', this.client.strategy, strategy);\n\n // Load and instantiate the correct client, based on strategy\n const client = createClientFromStrategy(strategy);\n // Replace the client, and re-record any pending records\n this.client.abort().forEach((record) => client.record([record]));\n this.client = client;\n\n return this;\n }\n\n get isInitialized() {\n return this.actor.userHash !== undefined;\n }\n\n initialize({ userId }: { userId: string | null }) {\n this.actor.userHash = userId ? hashUserId(userId) : null;\n this.flushEarlyRecords();\n }\n\n private flushEarlyRecords() {\n if (this.earlyRecords.length) {\n this.recordInternal(this.earlyRecords);\n this.earlyRecords = [];\n }\n }\n\n private recordInternal(records: TelemetryRecord[]) {\n return this.client.record(\n records.map((record) => ({\n ...record,\n type: 'track' as const,\n sentAt: new Date(),\n messageId: createMessageId(record),\n anonymousId: this.actor.anonymousId,\n userHash: this.actor.userHash,\n context: {\n ...this.context,\n sessionId: this.actor.sessionId,\n client: { mode: this.client.strategy },\n },\n }))\n );\n }\n\n record(record: TelemetryRecord | TelemetryRecord[]) {\n const records = Array.isArray(record) ? record : [record];\n\n debug('Recording %d event(s)', records.length);\n\n if (!this.isInitialized) {\n this.earlyRecords.push(...records);\n return;\n }\n\n return this.recordInternal(records);\n }\n\n flush() {\n debug('Flushing events...');\n this.flushEarlyRecords();\n return this.client.flush();\n }\n\n flushOnExit() {\n this.setStrategy('detached');\n this.flushEarlyRecords();\n return this.client.flush();\n }\n}\n\nfunction createClientFromStrategy(strategy: TelemetryOptions['strategy']) {\n // When debugging, use the actual Rudderstack client, but lazy load it\n if (env.EXPO_NO_TELEMETRY_DETACH || strategy === 'debug' || strategy === 'instant') {\n return new FetchClient();\n }\n\n return new FetchDetachedClient();\n}\n\n/** Generate a unique message ID using a random hash and UUID */\nfunction createMessageId(record: TelemetryRecord) {\n const uuid = crypto.randomUUID();\n const md5 = crypto.createHash('md5').update(JSON.stringify(record)).digest('hex');\n\n return `node-${md5}-${uuid}`;\n}\n\n/** Hash the user identifier to make it untracable */\nfunction hashUserId(userId: string) {\n return crypto.createHash('sha256').update(userId).digest('hex');\n}\n"],"names":["Telemetry","debug","require","context","createContext","client","FetchDetachedClient","earlyRecords","constructor","anonymousId","getAnonymousId","sessionId","crypto","randomUUID","userId","strategy","actor","setStrategy","env","EXPO_NO_TELEMETRY_DETACH","initialize","createClientFromStrategy","abort","forEach","record","isInitialized","userHash","undefined","hashUserId","flushEarlyRecords","length","recordInternal","records","map","type","sentAt","Date","messageId","createMessageId","mode","Array","isArray","push","flush","flushOnExit","FetchClient","uuid","md5","createHash","update","JSON","stringify","digest"],"mappings":"AAAA;;;;+BAgCaA,WAAS;;aAATA,SAAS;;;8DAhCH,aAAa;;;;;;6BAEJ,uBAAuB;qCACf,+BAA+B;yBAErC,iBAAiB;8BAChB,6BAA6B;qBACxC,QAAQ;;;;;;AAE5B,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,AAAsB,AAAC;AAuBhE,MAAMF,SAAS;IACpB,AAAQG,OAAO,GAAGC,IAAAA,QAAa,cAAA,GAAE,CAAC;IAClC,AAAQC,MAAM,GAAoB,IAAIC,oBAAmB,oBAAA,EAAE,CAAC;IAG5D,8EAA8E,GAC9E,AAAQC,YAAY,GAAsB,EAAE,CAAC;IAE7CC,YAAY,EACVC,WAAW,EAAGC,IAAAA,aAAc,eAAA,GAAE,CAAA,EAC9BC,SAAS,EAAGC,WAAM,EAAA,QAAA,CAACC,UAAU,EAAE,CAAA,EAC/BC,MAAM,CAAA,EACNC,QAAQ,EAAG,UAAU,CAAA,EACJ,GA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ient {
|
|
|
31
31
|
this.headers = {
|
|
32
32
|
accept: "application/json",
|
|
33
33
|
"content-type": "application/json",
|
|
34
|
-
"user-agent": `expo-cli/${"0.22.
|
|
34
|
+
"user-agent": `expo-cli/${"0.22.20"}`,
|
|
35
35
|
authorization: "Basic " + _nodeBuffer().Buffer.from(`${target}:`).toString("base64")
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "FetchDetachedClient", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>FetchDetachedClient
|
|
8
|
+
});
|
|
9
|
+
function _nodeChildProcess() {
|
|
10
|
+
const data = require("node:child_process");
|
|
11
|
+
_nodeChildProcess = function() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
function _nodeFs() {
|
|
17
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("node:fs"));
|
|
18
|
+
_nodeFs = function() {
|
|
19
|
+
return data;
|
|
20
|
+
};
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
function _nodePath() {
|
|
24
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("node:path"));
|
|
25
|
+
_nodePath = function() {
|
|
26
|
+
return data;
|
|
27
|
+
};
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
const _createTempPath = require("../../createTempPath");
|
|
31
|
+
function _interopRequireDefault(obj) {
|
|
32
|
+
return obj && obj.__esModule ? obj : {
|
|
33
|
+
default: obj
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const debug = require("debug")("expo:telemetry:client:detached");
|
|
37
|
+
class FetchDetachedClient {
|
|
38
|
+
/** This client should be used for short-lived commands */ strategy = "detached";
|
|
39
|
+
/** All recorded telemetry events */ records = [];
|
|
40
|
+
abort() {
|
|
41
|
+
return this.records;
|
|
42
|
+
}
|
|
43
|
+
record(record) {
|
|
44
|
+
this.records.push(...record.map((record)=>({
|
|
45
|
+
...record,
|
|
46
|
+
originalTimestamp: record.sentAt
|
|
47
|
+
})));
|
|
48
|
+
}
|
|
49
|
+
async flush() {
|
|
50
|
+
try {
|
|
51
|
+
if (!this.records.length) {
|
|
52
|
+
return debug("No records to flush, skipping...");
|
|
53
|
+
}
|
|
54
|
+
const file = (0, _createTempPath.createTempFilePath)("expo-telemetry.json");
|
|
55
|
+
const data = JSON.stringify({
|
|
56
|
+
records: this.records
|
|
57
|
+
});
|
|
58
|
+
this.records = [];
|
|
59
|
+
await _nodeFs().default.promises.mkdir(_nodePath().default.dirname(file), {
|
|
60
|
+
recursive: true
|
|
61
|
+
});
|
|
62
|
+
await _nodeFs().default.promises.writeFile(file, data);
|
|
63
|
+
const child = (0, _nodeChildProcess().spawn)(process.execPath, [
|
|
64
|
+
require.resolve("./flushFetchDetached"),
|
|
65
|
+
file
|
|
66
|
+
], {
|
|
67
|
+
detached: true,
|
|
68
|
+
windowsHide: true,
|
|
69
|
+
shell: false,
|
|
70
|
+
stdio: "ignore"
|
|
71
|
+
});
|
|
72
|
+
child.unref();
|
|
73
|
+
} catch (error) {
|
|
74
|
+
// This could fail if any direct or indirect imports change during an upgrade to the `expo` dependency via `npx expo install --fix`,
|
|
75
|
+
// since this file may no longer be present after the upgrade, but before the process under the old Expo CLI version is terminated.
|
|
76
|
+
debug("Exception while initiating detached flush:", error);
|
|
77
|
+
}
|
|
78
|
+
debug("Detached flush started");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=FetchDetachedClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/utils/telemetry/clients/FetchDetachedClient.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { createTempFilePath } from '../../createTempPath';\nimport type { TelemetryClient, TelemetryClientStrategy, TelemetryRecordInternal } from '../types';\n\nconst debug = require('debug')('expo:telemetry:client:detached') as typeof console.log;\n\nexport class FetchDetachedClient implements TelemetryClient {\n /** This client should be used for short-lived commands */\n readonly strategy: TelemetryClientStrategy = 'detached';\n /** All recorded telemetry events */\n private records: TelemetryRecordInternal[] = [];\n\n abort() {\n return this.records;\n }\n\n record(record: TelemetryRecordInternal[]) {\n this.records.push(\n ...record.map((record) => ({\n ...record,\n originalTimestamp: record.sentAt,\n }))\n );\n }\n\n async flush() {\n try {\n if (!this.records.length) {\n return debug('No records to flush, skipping...');\n }\n\n const file = createTempFilePath('expo-telemetry.json');\n const data = JSON.stringify({ records: this.records });\n\n this.records = [];\n\n await fs.promises.mkdir(path.dirname(file), { recursive: true });\n await fs.promises.writeFile(file, data);\n\n const child = spawn(process.execPath, [require.resolve('./flushFetchDetached'), file], {\n detached: true,\n windowsHide: true,\n shell: false,\n stdio: 'ignore',\n });\n\n child.unref();\n } catch (error) {\n // This could fail if any direct or indirect imports change during an upgrade to the `expo` dependency via `npx expo install --fix`,\n // since this file may no longer be present after the upgrade, but before the process under the old Expo CLI version is terminated.\n debug('Exception while initiating detached flush:', error);\n }\n\n debug('Detached flush started');\n }\n}\n"],"names":["FetchDetachedClient","debug","require","strategy","records","abort","record","push","map","originalTimestamp","sentAt","flush","length","file","createTempFilePath","data","JSON","stringify","fs","promises","mkdir","path","dirname","recursive","writeFile","child","spawn","process","execPath","resolve","detached","windowsHide","shell","stdio","unref","error"],"mappings":"AAAA;;;;+BASaA,qBAAmB;;aAAnBA,mBAAmB;;;yBATV,oBAAoB;;;;;;;8DAC3B,SAAS;;;;;;;8DACP,WAAW;;;;;;gCAEO,sBAAsB;;;;;;AAGzD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gCAAgC,CAAC,AAAsB,AAAC;AAEhF,MAAMF,mBAAmB;IAC9B,wDAAwD,GACxD,AAASG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C,KAAK,EAAE,QAAQ;aAChB,CAAC,AAAC;YAEHR,KAAK,CAACS,KAAK,EAAE,CAAC;QAChB,EAAE,OAAOC,KAAK,EAAE;YACd,oIAAoI;YACpI,mIAAmI;YACnIlC,KAAK,CAAC,4CAA4C,EAAEkC,KAAK,CAAC,CAAC;QAC7D,CAAC;QAEDlC,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAClC;CACD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _nodeFs() {
|
|
6
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("node:fs"));
|
|
7
|
+
_nodeFs = function() {
|
|
8
|
+
return data;
|
|
9
|
+
};
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
const _fetchClient = require("./FetchClient");
|
|
13
|
+
function _interopRequireDefault(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const telemetryFile = process.argv[2];
|
|
19
|
+
flush().catch(()=>_nodeFs().default.promises.unlink(telemetryFile)).finally(()=>process.exit(0));
|
|
20
|
+
async function flush() {
|
|
21
|
+
if (!telemetryFile) return;
|
|
22
|
+
let json;
|
|
23
|
+
let data;
|
|
24
|
+
try {
|
|
25
|
+
json = await _nodeFs().default.promises.readFile(telemetryFile, "utf8");
|
|
26
|
+
data = JSON.parse(json);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (error.code === "ENOENT") return;
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
if (data.records.length) {
|
|
32
|
+
const client = new _fetchClient.FetchClient();
|
|
33
|
+
await client.record(data.records);
|
|
34
|
+
await client.flush();
|
|
35
|
+
}
|
|
36
|
+
await _nodeFs().default.promises.unlink(telemetryFile);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=flushFetchDetached.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/utils/telemetry/clients/flushFetchDetached.ts"],"sourcesContent":["import fs from 'node:fs';\n\nimport { FetchClient } from './FetchClient';\nimport type { TelemetryRecordInternal } from '../types';\n\nconst telemetryFile = process.argv[2];\n\nflush()\n .catch(() => fs.promises.unlink(telemetryFile))\n .finally(() => process.exit(0));\n\nasync function flush() {\n if (!telemetryFile) return;\n\n let json: string;\n let data: { records: TelemetryRecordInternal[] };\n\n try {\n json = await fs.promises.readFile(telemetryFile, 'utf8');\n data = JSON.parse(json) as any;\n } catch (error: any) {\n if (error.code === 'ENOENT') return;\n throw error;\n }\n\n if (data.records.length) {\n const client = new FetchClient();\n await client.record(data.records);\n await client.flush();\n }\n\n await fs.promises.unlink(telemetryFile);\n}\n"],"names":["telemetryFile","process","argv","flush","catch","fs","promises","unlink","finally","exit","json","data","readFile","JSON","parse","error","code","records","length","client","FetchClient","record"],"mappings":"AAAA;;;;;8DAAe,SAAS;;;;;;6BAEI,eAAe;;;;;;AAG3C,MAAMA,aAAa,GAAGC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC,AAAC;AAEtCC,KAAK,EAAE,CACJC,KAAK,CAAC,IAAMC,OAAE,EAAA,QAAA,CAACC,QAAQ,CAACC,MAAM,CAACP,aAAa,CAAC,CAAC,CAC9CQ,OAAO,CAAC,IAAMP,OAAO,CAACQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,eAAeN,KAAK,GAAG;IACrB,IAAI,CAACH,aAAa,EAAE,OAAO;IAE3B,IAAIU,IAAI,AAAQ,AAAC;IACjB,IAAIC,IAAI,AAAwC,AAAC;IAEjD,IAAI;QACFD,IAAI,GAAG,MAAML,OAAE,EAAA,QAAA,CAACC,QAAQ,CAACM,QAAQ,CAACZ,aAAa,EAAE,MAAM,CAAC,CAAC;QACzDW,IAAI,GAAGE,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC,AAAO,CAAC;IACjC,EAAE,OAAOK,KAAK,EAAO;QACnB,IAAIA,KAAK,CAACC,IAAI,KAAK,QAAQ,EAAE,OAAO;QACpC,MAAMD,KAAK,CAAC;IACd,CAAC;IAED,IAAIJ,IAAI,CAACM,OAAO,CAACC,MAAM,EAAE;QACvB,MAAMC,MAAM,GAAG,IAAIC,YAAW,YAAA,EAAE,AAAC;QACjC,MAAMD,MAAM,CAACE,MAAM,CAACV,IAAI,CAACM,OAAO,CAAC,CAAC;QAClC,MAAME,MAAM,CAAChB,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,MAAME,OAAE,EAAA,QAAA,CAACC,QAAQ,CAACC,MAAM,CAACP,aAAa,CAAC,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.20",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -42,17 +42,17 @@
|
|
|
42
42
|
"@0no-co/graphql.web": "^1.0.8",
|
|
43
43
|
"@babel/runtime": "^7.20.0",
|
|
44
44
|
"@expo/code-signing-certificates": "^0.0.5",
|
|
45
|
-
"@expo/config": "~10.0.
|
|
46
|
-
"@expo/config-plugins": "~9.0.
|
|
45
|
+
"@expo/config": "~10.0.11",
|
|
46
|
+
"@expo/config-plugins": "~9.0.17",
|
|
47
47
|
"@expo/devcert": "^1.1.2",
|
|
48
48
|
"@expo/env": "~0.4.2",
|
|
49
49
|
"@expo/image-utils": "^0.6.5",
|
|
50
50
|
"@expo/json-file": "^9.0.2",
|
|
51
|
-
"@expo/metro-config": "~0.19.
|
|
51
|
+
"@expo/metro-config": "~0.19.12",
|
|
52
52
|
"@expo/osascript": "^2.1.6",
|
|
53
53
|
"@expo/package-manager": "^1.7.2",
|
|
54
54
|
"@expo/plist": "^0.2.2",
|
|
55
|
-
"@expo/prebuild-config": "^8.0.
|
|
55
|
+
"@expo/prebuild-config": "^8.0.29",
|
|
56
56
|
"@expo/rudder-sdk-node": "^1.1.1",
|
|
57
57
|
"@expo/spawn-async": "^1.7.2",
|
|
58
58
|
"@expo/ws-tunnel": "^1.0.1",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@expo/multipart-body-parser": "^1.0.0",
|
|
122
122
|
"@expo/ngrok": "4.1.3",
|
|
123
|
-
"@expo/server": "^0.5.
|
|
123
|
+
"@expo/server": "^0.5.3",
|
|
124
124
|
"@graphql-codegen/cli": "^2.16.3",
|
|
125
125
|
"@graphql-codegen/typescript": "^2.8.7",
|
|
126
126
|
"@graphql-codegen/typescript-operations": "^2.5.12",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"tree-kill": "^1.2.2",
|
|
169
169
|
"tsd": "^0.28.1"
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "ee33df50fbe6bf9bb5d772e7f341f85a27cf9993"
|
|
172
172
|
}
|