@expo/cli 0.7.0 → 0.8.0

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.
Files changed (179) hide show
  1. package/README.md +1 -1
  2. package/build/bin/cli +12 -3
  3. package/build/bin/cli.map +1 -1
  4. package/build/src/api/getExpoGoIntermediateCertificate.js +0 -2
  5. package/build/src/api/getExpoGoIntermediateCertificate.js.map +1 -1
  6. package/build/src/api/getProjectDevelopmentCertificate.js +0 -2
  7. package/build/src/api/getProjectDevelopmentCertificate.js.map +1 -1
  8. package/build/src/api/graphql/queries/AppQuery.js +39 -0
  9. package/build/src/api/graphql/queries/AppQuery.js.map +1 -0
  10. package/build/src/api/graphql/queries/UserQuery.js +10 -3
  11. package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
  12. package/build/src/api/graphql/types/App.js +23 -0
  13. package/build/src/api/graphql/types/App.js.map +1 -0
  14. package/build/src/api/signManifest.js +0 -12
  15. package/build/src/api/signManifest.js.map +1 -1
  16. package/build/src/api/user/UserSettings.js.map +1 -1
  17. package/build/src/api/user/user.js.map +1 -1
  18. package/build/src/config/configAsync.js +3 -0
  19. package/build/src/config/configAsync.js.map +1 -1
  20. package/build/src/customize/customizeAsync.js +3 -0
  21. package/build/src/customize/customizeAsync.js.map +1 -1
  22. package/build/src/export/createBundles.js +7 -3
  23. package/build/src/export/createBundles.js.map +1 -1
  24. package/build/src/export/embed/exportEmbedAsync.js +24 -0
  25. package/build/src/export/embed/exportEmbedAsync.js.map +1 -0
  26. package/build/src/export/embed/index.js +117 -0
  27. package/build/src/export/embed/index.js.map +1 -0
  28. package/build/src/export/embed/resolveOptions.js +63 -0
  29. package/build/src/export/embed/resolveOptions.js.map +1 -0
  30. package/build/src/export/exportApp.js +56 -29
  31. package/build/src/export/exportApp.js.map +1 -1
  32. package/build/src/export/exportAssets.js +17 -0
  33. package/build/src/export/exportAssets.js.map +1 -1
  34. package/build/src/export/exportAsync.js +3 -0
  35. package/build/src/export/exportAsync.js.map +1 -1
  36. package/build/src/export/exportStaticAsync.js +179 -0
  37. package/build/src/export/exportStaticAsync.js.map +1 -0
  38. package/build/src/export/fork-bundleAsync.js +15 -42
  39. package/build/src/export/fork-bundleAsync.js.map +1 -1
  40. package/build/src/export/html.js +21 -0
  41. package/build/src/export/html.js.map +1 -0
  42. package/build/src/export/printBundleSizes.js +2 -2
  43. package/build/src/export/printBundleSizes.js.map +1 -1
  44. package/build/src/export/web/exportWebAsync.js +3 -0
  45. package/build/src/export/web/exportWebAsync.js.map +1 -1
  46. package/build/src/export/writeContents.js +5 -2
  47. package/build/src/export/writeContents.js.map +1 -1
  48. package/build/src/graphql/generated.js +462 -0
  49. package/build/src/graphql/generated.js.map +1 -0
  50. package/build/src/install/installAsync.js +3 -0
  51. package/build/src/install/installAsync.js.map +1 -1
  52. package/build/src/prebuild/clearNativeFolder.js +6 -1
  53. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  54. package/build/src/prebuild/ensureConfigAsync.js +1 -12
  55. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  56. package/build/src/prebuild/prebuildAsync.js +7 -2
  57. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  58. package/build/src/prebuild/resolveOptions.js +7 -8
  59. package/build/src/prebuild/resolveOptions.js.map +1 -1
  60. package/build/src/prebuild/resolveTemplate.js +5 -0
  61. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  62. package/build/src/prebuild/updateFromTemplate.js +6 -1
  63. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  64. package/build/src/prebuild/validateTemplatePlatforms.js +48 -0
  65. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -0
  66. package/build/src/run/android/runAndroidAsync.js +4 -0
  67. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  68. package/build/src/run/ios/appleDevice/AppleDevice.js +25 -19
  69. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  70. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  71. package/build/src/run/ios/options/resolveNativeScheme.js +13 -4
  72. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  73. package/build/src/run/ios/runIosAsync.js +3 -0
  74. package/build/src/run/ios/runIosAsync.js.map +1 -1
  75. package/build/src/run/startBundler.js +4 -0
  76. package/build/src/run/startBundler.js.map +1 -1
  77. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  78. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +12 -6
  79. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  80. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +1 -3
  81. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  82. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +31 -5
  83. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  84. package/build/src/start/doctor/typescript/updateTSConfig.js +6 -0
  85. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  86. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +1 -0
  87. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  88. package/build/src/start/platforms/android/adb.js +1 -1
  89. package/build/src/start/platforms/android/adb.js.map +1 -1
  90. package/build/src/start/platforms/ios/AppleDeviceManager.js +1 -1
  91. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  92. package/build/src/start/server/BundlerDevServer.js +16 -2
  93. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  94. package/build/src/start/server/DevServerManager.js +33 -2
  95. package/build/src/start/server/DevServerManager.js.map +1 -1
  96. package/build/src/start/server/getStaticRenderFunctions.js +166 -0
  97. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -0
  98. package/build/src/start/server/metro/MetroBundlerDevServer.js +279 -3
  99. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  100. package/build/src/start/server/metro/MetroTerminalReporter.js +2 -34
  101. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  102. package/build/src/start/server/metro/externals.js +95 -0
  103. package/build/src/start/server/metro/externals.js.map +1 -0
  104. package/build/src/start/server/metro/getCssModulesFromBundler.js +77 -0
  105. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -0
  106. package/build/src/start/server/metro/inspector-proxy/index.js +2 -2
  107. package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
  108. package/build/src/start/server/metro/inspector-proxy/proxy.js +1 -3
  109. package/build/src/start/server/metro/inspector-proxy/proxy.js.map +1 -1
  110. package/build/src/start/server/metro/instantiateMetro.js +44 -48
  111. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  112. package/build/src/start/server/metro/metroErrorInterface.js +114 -0
  113. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -0
  114. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +51 -0
  115. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -0
  116. package/build/src/start/server/metro/resolveFromProject.js +26 -3
  117. package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
  118. package/build/src/start/server/metro/router.js +4 -0
  119. package/build/src/start/server/metro/router.js.map +1 -1
  120. package/build/src/start/server/metro/runServer-fork.js +108 -0
  121. package/build/src/start/server/metro/runServer-fork.js.map +1 -0
  122. package/build/src/start/server/metro/symbolicate.js +6 -0
  123. package/build/src/start/server/metro/symbolicate.js.map +1 -0
  124. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +70 -0
  125. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -0
  126. package/build/src/start/server/metro/withMetroMultiPlatform.js +181 -44
  127. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  128. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +8 -1
  129. package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +1 -1
  130. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  131. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +38 -32
  132. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  133. package/build/src/start/server/middleware/ManifestMiddleware.js +53 -19
  134. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  135. package/build/src/start/server/type-generation/expo-env.js +27 -0
  136. package/build/src/start/server/type-generation/expo-env.js.map +1 -0
  137. package/build/src/start/server/type-generation/index.js +49 -0
  138. package/build/src/start/server/type-generation/index.js.map +1 -0
  139. package/build/src/start/server/type-generation/routes.js +292 -0
  140. package/build/src/start/server/type-generation/routes.js.map +1 -0
  141. package/build/src/start/server/type-generation/tsconfig.js +89 -0
  142. package/build/src/start/server/type-generation/tsconfig.js.map +1 -0
  143. package/build/src/start/server/webTemplate.js +20 -4
  144. package/build/src/start/server/webTemplate.js.map +1 -1
  145. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +4 -6
  146. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  147. package/build/src/start/startAsync.js +30 -8
  148. package/build/src/start/startAsync.js.map +1 -1
  149. package/build/src/utils/FileNotifier.js +11 -4
  150. package/build/src/utils/FileNotifier.js.map +1 -1
  151. package/build/src/utils/analytics/getMetroProperties.js +1 -1
  152. package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
  153. package/build/src/utils/analytics/rudderstackClient.js +2 -2
  154. package/build/src/utils/codesigning.js +31 -7
  155. package/build/src/utils/codesigning.js.map +1 -1
  156. package/build/src/utils/env.js +3 -0
  157. package/build/src/utils/env.js.map +1 -1
  158. package/build/src/utils/mergeGitIgnorePaths.js +42 -0
  159. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  160. package/build/src/utils/nodeEnv.js +11 -0
  161. package/build/src/utils/nodeEnv.js.map +1 -0
  162. package/build/src/utils/resolveArgs.js +43 -0
  163. package/build/src/utils/resolveArgs.js.map +1 -1
  164. package/build/src/utils/template.js +21 -0
  165. package/build/src/utils/template.js.map +1 -0
  166. package/build/src/utils/tsconfig/evaluateTsConfig.js +61 -0
  167. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -0
  168. package/build/src/utils/tsconfig/loadTsConfigPaths.js +69 -0
  169. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -0
  170. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +88 -0
  171. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +1 -0
  172. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +41 -0
  173. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -0
  174. package/package.json +16 -8
  175. package/static/template/metro.config.js +4 -1
  176. package/build/src/api/getProject.js +0 -19
  177. package/build/src/api/getProject.js.map +0 -1
  178. package/build/src/api/graphql/generated.js +0 -113
  179. package/build/src/api/graphql/generated.js.map +0 -1
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.unstable_exportStaticAsync = unstable_exportStaticAsync;
6
+ exports.getFilesToExportFromServerAsync = getFilesToExportFromServerAsync;
7
+ exports.exportFromServerAsync = exportFromServerAsync;
8
+ exports.getHtmlFiles = getHtmlFiles;
9
+ exports.getPathVariations = getPathVariations;
10
+ var _assert = _interopRequireDefault(require("assert"));
11
+ var _chalk = _interopRequireDefault(require("chalk"));
12
+ var _fs = _interopRequireDefault(require("fs"));
13
+ var _path = _interopRequireDefault(require("path"));
14
+ var _prettyBytes = _interopRequireDefault(require("pretty-bytes"));
15
+ var _util = require("util");
16
+ var _log = require("../log");
17
+ var _devServerManager = require("../start/server/DevServerManager");
18
+ var _metroBundlerDevServer = require("../start/server/metro/MetroBundlerDevServer");
19
+ var _ansi = require("../utils/ansi");
20
+ function _interopRequireDefault(obj) {
21
+ return obj && obj.__esModule ? obj : {
22
+ default: obj
23
+ };
24
+ }
25
+ const debug = require("debug")("expo:export:generateStaticRoutes");
26
+ async function unstable_exportStaticAsync(projectRoot, options) {
27
+ // NOTE(EvanBacon): Please don't use this feature.
28
+ _log.Log.warn("Static exporting with Metro is an experimental feature.");
29
+ const devServerManager = new _devServerManager.DevServerManager(projectRoot, {
30
+ minify: options.minify,
31
+ mode: "production",
32
+ location: {}
33
+ });
34
+ await devServerManager.startAsync([
35
+ {
36
+ type: "metro"
37
+ },
38
+ ]);
39
+ await exportFromServerAsync(devServerManager, options);
40
+ await devServerManager.stopAsync();
41
+ }
42
+ /** Match `(page)` -> `page` */ function matchGroupName(name) {
43
+ var ref;
44
+ return (ref = name.match(/^\(([^/]+?)\)$/)) == null ? void 0 : ref[1];
45
+ }
46
+ async function getFilesToExportFromServerAsync({ manifest , renderAsync }) {
47
+ // name : contents
48
+ const files = new Map();
49
+ await Promise.all(getHtmlFiles({
50
+ manifest
51
+ }).map(async (outputPath)=>{
52
+ const pathname = outputPath.replace(/(index)?\.html$/, "");
53
+ try {
54
+ files.set(outputPath, "");
55
+ const data = await renderAsync(pathname);
56
+ files.set(outputPath, data);
57
+ } catch (e) {
58
+ // TODO: Format Metro error message better...
59
+ _log.Log.error("Failed to statically render route:", pathname);
60
+ e.message = (0, _ansi).stripAnsi(e.message);
61
+ _log.Log.exception(e);
62
+ throw e;
63
+ }
64
+ }));
65
+ return files;
66
+ }
67
+ async function exportFromServerAsync(devServerManager, { outputDir }) {
68
+ const devServer = devServerManager.getDefaultDevServer();
69
+ (0, _assert).default(devServer instanceof _metroBundlerDevServer.MetroBundlerDevServer);
70
+ const [manifest, resources, renderAsync] = await Promise.all([
71
+ devServer.getRoutesAsync(),
72
+ devServer.getStaticResourcesAsync({
73
+ mode: "production"
74
+ }),
75
+ devServer.getStaticRenderFunctionAsync({
76
+ mode: "production"
77
+ }),
78
+ ]);
79
+ debug("Routes:\n", (0, _util).inspect(manifest, {
80
+ colors: true,
81
+ depth: null
82
+ }));
83
+ const files = await getFilesToExportFromServerAsync({
84
+ manifest,
85
+ async renderAsync (pathname) {
86
+ const template = await renderAsync(pathname);
87
+ return devServer.composeResourcesWithHtml({
88
+ mode: "production",
89
+ resources,
90
+ template
91
+ });
92
+ }
93
+ });
94
+ resources.forEach((resource)=>{
95
+ files.set(resource.filename, resource.source);
96
+ });
97
+ _fs.default.mkdirSync(_path.default.join(outputDir), {
98
+ recursive: true
99
+ });
100
+ _log.Log.log("");
101
+ _log.Log.log(_chalk.default.bold`Exporting ${files.size} files:`);
102
+ await Promise.all([
103
+ ...files.entries()
104
+ ].sort(([a], [b])=>a.localeCompare(b)
105
+ ).map(async ([file, contents])=>{
106
+ const length = Buffer.byteLength(contents, "utf8");
107
+ _log.Log.log(file, _chalk.default.gray`(${(0, _prettyBytes).default(length)})`);
108
+ const outputPath = _path.default.join(outputDir, file);
109
+ await _fs.default.promises.mkdir(_path.default.dirname(outputPath), {
110
+ recursive: true
111
+ });
112
+ await _fs.default.promises.writeFile(outputPath, contents);
113
+ }));
114
+ _log.Log.log("");
115
+ }
116
+ function getHtmlFiles({ manifest }) {
117
+ const htmlFiles = new Set();
118
+ function traverseScreens(screens, basePath = "") {
119
+ for (const value of Object.values(screens)){
120
+ if (typeof value === "string") {
121
+ let filePath = basePath + value;
122
+ if (value === "") {
123
+ filePath = basePath === "" ? "index" : basePath.endsWith("/") ? basePath + "index" : basePath.slice(0, -1);
124
+ }
125
+ // TODO: Dedupe requests for alias routes.
126
+ addOptionalGroups(filePath);
127
+ } else if (typeof value === "object" && (value == null ? void 0 : value.screens)) {
128
+ const newPath = basePath + value.path + "/";
129
+ traverseScreens(value.screens, newPath);
130
+ }
131
+ }
132
+ }
133
+ function addOptionalGroups(path) {
134
+ const variations = getPathVariations(path);
135
+ for (const variation of variations){
136
+ htmlFiles.add(variation);
137
+ }
138
+ }
139
+ traverseScreens(manifest.screens);
140
+ return Array.from(htmlFiles).map((value)=>{
141
+ const parts = value.split("/");
142
+ // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`
143
+ const partsWithGroups = parts.map((part)=>{
144
+ if (part.startsWith(":")) {
145
+ return `[${part.slice(1)}]`;
146
+ } else if (part.startsWith("*")) {
147
+ return `[...${part.slice(1)}]`;
148
+ }
149
+ return part;
150
+ });
151
+ return partsWithGroups.join("/") + ".html";
152
+ });
153
+ }
154
+ function getPathVariations(routePath) {
155
+ const variations = new Set([
156
+ routePath
157
+ ]);
158
+ const segments1 = routePath.split("/");
159
+ function generateVariations(segments, index) {
160
+ if (index >= segments.length) {
161
+ return;
162
+ }
163
+ const segment = segments[index];
164
+ const groupName = matchGroupName(segment);
165
+ if (groupName) {
166
+ const newSegments = [
167
+ ...segments
168
+ ];
169
+ newSegments.splice(index, 1);
170
+ variations.add(newSegments.join("/"));
171
+ generateVariations(newSegments, index + 1);
172
+ }
173
+ generateVariations(segments, index + 1);
174
+ }
175
+ generateVariations(segments1, 0);
176
+ return Array.from(variations);
177
+ }
178
+
179
+ //# sourceMappingURL=exportStaticAsync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/export/exportStaticAsync.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport prettyBytes from 'pretty-bytes';\nimport { inspect } from 'util';\n\nimport { Log } from '../log';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { stripAnsi } from '../utils/ansi';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype Options = { outputDir: string; minify: boolean };\n\n/** @private */\nexport async function unstable_exportStaticAsync(projectRoot: string, options: Options) {\n // NOTE(EvanBacon): Please don't use this feature.\n Log.warn('Static exporting with Metro is an experimental feature.');\n\n const devServerManager = new DevServerManager(projectRoot, {\n minify: options.minify,\n mode: 'production',\n location: {},\n });\n\n await devServerManager.startAsync([\n {\n type: 'metro',\n },\n ]);\n\n await exportFromServerAsync(devServerManager, options);\n\n await devServerManager.stopAsync();\n}\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync({\n manifest,\n renderAsync,\n}: {\n manifest: any;\n renderAsync: (pathname: string) => Promise<string>;\n}): Promise<Map<string, string>> {\n // name : contents\n const files = new Map<string, string>();\n\n await Promise.all(\n getHtmlFiles({ manifest }).map(async (outputPath) => {\n const pathname = outputPath.replace(/(index)?\\.html$/, '');\n try {\n files.set(outputPath, '');\n const data = await renderAsync(pathname);\n files.set(outputPath, data);\n } catch (e: any) {\n // TODO: Format Metro error message better...\n Log.error('Failed to statically render route:', pathname);\n e.message = stripAnsi(e.message);\n Log.exception(e);\n throw e;\n }\n })\n );\n\n return files;\n}\n\n/** Perform all fs commits */\nexport async function exportFromServerAsync(\n devServerManager: DevServerManager,\n { outputDir }: Options\n): Promise<void> {\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const [manifest, resources, renderAsync] = await Promise.all([\n devServer.getRoutesAsync(),\n devServer.getStaticResourcesAsync({ mode: 'production' }),\n devServer.getStaticRenderFunctionAsync({\n mode: 'production',\n }),\n ]);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n const files = await getFilesToExportFromServerAsync({\n manifest,\n async renderAsync(pathname: string) {\n const template = await renderAsync(pathname);\n return devServer.composeResourcesWithHtml({\n mode: 'production',\n resources,\n template,\n });\n },\n });\n\n resources.forEach((resource) => {\n files.set(resource.filename, resource.source);\n });\n\n fs.mkdirSync(path.join(outputDir), { recursive: true });\n\n Log.log('');\n Log.log(chalk.bold`Exporting ${files.size} files:`);\n await Promise.all(\n [...files.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(async ([file, contents]) => {\n const length = Buffer.byteLength(contents, 'utf8');\n Log.log(file, chalk.gray`(${prettyBytes(length)})`);\n const outputPath = path.join(outputDir, file);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.promises.writeFile(outputPath, contents);\n })\n );\n Log.log('');\n}\n\nexport function getHtmlFiles({ manifest }: { manifest: any }): string[] {\n const htmlFiles = new Set<string>();\n\n function traverseScreens(screens: string | { screens: any; path: string }, basePath = '') {\n for (const value of Object.values(screens)) {\n if (typeof value === 'string') {\n let filePath = basePath + value;\n if (value === '') {\n filePath =\n basePath === ''\n ? 'index'\n : basePath.endsWith('/')\n ? basePath + 'index'\n : basePath.slice(0, -1);\n }\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath);\n } else if (typeof value === 'object' && value?.screens) {\n const newPath = basePath + value.path + '/';\n traverseScreens(value.screens, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add(variation);\n }\n }\n\n traverseScreens(manifest.screens);\n\n return Array.from(htmlFiles).map((value) => {\n const parts = value.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n return partsWithGroups.join('/') + '.html';\n });\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>([routePath]);\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], index: number): void {\n if (index >= segments.length) {\n return;\n }\n\n const segment = segments[index];\n const groupName = matchGroupName(segment);\n if (groupName) {\n const newSegments = [...segments];\n newSegments.splice(index, 1);\n variations.add(newSegments.join('/'));\n\n generateVariations(newSegments, index + 1);\n }\n\n generateVariations(segments, index + 1);\n }\n\n generateVariations(segments, 0);\n\n return Array.from(variations);\n}\n"],"names":["unstable_exportStaticAsync","getFilesToExportFromServerAsync","exportFromServerAsync","getHtmlFiles","getPathVariations","debug","require","projectRoot","options","Log","warn","devServerManager","DevServerManager","minify","mode","location","startAsync","type","stopAsync","matchGroupName","name","match","manifest","renderAsync","files","Map","Promise","all","map","outputPath","pathname","replace","set","data","e","error","message","stripAnsi","exception","outputDir","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","resources","getRoutesAsync","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","template","composeResourcesWithHtml","forEach","resource","filename","source","fs","mkdirSync","path","join","recursive","log","chalk","bold","size","entries","sort","a","b","localeCompare","file","contents","length","Buffer","byteLength","gray","prettyBytes","promises","mkdir","dirname","writeFile","htmlFiles","Set","traverseScreens","screens","basePath","value","Object","values","filePath","endsWith","slice","addOptionalGroups","newPath","variations","variation","add","Array","from","parts","split","partsWithGroups","part","startsWith","routePath","segments","generateVariations","index","segment","groupName","newSegments","splice"],"mappings":"AAMA;;;;QAiBsBA,0BAA0B,GAA1BA,0BAA0B;QA0B1BC,+BAA+B,GAA/BA,+BAA+B;QA+B/BC,qBAAqB,GAArBA,qBAAqB;QAmD3BC,YAAY,GAAZA,YAAY;QAkDZC,iBAAiB,GAAjBA,iBAAiB;AA/Kd,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AACd,IAAA,KAAM,WAAN,MAAM,CAAA;AAEV,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACK,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAC7B,IAAA,sBAA6C,WAA7C,6CAA6C,CAAA;AACzD,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;AAEzC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,AAAs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,KAAK,CAAC,GAAG,CAAC,AAAC;IAEtC,SAASM,kBAAkB,CAACD,QAAkB,EAAEE,KAAa,EAAQ;QACnE,IAAIA,KAAK,IAAIF,QAAQ,CAACjC,MAAM,EAAE;YAC5B,OAAO;SACR;QAED,MAAMoC,OAAO,GAAGH,QAAQ,CAACE,KAAK,CAAC,AAAC;QAChC,MAAME,SAAS,GAAG3F,cAAc,CAAC0F,OAAO,CAAC,AAAC;QAC1C,IAAIC,SAAS,EAAE;YACb,MAAMC,WAAW,GAAG;mBAAIL,QAAQ;aAAC,AAAC;YAClCK,WAAW,CAACC,MAAM,CAACJ,KAAK,EAAE,CAAC,CAAC,CAAC;YAC7Bb,UAAU,CAACE,GAAG,CAACc,WAAW,CAACnD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAEtC+C,kBAAkB,CAACI,WAAW,EAAEH,KAAK,GAAG,CAAC,CAAC,CAAC;SAC5C;QAEDD,kBAAkB,CAACD,QAAQ,EAAEE,KAAK,GAAG,CAAC,CAAC,CAAC;KACzC;IAEDD,kBAAkB,CAACD,SAAQ,EAAE,CAAC,CAAC,CAAC;IAEhC,OAAOR,KAAK,CAACC,IAAI,CAACJ,UAAU,CAAC,CAAC;CAC/B"}
@@ -7,29 +7,13 @@ var _config = require("@expo/config");
7
7
  var _hermesBundler = require("@expo/dev-server/build/HermesBundler");
8
8
  var _importMetroFromProject = require("@expo/dev-server/build/metro/importMetroFromProject");
9
9
  var _chalk = _interopRequireDefault(require("chalk"));
10
- var _metroCore = require("metro-core");
11
- var _metroTerminalReporter = require("../start/server/metro/MetroTerminalReporter");
12
- var _withMetroMultiPlatform = require("../start/server/metro/withMetroMultiPlatform");
13
- var _platformBundlers = require("../start/server/platformBundlers");
14
- var _getMetroProperties = require("../utils/analytics/getMetroProperties");
15
- var _rudderstackClient = require("../utils/analytics/rudderstackClient");
10
+ var _getCssModulesFromBundler = require("../start/server/metro/getCssModulesFromBundler");
11
+ var _instantiateMetro = require("../start/server/metro/instantiateMetro");
16
12
  function _interopRequireDefault(obj) {
17
13
  return obj && obj.__esModule ? obj : {
18
14
  default: obj
19
15
  };
20
16
  }
21
- function getExpoMetroConfig(projectRoot, { logger }) {
22
- try {
23
- return (0, _importMetroFromProject).importExpoMetroConfigFromProject(projectRoot);
24
- } catch {
25
- // If expo isn't installed, use the unversioned config and warn about installing expo.
26
- }
27
- const unversionedVersion = require("@expo/metro-config/package.json").version;
28
- logger.info({
29
- tag: "expo"
30
- }, _chalk.default.gray(`\u203A Unversioned ${_chalk.default.bold`@expo/metro-config@${unversionedVersion}`} is being used. Bundling apps may not work as expected, and is subject to breaking changes. Install ${_chalk.default.bold`expo`} or set the app.json sdkVersion to use a stable version of @expo/metro-config.`));
31
- return require("@expo/metro-config");
32
- }
33
17
  let nextBuildID = 0;
34
18
  // Fork of @expo/dev-server bundleAsync to add Metro logging back.
35
19
  async function assertEngineMismatchAsync(projectRoot, exp, platform) {
@@ -46,24 +30,9 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
46
30
  ));
47
31
  const metro = (0, _importMetroFromProject).importMetroFromProject(projectRoot);
48
32
  const Server = (0, _importMetroFromProject).importMetroServerFromProject(projectRoot);
49
- const terminal = new _metroCore.Terminal(process.stdout);
50
- const terminalReporter = new _metroTerminalReporter.MetroTerminalReporter(projectRoot, terminal);
51
- const reporter = {
52
- update (event) {
53
- terminalReporter.update(event);
54
- }
55
- };
56
- const ExpoMetroConfig = getExpoMetroConfig(projectRoot, options);
57
- const { exp } = (0, _config).getConfig(projectRoot, {
58
- skipSDKVersionRequirement: true
59
- });
60
- let config = await ExpoMetroConfig.loadAsync(projectRoot, {
61
- reporter,
62
- ...options
33
+ const { config , reporter } = await (0, _instantiateMetro).loadMetroConfigAsync(projectRoot, options, {
34
+ exp: expoConfig
63
35
  });
64
- const bundlerPlatforms = (0, _platformBundlers).getPlatformBundlers(exp);
65
- config = await (0, _withMetroMultiPlatform).withMetroMultiPlatformAsync(projectRoot, config, bundlerPlatforms);
66
- (0, _rudderstackClient).logEventAsync("metro config", (0, _getMetroProperties).getMetroProperties(projectRoot, exp, config));
67
36
  const metroServer = await metro.runMetro(config, {
68
37
  watch: false
69
38
  });
@@ -83,7 +52,7 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
83
52
  createModuleIdFactory: config.serializer.createModuleIdFactory,
84
53
  onProgress: (transformedFileCount, totalFileCount)=>{
85
54
  if (!options.quiet) {
86
- terminalReporter.update({
55
+ reporter.update({
87
56
  buildID,
88
57
  type: "bundle_transform_progressed",
89
58
  transformedFileCount,
@@ -96,7 +65,7 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
96
65
  ...bundleOptions,
97
66
  buildID
98
67
  };
99
- terminalReporter.update({
68
+ reporter.update({
100
69
  buildID,
101
70
  type: "bundle_build_started",
102
71
  // @ts-expect-error: TODO
@@ -104,18 +73,22 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
104
73
  });
105
74
  try {
106
75
  const { code , map } = await metroServer.build(bundleOptions);
107
- const assets = await metroServer.getAssets(bundleOptions);
108
- terminalReporter.update({
76
+ const [assets, css] = await Promise.all([
77
+ metroServer.getAssets(bundleOptions),
78
+ (0, _getCssModulesFromBundler).getCssModulesFromBundler(config, metroServer.getBundler(), bundleOptions),
79
+ ]);
80
+ reporter.update({
109
81
  buildID,
110
82
  type: "bundle_build_done"
111
83
  });
112
84
  return {
113
85
  code,
114
86
  map,
115
- assets
87
+ assets: assets,
88
+ css
116
89
  };
117
90
  } catch (error) {
118
- terminalReporter.update({
91
+ reporter.update({
119
92
  buildID,
120
93
  type: "bundle_build_failed"
121
94
  });
@@ -131,7 +104,7 @@ async function bundleAsync(projectRoot, expoConfig, options, bundles) {
131
104
  android: "Android",
132
105
  web: "Web"
133
106
  }[platform] || platform);
134
- terminalReporter.terminal.log(`${platformTag} Building Hermes bytecode for the bundle`);
107
+ reporter.terminal.log(`${platformTag} Building Hermes bytecode for the bundle`);
135
108
  var _minify;
136
109
  const hermesBundleOutput = await (0, _hermesBundler).buildHermesBundleAsync(projectRoot, bundleOutput.code, bundleOutput.map, (_minify = bundle.minify) != null ? _minify : !bundle.dev);
137
110
  bundleOutput.hermesBytecodeBundle = hermesBundleOutput.hbc;
@@ -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';\nimport { getMetroProperties } from '../utils/analytics/getMetroProperties';\nimport { logEventAsync } from '../utils/analytics/rudderstackClient';\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 logEventAsync('metro config', getMetroProperties(projectRoot, exp, config));\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 isHermes = isEnableHermesManaged(expoConfig, 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: !isHermes && (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 ?? !bundle.dev\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","logEventAsync","getMetroProperties","metroServer","runMetro","watch","buildAsync","bundle","buildID","isHermes","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;;;;QAkFsBA,WAAW,GAAXA,WAAW;AAlFmC,IAAA,OAAc,WAAd,cAAc,CAAA;AAK3E,IAAA,cAAsC,WAAtC,sCAAsC,CAAA;AAKtC,IAAA,uBAAqD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CAAC,CAAC4B,MAAM,GAAKD,UAAU,CAACC,MAAM,CAAC;QAAA,CAAC,CAAC,AAAC;QAC3F,MAAMuC,aAAa,GAAmB,EAAE,AAAC;QACzC,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGvE,OAAO,CAACwE,MAAM,EAAE,EAAED,CAAC,CAAE;YACvC,sEAAsE;YACtE,qCAAqC;YACrCD,aAAa,CAACG,IAAI,CAAC,MAAMjB,yBAAyB,CAACxD,OAAO,CAACuE,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;QACR5B,WAAW,CAACgD,GAAG,EAAE,CAAC;KACnB;CACF"}
1
+ {"version":3,"sources":["../../../src/export/fork-bundleAsync.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform } from '@expo/config';\nimport {\n buildHermesBundleAsync,\n isEnableHermesManaged,\n maybeThrowFromInconsistentEngineAsync,\n} from '@expo/dev-server/build/HermesBundler';\nimport {\n importMetroFromProject,\n importMetroServerFromProject,\n} from '@expo/dev-server/build/metro/importMetroFromProject';\nimport type { LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport Metro from 'metro';\n\nimport { CSSAsset, getCssModulesFromBundler } from '../start/server/metro/getCssModulesFromBundler';\nimport { loadMetroConfigAsync } from '../start/server/metro/instantiateMetro';\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 css: CSSAsset[];\n assets: readonly BundleAssetWithFileHashes[];\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 { config, reporter } = await loadMetroConfigAsync(projectRoot, options, {\n exp: expoConfig,\n });\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 isHermes = isEnableHermesManaged(expoConfig, 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: !isHermes && (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 const bundleDetails = {\n ...bundleOptions,\n buildID,\n };\n reporter.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, css] = await Promise.all([\n metroServer.getAssets(bundleOptions),\n getCssModulesFromBundler(config, metroServer.getBundler(), bundleOptions),\n ]);\n\n reporter.update({\n buildID,\n type: 'bundle_build_done',\n });\n return { code, map, assets: assets as readonly BundleAssetWithFileHashes[], css };\n } catch (error) {\n reporter.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 reporter.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 ?? !bundle.dev\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","nextBuildID","assertEngineMismatchAsync","projectRoot","exp","platform","isHermesManaged","isEnableHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","maybeThrowFromInconsistentEngineAsync","expoConfig","options","bundles","Promise","all","map","metro","importMetroFromProject","Server","importMetroServerFromProject","config","reporter","loadMetroConfigAsync","metroServer","runMetro","watch","buildAsync","bundle","buildID","isHermes","bundleOptions","DEFAULT_BUNDLE_OPTIONS","bundleType","entryFile","entryPoint","dev","minify","inlineSourceMap","sourceMapUrl","createModuleIdFactory","serializer","onProgress","transformedFileCount","totalFileCount","quiet","update","type","bundleDetails","code","build","assets","css","getAssets","getCssModulesFromBundler","getBundler","error","maybeAddHermesBundleAsync","bundleOutput","platformTag","chalk","bold","ios","android","web","terminal","log","hermesBundleOutput","buildHermesBundleAsync","hermesBytecodeBundle","hbc","hermesSourcemap","sourcemap","intermediateOutputs","bundleOutputs","i","length","push","console","end"],"mappings":"AAAA;;;;QAyDsBA,WAAW,GAAXA,WAAW;AAzDwB,IAAA,OAAc,WAAd,cAAc,CAAA;AAKhE,IAAA,cAAsC,WAAtC,sCAAsC,CAAA;AAItC,IAAA,uBAAqD,WAArD,qDAAqD,CAAA;AAE1C,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG0B,IAAA,yBAAgD,WAAhD,gDAAgD,CAAA;AAC9D,IAAA,iBAAwC,WAAxC,wCAAwC,CAAA;;;;;;AAyB7E,IAAIC,WAAW,GAAG,CAAC,AAAC;AAEpB,kEAAkE;AAElE,eAAeC,yBAAyB,CAACC,WAAmB,EAAEC,GAAe,EAAEC,QAAkB,EAAE;IACjG,MAAMC,eAAe,GAAGC,CAAAA,GAAAA,cAAqB,AAAe,CAAA,sBAAf,CAACH,GAAG,EAAEC,QAAQ,CAAC,AAAC;IAE7D,MAAMG,KAAK,GAAGC,CAAAA,GAAAA,OAAkB,AAAa,CAAA,mBAAb,CAACN,WAAW,CAAC,AAAC;QACvBK,kBAAuB,EAAvBA,GAAiD;IAAxE,MAAME,cAAc,GAAGF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GAAG,MAAMC,CAAAA,GAAAA,cAAsB,AAKtD,CAAA,uBALsD,CACrDpE,WAAW,EACX0D,YAAY,CAACT,IAAI,EACjBS,YAAY,CAAC1C,GAAG,EAChBY,CAAAA,OAAa,GAAbA,MAAM,CAACS,MAAM,YAAbT,OAAa,GAAI,CAACA,MAAM,CAACQ,GAAG,CAC7B,AAAC;YACFsB,YAAY,CAACW,oBAAoB,GAAGF,kBAAkB,CAACG,GAAG,CAAC;YAC3DZ,YAAY,CAACa,eAAe,GAAGJ,kBAAkB,CAACK,SAAS,CAAC;SAC7D;QACD,OAAOd,YAAY,CAAC;KACrB,AAAC;IAEF,IAAI;QACF,MAAMe,mBAAmB,GAAG,MAAM3D,OAAO,CAACC,GAAG,CAACF,OAAO,CAACG,GAAG,CAAC,CAACY,MAAM,GAAKD,UAAU,CAACC,MAAM,CAAC;QAAA,CAAC,CAAC,AAAC;QAC3F,MAAM8C,aAAa,GAAmB,EAAE,AAAC;QACzC,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG9D,OAAO,CAAC+D,MAAM,EAAE,EAAED,CAAC,CAAE;YACvC,sEAAsE;YACtE,qCAAqC;YACrCD,aAAa,CAACG,IAAI,CAAC,MAAMpB,yBAAyB,CAAC5C,OAAO,CAAC8D,CAAC,CAAC,EAAEF,mBAAmB,CAACE,CAAC,CAAC,CAAC,CAAC,CAAC;SACzF;QACD,OAAOD,aAAa,CAAC;KACtB,CAAC,OAAOlB,KAAK,EAAE;QACd,gEAAgE;QAChEsB,OAAO,CAACZ,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,MAAMV,KAAK,CAAC;KACb,QAAS;QACRhC,WAAW,CAACuD,GAAG,EAAE,CAAC;KACnB;CACF"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.appendLinkToHtml = appendLinkToHtml;
6
+ exports.appendScriptsToHtml = appendScriptsToHtml;
7
+ function appendLinkToHtml(html, links) {
8
+ return html.replace("</head>", links.map((link)=>{
9
+ let linkTag = `<link rel="${link.rel}"`;
10
+ if (link.href) linkTag += ` href="${link.href}"`;
11
+ if (link.as) linkTag += ` as="${link.as}"`;
12
+ linkTag += ">";
13
+ return linkTag;
14
+ }).join("") + "</head>");
15
+ }
16
+ function appendScriptsToHtml(html, scripts) {
17
+ return html.replace("</body>", scripts.map((script)=>`<script src="${script}" defer></script>`
18
+ ).join("") + "</body>");
19
+ }
20
+
21
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/export/html.ts"],"sourcesContent":["// <link rel=\"preload\" href=\"/_expo/static/css/xxxxxx.css\" as=\"style\">\nexport function appendLinkToHtml(\n html: string,\n links: { rel: string; href: string; as?: string }[]\n) {\n return html.replace(\n '</head>',\n links\n .map((link) => {\n let linkTag = `<link rel=\"${link.rel}\"`;\n\n if (link.href) linkTag += ` href=\"${link.href}\"`;\n if (link.as) linkTag += ` as=\"${link.as}\"`;\n\n linkTag += '>';\n\n return linkTag;\n })\n .join('') + '</head>'\n );\n}\n\nexport function appendScriptsToHtml(html: string, scripts: string[]) {\n return html.replace(\n '</body>',\n scripts.map((script) => `<script src=\"${script}\" defer></script>`).join('') + '</body>'\n );\n}\n"],"names":["appendLinkToHtml","appendScriptsToHtml","html","links","replace","map","link","linkTag","rel","href","as","join","scripts","script"],"mappings":"AACA;;;;QAAgBA,gBAAgB,GAAhBA,gBAAgB;QAqBhBC,mBAAmB,GAAnBA,mBAAmB;AArB5B,SAASD,gBAAgB,CAC9BE,IAAY,EACZC,KAAmD,EACnD;IACA,OAAOD,IAAI,CAACE,OAAO,CACjB,SAAS,EACTD,KAAK,CACFE,GAAG,CAAC,CAACC,IAAI,GAAK;QACb,IAAIC,OAAO,GAAG,CAAC,WAAW,EAAED,IAAI,CAACE,GAAG,CAAC,CAAC,CAAC,AAAC;QAExC,IAAIF,IAAI,CAACG,IAAI,EAAEF,OAAO,IAAI,CAAC,OAAO,EAAED,IAAI,CAACG,IAAI,CAAC,CAAC,CAAC,CAAC;QACjD,IAAIH,IAAI,CAACI,EAAE,EAAEH,OAAO,IAAI,CAAC,KAAK,EAAED,IAAI,CAACI,EAAE,CAAC,CAAC,CAAC,CAAC;QAE3CH,OAAO,IAAI,GAAG,CAAC;QAEf,OAAOA,OAAO,CAAC;KAChB,CAAC,CACDI,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS,CACxB,CAAC;CACH;AAEM,SAASV,mBAAmB,CAACC,IAAY,EAAEU,OAAiB,EAAE;IACnE,OAAOV,IAAI,CAACE,OAAO,CACjB,SAAS,EACTQ,OAAO,CAACP,GAAG,CAAC,CAACQ,MAAM,GAAK,CAAC,aAAa,EAAEA,MAAM,CAAC,iBAAiB,CAAC;IAAA,CAAC,CAACF,IAAI,CAAC,EAAE,CAAC,GAAG,SAAS,CACxF,CAAC;CACH"}
@@ -41,7 +41,7 @@ function printBundleSizes(bundles) {
41
41
  for (const [platform, bundleOutput] of Object.entries(bundles)){
42
42
  if (bundleOutput.hermesBytecodeBundle) {
43
43
  files.push([
44
- _chalk.default.bold(`index.${platform}.js (Hermes)`),
44
+ _chalk.default.bold(`index.${platform}.hbc`),
45
45
  bundleOutput.hermesBytecodeBundle
46
46
  ]);
47
47
  } else if (bundleOutput.code) {
@@ -52,7 +52,7 @@ function printBundleSizes(bundles) {
52
52
  }
53
53
  if (bundleOutput.hermesSourcemap) {
54
54
  files.push([
55
- _chalk.default.dim(`index.${platform}.js.map (Hermes)`),
55
+ _chalk.default.dim(`index.${platform}.hbc.map`),
56
56
  bundleOutput.hermesSourcemap
57
57
  ]);
58
58
  } else if (bundleOutput.map) {
@@ -1 +1 @@
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,gBA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AAAA,UAAK,AAGV,CAAA,QAHU,CAAC;QAAC;YAAC,QAAQ;YAAE,MAAM;SAAC,CAACf,GAAG,CAAC,CAACgB,CAAC,GAAKrB,MAAK,QAAA,CAACsB,SAAS,CAACD,CAAC,CAAC;QAAA,CAAC;WAAKT,SAAS;KAAC,EAAE;QAC9EW,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"}
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}.hbc`), 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}.hbc.map`), 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,EAAd;AACW,IAAA,KAAe,WAAf,eAAe,CAAA;AACf,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGlC,SAASF,gBAAgB,CAACG,OAAgD,EAAE;IACjF,MAAMC,KAAK,GAAoC,EAAE,AAAC;IAElD,KAAK,MAAM,CAACC,QAAQ,EAAEC,YAAY,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,OAAO,CAAC,CAGzD;QACH,IAAIG,YAAY,CAACG,oBAAoB,EAAE;YACrCL,KAAK,CA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webSupportProjectPrerequisite = require("../../start/doctor/web/WebSupportP
10
10
  var _platformBundlers = require("../../start/server/platformBundlers");
11
11
  var _webpackBundlerDevServer = require("../../start/server/webpack/WebpackBundlerDevServer");
12
12
  var _errors = require("../../utils/errors");
13
+ var _nodeEnv = require("../../utils/nodeEnv");
13
14
  function _interopRequireDefault(obj) {
14
15
  return obj && obj.__esModule ? obj : {
15
16
  default: obj
@@ -18,6 +19,8 @@ function _interopRequireDefault(obj) {
18
19
  async function exportWebAsync(projectRoot, options) {
19
20
  // Ensure webpack is available
20
21
  await new _webSupportProjectPrerequisite.WebSupportProjectPrerequisite(projectRoot).assertAsync();
22
+ (0, _nodeEnv).setNodeEnv(options.dev ? "development" : "production");
23
+ require("@expo/env").load(projectRoot);
21
24
  const { exp } = (0, _config).getConfig(projectRoot);
22
25
  const platformBundlers = (0, _platformBundlers).getPlatformBundlers(exp);
23
26
  // Create a bundler interface
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/export/web/exportWebAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport { Log } from '../../log';\nimport { WebSupportProjectPrerequisite } from '../../start/doctor/web/WebSupportProjectPrerequisite';\nimport { getPlatformBundlers } from '../../start/server/platformBundlers';\nimport { WebpackBundlerDevServer } from '../../start/server/webpack/WebpackBundlerDevServer';\nimport { CommandError } from '../../utils/errors';\nimport { Options } from './resolveOptions';\n\nexport async function exportWebAsync(projectRoot: string, options: Options) {\n // Ensure webpack is available\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n\n const { exp } = getConfig(projectRoot);\n const platformBundlers = getPlatformBundlers(exp);\n // Create a bundler interface\n const bundler = new WebpackBundlerDevServer(projectRoot, platformBundlers, false);\n\n // If the user set `web.bundler: 'metro'` then they should use `expo export` instead.\n if (!bundler.isTargetingWeb()) {\n throw new CommandError(\n chalk`{bold expo export:web} can only be used with Webpack. Use {bold expo export} for other bundlers.`\n );\n }\n\n Log.log(`Exporting with Webpack...`);\n\n // Bundle the app\n await bundler.bundleAsync({\n mode: options.dev ? 'development' : 'production',\n clear: options.clear,\n });\n}\n"],"names":["exportWebAsync","projectRoot","options","WebSupportProjectPrerequisite","assertAsync","exp","getConfig","platformBundlers","getPlatformBundlers","bundler","WebpackBundlerDevServer","isTargetingWeb","CommandError","chalk","Log","log","bundleAsync","mode","dev","clear"],"mappings":"AAAA;;;;QAUsBA,cAAc,GAAdA,cAAc;AAVV,IAAA,OAAc,WAAd,cAAc,CAAA;AACtB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEL,IAAA,IAAW,WAAX,WAAW,CAAA;AACe,IAAA,8BAAsD,WAAtD,sDAAsD,CAAA;AAChE,IAAA,iBAAqC,WAArC,qCAAqC,CAAA;AACjC,IAAA,wBAAoD,WAApD,oDAAoD,CAAA;AAC/D,IAAA,OAAoB,WAApB,oBAAoB,CAAA;;;;;;AAG1C,eAAeA,cAAc,CAACC,WAAmB,EAAEC,OAAgB,EAAE;IAC1E,8BAA8B;IAC9B,MAAM,IAAIC,8BAA6B,8BAAA,CAACF,WAAW,CAAC,CAACG,WAAW,EAAE,CAAC;IAEnE,MAAM,EAAEC,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAACL,WAAW,CAAC,AAAC;IACvC,MAAMM,gBAAgB,GAAGC,CAAAA,GAAAA,iBAAmB,AAAK,CAAA,oBAAL,CAACH,GAAG,CAAC,AAAC;IAClD,6BAA6B;IAC7B,MAAMI,OAAO,GAAG,IAAIC,wBAAuB,wBAAA,CAACT,WAAW,EAAEM,gBAAgB,EAAE,KAAK,CAAC,AAAC;IAElF,qFAAqF;IACrF,IAAI,CAACE,OAAO,CAACE,cAAc,EAAE,EAAE;QAC7B,MAAM,IAAIC,OAAY,aAAA,CACpBC,MAAK,QAAA,CAAC,gGAAgG,CAAC,CACxG,CAAC;KACH;IAEDC,IAAG,IAAA,CAACC,GAAG,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAErC,iBAAiB;IACjB,MAAMN,OAAO,CAACO,WAAW,CAAC;QACxBC,IAAI,EAAEf,OAAO,CAACgB,GAAG,GAAG,aAAa,GAAG,YAAY;QAChDC,KAAK,EAAEjB,OAAO,CAACiB,KAAK;KACrB,CAAC,CAAC;CACJ"}
1
+ {"version":3,"sources":["../../../../src/export/web/exportWebAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport { Log } from '../../log';\nimport { WebSupportProjectPrerequisite } from '../../start/doctor/web/WebSupportProjectPrerequisite';\nimport { getPlatformBundlers } from '../../start/server/platformBundlers';\nimport { WebpackBundlerDevServer } from '../../start/server/webpack/WebpackBundlerDevServer';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { Options } from './resolveOptions';\n\nexport async function exportWebAsync(projectRoot: string, options: Options) {\n // Ensure webpack is available\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const { exp } = getConfig(projectRoot);\n const platformBundlers = getPlatformBundlers(exp);\n // Create a bundler interface\n const bundler = new WebpackBundlerDevServer(projectRoot, platformBundlers, false);\n\n // If the user set `web.bundler: 'metro'` then they should use `expo export` instead.\n if (!bundler.isTargetingWeb()) {\n throw new CommandError(\n chalk`{bold expo export:web} can only be used with Webpack. Use {bold expo export} for other bundlers.`\n );\n }\n\n Log.log(`Exporting with Webpack...`);\n\n // Bundle the app\n await bundler.bundleAsync({\n mode: options.dev ? 'development' : 'production',\n clear: options.clear,\n });\n}\n"],"names":["exportWebAsync","projectRoot","options","WebSupportProjectPrerequisite","assertAsync","setNodeEnv","dev","require","load","exp","getConfig","platformBundlers","getPlatformBundlers","bundler","WebpackBundlerDevServer","isTargetingWeb","CommandError","chalk","Log","log","bundleAsync","mode","clear"],"mappings":"AAAA;;;;QAWsBA,cAAc,GAAdA,cAAc;AAXV,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ACxBC,IAAI,EAAEnB,OAAO,CAACI,GAAG,GAAG,aAAa,GAAG,YAAY;QAChDgB,KAAK,EAAEpB,OAAO,CAACoB,KAAK;KACrB,CAAC,CAAC;CACJ"}
@@ -19,10 +19,11 @@ function _interopRequireDefault(obj) {
19
19
  const debug = require("debug")("expo:export:write");
20
20
  /**
21
21
  * @param props.platform native platform for the bundle
22
+ * @param props.format extension to use for the name
22
23
  * @param props.hash crypto hash for the bundle contents
23
24
  * @returns filename for the JS bundle.
24
- */ function createBundleFileName({ platform , hash }) {
25
- return `${platform}-${hash}.js`;
25
+ */ function createBundleFileName({ platform , format , hash }) {
26
+ return `${platform}-${hash}.${format === "javascript" ? "js" : "hbc"}`;
26
27
  }
27
28
  /**
28
29
  * @param bundle JS bundle as a string
@@ -39,6 +40,7 @@ async function writeBundlesAsync({ bundles , outputDir }) {
39
40
  const hash = createBundleHash(bundle);
40
41
  const fileName = createBundleFileName({
41
42
  platform,
43
+ format: bundleOutput.hermesBytecodeBundle ? "bytecode" : "javascript",
42
44
  hash
43
45
  });
44
46
  hashes[platform] = hash;
@@ -65,6 +67,7 @@ async function writeSourceMapsAsync({ bundles , hashes , fileNames , outputDir
65
67
  var ref1;
66
68
  const jsBundleFileName = (ref1 = fileNames == null ? void 0 : fileNames[platform]) != null ? ref1 : createBundleFileName({
67
69
  platform,
70
+ format: bundle.hermesBytecodeBundle ? "bytecode" : "javascript",
68
71
  hash
69
72
  });
70
73
  const jsPath = _path.default.join(outputDir, jsBundleFileName);
@@ -1 +1 @@
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 const metadataPath = path.join(outputDir, 'metadata.json');\n debug(`Writing metadata.json to ${metadataPath}`);\n await fs.writeFile(metadataPath, 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","metadataPath","JSON","stringify","assets","fromEntries","asset","values"],"mappings":"AAAA;;;;QA4BsBA,iBAAiB,GAAjBA,iBAAiB;QAkCjBC,oBAAoB,GAApBA,oBAAoB;QA8CpBC,sBAAsB,GAAtBA,sBAAsB;QAmBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAAmB,GAAnBA,mBAAmB;AA3ItB,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,EAAU;IAC5F,OAAO,CAAC,EAAED,QAAQ,CAAC,CAAC,EAAEC,IAAI,CAAC,GAAG,CAAC,CAAC;CACjC;AAED;;;GAGG,CACH,SAASC,gBAAgB,CAACC,MAA2B,EAAU;IAC7D,OAAOC,OAAM,QAAA,CAACC,UAAU,CAAC,KAAK,CAAC,CAACC,MAAM,CAACH,MAAM,CAAC,CAACI,MAAM,CAAC,KAAK,CAAC,CAAC;CAC9D;AAEM,eAAef,iBAAiB,CAAC,EACtCgB,OAAO,CAAA,EACPC,SAAS,CAAA,EAIV,EAAE;IACD,MAAMC,MAAM,GAAsC,EAAE,AAAC;IACrD,MAAMC,SAAS,GAAsC,EAAE,AAAC;IAExD,KAAK,MAAM,CAACX,QAAQ,EAAEY,YAAY,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,OAAO,CAAC,CAGzD;YACYI,qBAAiC;QAAhD,MAAMT,MAAM,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A,CAACC,IAAI,CAACZ,SAAS,EAAE,YAAY,CAAC,EAAE0B,QAAQ,CAAC,CAAC;IACjE,OAAOA,QAAQ,CAAC;CACjB"}
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.format extension to use for the name\n * @param props.hash crypto hash for the bundle contents\n * @returns filename for the JS bundle.\n */\nfunction createBundleFileName({\n platform,\n format,\n hash,\n}: {\n platform: string;\n format: 'javascript' | 'bytecode';\n hash: string;\n}): string {\n return `${platform}-${hash}.${format === 'javascript' ? 'js' : 'hbc'}`;\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({\n platform,\n format: bundleOutput.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\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 =\n fileNames?.[platform] ??\n createBundleFileName({\n platform,\n format: bundle.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\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 const metadataPath = path.join(outputDir, 'metadata.json');\n debug(`Writing metadata.json to ${metadataPath}`);\n await fs.writeFile(metadataPath, 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","format","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","metadataPath","JSON","stringify","assets","fromEntries","asset","values"],"mappings":"AAAA;;;;QAqCsBA,iBAAiB,GAAjBA,iBAAiB;QAsCjBC,oBAAoB,GAApBA,oBAAoB;QAoDpBC,sBAAsB,GAAtBA,sBAAsB;QAmBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAAmB,GAAnBA,mBAAmB;AA9JtB,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;;;;;GAKG,CACH,SAASC,oBAAoB,CAAC,EAC5BC,QAAQ,CAAA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