@expo/cli 0.7.3 → 0.9.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 (200) hide show
  1. package/README.md +1 -1
  2. package/build/bin/cli +17 -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 +8 -3
  23. package/build/src/export/createBundles.js.map +1 -1
  24. package/build/src/export/embed/exportEmbedAsync.js +23 -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 +58 -31
  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 -43
  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/index.js +5 -1
  43. package/build/src/export/index.js.map +1 -1
  44. package/build/src/export/printBundleSizes.js +2 -2
  45. package/build/src/export/printBundleSizes.js.map +1 -1
  46. package/build/src/export/resolveOptions.js +1 -0
  47. package/build/src/export/resolveOptions.js.map +1 -1
  48. package/build/src/export/web/exportWebAsync.js +3 -0
  49. package/build/src/export/web/exportWebAsync.js.map +1 -1
  50. package/build/src/export/writeContents.js +5 -2
  51. package/build/src/export/writeContents.js.map +1 -1
  52. package/build/src/graphql/generated.js +462 -0
  53. package/build/src/graphql/generated.js.map +1 -0
  54. package/build/src/install/checkPackages.js +6 -0
  55. package/build/src/install/checkPackages.js.map +1 -1
  56. package/build/src/install/installAsync.js +18 -1
  57. package/build/src/install/installAsync.js.map +1 -1
  58. package/build/src/prebuild/clearNativeFolder.js +6 -1
  59. package/build/src/prebuild/clearNativeFolder.js.map +1 -1
  60. package/build/src/prebuild/copyTemplateFiles.js +3 -33
  61. package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
  62. package/build/src/prebuild/ensureConfigAsync.js +1 -12
  63. package/build/src/prebuild/ensureConfigAsync.js.map +1 -1
  64. package/build/src/prebuild/prebuildAsync.js +7 -2
  65. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  66. package/build/src/prebuild/resolveOptions.js +7 -8
  67. package/build/src/prebuild/resolveOptions.js.map +1 -1
  68. package/build/src/prebuild/resolveTemplate.js +5 -0
  69. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  70. package/build/src/prebuild/updateFromTemplate.js +6 -8
  71. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  72. package/build/src/prebuild/updatePackageJson.js +33 -47
  73. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  74. package/build/src/prebuild/validateTemplatePlatforms.js +48 -0
  75. package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -0
  76. package/build/src/run/android/runAndroidAsync.js +4 -0
  77. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  78. package/build/src/run/ios/appleDevice/AppleDevice.js +25 -19
  79. package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
  80. package/build/src/run/ios/appleDevice/client/InstallationProxyClient.js.map +1 -1
  81. package/build/src/run/ios/options/resolveNativeScheme.js +13 -4
  82. package/build/src/run/ios/options/resolveNativeScheme.js.map +1 -1
  83. package/build/src/run/ios/runIosAsync.js +3 -0
  84. package/build/src/run/ios/runIosAsync.js.map +1 -1
  85. package/build/src/run/startBundler.js +4 -0
  86. package/build/src/run/startBundler.js.map +1 -1
  87. package/build/src/start/doctor/Prerequisite.js.map +1 -1
  88. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js +12 -6
  89. package/build/src/start/doctor/dependencies/ensureDependenciesAsync.js.map +1 -1
  90. package/build/src/start/doctor/dependencies/getVersionedPackages.js +13 -2
  91. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  92. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +12 -4
  93. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  94. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js +31 -5
  95. package/build/src/start/doctor/typescript/TypeScriptProjectPrerequisite.js.map +1 -1
  96. package/build/src/start/doctor/typescript/updateTSConfig.js +6 -0
  97. package/build/src/start/doctor/typescript/updateTSConfig.js.map +1 -1
  98. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js +1 -0
  99. package/build/src/start/doctor/web/WebSupportProjectPrerequisite.js.map +1 -1
  100. package/build/src/start/index.js +3 -1
  101. package/build/src/start/index.js.map +1 -1
  102. package/build/src/start/platforms/android/adb.js +1 -1
  103. package/build/src/start/platforms/android/adb.js.map +1 -1
  104. package/build/src/start/platforms/ios/AppleDeviceManager.js +1 -1
  105. package/build/src/start/platforms/ios/AppleDeviceManager.js.map +1 -1
  106. package/build/src/start/server/BundlerDevServer.js +16 -2
  107. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  108. package/build/src/start/server/DevServerManager.js +33 -2
  109. package/build/src/start/server/DevServerManager.js.map +1 -1
  110. package/build/src/start/server/getStaticRenderFunctions.js +167 -0
  111. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -0
  112. package/build/src/start/server/metro/MetroBundlerDevServer.js +262 -3
  113. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  114. package/build/src/start/server/metro/MetroTerminalReporter.js +2 -34
  115. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  116. package/build/src/start/server/metro/externals.js +72 -0
  117. package/build/src/start/server/metro/externals.js.map +1 -0
  118. package/build/src/start/server/metro/getCssModulesFromBundler.js +77 -0
  119. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -0
  120. package/build/src/start/server/metro/inspector-proxy/index.js +2 -2
  121. package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
  122. package/build/src/start/server/metro/inspector-proxy/proxy.js +1 -3
  123. package/build/src/start/server/metro/inspector-proxy/proxy.js.map +1 -1
  124. package/build/src/start/server/metro/instantiateMetro.js +47 -48
  125. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  126. package/build/src/start/server/metro/metroErrorInterface.js +137 -0
  127. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -0
  128. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js +51 -0
  129. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -0
  130. package/build/src/start/server/metro/resolveFromProject.js +26 -3
  131. package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
  132. package/build/src/start/server/metro/router.js +15 -2
  133. package/build/src/start/server/metro/router.js.map +1 -1
  134. package/build/src/start/server/metro/runServer-fork.js +107 -0
  135. package/build/src/start/server/metro/runServer-fork.js.map +1 -0
  136. package/build/src/start/server/metro/symbolicate.js +6 -0
  137. package/build/src/start/server/metro/symbolicate.js.map +1 -0
  138. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +70 -0
  139. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -0
  140. package/build/src/start/server/metro/withMetroMultiPlatform.js +188 -45
  141. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  142. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +8 -1
  143. package/build/src/start/server/middleware/ClassicManifestMiddleware.js.map +1 -1
  144. package/build/src/start/server/middleware/CreateFileMiddleware.js +6 -3
  145. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -1
  146. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +113 -47
  147. package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
  148. package/build/src/start/server/middleware/ManifestMiddleware.js +59 -20
  149. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  150. package/build/src/start/server/type-generation/expo-env.js +27 -0
  151. package/build/src/start/server/type-generation/expo-env.js.map +1 -0
  152. package/build/src/start/server/type-generation/index.js +57 -0
  153. package/build/src/start/server/type-generation/index.js.map +1 -0
  154. package/build/src/start/server/type-generation/routes.js +291 -0
  155. package/build/src/start/server/type-generation/routes.js.map +1 -0
  156. package/build/src/start/server/type-generation/tsconfig.js +89 -0
  157. package/build/src/start/server/type-generation/tsconfig.js.map +1 -0
  158. package/build/src/start/server/webTemplate.js +20 -4
  159. package/build/src/start/server/webTemplate.js.map +1 -1
  160. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +4 -6
  161. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  162. package/build/src/start/startAsync.js +30 -8
  163. package/build/src/start/startAsync.js.map +1 -1
  164. package/build/src/utils/FileNotifier.js +11 -4
  165. package/build/src/utils/FileNotifier.js.map +1 -1
  166. package/build/src/utils/analytics/getMetroProperties.js +1 -1
  167. package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
  168. package/build/src/utils/analytics/rudderstackClient.js +2 -2
  169. package/build/src/utils/codesigning.js +31 -7
  170. package/build/src/utils/codesigning.js.map +1 -1
  171. package/build/src/utils/dir.js +16 -6
  172. package/build/src/utils/dir.js.map +1 -1
  173. package/build/src/utils/env.js +6 -0
  174. package/build/src/utils/env.js.map +1 -1
  175. package/build/src/utils/mergeGitIgnorePaths.js +42 -0
  176. package/build/src/utils/mergeGitIgnorePaths.js.map +1 -1
  177. package/build/src/utils/nodeEnv.js +11 -0
  178. package/build/src/utils/nodeEnv.js.map +1 -0
  179. package/build/src/utils/resolveArgs.js +43 -0
  180. package/build/src/utils/resolveArgs.js.map +1 -1
  181. package/build/src/utils/strings.js +24 -0
  182. package/build/src/utils/strings.js.map +1 -0
  183. package/build/src/utils/template.js +21 -0
  184. package/build/src/utils/template.js.map +1 -0
  185. package/build/src/utils/tsconfig/evaluateTsConfig.js +61 -0
  186. package/build/src/utils/tsconfig/evaluateTsConfig.js.map +1 -0
  187. package/build/src/utils/tsconfig/loadTsConfigPaths.js +69 -0
  188. package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -0
  189. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js +88 -0
  190. package/build/src/utils/tsconfig/matchTsConfigPathAlias.js.map +1 -0
  191. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +41 -0
  192. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -0
  193. package/package.json +16 -10
  194. package/static/template/metro.config.js +4 -1
  195. package/build/src/api/getProject.js +0 -19
  196. package/build/src/api/getProject.js.map +0 -1
  197. package/build/src/api/graphql/generated.js +0 -113
  198. package/build/src/api/graphql/generated.js.map +0 -1
  199. package/build/src/prebuild/writeMetroConfig.js +0 -89
  200. package/build/src/prebuild/writeMetroConfig.js.map +0 -1
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.expoExportEmbed = void 0;
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var _args = require("../../utils/args");
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : {
12
+ default: obj
13
+ };
14
+ }
15
+ function _interopRequireWildcard(obj) {
16
+ if (obj && obj.__esModule) {
17
+ return obj;
18
+ } else {
19
+ var newObj = {};
20
+ if (obj != null) {
21
+ for(var key in obj){
22
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
23
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
24
+ if (desc.get || desc.set) {
25
+ Object.defineProperty(newObj, key, desc);
26
+ } else {
27
+ newObj[key] = obj[key];
28
+ }
29
+ }
30
+ }
31
+ }
32
+ newObj.default = obj;
33
+ return newObj;
34
+ }
35
+ }
36
+ const expoExportEmbed = async (argv)=>{
37
+ const rawArgsMap = {
38
+ // Types
39
+ "--entry-file": String,
40
+ "--platform": String,
41
+ "--transformer": String,
42
+ "--bundle-output": String,
43
+ "--bundle-encoding": String,
44
+ "--max-workers": Number,
45
+ "--sourcemap-output": String,
46
+ "--sourcemap-sources-root": String,
47
+ "--assets-dest": String,
48
+ "--asset-catalog-dest": String,
49
+ "--unstable-transform-profile": String,
50
+ "--config": String,
51
+ // This is here for compatibility with the `npx react-native bundle` command.
52
+ // devs should use `DEBUG=expo:*` instead.
53
+ "--verbose": Boolean,
54
+ "--help": Boolean,
55
+ // Aliases
56
+ "-h": "--help",
57
+ "-v": "--verbose"
58
+ };
59
+ const args = (0, _args).assertWithOptionsArgs(rawArgsMap, {
60
+ argv,
61
+ permissive: true
62
+ });
63
+ if (args["--help"]) {
64
+ (0, _args).printHelp(`(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`, _chalk.default`npx expo export:embed {dim <dir>}`, [
65
+ _chalk.default`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
66
+ `--entry-file <path> Path to the root JS file, either absolute or relative to JS root`,
67
+ `--platform <string> Either "ios" or "android" (default: "ios")`,
68
+ `--transformer <string> Specify a custom transformer to be used`,
69
+ `--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,
70
+ `--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,
71
+ `--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,
72
+ `--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: "utf8")`,
73
+ `--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,
74
+ `--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,
75
+ `--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,
76
+ `--sourcemap-use-absolute-path Report SourceMapURL using its full path`,
77
+ `--assets-dest <string> Directory name where to store assets referenced in the bundle`,
78
+ `--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,
79
+ `--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,
80
+ `--reset-cache Removes cached files`,
81
+ `-v, --verbose Enables debug logging`,
82
+ `--config <string> Path to the CLI configuration file`,
83
+ `--generate-static-view-configs Generate static view configs for Fabric components. If there are no Fabric components in the bundle or Fabric is disabled, this is just no-op.`,
84
+ // This is seemingly unused.
85
+ `--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,
86
+ `-h, --help Usage info`,
87
+ ].join("\n"));
88
+ }
89
+ const [{ exportEmbedAsync }, { resolveOptions }, { logCmdError }, { resolveCustomBooleanArgsAsync }, ] = await Promise.all([
90
+ Promise.resolve().then(function() {
91
+ return _interopRequireWildcard(require("./exportEmbedAsync"));
92
+ }),
93
+ Promise.resolve().then(function() {
94
+ return _interopRequireWildcard(require("./resolveOptions"));
95
+ }),
96
+ Promise.resolve().then(function() {
97
+ return _interopRequireWildcard(require("../../utils/errors"));
98
+ }),
99
+ Promise.resolve().then(function() {
100
+ return _interopRequireWildcard(require("../../utils/resolveArgs"));
101
+ }),
102
+ ]);
103
+ return (async ()=>{
104
+ const parsed = await resolveCustomBooleanArgsAsync(argv != null ? argv : [], rawArgsMap, {
105
+ "--dev": Boolean,
106
+ "--minify": Boolean,
107
+ "--sourcemap-use-absolute-path": Boolean,
108
+ "--reset-cache": Boolean,
109
+ "--read-global-cache": Boolean,
110
+ "--generate-static-view-configs": Boolean
111
+ });
112
+ return exportEmbedAsync(_path.default.resolve(parsed.projectRoot), resolveOptions(args, parsed));
113
+ })().catch(logCmdError);
114
+ };
115
+ exports.expoExportEmbed = expoExportEmbed;
116
+
117
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/export/embed/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport { Command } from '../../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../../utils/args';\n\nexport const expoExportEmbed: Command = async (argv) => {\n const rawArgsMap: arg.Spec = {\n // Types\n '--entry-file': String,\n '--platform': String,\n '--transformer': String,\n '--bundle-output': String,\n '--bundle-encoding': String,\n '--max-workers': Number,\n '--sourcemap-output': String,\n '--sourcemap-sources-root': String,\n '--assets-dest': String,\n '--asset-catalog-dest': String,\n '--unstable-transform-profile': String,\n '--config': String,\n\n // This is here for compatibility with the `npx react-native bundle` command.\n // devs should use `DEBUG=expo:*` instead.\n '--verbose': Boolean,\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n '-v': '--verbose',\n };\n const args = assertWithOptionsArgs(rawArgsMap, {\n argv,\n permissive: true,\n });\n\n if (args['--help']) {\n printHelp(\n `(Internal) Export the JavaScript bundle during a native build script for embedding in a native binary`,\n chalk`npx expo export:embed {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--entry-file <path> Path to the root JS file, either absolute or relative to JS root`,\n `--platform <string> Either \"ios\" or \"android\" (default: \"ios\")`,\n `--transformer <string> Specify a custom transformer to be used`,\n `--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)`,\n `--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.`,\n `--bundle-output <string> File name where to store the resulting bundle, ex. /tmp/groups.bundle`,\n `--bundle-encoding <string> Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: \"utf8\")`,\n `--max-workers <number> Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.`,\n `--sourcemap-output <string> File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map`,\n `--sourcemap-sources-root <string> Path to make sourcemap's sources entries relative to, ex. /root/dir`,\n `--sourcemap-use-absolute-path Report SourceMapURL using its full path`,\n `--assets-dest <string> Directory name where to store assets referenced in the bundle`,\n `--asset-catalog-dest <string> Directory to create an iOS Asset Catalog for images`,\n `--unstable-transform-profile <string> Experimental, transform JS for a specific JS engine. Currently supported: hermes, hermes-canary, default`,\n `--reset-cache Removes cached files`,\n `-v, --verbose Enables debug logging`,\n\n `--config <string> Path to the CLI configuration file`,\n `--generate-static-view-configs Generate static view configs for Fabric components. If there are no Fabric components in the bundle or Fabric is disabled, this is just no-op.`,\n // This is seemingly unused.\n `--read-global-cache Try to fetch transformed JS code from the global cache, if configured.`,\n\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const [\n { exportEmbedAsync },\n { resolveOptions },\n { logCmdError },\n { resolveCustomBooleanArgsAsync },\n ] = await Promise.all([\n import('./exportEmbedAsync'),\n import('./resolveOptions'),\n import('../../utils/errors'),\n import('../../utils/resolveArgs'),\n ]);\n\n return (async () => {\n const parsed = await resolveCustomBooleanArgsAsync(argv ?? [], rawArgsMap, {\n '--dev': Boolean,\n '--minify': Boolean,\n '--sourcemap-use-absolute-path': Boolean,\n '--reset-cache': Boolean,\n '--read-global-cache': Boolean,\n '--generate-static-view-configs': Boolean,\n });\n return exportEmbedAsync(path.resolve(parsed.projectRoot), resolveOptions(args, parsed));\n })().catch(logCmdError);\n};\n"],"names":["expoExportEmbed","argv","rawArgsMap","String","Number","Boolean","args","assertWithOptionsArgs","permissive","printHelp","chalk","join","exportEmbedAsync","resolveOptions","logCmdError","resolveCustomBooleanArgsAsync","Promise","all","parsed","path","resolve","projectRoot","catch"],"mappings":"AAAA;;;;;;AAEkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;AAG0B,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE5D,MAAMA,eAAe,GAAY,OAAOC,IAAI,GAAK;IACtD,MAAMC,UAAU,GAAa;QAC3B,QAAQ;QACR,cAAc,EAAEC,MAAM;QACtB,YAAY,EAAEA,MAAM;QACpB,eAAe,EAAEA,MAAM;QACvB,iBAAiB,EAAEA,MAAM;QACzB,mBAAmB,EAAEA,MAAM;QAC3B,eAAe,EAAEC,MAAM;QACvB,oBAAoB,EAAED,MAAM;QAC5B,0BAA0B,EAAEA,MAAM;QAClC,eAAe,EAAEA,MAAM;QACvB,sBAAsB,EAAEA,MAAM;QAC9B,8BAA8B,EAAEA,MAAM;QACtC,UAAU,EAAEA,MAAM;QAElB,6EAA6E;QAC7E,0CAA0C;QAC1C,WAAW,EAAEE,OAAO;QACpB,QAAQ,EAAEA,OAAO;QACjB,UAAU;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,WAAW;KAClB,AAAC;IACF,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAqB,AAGhC,CAAA,sBAHgC,CAACL,UAAU,EAA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AAG,MAAMH,6BAA6B,CAACd,IAAI,WAAJA,IAAI,GAAI,EAAE,EAAEC,UAAU,EAAE;YACzE,OAAO,EAAEG,OAAO;YAChB,UAAU,EAAEA,OAAO;YACnB,+BAA+B,EAAEA,OAAO;YACxC,eAAe,EAAEA,OAAO;YACxB,qBAAqB,EAAEA,OAAO;YAC9B,gCAAgC,EAAEA,OAAO;SAC1C,CAAC,AAAC;QACH,OAAOO,gBAAgB,CAACO,KAAI,QAAA,CAACC,OAAO,CAACF,MAAM,CAACG,WAAW,CAAC,EAAER,cAAc,CAACP,IAAI,EAAEY,MAAM,CAAC,CAAC,CAAC;KACzF,CAAC,EAAE,CAACI,KAAK,CAACR,WAAW,CAAC,CAAC;CACzB,AAAC;QArFWd,eAAe,GAAfA,eAAe"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.resolveOptions = resolveOptions;
6
+ var _path = _interopRequireDefault(require("path"));
7
+ var _env = require("../../utils/env");
8
+ var _errors = require("../../utils/errors");
9
+ function _interopRequireDefault(obj) {
10
+ return obj && obj.__esModule ? obj : {
11
+ default: obj
12
+ };
13
+ }
14
+ function assertIsBoolean(val) {
15
+ if (typeof val !== "boolean") {
16
+ throw new _errors.CommandError(`Expected boolean, got ${typeof val}`);
17
+ }
18
+ }
19
+ function resolveOptions(args, parsed) {
20
+ var ref;
21
+ const dev = (ref = parsed.args["--dev"]) != null ? ref : true;
22
+ assertIsBoolean(dev);
23
+ var ref1;
24
+ const generateStaticViewConfigs = (ref1 = parsed.args["--generate-static-view-configs"]) != null ? ref1 : true;
25
+ assertIsBoolean(generateStaticViewConfigs);
26
+ var ref2;
27
+ const minify = (ref2 = parsed.args["--minify"]) != null ? ref2 : true;
28
+ assertIsBoolean(minify);
29
+ const entryFile = args["--entry-file"];
30
+ if (!entryFile) {
31
+ throw new _errors.CommandError(`Missing required argument: --entry-file`);
32
+ }
33
+ const bundleOutput = args["--bundle-output"];
34
+ if (!bundleOutput) {
35
+ throw new _errors.CommandError(`Missing required argument: --bundle-output`);
36
+ }
37
+ var ref3, ref4, ref5, ref6;
38
+ return {
39
+ entryFile,
40
+ assetCatalogDest: args["--asset-catalog-dest"],
41
+ platform: (ref3 = args["--platform"]) != null ? ref3 : "ios",
42
+ transformer: args["--transformer"],
43
+ // TODO: Support `--dev false`
44
+ // dev: false,
45
+ bundleOutput,
46
+ bundleEncoding: (ref4 = args["--bundle-encoding"]) != null ? ref4 : "utf8",
47
+ maxWorkers: args["--max-workers"],
48
+ sourcemapOutput: args["--sourcemap-output"],
49
+ sourcemapSourcesRoot: args["--sourcemap-sources-root"],
50
+ sourcemapUseAbsolutePath: !!parsed.args["--sourcemap-use-absolute-path"],
51
+ assetsDest: args["--assets-dest"],
52
+ unstableTransformProfile: (ref5 = args["--unstable-transform-profile"]) != null ? ref5 : "default",
53
+ resetCache: !!parsed.args["--reset-cache"],
54
+ resetGlobalCache: false,
55
+ verbose: (ref6 = args["--verbose"]) != null ? ref6 : _env.env.EXPO_DEBUG,
56
+ config: args["--config"] ? _path.default.resolve(args["--config"]) : undefined,
57
+ dev,
58
+ generateStaticViewConfigs,
59
+ minify
60
+ };
61
+ }
62
+
63
+ //# sourceMappingURL=resolveOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/export/embed/resolveOptions.ts"],"sourcesContent":["import arg from 'arg';\nimport path from 'path';\n\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { resolveCustomBooleanArgsAsync } from '../../utils/resolveArgs';\n\nexport interface Options {\n assetsDest?: string;\n assetCatalogDest?: string;\n entryFile: string;\n resetCache: boolean;\n resetGlobalCache: boolean;\n transformer?: string;\n minify?: boolean;\n config?: string;\n platform: string;\n dev: boolean;\n bundleOutput: string;\n bundleEncoding?: string;\n maxWorkers?: number;\n sourcemapOutput?: string;\n sourcemapSourcesRoot?: string;\n sourcemapUseAbsolutePath: boolean;\n verbose: boolean;\n unstableTransformProfile: string;\n generateStaticViewConfigs: boolean;\n}\n\nfunction assertIsBoolean(val: any): asserts val is boolean {\n if (typeof val !== 'boolean') {\n throw new CommandError(`Expected boolean, got ${typeof val}`);\n }\n}\n\nexport function resolveOptions(\n args: arg.Result<arg.Spec>,\n parsed: Awaited<ReturnType<typeof resolveCustomBooleanArgsAsync>>\n): Options {\n const dev = parsed.args['--dev'] ?? true;\n assertIsBoolean(dev);\n\n const generateStaticViewConfigs = parsed.args['--generate-static-view-configs'] ?? true;\n assertIsBoolean(generateStaticViewConfigs);\n\n const minify = parsed.args['--minify'] ?? true;\n assertIsBoolean(minify);\n\n const entryFile = args['--entry-file'];\n if (!entryFile) {\n throw new CommandError(`Missing required argument: --entry-file`);\n }\n const bundleOutput = args['--bundle-output'];\n if (!bundleOutput) {\n throw new CommandError(`Missing required argument: --bundle-output`);\n }\n return {\n entryFile,\n assetCatalogDest: args['--asset-catalog-dest'],\n platform: args['--platform'] ?? 'ios',\n transformer: args['--transformer'],\n // TODO: Support `--dev false`\n // dev: false,\n bundleOutput,\n bundleEncoding: args['--bundle-encoding'] ?? 'utf8',\n maxWorkers: args['--max-workers'],\n sourcemapOutput: args['--sourcemap-output'],\n sourcemapSourcesRoot: args['--sourcemap-sources-root'],\n sourcemapUseAbsolutePath: !!parsed.args['--sourcemap-use-absolute-path'],\n assetsDest: args['--assets-dest'],\n unstableTransformProfile: args['--unstable-transform-profile'] ?? 'default',\n resetCache: !!parsed.args['--reset-cache'],\n resetGlobalCache: false,\n verbose: args['--verbose'] ?? env.EXPO_DEBUG,\n config: args['--config'] ? path.resolve(args['--config']) : undefined,\n dev,\n generateStaticViewConfigs,\n minify,\n };\n}\n"],"names":["resolveOptions","assertIsBoolean","val","CommandError","args","parsed","dev","generateStaticViewConfigs","minify","entryFile","bundleOutput","assetCatalogDest","platform","transformer","bundleEncoding","maxWorkers","sourcemapOutput","sourcemapSourcesRoot","sourcemapUseAbsolutePath","assetsDest","unstableTransformProfile","reset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BAAyB;QACzBC,MAAM;KACP,CAAC;CACH"}
@@ -10,8 +10,10 @@ var _resolveFromProject = require("../start/server/metro/resolveFromProject");
10
10
  var _webTemplate = require("../start/server/webTemplate");
11
11
  var _dir = require("../utils/dir");
12
12
  var _env = require("../utils/env");
13
+ var _nodeEnv = require("../utils/nodeEnv");
13
14
  var _createBundles = require("./createBundles");
14
15
  var _exportAssets = require("./exportAssets");
16
+ var _exportStaticAsync = require("./exportStaticAsync");
15
17
  var _getPublicExpoManifest = require("./getPublicExpoManifest");
16
18
  var _printBundleSizes = require("./printBundleSizes");
17
19
  var _writeContents = require("./writeContents");
@@ -41,70 +43,95 @@ function _interopRequireWildcard(obj) {
41
43
  return newObj;
42
44
  }
43
45
  }
44
- async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev , dumpAssetmap , dumpSourcemap }) {
46
+ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev , dumpAssetmap , dumpSourcemap , minify }) {
47
+ var ref;
48
+ (0, _nodeEnv).setNodeEnv(dev ? "development" : "production");
49
+ require("@expo/env").load(projectRoot);
45
50
  const exp = await (0, _getPublicExpoManifest).getPublicExpoManifestAsync(projectRoot);
51
+ const useWebSSG = ((ref = exp.web) == null ? void 0 : ref.output) === "static";
46
52
  const publicPath = _path.default.resolve(projectRoot, _env.env.EXPO_PUBLIC_FOLDER);
47
53
  const outputPath = _path.default.resolve(projectRoot, outputDir);
48
- const assetsPath = _path.default.join(outputPath, "assets");
49
- const bundlesPath = _path.default.join(outputPath, "bundles");
54
+ const staticFolder = outputPath;
55
+ const assetsPath = _path.default.join(staticFolder, "assets");
56
+ const bundlesPath = _path.default.join(staticFolder, "bundles");
50
57
  await Promise.all([
51
58
  assetsPath,
52
59
  bundlesPath
53
60
  ].map(_dir.ensureDirectoryAsync));
54
- await copyPublicFolderAsync(publicPath, outputDir);
61
+ await copyPublicFolderAsync(publicPath, staticFolder);
55
62
  // Run metro bundler and create the JS bundles/source maps.
56
63
  const bundles = await (0, _createBundles).createBundlesAsync(projectRoot, {
57
64
  resetCache: !!clear
58
65
  }, {
59
66
  platforms,
67
+ minify,
68
+ // TODO: Breaks asset exports
69
+ // platforms: useWebSSG ? platforms.filter((platform) => platform !== 'web') : platforms,
60
70
  dev
61
71
  });
62
- // Log bundle size info to the user
63
- (0, _printBundleSizes).printBundleSizes(Object.fromEntries(Object.entries(bundles).map(([key, value])=>{
64
- if (!dumpSourcemap) {
72
+ const bundleEntries = Object.entries(bundles);
73
+ if (bundleEntries.length) {
74
+ // Log bundle size info to the user
75
+ (0, _printBundleSizes).printBundleSizes(Object.fromEntries(bundleEntries.map(([key, value])=>{
76
+ if (!dumpSourcemap) {
77
+ return [
78
+ key,
79
+ {
80
+ ...value,
81
+ // Remove source maps from the bundles if they aren't going to be written.
82
+ map: undefined
83
+ },
84
+ ];
85
+ }
65
86
  return [
66
87
  key,
67
- {
68
- ...value,
69
- // Remove source maps from the bundles if they aren't going to be written.
70
- map: undefined
71
- },
88
+ value
72
89
  ];
73
- }
74
- return [
75
- key,
76
- value
77
- ];
78
- })));
90
+ })));
91
+ }
79
92
  // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).
80
93
  const { hashes , fileNames } = await (0, _writeContents).writeBundlesAsync({
81
94
  bundles,
82
95
  outputDir: bundlesPath
83
96
  });
84
97
  Log.log("Finished saving JS Bundles");
85
- if (fileNames.web) {
86
- // If web exists, then write the template HTML file.
87
- await _fs.default.promises.writeFile(_path.default.join(outputPath, "index.html"), await (0, _webTemplate).createTemplateHtmlFromExpoConfigAsync(projectRoot, {
88
- scripts: [
89
- `/bundles/${fileNames.web}`
90
- ]
91
- }));
98
+ if (platforms.includes("web")) {
99
+ if (useWebSSG) {
100
+ await (0, _exportStaticAsync).unstable_exportStaticAsync(projectRoot, {
101
+ outputDir: outputPath,
102
+ // TODO: Expose
103
+ minify
104
+ });
105
+ Log.log("Finished saving static files");
106
+ } else {
107
+ const cssLinks = await (0, _exportAssets).exportCssAssetsAsync({
108
+ outputDir,
109
+ bundles
110
+ });
111
+ // Generate SPA-styled HTML file.
112
+ // If web exists, then write the template HTML file.
113
+ await _fs.default.promises.writeFile(_path.default.join(staticFolder, "index.html"), await (0, _webTemplate).createTemplateHtmlFromExpoConfigAsync(projectRoot, {
114
+ scripts: [
115
+ `/bundles/${fileNames.web}`
116
+ ],
117
+ cssLinks
118
+ }));
119
+ }
92
120
  // Save assets like a typical bundler, preserving the file paths on web.
93
121
  const saveAssets = (0, _resolveFromProject).importCliSaveAssetsFromProject(projectRoot);
94
122
  await Promise.all(Object.entries(bundles).map(([platform, bundle])=>{
95
- return saveAssets(// @ts-expect-error: tolerable type mismatches: unused `readonly` (common in Metro) and `undefined` instead of `null`.
96
- bundle.assets, platform, outputPath, undefined);
123
+ return saveAssets(bundle.assets, platform, staticFolder, undefined);
97
124
  }));
98
125
  }
99
126
  const { assets } = await (0, _exportAssets).exportAssetsAsync(projectRoot, {
100
127
  exp,
101
- outputDir: outputPath,
128
+ outputDir: staticFolder,
102
129
  bundles
103
130
  });
104
131
  if (dumpAssetmap) {
105
132
  Log.log("Dumping asset map");
106
133
  await (0, _writeContents).writeAssetMapAsync({
107
- outputDir: outputPath,
134
+ outputDir: staticFolder,
108
135
  assets
109
136
  });
110
137
  }
@@ -121,13 +148,13 @@ async function exportAppAsync(projectRoot, { platforms , outputDir , clear , dev
121
148
  // If we output source maps, then add a debug HTML file which the user can open in
122
149
  // the web browser to inspect the output like web.
123
150
  await (0, _writeContents).writeDebugHtmlAsync({
124
- outputDir: outputPath,
151
+ outputDir: staticFolder,
125
152
  fileNames
126
153
  });
127
154
  }
128
155
  // Generate a `metadata.json` and the export is complete.
129
156
  await (0, _writeContents).writeMetadataJsonAsync({
130
- outputDir: outputPath,
157
+ outputDir: staticFolder,
131
158
  bundles,
132
159
  fileNames
133
160
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportApp.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { importCliSaveAssetsFromProject } from '../start/server/metro/resolveFromProject';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../start/server/webTemplate';\nimport { copyAsync, ensureDirectoryAsync } from '../utils/dir';\nimport { env } from '../utils/env';\nimport { createBundlesAsync } from './createBundles';\nimport { exportAssetsAsync } from './exportAssets';\nimport { getPublicExpoManifestAsync } from './getPublicExpoManifest';\nimport { printBundleSizes } from './printBundleSizes';\nimport { Options } from './resolveOptions';\nimport {\n writeAssetMapAsync,\n writeBundlesAsync,\n writeDebugHtmlAsync,\n writeMetadataJsonAsync,\n writeSourceMapsAsync,\n} from './writeContents';\n\n/**\n * The structure of the outputDir will be:\n *\n * ```\n * ├── assets\n * │ └── *\n * ├── bundles\n * │ ├── android-01ee6e3ab3e8c16a4d926c91808d5320.js\n * │ └── ios-ee8206cc754d3f7aa9123b7f909d94ea.js\n * └── metadata.json\n * ```\n */\nexport async function exportAppAsync(\n projectRoot: string,\n {\n platforms,\n outputDir,\n clear,\n dev,\n dumpAssetmap,\n dumpSourcemap,\n }: Pick<Options, 'dumpAssetmap' | 'dumpSourcemap' | 'dev' | 'clear' | 'outputDir' | 'platforms'>\n): Promise<void> {\n const exp = await getPublicExpoManifestAsync(projectRoot);\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n const outputPath = path.resolve(projectRoot, outputDir);\n const assetsPath = path.join(outputPath, 'assets');\n const bundlesPath = path.join(outputPath, 'bundles');\n\n await Promise.all([assetsPath, bundlesPath].map(ensureDirectoryAsync));\n\n await copyPublicFolderAsync(publicPath, outputDir);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundles = await createBundlesAsync(\n projectRoot,\n { resetCache: !!clear },\n {\n platforms,\n dev,\n // TODO: Disable source map generation if we aren't outputting them.\n }\n );\n\n // Log bundle size info to the user\n printBundleSizes(\n Object.fromEntries(\n Object.entries(bundles).map(([key, value]) => {\n if (!dumpSourcemap) {\n return [\n key,\n {\n ...value,\n // Remove source maps from the bundles if they aren't going to be written.\n map: undefined,\n },\n ];\n }\n\n return [key, value];\n })\n )\n );\n\n // Write the JS bundles to disk, and get the bundle file names (this could change with async chunk loading support).\n const { hashes, fileNames } = await writeBundlesAsync({ bundles, outputDir: bundlesPath });\n\n Log.log('Finished saving JS Bundles');\n\n if (fileNames.web) {\n // If web exists, then write the template HTML file.\n await fs.promises.writeFile(\n path.join(outputPath, 'index.html'),\n await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [`/bundles/${fileNames.web}`],\n })\n );\n\n // Save assets like a typical bundler, preserving the file paths on web.\n const saveAssets = importCliSaveAssetsFromProject(projectRoot);\n await Promise.all(\n Object.entries(bundles).map(([platform, bundle]) => {\n return saveAssets(\n // @ts-expect-error: tolerable type mismatches: unused `readonly` (common in Metro) and `undefined` instead of `null`.\n bundle.assets,\n platform,\n outputPath,\n undefined\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: outputPath, 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","printBundleSizes","Object","fromEntries","entries","key","value","undefined","hashes","fileNames","writeBundlesAsync","log","web","fs","promises","writeFile","createTemplateHtmlFromExpoConfigAsync","scripts","saveAssets","importCliSaveAssetsFromProject","platform","bundle","assets","exportAssetsAsync","writeAssetMapAsync","writeSourceMapsAsync","writeDebugHtmlAsync","writeMetadataJsonAsync","publicFolder","outputFolder","existsSync","copyAsync"],"mappings":"AAAA;;;;QAiCsBA,cAAc,GAAdA,cAAc;AAjCrB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACgC,IAAA,mBAA0C,WAA1C,0CAA0C,CAAA;AACnC,IAAA,YAA6B,WAA7B,6BAA6B,CAAA;AACnC,IAAA,IAAc,WAAd,cAAc,CAAA;AAC1C,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClB,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AACP,IAAA,sBAAyB,WAAzB,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,GAAG,MAAMC,CAAAA,GAAAA,sBAA0B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QAC7B,MAAMa,CAAAA,GAAAA,cAAkB,AAAmC,CAAA,mBAAnC,CAAC;YAAE/C,SAAS,EAAEY,UAAU;YAAEiC,MAAM;SAAE,CAAC,CAAC;KAC7D;IAED,oBAAoB;IACpB,IAAIzC,aAAa,EAAE;QACjBP,GAAG,CAACqC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAC/B,MAAMc,CAAAA,GAAAA,cAAoB,AAKxB,CAAA,qBALwB,CAAC;YACzB3B,OAAO;YACPU,MAAM;YACN/B,SAAS,EAAEe,WAAW;YACtBiB,SAAS;SACV,CAAC,CAAC;QAEHnC,GAAG,CAACqC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QAChD,kFAAkF;QAClF,kDAAkD;QAClD,MAAMe,CAAAA,GAAAA,cAAmB,AAGvB,CAAA,oBAHuB,CAAC;YACxBjD,SAAS,EAAEY,UAAU;YACrBoB,SAAS;SACV,CAAC,CAAC;KACJ;IAED,yDAAyD;IACzD,MAAMkB,CAAAA,GAAAA,cAAsB,AAA+C,CAAA,uBAA/C,CAAC;QAAElD,SAAS,EAAEY,UAAU;QAAES,OAAO;QAAEW,SAAS;KAAE,CAAC,CAAC;CAC7E;AAED;;;;;;;GAOG,CACH,eAAeZ,qBAAqB,CAAC+B,YAAoB,EAAEC,YAAoB,EAAE;IAC/E,IAAIhB,GAAE,QAAA,CAACiB,UAAU,CAACF,YAAY,CAAC,EAAE;QAC/B,MAAMG,CAAAA,GAAAA,IAAS,AAA4B,CAAA,UAA5B,CAACH,YAAY,EAAEC,YAAY,CAAC,CAAC;KAC7C;CACF"}
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 { setNodeEnv } from '../utils/nodeEnv';\nimport { createBundlesAsync } from './createBundles';\nimport { exportAssetsAsync, exportCssAssetsAsync } from './exportAssets';\nimport { unstable_exportStaticAsync } from './exportStaticAsync';\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 minify,\n }: Pick<\n Options,\n 'dumpAssetmap' | 'dumpSourcemap' | 'dev' | 'clear' | 'outputDir' | 'platforms' | 'minify'\n >\n): Promise<void> {\n setNodeEnv(dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const exp = await getPublicExpoManifestAsync(projectRoot);\n\n const useWebSSG = exp.web?.output === 'static';\n\n const publicPath = path.resolve(projectRoot, env.EXPO_PUBLIC_FOLDER);\n\n const outputPath = path.resolve(projectRoot, outputDir);\n const staticFolder = outputPath;\n const assetsPath = path.join(staticFolder, 'assets');\n const bundlesPath = path.join(staticFolder, 'bundles');\n\n await Promise.all([assetsPath, bundlesPath].map(ensureDirectoryAsync));\n\n await copyPublicFolderAsync(publicPath, staticFolder);\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 minify,\n // TODO: Breaks asset exports\n // platforms: useWebSSG ? platforms.filter((platform) => platform !== 'web') : platforms,\n dev,\n // TODO: Disable source map generation if we aren't outputting them.\n }\n );\n\n const bundleEntries = Object.entries(bundles);\n if (bundleEntries.length) {\n // Log bundle size info to the user\n printBundleSizes(\n Object.fromEntries(\n bundleEntries.map(([key, value]) => {\n if (!dumpSourcemap) {\n return [\n key,\n {\n ...value,\n // Remove source maps from the bundles if they aren't going to be written.\n map: undefined,\n },\n ];\n }\n\n return [key, value];\n })\n )\n );\n }\n\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 (platforms.includes('web')) {\n if (useWebSSG) {\n await unstable_exportStaticAsync(projectRoot, {\n outputDir: outputPath,\n // TODO: Expose\n minify,\n });\n Log.log('Finished saving static files');\n } else {\n const cssLinks = await exportCssAssetsAsync({\n outputDir,\n bundles,\n });\n // Generate SPA-styled HTML file.\n // If web exists, then write the template HTML file.\n await fs.promises.writeFile(\n path.join(staticFolder, 'index.html'),\n await createTemplateHtmlFromExpoConfigAsync(projectRoot, {\n scripts: [`/bundles/${fileNames.web}`],\n cssLinks,\n })\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(bundle.assets, platform, staticFolder, undefined);\n })\n );\n }\n\n const { assets } = await exportAssetsAsync(projectRoot, {\n exp,\n outputDir: staticFolder,\n bundles,\n });\n\n if (dumpAssetmap) {\n Log.log('Dumping asset map');\n await writeAssetMapAsync({ outputDir: staticFolder, 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: staticFolder,\n fileNames,\n });\n }\n\n // Generate a `metadata.json` and the export is complete.\n await writeMetadataJsonAsync({ outputDir: staticFolder, 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","minify","exp","setNodeEnv","require","load","getPublicExpoManifestAsync","useWebSSG","web","output","publicPath","path","resolve","env","EXPO_PUBLIC_FOLDER","outputPath","staticFolder","assetsPath","join","bundlesPath","Promise","all","map","ensureDirectoryAsync","copyPublicFolderAsync","bundles","createBundlesAsync","resetCache","bundleEntries","Object","entries","length","printBundleSizes","fromEntries","key","value","undefined","hashes","fileNames","writeBundlesAsync","log","includes","unstable_exportStaticAsync","cssLinks","exportCssAssetsAsync","fs","promises","writeFile","createTemplateHtmlFromExpoConfigAsync","scripts","saveAssets","importCliSaveAssetsFromProject","platform","bundle","assets","exportAssetsAsync","writeAssetMapAsync","writeSourceMapsAsync","writeDebugHtmlAsync","writeMetadataJsonAsync","publicFolder","outputFolder","existsSync","copyAsync"],"mappings":"AAAA;;;;QAmCsBA,cAAc,GAAdA,cAAc;AAnCrB,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;AACP,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACV,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACI,IAAA,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atternsAsync = resolveAssetBundlePatternsAsync;
6
6
  exports.exportAssetsAsync = exportAssetsAsync;
7
+ exports.exportCssAssetsAsync = exportCssAssetsAsync;
8
+ var _fs = _interopRequireDefault(require("fs"));
7
9
  var _minimatch = _interopRequireDefault(require("minimatch"));
8
10
  var _path = _interopRequireDefault(require("path"));
9
11
  var Log = _interopRequireWildcard(require("../log"));
@@ -101,5 +103,20 @@ async function exportAssetsAsync(projectRoot, { exp , outputDir , bundles }) {
101
103
  assets
102
104
  };
103
105
  }
106
+ async function exportCssAssetsAsync({ outputDir , bundles }) {
107
+ var ref;
108
+ const assets = (0, _array).uniqBy(Object.values(bundles).flatMap((bundle)=>bundle.css
109
+ ), (asset)=>asset.filename
110
+ );
111
+ const cssDirectory = (ref = assets[0]) == null ? void 0 : ref.filename;
112
+ if (!cssDirectory) return [];
113
+ await _fs.default.promises.mkdir(_path.default.join(outputDir, _path.default.dirname(cssDirectory)), {
114
+ recursive: true
115
+ });
116
+ await Promise.all(assets.map((v)=>_fs.default.promises.writeFile(_path.default.join(outputDir, v.filename), v.source)
117
+ ));
118
+ return assets.map((v)=>"/" + v.filename
119
+ );
120
+ }
104
121
 
105
122
  //# sourceMappingURL=exportAssets.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoAppManifest } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport minimatch from 'minimatch';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { resolveGoogleServicesFile } from '../start/server/middleware/resolveAssets';\nimport { uniqBy } from '../utils/array';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset, saveAssetsAsync } from './saveAssets';\n\nconst debug = require('debug')('expo:export:exportAssets') as typeof console.log;\n\n/**\n * Resolves the assetBundlePatterns from the manifest and returns a list of assets to bundle.\n *\n * @modifies {exp}\n */\nexport async function resolveAssetBundlePatternsAsync(\n projectRoot: string,\n exp: Pick<ExpoAppManifest, 'bundledAssets' | 'assetBundlePatterns'>,\n assets: Asset[]\n) {\n if (!exp.assetBundlePatterns?.length || !assets.length) {\n delete exp.assetBundlePatterns;\n return exp;\n }\n // Convert asset patterns to a list of asset strings that match them.\n // Assets strings are formatted as `asset_<hash>.<type>` and represent\n // the name that the file will have in the app bundle. The `asset_` prefix is\n // needed because android doesn't support assets that start with numbers.\n\n const fullPatterns: string[] = exp.assetBundlePatterns.map((p: string) =>\n path.join(projectRoot, p)\n );\n\n logPatterns(fullPatterns);\n\n const allBundledAssets = assets\n .map((asset) => {\n const shouldBundle = shouldBundleAsset(asset, fullPatterns);\n if (shouldBundle) {\n debug(`${shouldBundle ? 'Include' : 'Exclude'} asset ${asset.files?.[0]}`);\n return asset.fileHashes.map(\n (hash) => 'asset_' + hash + ('type' in asset && asset.type ? '.' + asset.type : '')\n );\n }\n return [];\n })\n .flat();\n\n // The assets returned by the RN packager has duplicates so make sure we\n // only bundle each once.\n exp.bundledAssets = [...new Set(allBundledAssets)];\n delete exp.assetBundlePatterns;\n\n return exp;\n}\n\nfunction logPatterns(patterns: string[]) {\n // Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.\n Log.log('\\nProcessing asset bundle patterns:');\n patterns.forEach((p) => Log.log('- ' + p));\n}\n\nfunction shouldBundleAsset(asset: Asset, patterns: string[]) {\n const file = asset.files?.[0];\n return !!(\n '__packager_asset' in asset &&\n asset.__packager_asset &&\n file &&\n patterns.some((pattern) => minimatch(file, pattern))\n );\n}\n\nexport async function exportAssetsAsync(\n projectRoot: string,\n {\n exp,\n outputDir,\n bundles,\n }: {\n exp: ExpoAppManifest;\n bundles: Partial<Record<ModPlatform, BundleOutput>>;\n outputDir: string;\n }\n) {\n const assets: Asset[] = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.assets),\n (asset) => asset.hash\n );\n\n if (assets[0]?.fileHashes) {\n Log.log('Saving assets');\n await saveAssetsAsync(projectRoot, { assets, outputDir });\n }\n\n // Add google services file if it exists\n await resolveGoogleServicesFile(projectRoot, exp);\n\n // Updates the manifest to reflect additional asset bundling + configs\n await resolveAssetBundlePatternsAsync(projectRoot, exp, assets);\n\n return { exp, assets };\n}\n"],"names":["resolveAssetBundlePatternsAsync","exportAssetsAsync","Log","debug","require","projectRoot","exp","assets","assetBundlePatterns","length","fullPatterns","map","p","path","join","logPatterns","allBundledAssets","asset","shouldBundle","shouldBundleAsset","files","fileHashes","hash","type","flat","bundledAssets","Set","patterns","log","forEach","file","__packager_asset","some","pattern","minimatch","outputDir","bundles","uniqBy","Object","values","flatMap","bundle","saveAssetsAsync","resolveGoogleServicesFile"],"mappings":"AAAA;;;;QAkBsBA,+BAA+B,GAA/BA,+BAA+B;QAyD/BC,iBAAiB,GAAjBA,iBAAiB;AAzEjB,IAAA,UAAW,kCAAX,WAAW,EAAA;AAChB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AAC2B,IAAA,cAA0C,WAA1C,0CAA0C,CAAA;AAC7D,IAAA,MAAgB,WAAhB,gBAAgB,CAAA;AAEA,IAAA,WAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,0BAA0B,CAAC,AAAsB,AAAC;AAO1E,eAAeJ,+BAA+B,CACnDK,WAAmB,EACnBC,GAAmE,EACnEC,MAAe,EACf;QACKD,IAAuB;IAA5B,IAAI,CAACA,CAAAA,CAAAA,IAAuB,GAAvBA,GAAG,CAACE,mBAAmB,SAAQ,GAA/BF,KAAAA,CAA+B,GAA/BA,IAAuB,CAAEG,MAAM,CAAA,IAAI,CAACF,MAAM,CAACE,MAAM,EAAE;QACtD,OAAOH,GAAG,CAACE,mBAAmB,CAAC;QAC/B,OAAOF,GAAG,CAAC;KACZ;IACD,qEAAqE;IACrE,sEAAsE;IACtE,6EAA6E;IAC7E,yEAAyE;IAEzE,MAAMI,YAAY,GAAaJ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C,WAAW,EAAEC,GAAG,CAAC,CAAC;IAElD,sEAAsE;IACtE,MAAMN,+BAA+B,CAACK,WAAW,EAAEC,GAAG,EAAEC,MAAM,CAAC,CAAC;IAEhE,OAAO;QAAED,GAAG;QAAEC,MAAM;KAAE,CAAC;CACxB"}
1
+ {"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoAppManifest } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport fs from 'fs';\nimport minimatch from 'minimatch';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { resolveGoogleServicesFile } from '../start/server/middleware/resolveAssets';\nimport { uniqBy } from '../utils/array';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset, saveAssetsAsync } from './saveAssets';\n\nconst debug = require('debug')('expo:export:exportAssets') as typeof console.log;\n\n/**\n * Resolves the assetBundlePatterns from the manifest and returns a list of assets to bundle.\n *\n * @modifies {exp}\n */\nexport async function resolveAssetBundlePatternsAsync(\n projectRoot: string,\n exp: Pick<ExpoAppManifest, 'bundledAssets' | 'assetBundlePatterns'>,\n assets: Asset[]\n) {\n if (!exp.assetBundlePatterns?.length || !assets.length) {\n delete exp.assetBundlePatterns;\n return exp;\n }\n // Convert asset patterns to a list of asset strings that match them.\n // Assets strings are formatted as `asset_<hash>.<type>` and represent\n // the name that the file will have in the app bundle. The `asset_` prefix is\n // needed because android doesn't support assets that start with numbers.\n\n const fullPatterns: string[] = exp.assetBundlePatterns.map((p: string) =>\n path.join(projectRoot, p)\n );\n\n logPatterns(fullPatterns);\n\n const allBundledAssets = assets\n .map((asset) => {\n const shouldBundle = shouldBundleAsset(asset, fullPatterns);\n if (shouldBundle) {\n debug(`${shouldBundle ? 'Include' : 'Exclude'} asset ${asset.files?.[0]}`);\n return asset.fileHashes.map(\n (hash) => 'asset_' + hash + ('type' in asset && asset.type ? '.' + asset.type : '')\n );\n }\n return [];\n })\n .flat();\n\n // The assets returned by the RN packager has duplicates so make sure we\n // only bundle each once.\n exp.bundledAssets = [...new Set(allBundledAssets)];\n delete exp.assetBundlePatterns;\n\n return exp;\n}\n\nfunction logPatterns(patterns: string[]) {\n // Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.\n Log.log('\\nProcessing asset bundle patterns:');\n patterns.forEach((p) => Log.log('- ' + p));\n}\n\nfunction shouldBundleAsset(asset: Asset, patterns: string[]) {\n const file = asset.files?.[0];\n return !!(\n '__packager_asset' in asset &&\n asset.__packager_asset &&\n file &&\n patterns.some((pattern) => minimatch(file, pattern))\n );\n}\n\nexport async function exportAssetsAsync(\n projectRoot: string,\n {\n exp,\n outputDir,\n bundles,\n }: {\n exp: ExpoAppManifest;\n bundles: Partial<Record<ModPlatform, BundleOutput>>;\n outputDir: string;\n }\n) {\n const assets: Asset[] = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.assets),\n (asset) => asset.hash\n );\n\n if (assets[0]?.fileHashes) {\n Log.log('Saving assets');\n await saveAssetsAsync(projectRoot, { assets, outputDir });\n }\n\n // Add google services file if it exists\n await resolveGoogleServicesFile(projectRoot, exp);\n\n // Updates the manifest to reflect additional asset bundling + configs\n await resolveAssetBundlePatternsAsync(projectRoot, exp, assets);\n\n return { exp, assets };\n}\n\nexport async function exportCssAssetsAsync({\n outputDir,\n bundles,\n}: {\n bundles: Partial<Record<ModPlatform, BundleOutput>>;\n outputDir: string;\n}) {\n const assets = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.css),\n (asset) => asset.filename\n );\n\n const cssDirectory = assets[0]?.filename;\n if (!cssDirectory) return [];\n\n await fs.promises.mkdir(path.join(outputDir, path.dirname(cssDirectory)), { recursive: true });\n\n await Promise.all(\n assets.map((v) => fs.promises.writeFile(path.join(outputDir, v.filename), v.source))\n );\n\n return assets.map((v) => '/' + v.filename);\n}\n"],"names":["resolveAssetBundlePatternsAsync","exportAssetsAsync","exportCssAssetsAsync","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","css","filename","cssDirectory","fs","promises","mkdir","dirname","recursive","Promise","all","v","writeFile","source"],"mappings":"AAAA;;;;QAmBsBA,+BAA+B,GAA/BA,+BAA+B;QAyD/BC,iBAAiB,GAAjBA,iBAAiB;QA+BjBC,oBAAoB,GAApBA,oBAAoB;AAzG3B,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACG,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;AAEA,IAAA,WAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,0BAA0B,CAAC,AAAsB,AAAC;AAO1E,eAAeL,+BAA+B,CACnDM,WAAmB,EACnBC,GAAmE,EACnEC,MAAe,EACf;QACKD,IAAuB;IAA5B,IAAI,CAACA,CAAAA,CAAAA,IAAuB,GAAvBA,GAAG,CAACE,mBAAmB,SAAQ,GAA/BF,KAAAA,CAA+B,GAA/BA,IAAuB,CAAEG,MAAM,CAAA,IAAI,CAACF,MAAM,CAACE,MAAM,EAAE;QACtD,OAAOH,GAAG,CAACE,mBAAmB,CAAC;QAC/B,OAAOF,GAAG,CAAC;KACZ;IACD,qEAAqE;IACrE,sEAAsE;IACtE,6EAA6E;IAC7E,yEAAyE;IAEzE,MAAMI,YAAY,GAAaJ,GAAG,CAACE,mBAAmB,CAACG,GAAG,CAAC,CAACC,CAAS,GACnEC,KAAI,QAAA,CAACC,IA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perty(exports, "__esModule", {
5
5
  exports.exportAsync = exportAsync;
6
6
  var _path = _interopRequireDefault(require("path"));
7
7
  var Log = _interopRequireWildcard(require("../log"));
8
+ var _fileNotifier = require("../utils/FileNotifier");
8
9
  var _dir = require("../utils/dir");
9
10
  var _exportApp = require("./exportApp");
10
11
  function _interopRequireDefault(obj) {
@@ -42,6 +43,8 @@ async function exportAsync(projectRoot, options) {
42
43
  await (0, _dir).ensureDirectoryAsync(outputPath);
43
44
  // Export the app
44
45
  await (0, _exportApp).exportAppAsync(projectRoot, options);
46
+ // Stop any file watchers to prevent the CLI from hanging.
47
+ _fileNotifier.FileNotifier.stopAll();
45
48
  // Final notes
46
49
  Log.log(`Export was successful. Your exported files can be found in ${options.outputDir}`);
47
50
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport * as Log from '../log';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Final notes\n Log.log(`Export was successful. Your exported files can be found in ${options.outputDir}`);\n}\n"],"names":["exportAsync","Log","projectRoot","options","outputPath","path","resolve","outputDir","removeAsync","ensureDirectoryAsync","exportAppAsync","log"],"mappings":"AAAA;;;;QAOsBA,WAAW,GAAXA,WAAW;AAPhB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACmC,IAAA,IAAc,WAAd,cAAc,CAAA;AACjC,IAAA,UAAa,WAAb,aAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrC,eAAeD,WAAW,CAACE,WAAmB,EAAEC,OAAgB,EAAE;IACvE,yCAAyC;IACzC,MAAMC,UAAU,GAAGC,KAAI,QAAA,CAACC,OAAO,CAACJ,WAAW,EAAEC,OAAO,CAACI,SAAS,CAAC,AAAC;IAChE,2CAA2C;IAC3C,MAAMC,CAAAA,GAAAA,IAAW,AAAY,CAAA,YAAZ,CAACJ,UAAU,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,MAAMK,CAAAA,GAAAA,IAAoB,AAAY,CAAA,qBAAZ,CAACL,UAAU,CAAC,CAAC;IAEvC,iBAAiB;IACjB,MAAMM,CAAAA,GAAAA,UAAc,AAAsB,CAAA,eAAtB,CAACR,WAAW,EAAEC,OAAO,CAAC,CAAC;IAE3C,cAAc;IACdF,GAAG,CAACU,GAAG,CAAC,CAAC,2DAA2D,EAAER,OAAO,CAACI,SAAS,CAAC,CAAC,CAAC,CAAC;CAC5F"}
1
+ {"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport * as Log from '../log';\nimport { FileNotifier } from '../utils/FileNotifier';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Stop any file watchers to prevent the CLI from hanging.\n FileNotifier.stopAll();\n\n // Final notes\n Log.log(`Export was successful. Your exported files can be found in ${options.outputDir}`);\n}\n"],"names":["exportAsync","Log","projectRoot","options","outputPath","path","resolve","outputDir","removeAsync","ensureDirectoryAsync","exportAppAsync","FileNotifier","stopAll","log"],"mappings":"AAAA;;;;QAQsBA,WAAW,GAAXA,WAAW;AARhB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACc,IAAA,aAAuB,WAAvB,uBAAuB,CAAA;AACF,IAAA,IAAc,WAAd,cAAc,CAAA;AACjC,IAAA,UAAa,WAAb,aAAa,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrC,eAAeD,WAAW,CAACE,WAAmB,EAAEC,OAAgB,EAAE;IACvE,yCAAyC;IACzC,MAAMC,UAAU,GAAGC,KAAI,QAAA,CAACC,OAAO,CAACJ,WAAW,EAAEC,OAAO,CAACI,SAAS,CAAC,AAAC;IAChE,2CAA2C;IAC3C,MAAMC,CAAAA,GAAAA,IAAW,AAAY,CAAA,YAAZ,CAACJ,UAAU,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,MAAMK,CAAAA,GAAAA,IAAoB,AAAY,CAAA,qBAAZ,CAACL,UAAU,CAAC,CAAC;IAEvC,iBAAiB;IACjB,MAAMM,CAAAA,GAAAA,UAAc,AAAsB,CAAA,eAAtB,CAACR,WAAW,EAAEC,OAAO,CAAC,CAAC;IAE3C,0DAA0D;IAC1DQ,aAAY,aAAA,CAACC,OAAO,EAAE,CAAC;IAEvB,cAAc;IACdX,GAAG,CAACY,GAAG,CAAC,CAAC,2DAA2D,EAAEV,OAAO,CAACI,SAAS,CAAC,CAAC,CAAC,CAAC;CAC5F"}