@expo/cli 0.4.0 → 0.4.1
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 +2 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/exportApp.js +16 -1
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/printBundleSizes.js +1 -1
- package/build/src/export/printBundleSizes.js.map +1 -1
- package/build/src/export/writeContents.js +7 -2
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/package.json +2 -2
package/build/bin/cli
CHANGED
|
@@ -121,7 +121,7 @@ const args = (0, _arg).default({
|
|
|
121
121
|
});
|
|
122
122
|
if (args["--version"]) {
|
|
123
123
|
// Version is added in the build script.
|
|
124
|
-
console.log("0.4.
|
|
124
|
+
console.log("0.4.1");
|
|
125
125
|
process.exit(0);
|
|
126
126
|
}
|
|
127
127
|
if (args["--non-interactive"]) {
|
|
@@ -248,7 +248,7 @@ commands[command]().then((exec)=>{
|
|
|
248
248
|
logEventAsync("action", {
|
|
249
249
|
action: `expo ${command}`,
|
|
250
250
|
source: "expo/cli",
|
|
251
|
-
source_version: "0.4.
|
|
251
|
+
source_version: "0.4.1"
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleOutput } from './fork-bundleAsync';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\ntype PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => ({\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n bundle: path.join('bundles', fileNames[platform]!),\n // Collect all of the assets and convert them to the serial format.\n assets: bundle.assets\n .map((asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat(),\n },\n }),\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","path","join","assets","map","asset","fileHashes","hash","ext","type","filter","Boolean","flat"],"mappings":"AAAA;;;;QAcgBA,kBAAkB,GAAlBA,kBAAkB;AAdjB,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAchB,SAASA,kBAAkB,CAAC,EACjCC,OAAO,CAAA,EACPC,SAAS,CAAA,EAIV,EAIC;IACA,sBAAsB;IACtB,OAAO;QACLC,OAAO,EAAE,CAAC;QACVC,OAAO,EAAE,OAAO;QAChBC,YAAY,EAAEC,MAAM,CAACC,OAAO,CAACN,OAAO,CAAC,CAACO,MAAM,CAC1C,CAACC,QAAQ,EAAE,CAACC,QAAQ,EAAEC,MAAM,CAAC;YAAK,OAAC;gBACjC,GAAGF,QAAQ;gBACX,CAACC,QAAQ,CAAC,EAAE;oBACV,+CAA+C;oBAC/CC,MAAM,EAAEC,KAAI,QAAA,CAACC,IAAI,CAAC,SAAS,EAAEX,SAAS,CAACQ,QAAQ,CAAC,CAAE;oBAClD,mEAAmE;oBACnEI,MAAM,EAAEH,MAAM,CAACG,MAAM,CAClBC,GAAG,CAAC,CAACC,KAAK;4BACT,oEAAoE;wBACpEA,GAAgB;wBAAhBA,OAAAA,CAAAA,GAAgB,GAAhBA,KAAK,CAACC,UAAU,SAAK,GAArBD,KAAAA,CAAqB,GAArBA,GAAgB,CAAED,GAAG,CAAC,CAACG,IAAI,GAAK,CAAC;gCAC/BN,IAAI,EAAEA,KAAI,QAAA,CAACC,IAAI,CAAC,QAAQ,EAAEK,IAAI,CAAC;gCAC/BC,GAAG,EAAEH,KAAK,CAACI,IAAI;6BAChB,CAAC;wBAAA,CAAC,CAAA;qBAAA,CACJ,CACAC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,EAAE;iBACV;aACF,CAAC;SAAA,EACF,EAAE,CACH;KACF,CAAC;CACH"}
|
|
@@ -61,7 +61,22 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
61
61
|
useDevServer: true
|
|
62
62
|
});
|
|
63
63
|
// Log bundle size info to the user
|
|
64
|
-
(0, _printBundleSizes).printBundleSizes(bundles)
|
|
64
|
+
(0, _printBundleSizes).printBundleSizes(Object.fromEntries(Object.entries(bundles).map(([key, value])=>{
|
|
65
|
+
if (!dumpSourcemap) {
|
|
66
|
+
return [
|
|
67
|
+
key,
|
|
68
|
+
{
|
|
69
|
+
...value,
|
|
70
|
+
// Remove source maps from the bundles if they aren't going to be written.
|
|
71
|
+
map: undefined
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
return [
|
|
76
|
+
key,
|
|
77
|
+
value
|
|
78
|
+
];
|
|
79
|
+
})));
|
|
65
80
|
// Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).
|
|
66
81
|
const { hashes , fileNames } = await (0, _writeContents).writeBundlesAsync({
|
|
67
82
|
bundles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { importCliSaveAssetsFromProject } from '../start/server/metro/resolveFromProject';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { copyAsync, ensureDirectoryAsync } from '../utils/dir';\nimport { env } from '../utils/env';\nimport { createBundlesAsync } from './createBundles';\nimport { exportAssetsAsync } from './exportAssets';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { printBundleSizes } from './printBundleSizes';\nimport { Options } from './resolveOptions';\nimport {\n writeAssetMapAsync,\n writeBundlesAsync,\n writeDebugHtmlAsync,\n writeMetadataJsonAsync,\n writeSourceMapsAsync,\n} from './writeContents';\n\n/**\n * The structure of the outputDir will be:\n *\n * ```\n * ├── assets\n * │ └── *\n * ├── bundles\n * │ ├── android-01ee6e3ab3e8c16a4d926c91808d5320.js\n * │ └── ios-ee8206cc754d3f7aa9123b7f909d94ea.js\n * └── metadata.json\n * ```\n */\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n dumpSourcemap,\n }: Pick<Options, 'dumpAssetmap' | 'dumpSourcemap' | 'dev' | 'clear' | 'outputDir' | 'platforms'>\n): Promise<void> {\n const exp = await getPublicExpoManifestAsync(projectRoot);\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n const outputPath = path.resolve(projectRoot, outputDir);\n const assetsPath = path.join(outputPath, 'assets');\n const bundlesPath = path.join(outputPath, 'bundles');\n\n await Promise.all([assetsPath, bundlesPath].map(ensureDirectoryAsync));\n\n await copyPublicFolderAsync(publicPath, outputDir);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundles = await createBundlesAsync(\n projectRoot,\n { resetCache: !!clear },\n {\n platforms,\n dev,\n useDevServer: true,\n // TODO: Disable source map generation if we aren't outputting them.\n }\n );\n\n // Log bundle size info to the user\n printBundleSizes(bundles);\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n const { hashes, fileNames } = await writeBundlesAsync({ bundles, outputDir: bundlesPath });\n\n Log.log('Finished saving JS Bundles');\n\n if (fileNames.web) {\n // If web exists, then write the template HTML file.\n await fs.promises.writeFile(\n path.join(outputPath, 'index.html'),\n await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [`/bundles/${fileNames.web}`],\n })\n );\n\n // Save assets like a typical bundler, preserving the file paths on web.\n const saveAssets = importCliSaveAssetsFromProject(projectRoot);\n await Promise.all(\n Object.entries(bundles).map(([platform, bundle]) => {\n return saveAssets(\n // @ts-expect-error: tolerable type mismatches: unused `readonly` (common in Metro) and `undefined` instead of `null`.\n bundle.assets,\n platform,\n outputPath\n );\n })\n );\n }\n\n const { assets } = await exportAssetsAsync(projectRoot, {\n exp,\n outputDir: outputPath,\n bundles,\n });\n\n if (dumpAssetmap) {\n Log.log('Dumping asset map');\n await writeAssetMapAsync({ outputDir: outputPath, assets });\n }\n\n // build source maps\n if (dumpSourcemap) {\n Log.log('Dumping source maps');\n await writeSourceMapsAsync({\n bundles,\n hashes,\n outputDir: bundlesPath,\n fileNames,\n });\n\n Log.log('Preparing additional debugging files');\n // If we output source maps, then add a debug HTML file which the user can open in\n // the web browser to inspect the output like web.\n await writeDebugHtmlAsync({\n outputDir: outputPath,\n fileNames,\n });\n }\n\n // Generate a `metadata.json` and the export is complete.\n await writeMetadataJsonAsync({ outputDir, bundles, fileNames });\n}\n\n/**\n * Copy the contents of the public folder into the output folder.\n * This enables users to add static files like `favicon.ico` or `serve.json`.\n *\n * The contents of this folder are completely universal since they refer to\n * static network requests which fall outside the scope of React Native's magic\n * platform resolution patterns.\n */\nasync function copyPublicFolderAsync(publicFolder: string, outputFolder: string) {\n if (fs.existsSync(publicFolder)) {\n await copyAsync(publicFolder, outputFolder);\n }\n}\n"],"names":["exportAppAsync","Log","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","dumpSourcemap","exp","getPublicExpoManifestAsync","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","assetsPath","join","bundlesPath","Promise","all","map","ensureDirectoryAsync","copyPublicFolderAsync","bundles","createBundlesAsync","resetCache","useDevServer","printBundleSizes","hashes","fileNames","writeBundlesAsync","log","web","fs","promises","writeFile","createTemplateHtmlFromExpoConfigAsync","scripts","saveAssets","importCliSaveAssetsFromProject","
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { importCliSaveAssetsFromProject } from '../start/server/metro/resolveFromProject';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { copyAsync, ensureDirectoryAsync } from '../utils/dir';\nimport { env } from '../utils/env';\nimport { createBundlesAsync } from './createBundles';\nimport { exportAssetsAsync } from './exportAssets';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { printBundleSizes } from './printBundleSizes';\nimport { Options } from './resolveOptions';\nimport {\n writeAssetMapAsync,\n writeBundlesAsync,\n writeDebugHtmlAsync,\n writeMetadataJsonAsync,\n writeSourceMapsAsync,\n} from './writeContents';\n\n/**\n * The structure of the outputDir will be:\n *\n * ```\n * ├── assets\n * │ └── *\n * ├── bundles\n * │ ├── android-01ee6e3ab3e8c16a4d926c91808d5320.js\n * │ └── ios-ee8206cc754d3f7aa9123b7f909d94ea.js\n * └── metadata.json\n * ```\n */\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n dumpSourcemap,\n }: Pick<Options, 'dumpAssetmap' | 'dumpSourcemap' | 'dev' | 'clear' | 'outputDir' | 'platforms'>\n): Promise<void> {\n const exp = await getPublicExpoManifestAsync(projectRoot);\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n const outputPath = path.resolve(projectRoot, outputDir);\n const assetsPath = path.join(outputPath, 'assets');\n const bundlesPath = path.join(outputPath, 'bundles');\n\n await Promise.all([assetsPath, bundlesPath].map(ensureDirectoryAsync));\n\n await copyPublicFolderAsync(publicPath, outputDir);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundles = await createBundlesAsync(\n projectRoot,\n { resetCache: !!clear },\n {\n platforms,\n dev,\n useDevServer: true,\n // TODO: Disable source map generation if we aren't outputting them.\n }\n );\n\n // Log bundle size info to the user\n printBundleSizes(\n Object.fromEntries(\n Object.entries(bundles).map(([key, value]) => {\n if (!dumpSourcemap) {\n return [\n key,\n {\n ...value,\n // Remove source maps from the bundles if they aren't going to be written.\n map: undefined,\n },\n ];\n }\n\n return [key, value];\n })\n )\n );\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n const { hashes, fileNames } = await writeBundlesAsync({ bundles, outputDir: bundlesPath });\n\n Log.log('Finished saving JS Bundles');\n\n if (fileNames.web) {\n // If web exists, then write the template HTML file.\n await fs.promises.writeFile(\n path.join(outputPath, 'index.html'),\n await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [`/bundles/${fileNames.web}`],\n })\n );\n\n // Save assets like a typical bundler, preserving the file paths on web.\n const saveAssets = importCliSaveAssetsFromProject(projectRoot);\n await Promise.all(\n Object.entries(bundles).map(([platform, bundle]) => {\n return saveAssets(\n // @ts-expect-error: tolerable type mismatches: unused `readonly` (common in Metro) and `undefined` instead of `null`.\n bundle.assets,\n platform,\n outputPath\n );\n })\n );\n }\n\n const { assets } = await exportAssetsAsync(projectRoot, {\n exp,\n outputDir: outputPath,\n bundles,\n });\n\n if (dumpAssetmap) {\n Log.log('Dumping asset map');\n await writeAssetMapAsync({ outputDir: outputPath, assets });\n }\n\n // build source maps\n if (dumpSourcemap) {\n Log.log('Dumping source maps');\n await writeSourceMapsAsync({\n bundles,\n hashes,\n outputDir: bundlesPath,\n fileNames,\n });\n\n Log.log('Preparing additional debugging files');\n // If we output source maps, then add a debug HTML file which the user can open in\n // the web browser to inspect the output like web.\n await writeDebugHtmlAsync({\n outputDir: outputPath,\n fileNames,\n });\n }\n\n // Generate a `metadata.json` and the export is complete.\n await writeMetadataJsonAsync({ outputDir, bundles, fileNames });\n}\n\n/**\n * Copy the contents of the public folder into the output folder.\n * This enables users to add static files like `favicon.ico` or `serve.json`.\n *\n * The contents of this folder are completely universal since they refer to\n * static network requests which fall outside the scope of React Native's magic\n * platform resolution patterns.\n */\nasync function copyPublicFolderAsync(publicFolder: string, outputFolder: string) {\n if (fs.existsSync(publicFolder)) {\n await copyAsync(publicFolder, outputFolder);\n }\n}\n"],"names":["exportAppAsync","Log","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","dumpSourcemap","exp","getPublicExpoManifestAsync","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","assetsPath","join","bundlesPath","Promise","all","map","ensureDirectoryAsync","copyPublicFolderAsync","bundles","createBundlesAsync","resetCache","useDevServer","printBundleSizes","Object","fromEntries","entries","key","value","undefined","hashes","fileNames","writeBundlesAsync","log","web","fs","promises","writeFile","createTemplateHtmlFromExpoConfigAsync","scripts","saveAssets","importCliSaveAssetsFromProject","platform","bundle","assets","exportAssetsAsync","writeAssetMapAsync","writeSourceMapsAsync","writeDebugHtmlAsync","writeMetadataJsonAsync","publicFolder","outputFolder","existsSync","copyAsync"],"mappings":"AAAA;;;;QAiCsBA,cAAc,GAAdA,cAAc;AAjCrB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACgC,IAAA,mBAA0C,WAA1C,0CAA0C,CAAA;AACnC,IAAA,YAA6B,WAA7B,6BAA6B,CAAA;AACnC,IAAA,IAAc,WAAd,cAAc,CAAA;AAC1C,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClB,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AACP,IAAA,sBAAyB,WAAzB,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G,CAAAA,GAAAA,IAAS,AAA4B,CAAA,UAA5B,CAACH,YAAY,EAAEC,YAAY,CAAC,CAAC;KAC7C;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoAppManifest } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoAppManifest } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport minimatch from 'minimatch';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { resolveGoogleServicesFile } from '../start/server/middleware/resolveAssets';\nimport { uniqBy } from '../utils/array';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset, saveAssetsAsync } from './saveAssets';\n\nconst debug = require('debug')('expo:export:exportAssets') as typeof console.log;\n\n/**\n * Resolves the assetBundlePatterns from the manifest and returns a list of assets to bundle.\n *\n * @modifies {exp}\n */\nexport async function resolveAssetBundlePatternsAsync(\n projectRoot: string,\n exp: Pick<ExpoAppManifest, 'bundledAssets' | 'assetBundlePatterns'>,\n assets: Asset[]\n) {\n if (!exp.assetBundlePatterns?.length || !assets.length) {\n delete exp.assetBundlePatterns;\n return exp;\n }\n // Convert asset patterns to a list of asset strings that match them.\n // Assets strings are formatted as `asset_<hash>.<type>` and represent\n // the name that the file will have in the app bundle. The `asset_` prefix is\n // needed because android doesn't support assets that start with numbers.\n\n const fullPatterns: string[] = exp.assetBundlePatterns.map((p: string) =>\n path.join(projectRoot, p)\n );\n\n logPatterns(fullPatterns);\n\n const allBundledAssets = assets\n .map((asset) => {\n const shouldBundle = shouldBundleAsset(asset, fullPatterns);\n if (shouldBundle) {\n debug(`${shouldBundle ? 'Include' : 'Exclude'} asset ${asset.files?.[0]}`);\n return asset.fileHashes.map(\n (hash) => 'asset_' + hash + ('type' in asset && asset.type ? '.' + asset.type : '')\n );\n }\n return [];\n })\n .flat();\n\n // The assets returned by the RN packager has duplicates so make sure we\n // only bundle each once.\n exp.bundledAssets = [...new Set(allBundledAssets)];\n delete exp.assetBundlePatterns;\n\n return exp;\n}\n\nfunction logPatterns(patterns: string[]) {\n // Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.\n Log.log('\\nProcessing asset bundle patterns:');\n patterns.forEach((p) => Log.log('- ' + p));\n}\n\nfunction shouldBundleAsset(asset: Asset, patterns: string[]) {\n const file = asset.files?.[0];\n return !!(\n '__packager_asset' in asset &&\n asset.__packager_asset &&\n file &&\n patterns.some((pattern) => minimatch(file, pattern))\n );\n}\n\nexport async function exportAssetsAsync(\n projectRoot: string,\n {\n exp,\n outputDir,\n bundles,\n }: {\n exp: ExpoAppManifest;\n bundles: Partial<Record<ModPlatform, BundleOutput>>;\n outputDir: string;\n }\n) {\n const assets: Asset[] = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.assets),\n (asset) => asset.hash\n );\n\n if (assets[0]?.fileHashes) {\n Log.log('Saving assets');\n await saveAssetsAsync(projectRoot, { assets, outputDir });\n }\n\n // Add google services file if it exists\n await resolveGoogleServicesFile(projectRoot, exp);\n\n // Updates the manifest to reflect additional asset bundling + configs\n await resolveAssetBundlePatternsAsync(projectRoot, exp, assets);\n\n return { exp, assets };\n}\n"],"names":["resolveAssetBundlePatternsAsync","exportAssetsAsync","Log","debug","require","projectRoot","exp","assets","assetBundlePatterns","length","fullPatterns","map","p","path","join","logPatterns","allBundledAssets","asset","shouldBundle","shouldBundleAsset","files","fileHashes","hash","type","flat","bundledAssets","Set","patterns","log","forEach","file","__packager_asset","some","pattern","minimatch","outputDir","bundles","uniqBy","Object","values","flatMap","bundle","saveAssetsAsync","resolveGoogleServicesFile"],"mappings":"AAAA;;;;QAkBsBA,+BAA+B,GAA/BA,+BAA+B;QAyD/BC,iBAAiB,GAAjBA,iBAAiB;AAzEjB,IAAA,UAAW,kCAAX,WAAW,EAAA;AAChB,IAAA,KAAM,kCAAN,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EACnB,EACEC,GAAG,CAAA,EACH6B,SAAS,CAAA,EACTC,OAAO,CAAA,EAKR,EACD;QAMI7B,GAAS;IALb,MAAMA,MAAM,GAAY8B,CAAAA,GAAAA,MAAM,AAG7B,CAAA,OAH6B,CAC5BC,MAAM,CAACC,MAAM,CAACH,OAAO,CAAC,CAACI,OAAO,CAAC,CAACC,MAAM,GAAKA,MAAM,CAAElC,MAAM;IAAA,CAAC,EAC1D,CAACU,KAAK,GAAKA,KAAK,CAACK,IAAI;IAAA,CACtB,AAAC;IAEF,IAAIf,CAAAA,GAAS,GAATA,MAAM,CAAC,CAAC,CAAC,SAAY,GAArBA,KAAAA,CAAqB,GAArBA,GAAS,CAAEc,UAAU,EAAE;QACzBnB,GAAG,CAAC0B,GAAG,CAAC,eAAe,CAAC,CAAC;QACzB,MAAMc,CAAAA,GAAAA,WAAe,AAAoC,CAAA,gBAApC,CAACrC,WAAW,EAAE;YAAEE,MAAM;YAAE4B,SAAS;SAAE,CAAC,CAAC;KAC3D;IAED,wCAAwC;IACxC,MAAMQ,CAAAA,GAAAA,cAAyB,AAAkB,CAAA,0BAAlB,CAACtC,WAAW,EAAEC,GAAG,CAAC,CAAC;IAElD,sEAAsE;IACtE,MAAMN,+BAA+B,CAACK,WAAW,EAAEC,GAAG,EAAEC,MAAM,CAAC,CAAC;IAEhE,OAAO;QAAED,GAAG;QAAEC,MAAM;KAAE,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig, getConfigFilePaths, Platform } from '@expo/config';\nimport {\n buildHermesBundleAsync,\n isEnableHermesManaged,\n maybeThrowFromInconsistentEngineAsync,\n} from '@expo/dev-server/build/HermesBundler';\nimport {\n importExpoMetroConfigFromProject,\n importMetroFromProject,\n importMetroServerFromProject,\n} from '@expo/dev-server/build/metro/importMetroFromProject';\nimport { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport Metro from 'metro';\nimport { Terminal } from 'metro-core';\n\nimport { MetroTerminalReporter } from '../start/server/metro/MetroTerminalReporter';\nimport { withMetroMultiPlatformAsync } from '../start/server/metro/withMetroMultiPlatform';\nimport { getPlatformBundlers } from '../start/server/platformBundlers';\n\nexport type MetroDevServerOptions = LoadOptions & {\n logger: import('@expo/bunyan');\n quiet?: boolean;\n};\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n sourceMapUrl?: string;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n code: string;\n map: string;\n hermesBytecodeBundle?: Uint8Array;\n hermesSourcemap?: string;\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nfunction getExpoMetroConfig(\n projectRoot: string,\n { logger }: Pick<MetroDevServerOptions, 'logger'>\n): typeof import('@expo/metro-config') {\n try {\n return importExpoMetroConfigFromProject(projectRoot);\n } catch {\n // If expo isn't installed, use the unversioned config and warn about installing expo.\n }\n\n const unversionedVersion = require('@expo/metro-config/package.json').version;\n logger.info(\n { tag: 'expo' },\n chalk.gray(\n `\\u203A Unversioned ${chalk.bold`@expo/metro-config@${unversionedVersion}`} is being used. Bundling apps may not work as expected, and is subject to breaking changes. Install ${chalk.bold`expo`} or set the app.json sdkVersion to use a stable version of @expo/metro-config.`\n )\n );\n\n return require('@expo/metro-config');\n}\n\nlet nextBuildID = 0;\n\n// Fork of @expo/dev-server bundleAsync to add Metro logging back.\n\nasync function assertEngineMismatchAsync(projectRoot: string, exp: ExpoConfig, platform: Platform) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function bundleAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n options: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\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 await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const metro = importMetroFromProject(projectRoot);\n const Server = importMetroServerFromProject(projectRoot);\n\n const terminal = new Terminal(process.stdout);\n const terminalReporter = new MetroTerminalReporter(projectRoot, terminal);\n\n const reporter = {\n update(event: any) {\n terminalReporter.update(event);\n },\n };\n\n const ExpoMetroConfig = getExpoMetroConfig(projectRoot, options);\n\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n let config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n\n const bundlerPlatforms = getPlatformBundlers(exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, config, bundlerPlatforms);\n\n const metroServer = await metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const bundleOptions: Metro.BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n bundleType: 'bundle',\n platform: bundle.platform,\n entryFile: bundle.entryPoint,\n dev: bundle.dev ?? false,\n minify: bundle.minify ?? !bundle.dev,\n inlineSourceMap: false,\n sourceMapUrl: bundle.sourceMapUrl,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n if (!options.quiet) {\n terminalReporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n }\n },\n };\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n terminalReporter.update({\n buildID,\n type: 'bundle_build_started',\n // @ts-expect-error: TODO\n bundleDetails,\n });\n try {\n const { code, map } = await metroServer.build(bundleOptions);\n const assets = (await metroServer.getAssets(\n bundleOptions\n )) as readonly BundleAssetWithFileHashes[];\n terminalReporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return { code, map, assets };\n } catch (error) {\n terminalReporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n const maybeAddHermesBundleAsync = async (\n bundle: BundleOptions,\n bundleOutput: BundleOutput\n ): Promise<BundleOutput> => {\n const { platform } = bundle;\n const isHermesManaged = isEnableHermesManaged(expoConfig, platform);\n if (isHermesManaged) {\n const platformTag = chalk.bold(\n { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform\n );\n\n terminalReporter.terminal.log(`${platformTag} Building Hermes bytecode for the bundle`);\n\n const hermesBundleOutput = await buildHermesBundleAsync(\n projectRoot,\n bundleOutput.code,\n bundleOutput.map,\n bundle.minify\n );\n bundleOutput.hermesBytecodeBundle = hermesBundleOutput.hbc;\n bundleOutput.hermesSourcemap = hermesBundleOutput.sourcemap;\n }\n return bundleOutput;\n };\n\n try {\n const intermediateOutputs = await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n const bundleOutputs: BundleOutput[] = [];\n for (let i = 0; i < bundles.length; ++i) {\n // hermesc does not support parallel building even we spawn processes.\n // we should build them sequentially.\n bundleOutputs.push(await maybeAddHermesBundleAsync(bundles[i], intermediateOutputs[i]));\n }\n return bundleOutputs;\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n"],"names":["bundleAsync","getExpoMetroConfig","projectRoot","logger","importExpoMetroConfigFromProject","unversionedVersion","require","version","info","tag","chalk","gray","bold","nextBuildID","assertEngineMismatchAsync","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","expoConfig","options","bundles","Promise","all","map","metro","importMetroFromProject","Server","importMetroServerFromProject","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","ExpoMetroConfig","getConfig","skipSDKVersionRequirement","config","loadAsync","bundlerPlatforms","getPlatformBundlers","withMetroMultiPlatformAsync","metroServer","runMetro","watch","buildAsync","bundle","buildID","bundleOptions","DEFAULT_BUNDLE_OPTIONS","bundleType","entryFile","entryPoint","dev","minify","inlineSourceMap","sourceMapUrl","createModuleIdFactory","serializer","onProgress","transformedFileCount","totalFileCount","quiet","type","bundleDetails","code","build","assets","getAssets","error","maybeAddHermesBundleAsync","bundleOutput","platformTag","ios","android","web","log","hermesBundleOutput","buildHermesBundleAsync","hermesBytecodeBundle","hbc","hermesSourcemap","sourcemap","intermediateOutputs","bundleOutputs","i","length","push","console","end"],"mappings":"AAAA;;;;QAgFsBA,WAAW,GAAXA,WAAW;AAhFmC,IAAA,OAAc,WAAd,cAAc,CAAA;AAK3E,IAAA,cAAsC,WAAtC,sCAAsC,CAAA;AAKtC,IAAA,uBAAqD,WAArD,qDAAqD,CAAA;AAE1C,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEA,IAAA,UAAY,WAAZ,YAAY,CAAA;AAEC,IAAA,sBAA6C,WAA7C,6CAA6C,CAAA;AACvC,IAAA,uBAA8C,WAA9C,8CAA8C,CAAA;AACtD,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;;;;;;AAwBtE,SAASC,kBAAkB,CACzBC,WAAmB,EACnB,EAAEC,MAAM,CAAA,EAAyC,EACZ;IACrC,IAAI;QACF,OAAOC,CAAAA,GAAAA,uBAAgC,AAAa,CAAA,iCAAb,CAACF,WAAW,CAAC,CAAC;KACtD,CAAC,OAAM;IACN,sFAAsF;KACvF;IAED,MAAMG,kBAAkB,GAAGC,OAAO,CAAC,iCAAiC,CAAC,CAACC,OAAO,AAAC;IAC9EJ,MAAM,CAACK,IAAI,CACT;QAAEC,GAAG,EAAE,MAAM;KAAE,EACfC,MAAK,QAAA,CAACC,IAAI,CACR,CAAC,mBAAmB,EAAED,MAAK,QAAA,CAACE,IAAI,CAAC,mBAAmB,EAAEP,kBAAkB,CA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OAAO,CAACC,GAAG,CAACF,OAAO,CAACG,GAAG,CAAC,CAAC0B,MAAM,GAAKD,UAAU,CAACC,MAAM,CAAC;QAAA,CAAC,CAAC,AAAC;QAC3F,MAAMsC,aAAa,GAAmB,EAAE,AAAC;QACzC,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGpE,OAAO,CAACqE,MAAM,EAAE,EAAED,CAAC,CAAE;YACvC,sEAAsE;YACtE,qCAAqC;YACrCD,aAAa,CAACG,IAAI,CAAC,MAAMjB,yBAAyB,CAACrD,OAAO,CAACoE,CAAC,CAAC,EAAEF,mBAAmB,CAACE,CAAC,CAAC,CAAC,CAAC,CAAC;SACzF;QACD,OAAOD,aAAa,CAAC;KACtB,CAAC,OAAOf,KAAK,EAAE;QACd,gEAAgE;QAChEmB,OAAO,CAACZ,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,MAAMP,KAAK,CAAC;KACb,QAAS;QACR3B,WAAW,CAAC+C,GAAG,EAAE,CAAC;KACnB;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfig, getConfigFilePaths, Platform } from '@expo/config';\nimport {\n buildHermesBundleAsync,\n isEnableHermesManaged,\n maybeThrowFromInconsistentEngineAsync,\n} from '@expo/dev-server/build/HermesBundler';\nimport {\n importExpoMetroConfigFromProject,\n importMetroFromProject,\n importMetroServerFromProject,\n} from '@expo/dev-server/build/metro/importMetroFromProject';\nimport { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport Metro from 'metro';\nimport { Terminal } from 'metro-core';\n\nimport { MetroTerminalReporter } from '../start/server/metro/MetroTerminalReporter';\nimport { withMetroMultiPlatformAsync } from '../start/server/metro/withMetroMultiPlatform';\nimport { getPlatformBundlers } from '../start/server/platformBundlers';\n\nexport type MetroDevServerOptions = LoadOptions & {\n logger: import('@expo/bunyan');\n quiet?: boolean;\n};\nexport type BundleOptions = {\n entryPoint: string;\n platform: 'android' | 'ios' | 'web';\n dev?: boolean;\n minify?: boolean;\n sourceMapUrl?: string;\n};\nexport type BundleAssetWithFileHashes = Metro.AssetData & {\n fileHashes: string[]; // added by the hashAssets asset plugin\n};\nexport type BundleOutput = {\n code: string;\n map?: string;\n hermesBytecodeBundle?: Uint8Array;\n hermesSourcemap?: string;\n assets: readonly BundleAssetWithFileHashes[];\n};\n\nfunction getExpoMetroConfig(\n projectRoot: string,\n { logger }: Pick<MetroDevServerOptions, 'logger'>\n): typeof import('@expo/metro-config') {\n try {\n return importExpoMetroConfigFromProject(projectRoot);\n } catch {\n // If expo isn't installed, use the unversioned config and warn about installing expo.\n }\n\n const unversionedVersion = require('@expo/metro-config/package.json').version;\n logger.info(\n { tag: 'expo' },\n chalk.gray(\n `\\u203A Unversioned ${chalk.bold`@expo/metro-config@${unversionedVersion}`} is being used. Bundling apps may not work as expected, and is subject to breaking changes. Install ${chalk.bold`expo`} or set the app.json sdkVersion to use a stable version of @expo/metro-config.`\n )\n );\n\n return require('@expo/metro-config');\n}\n\nlet nextBuildID = 0;\n\n// Fork of @expo/dev-server bundleAsync to add Metro logging back.\n\nasync function assertEngineMismatchAsync(projectRoot: string, exp: ExpoConfig, platform: Platform) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport async function bundleAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n options: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\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 await Promise.all(\n bundles.map(({ platform }) => assertEngineMismatchAsync(projectRoot, expoConfig, platform))\n );\n\n const metro = importMetroFromProject(projectRoot);\n const Server = importMetroServerFromProject(projectRoot);\n\n const terminal = new Terminal(process.stdout);\n const terminalReporter = new MetroTerminalReporter(projectRoot, terminal);\n\n const reporter = {\n update(event: any) {\n terminalReporter.update(event);\n },\n };\n\n const ExpoMetroConfig = getExpoMetroConfig(projectRoot, options);\n\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n let config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n\n const bundlerPlatforms = getPlatformBundlers(exp);\n\n config = await withMetroMultiPlatformAsync(projectRoot, config, bundlerPlatforms);\n\n const metroServer = await metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\n const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;\n const bundleOptions: Metro.BundleOptions = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n bundleType: 'bundle',\n platform: bundle.platform,\n entryFile: bundle.entryPoint,\n dev: bundle.dev ?? false,\n minify: bundle.minify ?? !bundle.dev,\n inlineSourceMap: false,\n sourceMapUrl: bundle.sourceMapUrl,\n createModuleIdFactory: config.serializer.createModuleIdFactory,\n onProgress: (transformedFileCount: number, totalFileCount: number) => {\n if (!options.quiet) {\n terminalReporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n }\n },\n };\n const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n terminalReporter.update({\n buildID,\n type: 'bundle_build_started',\n // @ts-expect-error: TODO\n bundleDetails,\n });\n try {\n const { code, map } = await metroServer.build(bundleOptions);\n const assets = (await metroServer.getAssets(\n bundleOptions\n )) as readonly BundleAssetWithFileHashes[];\n terminalReporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return { code, map, assets };\n } catch (error) {\n terminalReporter.update({\n buildID,\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n };\n\n const maybeAddHermesBundleAsync = async (\n bundle: BundleOptions,\n bundleOutput: BundleOutput\n ): Promise<BundleOutput> => {\n const { platform } = bundle;\n const isHermesManaged = isEnableHermesManaged(expoConfig, platform);\n if (isHermesManaged) {\n const platformTag = chalk.bold(\n { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform\n );\n\n terminalReporter.terminal.log(`${platformTag} Building Hermes bytecode for the bundle`);\n\n const hermesBundleOutput = await buildHermesBundleAsync(\n projectRoot,\n bundleOutput.code,\n bundleOutput.map!,\n bundle.minify\n );\n bundleOutput.hermesBytecodeBundle = hermesBundleOutput.hbc;\n bundleOutput.hermesSourcemap = hermesBundleOutput.sourcemap;\n }\n return bundleOutput;\n };\n\n try {\n const intermediateOutputs = await Promise.all(bundles.map((bundle) => buildAsync(bundle)));\n const bundleOutputs: BundleOutput[] = [];\n for (let i = 0; i < bundles.length; ++i) {\n // hermesc does not support parallel building even we spawn processes.\n // we should build them sequentially.\n bundleOutputs.push(await maybeAddHermesBundleAsync(bundles[i], intermediateOutputs[i]));\n }\n return bundleOutputs;\n } catch (error) {\n // New line so errors don't show up inline with the progress bar\n console.log('');\n throw error;\n } finally {\n metroServer.end();\n }\n}\n"],"names":["bundleAsync","getExpoMetroConfig","projectRoot","logger","importExpoMetroConfigFromProject","unversionedVersion","require","version","info","tag","chalk","gray","bold","nextBuildID","assertEngineMismatchAsync","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","expoConfig","options","bundles","Promise","all","map","metro","importMetroFromProject","Server","importMetroServerFromProject","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","ExpoMetroConfig","getConfig","skipSDKVersionRequirement","config","loadAsync","bundlerPlatforms","getPlatformBundlers","withMetroMultiPlatformAsync","metroServer","runMetro","watch","buildAsync","bundle","buildID","bundleOptions","DEFAULT_BUNDLE_OPTIONS","bundleType","entryFile","entryPoint","dev","minify","inlineSourceMap","sourceMapUrl","createModuleIdFactory","serializer","onProgress","transformedFileCount","totalFileCount","quiet","type","bundleDetails","code","build","assets","getAssets","error","maybeAddHermesBundleAsync","bundleOutput","platformTag","ios","android","web","log","hermesBundleOutput","buildHermesBundleAsync","hermesBytecodeBundle","hbc","hermesSourcemap","sourcemap","intermediateOutputs","bundleOutputs","i","length","push","console","end"],"mappings":"AAAA;;;;QAgFsBA,WAAW,GAAXA,WAAW;AAhFmC,IAAA,OAAc,WAAd,cAAc,CAAA;AAK3E,IAAA,cAAsC,WAAtC,sCAAsC,CAAA;AAKtC,IAAA,uBAAqD,WAArD,qDAAqD,CAAA;AAE1C,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEA,IAAA,UAAY,WAAZ,YAAY,CAAA;AAEC,IAAA,sBAA6C,WAA7C,6CAA6C,CAAA;AACvC,IAAA,uBAA8C,WAA9C,8CAA8C,CAAA;AACtD,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;;;;;;AAwBtE,SAASC,kBAAkB,CACzBC,WAAmB,EACnB,EAAEC,MAAM,CAAA,EAAyC,EACZ;IACrC,IAAI;QACF,OAAOC,CAAAA,GAAAA,uBAAgC,AAAa,CAAA,iCAAb,CAACF,WAAW,CAAC,CAAC;KACtD,CAAC,OAAM;IACN,sFAAsF;KACvF;IAED,MAAMG,kBAAkB,GAAGC,OAAO,CAAC,iCAAiC,CAAC,CAACC,OAAO,AAAC;IAC9EJ,MAAM,CAACK,IAAI,CACT;QAAEC,GAAG,EAAE,MAAM;KAAE,EACfC,MAAK,QAAA,CAACC,IAAI,CACR,CAAC,mBAAmB,EAAED,MAAK,QAAA,CAACE,IAAI,CAAC,mBAAmB,EAAEP,kBAAkB,CAAC,CAAC,CAAC,oGAAoG,EAAEK,MAAK,QAAA,CAACE,IAAI,CAAC,IAAI,CAAC,CAAC,8EAA8E,CAAC,CAClR,CACF,CAAC;IAEF,OAAON,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACtC;AAED,IAAIO,WAAW,GAAG,CAAC,AAAC;AAEpB,kEAAkE;AAElE,eAAeC,yBAAyB,CAACZ,WAAmB,EAAEa,GAAe,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ACvC,sEAAsE;YACtE,qCAAqC;YACrCD,aAAa,CAACG,IAAI,CAAC,MAAMjB,yBAAyB,CAACrD,OAAO,CAACoE,CAAC,CAAC,EAAEF,mBAAmB,CAACE,CAAC,CAAC,CAAC,CAAC,CAAC;SACzF;QACD,OAAOD,aAAa,CAAC;KACtB,CAAC,OAAOf,KAAK,EAAE;QACd,gEAAgE;QAChEmB,OAAO,CAACZ,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,MAAMP,KAAK,CAAC;KACb,QAAS;QACR3B,WAAW,CAAC+C,GAAG,EAAE,CAAC;KACnB;CACF"}
|
|
@@ -72,7 +72,7 @@ function printBundleSizes(bundles) {
|
|
|
72
72
|
}
|
|
73
73
|
function createFilesTable(files) {
|
|
74
74
|
const tableData = files.map((item, index)=>{
|
|
75
|
-
const fileBranch = index === 0 ? "\u250C" : index === files.length - 1 ? "\u2514" : "\u251C";
|
|
75
|
+
const fileBranch = index === 0 ? files.length > 1 ? "\u250C" : "\u2500" : index === files.length - 1 ? "\u2514" : "\u251C";
|
|
76
76
|
return [
|
|
77
77
|
`${fileBranch} ${item[0]}`,
|
|
78
78
|
(0, _prettyBytes).default(Buffer.byteLength(item[1], "utf8"))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/printBundleSizes.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/export/printBundleSizes.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport chalk from 'chalk';\nimport prettyBytes from 'pretty-bytes';\nimport table from 'text-table';\n\nimport * as Log from '../log';\nimport { stripAnsi } from '../utils/ansi';\nimport { learnMore } from '../utils/link';\nimport { BundleOutput } from './fork-bundleAsync';\n\nexport function printBundleSizes(bundles: Partial<Record<Platform, BundleOutput>>) {\n const files: [string, string | Uint8Array][] = [];\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code' | 'hermesSourcemap' | 'map'>\n ][]) {\n if (bundleOutput.hermesBytecodeBundle) {\n files.push([chalk.bold(`index.${platform}.js (Hermes)`), bundleOutput.hermesBytecodeBundle]);\n } else if (bundleOutput.code) {\n files.push([chalk.bold(`index.${platform}.js`), bundleOutput.code]);\n }\n if (bundleOutput.hermesSourcemap) {\n files.push([chalk.dim(`index.${platform}.js.map (Hermes)`), bundleOutput.hermesSourcemap]);\n } else if (bundleOutput.map) {\n files.push([chalk.dim(`index.${platform}.js.map`), bundleOutput.map]);\n }\n }\n\n Log.log();\n Log.log(createFilesTable(files.sort((a, b) => a[1].length - b[1].length)));\n Log.log();\n Log.log(\n chalk`💡 JavaScript bundle sizes affect startup time. {dim ${learnMore(\n `https://expo.fyi/javascript-bundle-sizes`\n )}}`\n );\n Log.log();\n\n return files;\n}\n\nexport function createFilesTable(files: [string, string | Uint8Array][]): string {\n const tableData = files.map((item, index) => {\n const fileBranch =\n index === 0 ? (files.length > 1 ? '┌' : '─') : index === files.length - 1 ? '└' : '├';\n\n return [`${fileBranch} ${item[0]}`, prettyBytes(Buffer.byteLength(item[1], 'utf8'))];\n });\n return table([['Bundle', 'Size'].map((v) => chalk.underline(v)), ...tableData], {\n align: ['l', 'r'],\n stringLength: (str) => stripAnsi(str)?.length ?? 0,\n });\n}\n"],"names":["printBundleSizes","createFilesTable","Log","bundles","files","platform","bundleOutput","Object","entries","hermesBytecodeBundle","push","chalk","bold","code","hermesSourcemap","dim","map","log","sort","a","b","length","learnMore","tableData","item","index","fileBranch","prettyBytes","Buffer","byteLength","stripAnsi","table","v","underline","align","stringLength","str"],"mappings":"AAAA;;;;QAUgBA,gBAAgB,GAAhBA,gBAAgB;QAgChBC,gBAAgB,GAAhBA,gBAAgB;AAzCd,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,YAAc,kCAAd,cAAc,EAAA;AACpB,IAAA,UAAY,kCAAZ,YAAY,EAAA;AAElBC,IAAAA,GAAG,mCAAM,QAAQ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KAAK,EAAE;YAAC,GAAG;YAAE,GAAG;SAAC;QACjBC,YAAY,EAAE,CAACC,GAAG;gBAAKN,IAAc;YAAdA,OAAAA,CAAAA,GAAsB,GAAtBA,CAAAA,IAAc,GAAdA,CAAAA,GAAAA,KAAS,AAAK,CAAA,UAAL,CAACM,GAAG,CAAC,SAAQ,GAAtBN,KAAAA,CAAsB,GAAtBA,IAAc,CAAET,MAAM,YAAtBS,GAAsB,GAAI,CAAC,CAAA;SAAA;KACnD,CAAC,CAAC;CACJ"}
|
|
@@ -16,6 +16,7 @@ function _interopRequireDefault(obj) {
|
|
|
16
16
|
default: obj
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
const debug = require("debug")("expo:export:write");
|
|
19
20
|
/**
|
|
20
21
|
* @param props.platform native platform for the bundle
|
|
21
22
|
* @param props.hash crypto hash for the bundle contents
|
|
@@ -50,9 +51,13 @@ async function writeBundlesAsync({ bundles , outputDir }) {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
async function writeSourceMapsAsync({ bundles , hashes , fileNames , outputDir }) {
|
|
53
|
-
return Promise.all(Object.entries(bundles).map(async ([platform, bundle])=>{
|
|
54
|
+
return (await Promise.all(Object.entries(bundles).map(async ([platform, bundle])=>{
|
|
54
55
|
var _hermesSourcemap;
|
|
55
56
|
const sourceMap = (_hermesSourcemap = bundle.hermesSourcemap) != null ? _hermesSourcemap : bundle.map;
|
|
57
|
+
if (!sourceMap) {
|
|
58
|
+
debug(`Skip writing sourcemap (platform: ${platform})`);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
56
61
|
var _hermesBytecodeBundle, ref;
|
|
57
62
|
const hash = (ref = hashes == null ? void 0 : hashes[platform]) != null ? ref : createBundleHash((_hermesBytecodeBundle = bundle.hermesBytecodeBundle) != null ? _hermesBytecodeBundle : bundle.code);
|
|
58
63
|
const mapName = `${platform}-${hash}.map`;
|
|
@@ -73,7 +78,7 @@ async function writeSourceMapsAsync({ bundles , hashes , fileNames , outputDir
|
|
|
73
78
|
map: sourceMap,
|
|
74
79
|
comment: mappingComment
|
|
75
80
|
};
|
|
76
|
-
}));
|
|
81
|
+
}))).filter(Boolean);
|
|
77
82
|
}
|
|
78
83
|
async function writeMetadataJsonAsync({ outputDir , bundles , fileNames }) {
|
|
79
84
|
const contents = (0, _createMetadataJson).createMetadataJson({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/writeContents.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/export/writeContents.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport crypto from 'crypto';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset } from './saveAssets';\n\nconst debug = require('debug')('expo:export:write') as typeof console.log;\n\n/**\n * @param props.platform native platform for the bundle\n * @param props.hash crypto hash for the bundle contents\n * @returns filename for the JS bundle.\n */\nfunction createBundleFileName({ platform, hash }: { platform: string; hash: string }): string {\n return `${platform}-${hash}.js`;\n}\n\n/**\n * @param bundle JS bundle as a string\n * @returns crypto hash for the provided bundle\n */\nfunction createBundleHash(bundle: string | Uint8Array): string {\n return crypto.createHash('md5').update(bundle).digest('hex');\n}\n\nexport async function writeBundlesAsync({\n bundles,\n outputDir,\n}: {\n bundles: Partial<Record<Platform, Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>>>;\n outputDir: string;\n}) {\n const hashes: Partial<Record<Platform, string>> = {};\n const fileNames: Partial<Record<Platform, string>> = {};\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>\n ][]) {\n const bundle = bundleOutput.hermesBytecodeBundle ?? bundleOutput.code;\n const hash = createBundleHash(bundle);\n const fileName = createBundleFileName({ platform, hash });\n\n hashes[platform] = hash;\n fileNames[platform] = fileName;\n await fs.writeFile(path.join(outputDir, fileName), bundle);\n }\n\n return { hashes, fileNames };\n}\n\ntype SourceMapWriteResult = {\n platform: string;\n fileName: string;\n hash: string;\n map: string;\n comment: string;\n};\n\nexport async function writeSourceMapsAsync({\n bundles,\n hashes,\n fileNames,\n outputDir,\n}: {\n bundles: Record<\n string,\n Pick<BundleOutput, 'hermesSourcemap' | 'map' | 'hermesBytecodeBundle' | 'code'>\n >;\n hashes?: Record<string, string>;\n fileNames?: Record<string, string>;\n outputDir: string;\n}): Promise<SourceMapWriteResult[]> {\n return (\n await Promise.all(\n Object.entries(bundles).map(async ([platform, bundle]) => {\n const sourceMap = bundle.hermesSourcemap ?? bundle.map;\n if (!sourceMap) {\n debug(`Skip writing sourcemap (platform: ${platform})`);\n return null;\n }\n\n const hash =\n hashes?.[platform] ?? createBundleHash(bundle.hermesBytecodeBundle ?? bundle.code);\n const mapName = `${platform}-${hash}.map`;\n await fs.writeFile(path.join(outputDir, mapName), sourceMap);\n\n const jsBundleFileName = fileNames?.[platform] ?? createBundleFileName({ platform, hash });\n const jsPath = path.join(outputDir, jsBundleFileName);\n\n // Add correct mapping to sourcemap paths\n const mappingComment = `\\n//# sourceMappingURL=${mapName}`;\n await fs.appendFile(jsPath, mappingComment);\n return {\n platform,\n fileName: mapName,\n hash,\n map: sourceMap,\n comment: mappingComment,\n };\n })\n )\n ).filter(Boolean) as SourceMapWriteResult[];\n}\n\nexport async function writeMetadataJsonAsync({\n outputDir,\n bundles,\n fileNames,\n}: {\n outputDir: string;\n bundles: Record<string, Pick<BundleOutput, 'assets'>>;\n fileNames: Record<string, string>;\n}) {\n const contents = createMetadataJson({\n bundles,\n fileNames,\n });\n await fs.writeFile(path.join(outputDir, 'metadata.json'), JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeAssetMapAsync({\n outputDir,\n assets,\n}: {\n outputDir: string;\n assets: Asset[];\n}) {\n // Convert the assets array to a k/v pair where the asset hash is the key and the asset is the value.\n const contents = Object.fromEntries(assets.map((asset) => [asset.hash, asset]));\n await fs.writeFile(path.join(outputDir, 'assetmap.json'), JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeDebugHtmlAsync({\n outputDir,\n fileNames,\n}: {\n outputDir: string;\n fileNames: Record<string, string>;\n}) {\n // Make a debug html so user can debug their bundles\n const contents = `\n ${Object.values(fileNames)\n .map((fileName) => `<script src=\"${path.join('bundles', fileName)}\"></script>`)\n .join('\\n ')}\n Open up this file in Chrome. In the JavaScript developer console, navigate to the Source tab.\n You can see a red colored folder containing the original source code from your bundle.\n `;\n\n await fs.writeFile(path.join(outputDir, 'debug.html'), contents);\n return contents;\n}\n"],"names":["writeBundlesAsync","writeSourceMapsAsync","writeMetadataJsonAsync","writeAssetMapAsync","writeDebugHtmlAsync","debug","require","createBundleFileName","platform","hash","createBundleHash","bundle","crypto","createHash","update","digest","bundles","outputDir","hashes","fileNames","bundleOutput","Object","entries","hermesBytecodeBundle","code","fileName","fs","writeFile","path","join","Promise","all","map","sourceMap","hermesSourcemap","mapName","jsBundleFileName","jsPath","mappingComment","appendFile","comment","filter","Boolean","contents","createMetadataJson","JSON","stringify","assets","fromEntries","asset","values"],"mappings":"AAAA;;;;QA4BsBA,iBAAiB,GAAjBA,iBAAiB;QAkCjBC,oBAAoB,GAApBA,oBAAoB;QA8CpBC,sBAAsB,GAAtBA,sBAAsB;QAiBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAAmB,GAAnBA,mBAAmB;AAzItB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACZ,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEY,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;;;;;;AAIzD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAsB,AAAC;AAE1E;;;;GAIG,CACH,SAASC,oBAAoB,CAAC,EAAEC,QAAQ,CAAA,EAAEC,IAAI,CAAA,EAAsC,EAA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CACjB;AAEM,eAAevC,mBAAmB,CAAC,EACxCa,SAAS,CAAA,EACTE,SAAS,CAAA,EAIV,EAAE;IACD,oDAAoD;IACpD,MAAMwB,QAAQ,GAAG,CAAC;MACd,EAAEtB,MAAM,CAAC6B,MAAM,CAAC/B,SAAS,CAAC,CACvBa,GAAG,CAAC,CAACP,QAAQ,GAAK,CAAC,aAAa,EAAEG,KAAI,QAAA,CAACC,IAAI,CAAC,SAAS,EAAEJ,QAAQ,CAAC,CAAC,WAAW,CAAC;IAAA,CAAC,CAC9EI,IAAI,CAAC,UAAU,CAAC,CAAC;;;MAGpB,CAAC,AAAC;IAEN,MAAMH,SAAE,QAAA,CAACC,SAAS,CAACC,KAAI,QAAA,CAACC,IAAI,CAACZ,SAAS,EAAE,YAAY,CAAC,EAAE0B,QAAQ,CAAC,CAAC;IACjE,OAAOA,QAAQ,CAAC;CACjB"}
|
|
@@ -130,7 +130,7 @@ async function createHostInfoAsync() {
|
|
|
130
130
|
host: await _userSettings.default.getAnonymousIdentifierAsync(),
|
|
131
131
|
server: "expo",
|
|
132
132
|
// Defined in the build step
|
|
133
|
-
serverVersion: "0.4.
|
|
133
|
+
serverVersion: "0.4.1",
|
|
134
134
|
serverDriver: _manifestMiddleware.DEVELOPER_TOOL,
|
|
135
135
|
serverOS: _os.default.platform(),
|
|
136
136
|
serverOSVersion: _os.default.release()
|
|
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
const { userId , deviceId } = identifyData;
|
|
96
96
|
const commonEventProperties = {
|
|
97
|
-
source_version: "0.4.
|
|
97
|
+
source_version: "0.4.1",
|
|
98
98
|
source: "expo"
|
|
99
99
|
};
|
|
100
100
|
const identity = {
|
|
@@ -135,7 +135,7 @@ function getContext() {
|
|
|
135
135
|
},
|
|
136
136
|
app: {
|
|
137
137
|
name: "expo",
|
|
138
|
-
version: "0.4.
|
|
138
|
+
version: "0.4.1"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"structured-headers": "^0.4.1",
|
|
139
139
|
"taskr": "1.1.0"
|
|
140
140
|
},
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "5ff3a7e56ae21f002da3d699cc95bc98d784cd77"
|
|
142
142
|
}
|