@expo/cli 0.1.5 → 0.2.2
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/CHANGELOG.md +133 -0
- package/build/bin/cli +83 -4
- package/build/bin/cli.map +1 -1
- package/build/src/api/getNativeModuleVersions.js.map +1 -1
- package/build/src/api/rest/wrapFetchWithOffline.js +2 -23
- package/build/src/api/rest/wrapFetchWithOffline.js.map +1 -1
- package/build/src/customize/customizeAsync.js +40 -0
- package/build/src/customize/customizeAsync.js.map +1 -0
- package/build/src/customize/generate.js +77 -0
- package/build/src/customize/generate.js.map +1 -0
- package/build/src/customize/index.js +41 -0
- package/build/src/customize/index.js.map +1 -0
- package/build/src/customize/resolveOptions.js +18 -0
- package/build/src/customize/resolveOptions.js.map +1 -0
- package/build/src/customize/templates.js +118 -0
- package/build/src/customize/templates.js.map +1 -0
- package/build/src/export/createMetadataJson.js +10 -7
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/exportApp.js +32 -0
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +2 -3
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +52 -35
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +14 -10
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/printBundleSizes.js +27 -48
- package/build/src/export/printBundleSizes.js.map +1 -1
- package/build/src/export/resolveOptions.js +44 -5
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +2 -1
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +37 -0
- package/build/src/export/web/exportWebAsync.js.map +1 -0
- package/build/src/export/web/index.js +66 -0
- package/build/src/export/web/index.js.map +1 -0
- package/build/src/export/web/resolveOptions.js +13 -0
- package/build/src/export/web/resolveOptions.js.map +1 -0
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/checkPackages.js +2 -1
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +13 -5
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/resolveOptions.js +12 -65
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/install/utils/autoAddConfigPlugins.js +5 -26
- package/build/src/install/utils/autoAddConfigPlugins.js.map +1 -1
- package/build/src/log.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +5 -23
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/index.js +18 -12
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +11 -12
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +17 -0
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/resolveTemplate.js +2 -1
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +5 -5
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/run/android/resolveInstallApkName.js +5 -26
- package/build/src/run/android/resolveInstallApkName.js.map +1 -1
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js +2 -0
- package/build/src/start/doctor/apple/SimulatorAppPrerequisite.js.map +1 -1
- package/build/src/start/doctor/apple/XcodePrerequisite.js +2 -0
- package/build/src/start/doctor/apple/XcodePrerequisite.js.map +1 -1
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +3 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +7 -13
- package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
- package/build/src/start/doctor/dependencies/getMissingPackages.js +3 -24
- package/build/src/start/doctor/dependencies/getMissingPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +2 -23
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +17 -9
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js +2 -1
- package/build/src/start/doctor/ngrok/ExternalModule.js.map +1 -1
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +4 -3
- package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +29 -31
- package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
- package/build/src/start/interface/KeyPressHandler.js +2 -0
- package/build/src/start/interface/KeyPressHandler.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +5 -5
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/interface/startInterface.js +3 -2
- package/build/src/start/interface/startInterface.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +2 -1
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/platforms/PlatformManager.js +4 -24
- package/build/src/start/platforms/PlatformManager.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +17 -32
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +41 -0
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -0
- package/build/src/start/platforms/android/activateWindow.js +4 -4
- package/build/src/start/platforms/android/activateWindow.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +8 -3
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/adbReverse.js +3 -2
- package/build/src/start/platforms/android/adbReverse.js.map +1 -1
- package/build/src/start/platforms/android/gradle.js +2 -2
- package/build/src/start/platforms/android/gradle.js.map +1 -1
- package/build/src/start/platforms/ios/getBestSimulator.js +4 -4
- package/build/src/start/platforms/ios/getBestSimulator.js.map +1 -1
- package/build/src/start/platforms/ios/xcrun.js +2 -23
- package/build/src/start/platforms/ios/xcrun.js.map +1 -1
- package/build/src/start/project/devices.js +2 -0
- package/build/src/start/project/devices.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +6 -5
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +15 -8
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +15 -5
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevelopmentSession.js +4 -0
- package/build/src/start/server/DevelopmentSession.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +10 -3
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +9 -0
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +5 -0
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +11 -2
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/resolveFromProject.js +8 -0
- package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +115 -0
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -0
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/start/server/middleware/ExpoMiddleware.js +9 -4
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js +24 -0
- package/build/src/start/server/middleware/HistoryFallbackMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +2 -0
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +57 -6
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +6 -1
- package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ServeStaticMiddleware.js +62 -0
- package/build/src/start/server/middleware/ServeStaticMiddleware.js.map +1 -0
- package/build/src/start/server/platformBundlers.js +18 -0
- package/build/src/start/server/platformBundlers.js.map +1 -0
- package/build/src/start/server/webTemplate.js +68 -0
- package/build/src/start/server/webTemplate.js.map +1 -0
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +59 -19
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/start/server/webpack/compile.js +64 -0
- package/build/src/start/server/webpack/compile.js.map +1 -0
- package/build/src/start/startAsync.js +21 -17
- package/build/src/start/startAsync.js.map +1 -1
- package/build/src/utils/FileNotifier.js +5 -2
- package/build/src/utils/FileNotifier.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/downloadAppAsync.js +3 -2
- package/build/src/utils/downloadAppAsync.js.map +1 -1
- package/build/src/utils/downloadExpoGoAsync.js +7 -32
- package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
- package/build/src/utils/editor.js +3 -2
- package/build/src/utils/editor.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/exit.js +4 -25
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/getRunningProcess.js +6 -2
- package/build/src/utils/getRunningProcess.js.map +1 -1
- package/build/src/utils/nodeModules.js +13 -102
- package/build/src/utils/nodeModules.js.map +1 -1
- package/build/src/utils/npm.js +3 -24
- package/build/src/utils/npm.js.map +1 -1
- package/build/src/utils/ora.js +1 -13
- package/build/src/utils/ora.js.map +1 -1
- package/build/src/utils/progress.js +46 -0
- package/build/src/utils/progress.js.map +1 -1
- package/build/src/utils/prompts.js +4 -4
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/tar.js +3 -0
- package/build/src/utils/tar.js.map +1 -1
- package/build/src/utils/validateApplicationId.js +9 -2
- package/build/src/utils/validateApplicationId.js.map +1 -1
- package/build/src/utils/variadic.js +47 -0
- package/build/src/utils/variadic.js.map +1 -0
- package/package.json +13 -8
- package/static/template/babel.config.js +6 -0
- package/static/template/index.html +117 -0
- package/static/template/metro.config.js +4 -0
- package/static/template/serve.json +13 -0
- package/static/template/webpack.config.js +7 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.selectTemplatesAsync = selectTemplatesAsync;
|
|
6
|
+
exports.TEMPLATES = void 0;
|
|
7
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
11
|
+
var _prompts = _interopRequireDefault(require("../utils/prompts"));
|
|
12
|
+
function _interopRequireDefault(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const debug = require("debug")("expo:customize:templates");
|
|
18
|
+
function importFromExpoWebpackConfig(projectRoot, folder, moduleId) {
|
|
19
|
+
try {
|
|
20
|
+
const filePath = (0, _resolveFrom).default(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);
|
|
21
|
+
debug(`Using @expo/webpack-config template for "${moduleId}": ${filePath}`);
|
|
22
|
+
return filePath;
|
|
23
|
+
} catch {
|
|
24
|
+
debug(`@expo/webpack-config template for "${moduleId}" not found, falling back on @expo/cli`);
|
|
25
|
+
}
|
|
26
|
+
return importFromVendor(projectRoot, moduleId);
|
|
27
|
+
}
|
|
28
|
+
function importFromVendor(projectRoot, moduleId) {
|
|
29
|
+
try {
|
|
30
|
+
const filePath = (0, _resolveFrom).default(projectRoot, "@expo/cli/static/template/" + moduleId);
|
|
31
|
+
debug(`Using @expo/cli template for "${moduleId}": ${filePath}`);
|
|
32
|
+
return filePath;
|
|
33
|
+
} catch {
|
|
34
|
+
// For dev mode, testing and other cases where @expo/cli is not installed
|
|
35
|
+
const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);
|
|
36
|
+
debug(`Local @expo/cli template for "${moduleId}" not found, falling back on template relative to @expo/cli: ${filePath}`);
|
|
37
|
+
return filePath;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const TEMPLATES = [
|
|
41
|
+
{
|
|
42
|
+
id: "babel.config.js",
|
|
43
|
+
file: (projectRoot)=>importFromVendor(projectRoot, "babel.config.js")
|
|
44
|
+
,
|
|
45
|
+
destination: ()=>"babel.config.js"
|
|
46
|
+
,
|
|
47
|
+
dependencies: [
|
|
48
|
+
// Even though this is installed in `expo`, we should add it for now.
|
|
49
|
+
"babel-preset-expo",
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "webpack.config.js",
|
|
54
|
+
file: (projectRoot)=>importFromExpoWebpackConfig(projectRoot, "template", "webpack.config.js")
|
|
55
|
+
,
|
|
56
|
+
destination: ()=>"webpack.config.js"
|
|
57
|
+
,
|
|
58
|
+
dependencies: [
|
|
59
|
+
"@expo/webpack-config"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "metro.config.js",
|
|
64
|
+
dependencies: [
|
|
65
|
+
"@expo/metro-config"
|
|
66
|
+
],
|
|
67
|
+
destination: ()=>"metro.config.js"
|
|
68
|
+
,
|
|
69
|
+
file: (projectRoot)=>importFromVendor(projectRoot, "metro.config.js")
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "serve.json",
|
|
73
|
+
file: (projectRoot)=>importFromExpoWebpackConfig(projectRoot, "web-default", "serve.json")
|
|
74
|
+
,
|
|
75
|
+
// web/serve.json
|
|
76
|
+
destination: ({ webStaticPath })=>webStaticPath + "/serve.json"
|
|
77
|
+
,
|
|
78
|
+
dependencies: []
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "index.html",
|
|
82
|
+
file: (projectRoot)=>importFromExpoWebpackConfig(projectRoot, "web-default", "index.html")
|
|
83
|
+
,
|
|
84
|
+
// web/index.html
|
|
85
|
+
destination: ({ webStaticPath })=>webStaticPath + "/index.html"
|
|
86
|
+
,
|
|
87
|
+
dependencies: []
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
exports.TEMPLATES = TEMPLATES;
|
|
91
|
+
/** Generate the prompt choices. */ function createChoices(projectRoot, props) {
|
|
92
|
+
return TEMPLATES.map((template, index)=>{
|
|
93
|
+
const destination = template.destination(props);
|
|
94
|
+
const localProjectFile = _path.default.resolve(projectRoot, destination);
|
|
95
|
+
const exists = _fs.default.existsSync(localProjectFile);
|
|
96
|
+
return {
|
|
97
|
+
title: destination,
|
|
98
|
+
value: index,
|
|
99
|
+
description: exists ? _chalk.default.red("This will overwrite the existing file") : undefined
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async function selectTemplatesAsync(projectRoot, props) {
|
|
104
|
+
const options = createChoices(projectRoot, props);
|
|
105
|
+
const { answer } = await (0, _prompts).default({
|
|
106
|
+
type: "multiselect",
|
|
107
|
+
name: "answer",
|
|
108
|
+
message: "Which files would you like to generate?",
|
|
109
|
+
hint: "- Space to select. Return to submit",
|
|
110
|
+
warn: "File already exists.",
|
|
111
|
+
limit: options.length,
|
|
112
|
+
instructions: "",
|
|
113
|
+
choices: options
|
|
114
|
+
});
|
|
115
|
+
return answer;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/customize/templates.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport prompt, { ExpoChoice } from '../utils/prompts';\n\nconst debug = require('debug')('expo:customize:templates');\n\nexport type DestinationResolutionProps = {\n /** Web 'public' folder path (defaults to `/web`). This technically can be changed but shouldn't be. */\n webStaticPath: string;\n};\n\nfunction importFromExpoWebpackConfig(projectRoot: string, folder: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, `@expo/webpack-config/${folder}/${moduleId}`);\n debug(`Using @expo/webpack-config template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n debug(`@expo/webpack-config template for \"${moduleId}\" not found, falling back on @expo/cli`);\n }\n return importFromVendor(projectRoot, moduleId);\n}\n\nfunction importFromVendor(projectRoot: string, moduleId: string) {\n try {\n const filePath = resolveFrom(projectRoot, '@expo/cli/static/template/' + moduleId);\n debug(`Using @expo/cli template for \"${moduleId}\": ${filePath}`);\n return filePath;\n } catch {\n // For dev mode, testing and other cases where @expo/cli is not installed\n const filePath = require.resolve(`@expo/cli/static/template/${moduleId}`);\n debug(\n `Local @expo/cli template for \"${moduleId}\" not found, falling back on template relative to @expo/cli: ${filePath}`\n );\n\n return filePath;\n }\n}\n\nexport const TEMPLATES: {\n /** Unique ID for easily indexing. */\n id: string;\n /** Template file path to copy into the project. */\n file: (projectRoot: string) => string;\n /** Output location for the file in the user project. */\n destination: (props: DestinationResolutionProps) => string;\n /** List of dependencies to install in the project. These are used inside of the template file. */\n dependencies: string[];\n}[] = [\n {\n id: 'babel.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'babel.config.js'),\n destination: () => 'babel.config.js',\n dependencies: [\n // Even though this is installed in `expo`, we should add it for now.\n 'babel-preset-expo',\n ],\n },\n {\n id: 'webpack.config.js',\n file: (projectRoot) =>\n importFromExpoWebpackConfig(projectRoot, 'template', 'webpack.config.js'),\n destination: () => 'webpack.config.js',\n dependencies: ['@expo/webpack-config'],\n },\n {\n id: 'metro.config.js',\n dependencies: ['@expo/metro-config'],\n destination: () => 'metro.config.js',\n file: (projectRoot) => importFromVendor(projectRoot, 'metro.config.js'),\n },\n {\n id: 'serve.json',\n file: (projectRoot) => importFromExpoWebpackConfig(projectRoot, 'web-default', 'serve.json'),\n // web/serve.json\n destination: ({ webStaticPath }) => webStaticPath + '/serve.json',\n dependencies: [],\n },\n {\n id: 'index.html',\n file: (projectRoot) => importFromExpoWebpackConfig(projectRoot, 'web-default', 'index.html'),\n // web/index.html\n destination: ({ webStaticPath }) => webStaticPath + '/index.html',\n dependencies: [],\n },\n];\n\n/** Generate the prompt choices. */\nfunction createChoices(\n projectRoot: string,\n props: DestinationResolutionProps\n): ExpoChoice<number>[] {\n return TEMPLATES.map((template, index) => {\n const destination = template.destination(props);\n const localProjectFile = path.resolve(projectRoot, destination);\n const exists = fs.existsSync(localProjectFile);\n\n return {\n title: destination,\n value: index,\n description: exists ? chalk.red('This will overwrite the existing file') : undefined,\n };\n });\n}\n\n/** Prompt to select templates to add. */\nexport async function selectTemplatesAsync(projectRoot: string, props: DestinationResolutionProps) {\n const options = createChoices(projectRoot, props);\n\n const { answer } = await prompt({\n type: 'multiselect',\n name: 'answer',\n message: 'Which files would you like to generate?',\n hint: '- Space to select. Return to submit',\n warn: 'File already exists.',\n limit: options.length,\n instructions: '',\n choices: options,\n });\n return answer;\n}\n"],"names":["selectTemplatesAsync","debug","require","importFromExpoWebpackConfig","projectRoot","folder","moduleId","filePath","resolveFrom","importFromVendor","resolve","TEMPLATES","id","file","destination","dependencies","webStaticPath","createChoices","props","map","template","index","localProjectFile","path","exists","fs","existsSync","title","value","description","chalk","red","undefined","options","answer","prompt","type","name","message","hint","warn","limit","length","instructions","choices"],"mappings":"AAAA;;;;QA4GsBA,oBAAoB,GAApBA,oBAAoB;;AA5GxB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEH,IAAA,QAAkB,kCAAlB,kBAAkB,EAAA;;;;;;AAErD,MAAMC,K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,OAAOP,SAAS,CAACQ,GAAG,CAAC,CAACC,QAAQ,EAAEC,KAAK,GAAK;QACxC,MAAMP,WAAW,GAAGM,QAAQ,CAACN,WAAW,CAACI,KAAK,CAAC,AAAC;QAChD,MAAMI,gBAAgB,GAAGC,KAAI,QAAA,CAACb,OAAO,CAACN,WAAW,EAAEU,WAAW,CAAC,AAAC;QAChE,MAAMU,MAAM,GAAGC,GAAE,QAAA,CAACC,UAAU,CAACJ,gBAAgB,CAAC,AAAC;QAE/C,OAAO;YACLK,KAAK,EAAEb,WAAW;YAClBc,KAAK,EAAEP,KAAK;YACZQ,WAAW,EAAEL,MAAM,GAAGM,MAAK,QAAA,CAACC,GAAG,CAAC,uCAAuC,CAAC,GAAGC,SAAS;SACrF,CAAC;KACH,CAAC,CAAC;CACJ;AAGM,eAAehC,oBAAoB,CAACI,WAAmB,EAAEc,KAAiC,EAAE;IACjG,MAAMe,OAAO,GAAGhB,aAAa,CAACb,WAAW,EAAEc,KAAK,CAAC,AAAC;IAElD,MAAM,EAAEgB,MAAM,CAAA,EAAE,GAAG,MAAMC,CAAAA,GAAAA,QAAM,AAS7B,CAAA,QAT6B,CAAC;QAC9BC,IAAI,EAAE,aAAa;QACnBC,IAAI,EAAE,QAAQ;QACdC,OAAO,EAAE,yCAAyC;QAClDC,IAAI,EAAE,qCAAqC;QAC3CC,IAAI,EAAE,sBAAsB;QAC5BC,KAAK,EAAER,OAAO,CAACS,MAAM;QACrBC,YAAY,EAAE,EAAE;QAChBC,OAAO,EAAEX,OAAO;KACjB,CAAC,AAAC;IACH,OAAOC,MAAM,CAAC;CACf"}
|
|
@@ -14,22 +14,25 @@ function createMetadataJson({ bundles , fileNames }) {
|
|
|
14
14
|
return {
|
|
15
15
|
version: 0,
|
|
16
16
|
bundler: "metro",
|
|
17
|
-
fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>
|
|
17
|
+
fileMetadata: Object.entries(bundles).reduce((metadata, [platform, bundle])=>{
|
|
18
|
+
return {
|
|
18
19
|
...metadata,
|
|
19
20
|
[platform]: {
|
|
20
21
|
// Get the filename for each platform's bundle.
|
|
21
22
|
bundle: _path.default.join("bundles", fileNames[platform]),
|
|
22
23
|
// Collect all of the assets and convert them to the serial format.
|
|
23
|
-
assets: bundle.assets.map((asset)
|
|
24
|
-
asset.
|
|
24
|
+
assets: bundle.assets.map((asset)=>{
|
|
25
|
+
var // Each asset has multiple hashes which we convert and then flatten.
|
|
26
|
+
ref;
|
|
27
|
+
return (ref = asset.fileHashes) == null ? void 0 : ref.map((hash)=>({
|
|
25
28
|
path: _path.default.join("assets", hash),
|
|
26
29
|
ext: asset.type
|
|
27
30
|
})
|
|
28
|
-
)
|
|
29
|
-
).flat()
|
|
31
|
+
);
|
|
32
|
+
}).filter(Boolean).flat()
|
|
30
33
|
}
|
|
31
|
-
}
|
|
32
|
-
, {})
|
|
34
|
+
};
|
|
35
|
+
}, {})
|
|
33
36
|
};
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import type { BundleOutput } from '@expo/dev-server';\nimport path from 'path';\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
|
|
1
|
+
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import type { BundleOutput } from '@expo/dev-server';\nimport path from 'path';\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;;;;QAagBA,kBAAkB,GAAlBA,kBAAkB;AAZjB,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAYhB,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"}
|
|
@@ -3,9 +3,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.exportAppAsync = exportAppAsync;
|
|
6
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
6
7
|
var _path = _interopRequireDefault(require("path"));
|
|
7
8
|
var Log = _interopRequireWildcard(require("../log"));
|
|
9
|
+
var _resolveFromProject = require("../start/server/metro/resolveFromProject");
|
|
10
|
+
var _webTemplate = require("../start/server/webTemplate");
|
|
8
11
|
var _dir = require("../utils/dir");
|
|
12
|
+
var _env = require("../utils/env");
|
|
9
13
|
var _createBundles = require("./createBundles");
|
|
10
14
|
var _exportAssets = require("./exportAssets");
|
|
11
15
|
var _getPublicExpoManifest = require("./getPublicExpoManifest");
|
|
@@ -39,6 +43,7 @@ function _interopRequireWildcard(obj) {
|
|
|
39
43
|
}
|
|
40
44
|
async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev , dumpAssetmap , dumpSourcemap }) {
|
|
41
45
|
const exp = await (0, _getPublicExpoManifest).getPublicExpoManifestAsync(projectRoot);
|
|
46
|
+
const publicPath = _path.default.resolve(projectRoot, _env.env.EXPO_PUBLIC_FOLDER);
|
|
42
47
|
const outputPath = _path.default.resolve(projectRoot, outputDir);
|
|
43
48
|
const assetsPath = _path.default.join(outputPath, "assets");
|
|
44
49
|
const bundlesPath = _path.default.join(outputPath, "bundles");
|
|
@@ -46,6 +51,7 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
46
51
|
assetsPath,
|
|
47
52
|
bundlesPath
|
|
48
53
|
].map(_dir.ensureDirectoryAsync));
|
|
54
|
+
await copyPublicFolderAsync(publicPath, outputDir);
|
|
49
55
|
// Run metro bundler and create the JS bundles/source maps.
|
|
50
56
|
const bundles = await (0, _createBundles).createBundlesAsync(projectRoot, {
|
|
51
57
|
resetCache: !!clear
|
|
@@ -62,6 +68,20 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
62
68
|
outputDir: bundlesPath
|
|
63
69
|
});
|
|
64
70
|
Log.log("Finished saving JS Bundles");
|
|
71
|
+
if (fileNames.web) {
|
|
72
|
+
// If web exists, then write the template HTML file.
|
|
73
|
+
await _fs.default.promises.writeFile(_path.default.join(outputPath, "index.html"), await (0, _webTemplate).createTemplateHtmlFromExpoConfigAsync(projectRoot, {
|
|
74
|
+
scripts: [
|
|
75
|
+
`/bundles/${fileNames.web}`
|
|
76
|
+
]
|
|
77
|
+
}));
|
|
78
|
+
// Save assets like a typical bundler, preserving the file paths on web.
|
|
79
|
+
const saveAssets = (0, _resolveFromProject).importCliSaveAssetsFromProject(projectRoot);
|
|
80
|
+
await Promise.all(Object.entries(bundles).map(([platform, bundle])=>{
|
|
81
|
+
return saveAssets(// @ts-expect-error: tolerable type mismatches: unused `readonly` (common in Metro) and `undefined` instead of `null`.
|
|
82
|
+
bundle.assets, platform, outputPath);
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
65
85
|
const { assets } = await (0, _exportAssets).exportAssetsAsync(projectRoot, {
|
|
66
86
|
exp,
|
|
67
87
|
outputDir: outputPath,
|
|
@@ -98,5 +118,17 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
|
|
|
98
118
|
fileNames
|
|
99
119
|
});
|
|
100
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Copy the contents of the public folder into the output folder.
|
|
123
|
+
* This enables users to add static files like `favicon.ico` or `serve.json`.
|
|
124
|
+
*
|
|
125
|
+
* The contents of this folder are completely universal since they refer to
|
|
126
|
+
* static network requests which fall outside the scope of React Native's magic
|
|
127
|
+
* platform resolution patterns.
|
|
128
|
+
*/ async function copyPublicFolderAsync(publicFolder, outputFolder) {
|
|
129
|
+
if (_fs.default.existsSync(publicFolder)) {
|
|
130
|
+
await (0, _dir).copyAsync(publicFolder, outputFolder);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
101
133
|
|
|
102
134
|
//# sourceMappingURL=exportApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import path from 'path';\n\nimport * as Log from '../log';\nimport { ensureDirectoryAsync } from '../utils/dir';\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 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 // 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 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"],"names":["exportAppAsync","Log","projectRoot","platforms","outputDir","clear","dev","dumpAssetmap","dumpSourcemap","exp","getPublicExpoManifestAsync","
|
|
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","Object","entries","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,yBAAyB,CAAA;AACnC,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAQ9C,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcjB,eAAeD,cAAc,CAClCE,WAAmB,EACnB,EACEC,SAAS,CAAA,EACTC,SAAS,CAAA,EACTC,KAAK,CAAA,EACLC,GAAG,CAAA,EACHC,YAAY,CAAA,EACZC,aAAa,CAAA,EACiF,EACjF;IACf,MAAMC,GAAG,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C;YACzBxB,OAAO;YACPK,MAAM;YACN1B,SAAS,EAAEe,WAAW;YACtBY,SAAS;SACV,CAAC,CAAC;QAEH9B,GAAG,CAACgC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QAChD,kFAAkF;QAClF,kDAAkD;QAClD,MAAMiB,CAAAA,GAAAA,cAAmB,AAGvB,CAAA,oBAHuB,CAAC;YACxB9C,SAAS,EAAEY,UAAU;YACrBe,SAAS;SACV,CAAC,CAAC;KACJ;IAED,yDAAyD;IACzD,MAAMoB,CAAAA,GAAAA,cAAsB,AAAmC,CAAA,uBAAnC,CAAC;QAAE/C,SAAS;QAAEqB,OAAO;QAAEM,SAAS;KAAE,CAAC,CAAC;CACjE;AAED;;;;;;;GAOG,CACH,eAAeP,qBAAqB,CAAC4B,YAAoB,EAAEC,YAAoB,EAAE;IAC/E,IAAIlB,GAAE,QAAA,CAACmB,UAAU,CAACF,YAAY,CAAC,EAAE;QAC/B,MAAMG,CAAAA,GAAAA,IAAS,AAA4B,CAAA,UAA5B,CAACH,YAAY,EAAEC,YAAY,CAAC,CAAC;KAC7C;CACF"}
|
|
@@ -36,6 +36,7 @@ function _interopRequireWildcard(obj) {
|
|
|
36
36
|
return newObj;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
const debug = require("debug")("expo:export:exportAssets");
|
|
39
40
|
async function resolveAssetBundlePatternsAsync(projectRoot, exp, assets) {
|
|
40
41
|
var ref1;
|
|
41
42
|
if (!((ref1 = exp.assetBundlePatterns) == null ? void 0 : ref1.length) || !assets.length) {
|
|
@@ -53,7 +54,7 @@ async function resolveAssetBundlePatternsAsync(projectRoot, exp, assets) {
|
|
|
53
54
|
const shouldBundle = shouldBundleAsset(asset, fullPatterns);
|
|
54
55
|
if (shouldBundle) {
|
|
55
56
|
var ref;
|
|
56
|
-
|
|
57
|
+
debug(`${shouldBundle ? "Include" : "Exclude"} asset ${(ref = asset.files) == null ? void 0 : ref[0]}`);
|
|
57
58
|
return asset.fileHashes.map((hash)=>"asset_" + hash + ("type" in asset && asset.type ? "." + asset.type : "")
|
|
58
59
|
);
|
|
59
60
|
}
|
|
@@ -90,8 +91,6 @@ async function exportAssetsAsync(projectRoot, { exp , outputDir , bundles }) {
|
|
|
90
91
|
assets,
|
|
91
92
|
outputDir
|
|
92
93
|
});
|
|
93
|
-
} else {
|
|
94
|
-
Log.log("No assets to upload, skipped.");
|
|
95
94
|
}
|
|
96
95
|
// Add google services file if it exists
|
|
97
96
|
await (0, _resolveAssets).resolveGoogleServicesFile(projectRoot, exp);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoAppManifest } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport { BundleOutput } from '@expo/dev-server';\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 { Asset, saveAssetsAsync } from './saveAssets';\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
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoAppManifest } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport { BundleOutput } from '@expo/dev-server';\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 { 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;AAxEjB,IAAA,UAAW,kCAAX,WAAW,EAAA;AAChB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AAC2B,IAAA,cAA0C,WAA1C,0CAA0C,CAAA;AAC7D,IAAA,MAAgB,WAAhB,gBAAgB,CAAA;AACA,IAAA,WAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,0BAA0B,CAAC,AAAsB,AAAC;A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KA,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"}
|
|
@@ -9,6 +9,8 @@ var _importMetroFromProject = require("@expo/dev-server/build/metro/importMetroF
|
|
|
9
9
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
10
|
var _metroCore = require("metro-core");
|
|
11
11
|
var _metroTerminalReporter = require("../start/server/metro/MetroTerminalReporter");
|
|
12
|
+
var _withMetroMultiPlatform = require("../start/server/metro/withMetroMultiPlatform");
|
|
13
|
+
var _platformBundlers = require("../start/server/platformBundlers");
|
|
12
14
|
function _interopRequireDefault(obj) {
|
|
13
15
|
return obj && obj.__esModule ? obj : {
|
|
14
16
|
default: obj
|
|
@@ -27,31 +29,42 @@ function getExpoMetroConfig(projectRoot, { logger }) {
|
|
|
27
29
|
return require("@expo/metro-config");
|
|
28
30
|
}
|
|
29
31
|
let nextBuildID = 0;
|
|
32
|
+
// Fork of @expo/dev-server bundleAsync to add Metro logging back.
|
|
33
|
+
async function assertEngineMismatchAsync(projectRoot, exp, platform) {
|
|
34
|
+
const isHermesManaged = (0, _hermesBundler).isEnableHermesManaged(exp, platform);
|
|
35
|
+
const paths = (0, _config).getConfigFilePaths(projectRoot);
|
|
36
|
+
var _dynamicConfigPath, ref;
|
|
37
|
+
const configFilePath = (ref = (_dynamicConfigPath = paths.dynamicConfigPath) != null ? _dynamicConfigPath : paths.staticConfigPath) != null ? ref : "app.json";
|
|
38
|
+
await (0, _hermesBundler).maybeThrowFromInconsistentEngineAsync(projectRoot, configFilePath, platform, isHermesManaged);
|
|
39
|
+
}
|
|
30
40
|
async function bundleAsync(projectRoot, expoConfig, options, bundles) {
|
|
41
|
+
// Assert early so the user doesn't have to wait until bundling is complete to find out that
|
|
42
|
+
// Hermes won't be available.
|
|
43
|
+
await Promise.all(bundles.map(({ platform })=>assertEngineMismatchAsync(projectRoot, expoConfig, platform)
|
|
44
|
+
));
|
|
31
45
|
const metro = (0, _importMetroFromProject).importMetroFromProject(projectRoot);
|
|
32
46
|
const Server = (0, _importMetroFromProject).importMetroServerFromProject(projectRoot);
|
|
33
|
-
let reportEvent;
|
|
34
47
|
const terminal = new _metroCore.Terminal(process.stdout);
|
|
35
48
|
const terminalReporter = new _metroTerminalReporter.MetroTerminalReporter(projectRoot, terminal);
|
|
36
49
|
const reporter = {
|
|
37
50
|
update (event) {
|
|
38
51
|
terminalReporter.update(event);
|
|
39
|
-
if (reportEvent) {
|
|
40
|
-
reportEvent(event);
|
|
41
|
-
}
|
|
42
52
|
}
|
|
43
53
|
};
|
|
44
54
|
const ExpoMetroConfig = getExpoMetroConfig(projectRoot, options);
|
|
45
|
-
const
|
|
55
|
+
const { exp } = (0, _config).getConfig(projectRoot, {
|
|
56
|
+
skipSDKVersionRequirement: true
|
|
57
|
+
});
|
|
58
|
+
let config = await ExpoMetroConfig.loadAsync(projectRoot, {
|
|
46
59
|
reporter,
|
|
47
60
|
...options
|
|
48
61
|
});
|
|
49
|
-
|
|
50
|
-
// @ts-expect-error
|
|
62
|
+
config = (0, _withMetroMultiPlatform).withMetroMultiPlatform(projectRoot, config, (0, _platformBundlers).getPlatformBundlers(exp));
|
|
51
63
|
const metroServer = await metro.runMetro(config, {
|
|
52
64
|
watch: false
|
|
53
65
|
});
|
|
54
66
|
const buildAsync = async (bundle)=>{
|
|
67
|
+
const buildID = `bundle_${nextBuildID++}_${bundle.platform}`;
|
|
55
68
|
var _dev, _minify;
|
|
56
69
|
const bundleOptions = {
|
|
57
70
|
...Server.DEFAULT_BUNDLE_OPTIONS,
|
|
@@ -65,7 +78,7 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
|
|
|
65
78
|
createModuleIdFactory: config.serializer.createModuleIdFactory,
|
|
66
79
|
onProgress: (transformedFileCount, totalFileCount)=>{
|
|
67
80
|
if (!options.quiet) {
|
|
68
|
-
|
|
81
|
+
terminalReporter.update({
|
|
69
82
|
buildID,
|
|
70
83
|
type: "bundle_transform_progressed",
|
|
71
84
|
transformedFileCount,
|
|
@@ -74,46 +87,46 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
|
|
|
74
87
|
}
|
|
75
88
|
}
|
|
76
89
|
};
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
const bundleDetails = {
|
|
91
|
+
...bundleOptions,
|
|
92
|
+
buildID
|
|
93
|
+
};
|
|
94
|
+
terminalReporter.update({
|
|
79
95
|
buildID,
|
|
80
96
|
type: "bundle_build_started",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
platform: bundle.platform,
|
|
84
|
-
entryFile: bundle.entryPoint,
|
|
85
|
-
dev: (_dev1 = bundle.dev) != null ? _dev1 : false,
|
|
86
|
-
minify: (_minify1 = bundle.minify) != null ? _minify1 : false
|
|
87
|
-
}
|
|
97
|
+
// @ts-expect-error: TODO
|
|
98
|
+
bundleDetails
|
|
88
99
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
try {
|
|
101
|
+
const { code , map } = await metroServer.build(bundleOptions);
|
|
102
|
+
const assets = await metroServer.getAssets(bundleOptions);
|
|
103
|
+
terminalReporter.update({
|
|
104
|
+
buildID,
|
|
105
|
+
type: "bundle_build_done"
|
|
106
|
+
});
|
|
107
|
+
return {
|
|
108
|
+
code,
|
|
109
|
+
map,
|
|
110
|
+
assets
|
|
111
|
+
};
|
|
112
|
+
} catch (error) {
|
|
113
|
+
terminalReporter.update({
|
|
114
|
+
buildID,
|
|
115
|
+
type: "bundle_build_failed"
|
|
116
|
+
});
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
100
119
|
};
|
|
101
120
|
const maybeAddHermesBundleAsync = async (bundle, bundleOutput)=>{
|
|
102
121
|
const { platform } = bundle;
|
|
103
122
|
const isHermesManaged = (0, _hermesBundler).isEnableHermesManaged(expoConfig, platform);
|
|
104
|
-
const paths = (0, _config).getConfigFilePaths(projectRoot);
|
|
105
|
-
var _dynamicConfigPath, ref;
|
|
106
|
-
const configFilePath = (ref = (_dynamicConfigPath = paths.dynamicConfigPath) != null ? _dynamicConfigPath : paths.staticConfigPath) != null ? ref : "app.json";
|
|
107
|
-
await (0, _hermesBundler).maybeThrowFromInconsistentEngineAsync(projectRoot, configFilePath, platform, isHermesManaged);
|
|
108
123
|
if (isHermesManaged) {
|
|
109
124
|
const platformTag = _chalk.default.bold({
|
|
110
125
|
ios: "iOS",
|
|
111
126
|
android: "Android",
|
|
112
127
|
web: "Web"
|
|
113
128
|
}[platform] || platform);
|
|
114
|
-
|
|
115
|
-
tag: "expo"
|
|
116
|
-
}, `💿 ${platformTag} Building Hermes bytecode for the bundle`);
|
|
129
|
+
terminalReporter.terminal.log(`${platformTag} Building Hermes bytecode for the bundle`);
|
|
117
130
|
const hermesBundleOutput = await (0, _hermesBundler).buildHermesBundleAsync(projectRoot, bundleOutput.code, bundleOutput.map, bundle.minify);
|
|
118
131
|
bundleOutput.hermesBytecodeBundle = hermesBundleOutput.hbc;
|
|
119
132
|
bundleOutput.hermesSourcemap = hermesBundleOutput.sourcemap;
|
|
@@ -130,6 +143,10 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
|
|
|
130
143
|
bundleOutputs.push(await maybeAddHermesBundleAsync(bundles[i], intermediateOutputs[i]));
|
|
131
144
|
}
|
|
132
145
|
return bundleOutputs;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
// New line so errors don't show up inline with the progress bar
|
|
148
|
+
console.log("");
|
|
149
|
+
throw error;
|
|
133
150
|
} finally{
|
|
134
151
|
metroServer.end();
|
|
135
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import Log from '@expo/bunyan';\nimport { ExpoConfig, getConfigFilePaths } 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';\n\nexport type MetroDevServerOptions = LoadOptions & {\n logger: Log;\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\nexport async function bundleAsync(\n projectRoot: string,\n expoConfig: ExpoConfig,\n options: MetroDevServerOptions,\n bundles: BundleOptions[]\n): Promise<BundleOutput[]> {\n const metro = importMetroFromProject(projectRoot);\n const Server = importMetroServerFromProject(projectRoot);\n\n let reportEvent: ((event: any) => void) | undefined;\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 if (reportEvent) {\n reportEvent(event);\n }\n },\n };\n\n const ExpoMetroConfig = getExpoMetroConfig(projectRoot, options);\n\n const config = await ExpoMetroConfig.loadAsync(projectRoot, { reporter, ...options });\n const buildID = `bundle_${nextBuildID++}`;\n\n // @ts-expect-error\n const metroServer = await metro.runMetro(config, {\n watch: false,\n });\n\n const buildAsync = async (bundle: BundleOptions): Promise<BundleOutput> => {\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 reporter.update({\n buildID,\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n }\n },\n };\n reporter.update({\n buildID,\n type: 'bundle_build_started',\n bundleDetails: {\n bundleType: bundleOptions.bundleType,\n platform: bundle.platform,\n entryFile: bundle.entryPoint,\n dev: bundle.dev ?? false,\n minify: bundle.minify ?? false,\n },\n });\n const { code, map } = await metroServer.build(bundleOptions);\n const assets = (await metroServer.getAssets(\n bundleOptions\n )) as readonly BundleAssetWithFileHashes[];\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return { code, map, assets };\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\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 if (isHermesManaged) {\n const platformTag = chalk.bold(\n { ios: 'iOS', android: 'Android', web: 'Web' }[platform] || platform\n );\n options.logger.info(\n { tag: 'expo' },\n `💿 ${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 } finally {\n metroServer.end();\n }\n}\n"],"names":["bundleAsync","getExpoMetroConfig","projectRoot","logger","importExpoMetroConfigFromProject","unversionedVersion","require","version","info","tag","chalk","gray","bold","nextBuildID","expoConfig","options","bundles","metro","importMetroFromProject","Server","importMetroServerFromProject","reportEvent","terminal","Terminal","process","stdout","terminalReporter","MetroTerminalReporter","reporter","update","event","ExpoMetroConfig","config","loadAsync","buildID","metroServer","runMetro","watch","buildAsync","bundle","bundleOptions","DEFAULT_BUNDLE_OPTIONS","bundleType","platform","entryFile","entryPoint","dev","minify","inlineSourceMap","sourceMapUrl","createModuleIdFactory","serializer","onProgress","transformedFileCount","totalFileCount","quiet","type","bundleDetails","code","map","build","assets","getAssets","maybeAddHermesBundleAsync","bundleOutput","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","platformTag","ios","android","web","hermesBundleOutput","buildHermesBundleAsync","hermesBytecodeBundle","hbc","hermesSourcemap","sourcemap","intermediateOutputs","Promise","all","bundleOutputs","i","length","push","end"],"mappings":"AAAA;;;;QAkEsBA,WAAW,GAAXA,WAAW;AAjEc,IAAA,OAAc,WAAd,cAAc,CAAA;AAKtD,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;;;;;;AAwBnF,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,CAC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{"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 { withMetroMultiPlatform } 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 config = withMetroMultiPlatform(projectRoot, config, getPlatformBundlers(exp));\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","withMetroMultiPlatform","getPlatformBundlers","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;AAC5C,IAAA,uBAA8C,WAA9C,8CAA8C,CAAA;AACjD,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,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