@vxrn/vite-plugin-metro 1.14.4 → 1.15.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 (189) hide show
  1. package/dist/cjs/babel-plugins/import-meta-env-plugin.cjs +55 -37
  2. package/dist/cjs/babel-plugins/import-meta-env-plugin.native.js +111 -94
  3. package/dist/cjs/babel-plugins/import-meta-env-plugin.native.js.map +1 -1
  4. package/dist/cjs/env/platformEnv.cjs +21 -14
  5. package/dist/cjs/env/platformEnv.native.js +30 -20
  6. package/dist/cjs/env/platformEnv.native.js.map +1 -1
  7. package/dist/cjs/index.cjs +16 -14
  8. package/dist/cjs/index.native.js +16 -14
  9. package/dist/cjs/index.native.js.map +1 -1
  10. package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.cjs +25 -19
  11. package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.js +39 -29
  12. package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.js.map +1 -1
  13. package/dist/cjs/metro-config/getMetroConfigFromViteConfig.cjs +103 -92
  14. package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js +111 -104
  15. package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
  16. package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.cjs +17 -13
  17. package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js +23 -19
  18. package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js.map +1 -1
  19. package/dist/cjs/metro-config/types.cjs +7 -5
  20. package/dist/cjs/metro-config/types.native.js +7 -5
  21. package/dist/cjs/metro-config/types.native.js.map +1 -1
  22. package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.cjs +37 -25
  23. package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.js +49 -33
  24. package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
  25. package/dist/cjs/plugins/metroPlugin.cjs +184 -126
  26. package/dist/cjs/plugins/metroPlugin.native.js +193 -140
  27. package/dist/cjs/plugins/metroPlugin.native.js.map +1 -1
  28. package/dist/cjs/rn-commands/bundle/assetCatalogIOS.cjs +34 -30
  29. package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.js +56 -44
  30. package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.js.map +1 -1
  31. package/dist/cjs/rn-commands/bundle/assetPathUtils.cjs +26 -15
  32. package/dist/cjs/rn-commands/bundle/assetPathUtils.native.js +22 -13
  33. package/dist/cjs/rn-commands/bundle/assetPathUtils.native.js.map +1 -1
  34. package/dist/cjs/rn-commands/bundle/buildBundle.cjs +36 -26
  35. package/dist/cjs/rn-commands/bundle/buildBundle.native.js +42 -32
  36. package/dist/cjs/rn-commands/bundle/buildBundle.native.js.map +1 -1
  37. package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.cjs +52 -41
  38. package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.js +57 -46
  39. package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.js.map +1 -1
  40. package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.cjs +23 -15
  41. package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.js +30 -19
  42. package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.js.map +1 -1
  43. package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.cjs +28 -26
  44. package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.js +28 -26
  45. package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.js.map +1 -1
  46. package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.cjs +26 -24
  47. package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.js +26 -24
  48. package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.js.map +1 -1
  49. package/dist/cjs/rn-commands/bundle/getBuildBundleFn.cjs +22 -16
  50. package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.js +16 -14
  51. package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.js.map +1 -1
  52. package/dist/cjs/rn-commands/bundle/index.cjs +14 -12
  53. package/dist/cjs/rn-commands/bundle/index.native.js +14 -12
  54. package/dist/cjs/rn-commands/bundle/index.native.js.map +1 -1
  55. package/dist/cjs/rn-commands/bundle/saveAssets.cjs +69 -51
  56. package/dist/cjs/rn-commands/bundle/saveAssets.native.js +75 -55
  57. package/dist/cjs/rn-commands/bundle/saveAssets.native.js.map +1 -1
  58. package/dist/cjs/rn-commands/bundle/types.cjs +7 -5
  59. package/dist/cjs/rn-commands/bundle/types.native.js +7 -5
  60. package/dist/cjs/rn-commands/bundle/types.native.js.map +1 -1
  61. package/dist/cjs/rn-commands/index.cjs +24 -22
  62. package/dist/cjs/rn-commands/index.native.js +24 -22
  63. package/dist/cjs/rn-commands/index.native.js.map +1 -1
  64. package/dist/cjs/transformer/babel-core.cjs +12 -10
  65. package/dist/cjs/transformer/babel-core.native.js +12 -10
  66. package/dist/cjs/transformer/babel-core.native.js.map +1 -1
  67. package/dist/cjs/transformer/babel-transformer.cjs +106 -89
  68. package/dist/cjs/transformer/babel-transformer.native.js +106 -96
  69. package/dist/cjs/transformer/babel-transformer.native.js.map +1 -1
  70. package/dist/cjs/transformer/loadBabelConfig.cjs +43 -32
  71. package/dist/cjs/transformer/loadBabelConfig.native.js +51 -41
  72. package/dist/cjs/transformer/loadBabelConfig.native.js.map +1 -1
  73. package/dist/cjs/transformer/transformSync.cjs +33 -25
  74. package/dist/cjs/transformer/transformSync.native.js +38 -30
  75. package/dist/cjs/transformer/transformSync.native.js.map +1 -1
  76. package/dist/cjs/transformer/types.cjs +7 -5
  77. package/dist/cjs/transformer/types.native.js +7 -5
  78. package/dist/cjs/transformer/types.native.js.map +1 -1
  79. package/dist/cjs/utils/exit.cjs +95 -53
  80. package/dist/cjs/utils/exit.native.js +138 -81
  81. package/dist/cjs/utils/exit.native.js.map +1 -1
  82. package/dist/cjs/utils/getTerminalReporter.cjs +33 -28
  83. package/dist/cjs/utils/getTerminalReporter.native.js +40 -33
  84. package/dist/cjs/utils/getTerminalReporter.native.js.map +1 -1
  85. package/dist/cjs/utils/metroCacheManager.cjs +82 -46
  86. package/dist/cjs/utils/metroCacheManager.native.js +96 -57
  87. package/dist/cjs/utils/metroCacheManager.native.js.map +1 -1
  88. package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.cjs +21 -17
  89. package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js +12 -10
  90. package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js.map +1 -1
  91. package/dist/cjs/utils/projectImport.cjs +40 -30
  92. package/dist/cjs/utils/projectImport.native.js +49 -37
  93. package/dist/cjs/utils/projectImport.native.js.map +1 -1
  94. package/dist/esm/babel-plugins/import-meta-env-plugin.mjs +28 -12
  95. package/dist/esm/babel-plugins/import-meta-env-plugin.mjs.map +1 -1
  96. package/dist/esm/babel-plugins/import-meta-env-plugin.native.js +83 -68
  97. package/dist/esm/babel-plugins/import-meta-env-plugin.native.js.map +1 -1
  98. package/dist/esm/env/platformEnv.mjs +9 -4
  99. package/dist/esm/env/platformEnv.mjs.map +1 -1
  100. package/dist/esm/env/platformEnv.native.js +18 -10
  101. package/dist/esm/env/platformEnv.native.js.map +1 -1
  102. package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.mjs +13 -9
  103. package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.mjs.map +1 -1
  104. package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.native.js +27 -19
  105. package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.native.js.map +1 -1
  106. package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs +75 -66
  107. package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs.map +1 -1
  108. package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js +83 -78
  109. package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
  110. package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.mjs +5 -3
  111. package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.mjs.map +1 -1
  112. package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js +11 -9
  113. package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js.map +1 -1
  114. package/dist/esm/plugins/expoManifestRequestHandlerPlugin.mjs +22 -12
  115. package/dist/esm/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
  116. package/dist/esm/plugins/expoManifestRequestHandlerPlugin.native.js +34 -20
  117. package/dist/esm/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
  118. package/dist/esm/plugins/metroPlugin.mjs +152 -96
  119. package/dist/esm/plugins/metroPlugin.mjs.map +1 -1
  120. package/dist/esm/plugins/metroPlugin.native.js +158 -107
  121. package/dist/esm/plugins/metroPlugin.native.js.map +1 -1
  122. package/dist/esm/rn-commands/bundle/assetCatalogIOS.mjs +7 -5
  123. package/dist/esm/rn-commands/bundle/assetCatalogIOS.mjs.map +1 -1
  124. package/dist/esm/rn-commands/bundle/assetCatalogIOS.native.js +29 -19
  125. package/dist/esm/rn-commands/bundle/assetCatalogIOS.native.js.map +1 -1
  126. package/dist/esm/rn-commands/bundle/assetPathUtils.mjs +14 -5
  127. package/dist/esm/rn-commands/bundle/assetPathUtils.mjs.map +1 -1
  128. package/dist/esm/rn-commands/bundle/assetPathUtils.native.js +10 -3
  129. package/dist/esm/rn-commands/bundle/assetPathUtils.native.js.map +1 -1
  130. package/dist/esm/rn-commands/bundle/buildBundle.mjs +19 -11
  131. package/dist/esm/rn-commands/bundle/buildBundle.mjs.map +1 -1
  132. package/dist/esm/rn-commands/bundle/buildBundle.native.js +25 -17
  133. package/dist/esm/rn-commands/bundle/buildBundle.native.js.map +1 -1
  134. package/dist/esm/rn-commands/bundle/buildBundleWithConfig.mjs +23 -14
  135. package/dist/esm/rn-commands/bundle/buildBundleWithConfig.mjs.map +1 -1
  136. package/dist/esm/rn-commands/bundle/buildBundleWithConfig.native.js +27 -18
  137. package/dist/esm/rn-commands/bundle/buildBundleWithConfig.native.js.map +1 -1
  138. package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.mjs +11 -5
  139. package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.mjs.map +1 -1
  140. package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.native.js +18 -9
  141. package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.native.js.map +1 -1
  142. package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.mjs +2 -2
  143. package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.mjs.map +1 -1
  144. package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.native.js +2 -2
  145. package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.native.js.map +1 -1
  146. package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.mjs +2 -2
  147. package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.mjs.map +1 -1
  148. package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.native.js +2 -2
  149. package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.native.js.map +1 -1
  150. package/dist/esm/rn-commands/bundle/getBuildBundleFn.mjs +8 -4
  151. package/dist/esm/rn-commands/bundle/getBuildBundleFn.mjs.map +1 -1
  152. package/dist/esm/rn-commands/bundle/getBuildBundleFn.native.js +2 -2
  153. package/dist/esm/rn-commands/bundle/getBuildBundleFn.native.js.map +1 -1
  154. package/dist/esm/rn-commands/bundle/saveAssets.mjs +39 -23
  155. package/dist/esm/rn-commands/bundle/saveAssets.mjs.map +1 -1
  156. package/dist/esm/rn-commands/bundle/saveAssets.native.js +45 -27
  157. package/dist/esm/rn-commands/bundle/saveAssets.native.js.map +1 -1
  158. package/dist/esm/transformer/babel-transformer.mjs +84 -69
  159. package/dist/esm/transformer/babel-transformer.mjs.map +1 -1
  160. package/dist/esm/transformer/babel-transformer.native.js +94 -86
  161. package/dist/esm/transformer/babel-transformer.native.js.map +1 -1
  162. package/dist/esm/transformer/loadBabelConfig.mjs +17 -8
  163. package/dist/esm/transformer/loadBabelConfig.mjs.map +1 -1
  164. package/dist/esm/transformer/loadBabelConfig.native.js +19 -11
  165. package/dist/esm/transformer/loadBabelConfig.native.js.map +1 -1
  166. package/dist/esm/transformer/transformSync.mjs +9 -3
  167. package/dist/esm/transformer/transformSync.mjs.map +1 -1
  168. package/dist/esm/transformer/transformSync.native.js +14 -8
  169. package/dist/esm/transformer/transformSync.native.js.map +1 -1
  170. package/dist/esm/utils/exit.mjs +68 -28
  171. package/dist/esm/utils/exit.mjs.map +1 -1
  172. package/dist/esm/utils/exit.native.js +111 -56
  173. package/dist/esm/utils/exit.native.js.map +1 -1
  174. package/dist/esm/utils/getTerminalReporter.mjs +7 -4
  175. package/dist/esm/utils/getTerminalReporter.mjs.map +1 -1
  176. package/dist/esm/utils/getTerminalReporter.native.js +14 -9
  177. package/dist/esm/utils/getTerminalReporter.native.js.map +1 -1
  178. package/dist/esm/utils/metroCacheManager.mjs +67 -33
  179. package/dist/esm/utils/metroCacheManager.mjs.map +1 -1
  180. package/dist/esm/utils/metroCacheManager.native.js +80 -43
  181. package/dist/esm/utils/metroCacheManager.native.js.map +1 -1
  182. package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.mjs +9 -7
  183. package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.mjs.map +1 -1
  184. package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js.map +1 -1
  185. package/dist/esm/utils/projectImport.mjs +14 -6
  186. package/dist/esm/utils/projectImport.mjs.map +1 -1
  187. package/dist/esm/utils/projectImport.native.js +23 -13
  188. package/dist/esm/utils/projectImport.native.js.map +1 -1
  189. package/package.json +3 -3
@@ -4,33 +4,35 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var assetCatalogIOS_exports = {};
35
37
  __export(assetCatalogIOS_exports, {
36
38
  cleanAssetCatalog: () => cleanAssetCatalog,
@@ -39,31 +41,36 @@ __export(assetCatalogIOS_exports, {
39
41
  writeImageSet: () => writeImageSet
40
42
  });
41
43
  module.exports = __toCommonJS(assetCatalogIOS_exports);
42
- var import_assetPathUtils = __toESM(require("./assetPathUtils.native.js"), 1),
43
- import_fs = __toESM(require("fs"), 1),
44
- import_path = __toESM(require("path"), 1);
44
+ var import_assetPathUtils = __toESM(require("./assetPathUtils.native.js"), 1);
45
+ var import_fs = __toESM(require("fs"), 1);
46
+ var import_path = __toESM(require("path"), 1);
45
47
  function cleanAssetCatalog(catalogDir) {
46
48
  var files = import_fs.default.readdirSync(catalogDir).filter(function (file2) {
47
- return file2.endsWith(".imageset");
48
- }),
49
- _iteratorNormalCompletion = !0,
50
- _didIteratorError = !1,
49
+ return file2.endsWith(".imageset");
50
+ });
51
+ var _iteratorNormalCompletion = true,
52
+ _didIteratorError = false,
51
53
  _iteratorError = void 0;
52
54
  try {
53
- for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
55
+ for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
54
56
  var file = _step.value;
55
57
  import_fs.default.rmSync(import_path.default.join(catalogDir, file), {
56
- recursive: !0,
57
- force: !0
58
+ recursive: true,
59
+ force: true
58
60
  });
59
61
  }
60
62
  } catch (err) {
61
- _didIteratorError = !0, _iteratorError = err;
63
+ _didIteratorError = true;
64
+ _iteratorError = err;
62
65
  } finally {
63
66
  try {
64
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
67
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
68
+ _iterator.return();
69
+ }
65
70
  } finally {
66
- if (_didIteratorError) throw _iteratorError;
71
+ if (_didIteratorError) {
72
+ throw _iteratorError;
73
+ }
67
74
  }
68
75
  }
69
76
  }
@@ -86,24 +93,29 @@ function isCatalogAsset(asset) {
86
93
  }
87
94
  function writeImageSet(imageSet) {
88
95
  import_fs.default.mkdirSync(imageSet.basePath, {
89
- recursive: !0
96
+ recursive: true
90
97
  });
91
- var _iteratorNormalCompletion = !0,
92
- _didIteratorError = !1,
98
+ var _iteratorNormalCompletion = true,
99
+ _didIteratorError = false,
93
100
  _iteratorError = void 0;
94
101
  try {
95
- for (var _iterator = imageSet.files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
96
- var file = _step.value,
97
- dest = import_path.default.join(imageSet.basePath, file.name);
102
+ for (var _iterator = imageSet.files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
103
+ var file = _step.value;
104
+ var dest = import_path.default.join(imageSet.basePath, file.name);
98
105
  import_fs.default.copyFileSync(file.src, dest);
99
106
  }
100
107
  } catch (err) {
101
- _didIteratorError = !0, _iteratorError = err;
108
+ _didIteratorError = true;
109
+ _iteratorError = err;
102
110
  } finally {
103
111
  try {
104
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
112
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
113
+ _iterator.return();
114
+ }
105
115
  } finally {
106
- if (_didIteratorError) throw _iteratorError;
116
+ if (_didIteratorError) {
117
+ throw _iteratorError;
118
+ }
107
119
  }
108
120
  }
109
121
  import_fs.default.writeFileSync(import_path.default.join(imageSet.basePath, "Contents.json"), JSON.stringify({
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","assetCatalogIOS_exports","__export","cleanAssetCatalog","getImageSet","isCatalogAsset","writeImageSet","module","exports","import_assetPathUtils","__toESM","require","import_fs","import_path","catalogDir","files","default","readdirSync","filter","file2","endsWith","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","file","rmSync","join","recursive","force","err","return","asset","scales","fileName","getResourceIdentifier","basePath","map","scale","idx","suffix","name","type","src","imageSet","mkdirSync"],"sources":["../../../../src/rn-commands/bundle/assetCatalogIOS.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,WAAA,EAAAA,CAAA,KAAAA,WAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA,cAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA;AAAA;AASAC,MAAA,CAAAC,OAAA,GAAAZ,YAA2B,CAAAK,uBAAA;AAIpB,IAAAQ,qBAAS,GAAkBC,OAAA,CAAAC,OAA0B;EAAAC,SAAA,GAAAF,OAAA,CAAAC,OAAA;EAAAE,WAAA,GAAAH,OAAA,CAAAC,OAAA;AAC1D,SAAMR,iBAAQA,CAAAW,UAAA,EAAG;EACjB,IAAAC,KAAA,GAAWH,SAAQ,CAAAI,OAAA,CAAAC,WAAA,CAAAH,UAAA,EAAAI,MAAA,WAAAC,KAAA;MACjB,OAAAA,KAAA,CAAAC,QAAA,YAAU;IAEd;IAAAC,yBAAA;IAAAC,iBAAA;IAAAC,cAAA;EAOO;IAKL,KAAM,IAAAC,SAAW,GAAAT,KAAA,CAAAU,MAAA,CAAAC,QAAA,GAAe,EAAAC,KAAA,IAAAN,yBAA2B,IAAAM,KAAA,GAAAH,SAAA,CAAAI,IAAA,IAAAC,IAAA,GAAAR,yBAAA;MAC3D,IAAOS,IAAA,GAAAH,KAAA,CAAA3B,KAAA;MACLY,SAAU,CAAAI,OAAA,CAAAe,MAAA,CAAAlB,WAAK,CAAAG,OAAK,CAAAgB,IAAA,CAAYlB,UAAG,EAAQgB,IAAA;QAC3CG,SAAO,EAAO;QACZC,KAAM;MACN;IAAO;EACmC,SACxCC,GAAA;IAAAb,iBACW,IAAM,GAAGC,cAAA,GAAAY,GAAA;EAAA,UACtB;IACF,IAAC;MACH,CAAAd,yBAAA,IAAAG,SAAA,CAAAY,MAAA,YAAAZ,SAAA,CAAAY,MAAA;IACF;MAEO,IAASd,iBAAe,EAC7B,MAAOC,cAAe;IACxB;EAEO;AACL;AAEA,SAAAnB,WAAWA,CAAQU,UAAS,EAAAuB,KAAO,EAAAC,MAAA;EACjC,IAAAC,QAAM,GAAO9B,qBAAA,CAAAO,OAAK,CAAKwB,qBAAmB,CAAAH,KAAK,CAAI;EACnD;IACFI,QAAA,EAAA5B,WAAA,CAAAG,OAAA,CAAAgB,IAAA,CAAAlB,UAAA,KAAAyB,QAAA;IAEAxB,KAAA,EAAAuB,MAAA,CAAAI,GAAA,WAAGC,KAAA,EAAAC,GAAA;MACD,IAAAC,MAAA,GAAAF,KAAA,KAAK,MAAK,OAAAA,KAAS;MACnB,OAAK;QACHG,IAAA,EAAQ,GAAAP,QAAS,GAAAM,MAAW,IAAAR,KAAA,CAAUU,IAAA;QACpCJ,KAAA;QACAK,GAAA,EAAAX,KAAO,CAAAtB,KAAA,CAAA6B,GAAA;MAAA;IACa;EACpB;AACI;AACI,SACRvC,cAASA,CAAAgC,KAAA;EAAA,OACXA,KAAA,CAAAU,IAAA,cAAAV,KAAA,CAAAU,IAAA,cAAAV,KAAA,CAAAU,IAAA;AAAA;AACD,SACHzC,cAAA2C,QAAA;EACFrC,SAAA,CAAAI,OAAA,CAAAkC,SAAA,CAAAD,QAAA,CAAAR,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","assetCatalogIOS_exports","__export","cleanAssetCatalog","getImageSet","isCatalogAsset","writeImageSet","module","exports","import_assetPathUtils","__toESM","require","import_fs","import_path","catalogDir","files","default","readdirSync","filter","file2","endsWith","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","file","rmSync","join","recursive","force","err","return","asset","scales","fileName","getResourceIdentifier","basePath","map","scale","idx","suffix","name","type","src"],"sources":["../../../../src/rn-commands/bundle/assetCatalogIOS.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,WAAA,EAAAA,CAAA,KAAAA,WAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA,cAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA;AAAA;AASAC,MAAA,CAAAC,OAAA,GAAAZ,YAA2B,CAAAK,uBAAA;AAC3B,IAAAQ,qBAAe,GAAAC,OAAA,CAAAC,OAAA;AACf,IAAAC,SAAA,GAAAF,OAAiB,CAAAC,OAAA;AAEV,IAAAE,WAAS,GAAAH,OAAA,CAAAC,OAAkB,OAA0B;AAC1D,SAAMR,iBAAQA,CAAAW,UAAA,EAAG;EACjB,IAAAC,KAAA,GAAWH,SAAQ,CAAAI,OAAO,CAAAC,WAAA,CAAAH,UAAA,EAAAI,MAAA,WAAAC,KAAA;IACxB,OAAAA,KAAA,CAAAC,QAAA,YAAU;EACZ;EACF,IAAAC,yBAAA;IAAAC,iBAAA;IAAAC,cAAA;EAOO;IAKL,KAAM,IAAAC,SAAW,GAAAT,KAAA,CAAAU,MAAA,CAAAC,QAAA,GAAe,EAAAC,KAAA,IAAAN,yBAA2B,IAAAM,KAAA,GAAAH,SAAA,CAAAI,IAAA,IAAAC,IAAA,GAAAR,yBAAA;MAC3D,IAAOS,IAAA,GAAAH,KAAA,CAAA3B,KAAA;MACLY,SAAU,CAAAI,OAAA,CAAAe,MAAA,CAAAlB,WAAK,CAAAG,OAAK,CAAAgB,IAAA,CAAYlB,UAAG,EAAQgB,IAAA;QAC3CG,SAAO,EAAO,IAAK;QACjBC,KAAM;MACN;IAAO;EACmC,SACxCC,GAAA;IAAAb,iBACW,OAAS;IAAAC,cACtB,GAAAY,GAAA;EAAA,UACD;IACH;MACF,KAAAd,yBAAA,IAAAG,SAAA,CAAAY,MAAA;QAEOZ,SAAS,CAAAY,MAAe;MAC7B;IACF;MAEO,IAASd,iBAAc;QAC5B,MAAAC,cAAG;MAEH;IACE;EACA;AAA8B;AAGhC,SAAAnB,YAAAU,UAAG,EAAAuB,KAAA,EAAAC,MAAA;EAAA,IACDC,QAAA,GAAA9B,qBAAU,CAAAO,OAAS,CAAAwB,qBAAyB,CAAAH,KAAA;EAAA,OACvC;IAAUI,QACb,EAAQ5B,WAAS,CAAAG,OAAU,CAACgB,IAAA,CAAAlB,UAAU,KAAAyB,QAAA;IAAAxB,KACpC,EAAAuB,MAAA,CAAUI,GAAA,WAAKC,KAAA,EAAAC,GAAA;MAAA,IACfC,MAAO,GAAAF,KAAA,kBAAAA,KAAA;MAAA,OACP;QACAG,IAAA,KAAAP,QAAA,GAAAM,MAAA,IAAAR,KAAA,CAAAU,IAAA;QACFJ,KAAM;QACJK,GAAA,EAAAX,KAAQ,CAAAtB,KAAA,CAAA6B,GAAA;MAAA;IACC;EACX;AACD;AAEL,SAAAvC,eAAAgC,KAAA","ignoreList":[]}
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var assetPathUtils_exports = {};
22
24
  __export(assetPathUtils_exports, {
@@ -43,17 +45,26 @@ function getAndroidAssetSuffix(scale) {
43
45
  }
44
46
  const drawableFileTypes = /* @__PURE__ */new Set(["gif", "jpeg", "jpg", "png", "webp", "xml"]);
45
47
  function getAndroidResourceFolderName(asset, scale) {
46
- if (!drawableFileTypes.has(asset.type)) return "raw";
48
+ if (!drawableFileTypes.has(asset.type)) {
49
+ return "raw";
50
+ }
47
51
  const suffix = getAndroidAssetSuffix(scale);
48
- if (!suffix) throw new Error(`Don't know which android drawable suffix to use for asset: ${JSON.stringify(asset)}`);
49
- return `drawable-${suffix}`;
52
+ if (!suffix) {
53
+ throw new Error(`Don't know which android drawable suffix to use for asset: ${JSON.stringify(asset)}`);
54
+ }
55
+ const androidFolder = `drawable-${suffix}`;
56
+ return androidFolder;
50
57
  }
51
58
  function getResourceIdentifier(asset) {
52
- return `${getBasePath(asset)}/${asset.name}`.toLowerCase().replace(/\//g, "_").replace(/([^a-z0-9_])/g, "").replace(/^assets_/, "");
59
+ const folderPath = getBasePath(asset);
60
+ return `${folderPath}/${asset.name}`.toLowerCase().replace(/\//g, "_").replace(/([^a-z0-9_])/g, "").replace(/^assets_/, "");
53
61
  }
54
62
  function getBasePath(asset) {
55
63
  let basePath = asset.httpServerLocation;
56
- return basePath[0] === "/" && (basePath = basePath.substr(1)), basePath;
64
+ if (basePath[0] === "/") {
65
+ basePath = basePath.substr(1);
66
+ }
67
+ return basePath;
57
68
  }
58
69
  var assetPathUtils_default = {
59
70
  getAndroidAssetSuffix,
@@ -5,20 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var assetPathUtils_exports = {};
24
26
  __export(assetPathUtils_exports, {
@@ -45,9 +47,13 @@ function getAndroidAssetSuffix(scale) {
45
47
  }
46
48
  var drawableFileTypes = /* @__PURE__ */new Set(["gif", "jpeg", "jpg", "png", "webp", "xml"]);
47
49
  function getAndroidResourceFolderName(asset, scale) {
48
- if (!drawableFileTypes.has(asset.type)) return "raw";
50
+ if (!drawableFileTypes.has(asset.type)) {
51
+ return "raw";
52
+ }
49
53
  var suffix = getAndroidAssetSuffix(scale);
50
- if (!suffix) throw new Error(`Don't know which android drawable suffix to use for asset: ${JSON.stringify(asset)}`);
54
+ if (!suffix) {
55
+ throw new Error(`Don't know which android drawable suffix to use for asset: ${JSON.stringify(asset)}`);
56
+ }
51
57
  var androidFolder = `drawable-${suffix}`;
52
58
  return androidFolder;
53
59
  }
@@ -57,7 +63,10 @@ function getResourceIdentifier(asset) {
57
63
  }
58
64
  function getBasePath(asset) {
59
65
  var basePath = asset.httpServerLocation;
60
- return basePath[0] === "/" && (basePath = basePath.substr(1)), basePath;
66
+ if (basePath[0] === "/") {
67
+ basePath = basePath.substr(1);
68
+ }
69
+ return basePath;
61
70
  }
62
71
  var assetPathUtils_default = {
63
72
  getAndroidAssetSuffix,
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","assetPathUtils_exports","__export","default","assetPathUtils_default","module","exports","getAndroidAssetSuffix","scale","drawableFileTypes","Set","getAndroidResourceFolderName","asset","has","type","suffix","Error","JSON","stringify","androidFolder","getResourceIdentifier","folderPath","getBasePath","name","toLowerCase","replace","basePath","httpServerLocation"],"sources":["../../../../src/rn-commands/bundle/assetPathUtils.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAC;AAAA;AAiBAC,MAAA,CAAAC,OAAS,GAAAV,YAAA,CAAAK,sBAA6C;AACpD,SAAAM,qBAAeA,CAAAC,KAAA;EAAA,QACRA,KAAA;IACH,SAAO;MACT,OAAK;IACH;MACF,OAAK;IACH;MACF,OAAK;IACH;MACF,OAAK;IACH;MACF,OAAK;IACH;MACF;IACE;MACJ;EACF;AAGA;AAEA,IAAAC,iBAAS,kBAA6B,IAAAC,GAAsB,EAC1D,KAAK,EACH,QAEF,OACA,KAAK,EACH,QAAU,KACR,CAAmF;AAIvF,SADsBC,4BAAkBA,CAAAC,KAAA,EAAAJ,KAAA;EAE1C,KAAAC,iBAAA,CAAAI,GAAA,CAAAD,KAAA,CAAAE,IAAA,GAEA,OAAS;EAEP,IAAAC,MADmB,GAAAR,qBACK,CAAAC,KAAM;EAKhC,KAAAO,MAAA,EAEA,MAAS,IAAAC,KAAA,+DAA0CC,IAAA,CAAAC,SAAA,CAAAN,KAAA;EACjD,IAAIO,aAAW,eAAMJ,MAAA;EACrB,OAAII,aAAU;AAIhB;AAEA,SAAOC,qBAAQA,CAAAR,KAAA;EACb,IAAAS,UAAA,GAAAC,WAAA,CAAAV,KAAA;EACA,UAAAS,UAAA,IAAAT,KAAA,CAAAW,IAAA,GAAAC,WAAA,GAAAC,OAAA,aAAAA,OAAA,sBAAAA,OAAA;AAAA;AACA,SACAH,YAAAV,KAAA;EACF,IAAAc,QAAA,GAAAd,KAAA,CAAAe,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","assetPathUtils_exports","__export","default","assetPathUtils_default","module","exports","getAndroidAssetSuffix","scale","drawableFileTypes","Set","getAndroidResourceFolderName","asset","has","type","suffix","Error","JSON","stringify","androidFolder","getResourceIdentifier","folderPath","getBasePath","name","toLowerCase","replace","basePath","httpServerLocation","substr"],"sources":["../../../../src/rn-commands/bundle/assetPathUtils.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAC;AAAA;AAiBAC,MAAA,CAAAC,OAAS,GAAAV,YAAA,CAAAK,sBAA6C;AACpD,SAAAM,qBAAeA,CAAAC,KAAA;EAAA,QACRA,KAAA;IACH,SAAO;MACT,OAAK;IACH;MACF,OAAK;IACH;MACF,OAAK;IACH;MACF,OAAK;IACH;MACF,OAAK;IACH;MACF;IACE;MACJ;EACF;AAGA;AAEA,IAAAC,iBAAS,kBAA6B,IAAAC,GAAsB,EAC1D,KAAK,EACH,QACF,OACA,OACA,MAAK,EACH,MAAU;AAC2E,SACrFC,6BAAAC,KAAA,EAAAJ,KAAA;EACF,KAAAC,iBAAA,CAAAI,GAAA,CAAAD,KAAA,CAAAE,IAAA;IACA,OAAM;EACN;EACF,IAAAC,MAAA,GAAAR,qBAAA,CAAAC,KAAA;EAEA,KAAAO,MAAS;IACP,MAAM,IAAAC,KAAA,+DAA8BC,IAAA,CAAAC,SAAA,CAAAN,KAAA;EACpC;EAKF,IAAAO,aAAA,eAAAJ,MAAA;EAEA,OAASI,aAAY;AACnB;AACA,SAAIC,qBAAqBA,CAAAR,KAAA;EACvB,IAAAS,UAAW,GAAAC,WAAS,CAAOV,KAAC;EAC9B,UAAAS,UAAA,IAAAT,KAAA,CAAAW,IAAA,GAAAC,WAAA,GAAAC,OAAA,aAAAA,OAAA,sBAAAA,OAAA;AACA;AACF,SAAAH,YAAAV,KAAA;EAEA,IAAOc,QAAA,GAAAd,KAAA,CAAAe,kBAAQ;EACb,IAAAD,QAAA;IACAA,QAAA,GAAAA,QAAA,CAAAE,MAAA;EACA;EACA,OAAAF,QAAA;AACF","ignoreList":[]}
@@ -3,50 +3,60 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var buildBundle_exports = {};
22
24
  __export(buildBundle_exports, {
23
25
  buildBundle: () => buildBundle
24
26
  });
25
27
  module.exports = __toCommonJS(buildBundle_exports);
26
- var import_getMetroConfigFromViteConfig = require("../../metro-config/getMetroConfigFromViteConfig.cjs"),
27
- import_buildBundleWithConfig = require("./buildBundleWithConfig.cjs"),
28
- import_patchMetroServerWithViteConfigAndMetroPluginOptions = require("../../metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.cjs"),
29
- import_projectImport = require("../../utils/projectImport.cjs"),
30
- import_exit = require("../../utils/exit.cjs");
28
+ var import_getMetroConfigFromViteConfig = require("../../metro-config/getMetroConfigFromViteConfig.cjs");
29
+ var import_buildBundleWithConfig = require("./buildBundleWithConfig.cjs");
30
+ var import_patchMetroServerWithViteConfigAndMetroPluginOptions = require("../../metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.cjs");
31
+ var import_projectImport = require("../../utils/projectImport.cjs");
32
+ var import_exit = require("../../utils/exit.cjs");
31
33
  async function buildBundle(_argv, ctx, argsIn, bundleImpl = null) {
32
34
  const {
33
35
  viteConfig,
34
36
  metroPluginOptions
35
37
  } = this || {};
36
- if (!viteConfig) throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has viteConfig property.");
37
- if (!metroPluginOptions) throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has metroPluginOptions property.");
38
- if (process.env.IS_VXRN_CLI) throw new Error("IS_VXRN_CLI should not be set while using @vxrn/vite-plugin-metro buildBundle, it is not supported");
38
+ if (!viteConfig) {
39
+ throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has viteConfig property.");
40
+ }
41
+ if (!metroPluginOptions) {
42
+ throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has metroPluginOptions property.");
43
+ }
44
+ if (process.env.IS_VXRN_CLI) {
45
+ throw new Error("IS_VXRN_CLI should not be set while using @vxrn/vite-plugin-metro buildBundle, it is not supported");
46
+ }
39
47
  const metroConfig = await (0, import_getMetroConfigFromViteConfig.getMetroConfigFromViteConfig)(viteConfig, {
40
- ...metroPluginOptions,
41
- watchman: metroPluginOptions.watchman ?? !1
42
- }),
43
- args = {
44
- ...argsIn,
45
- entryFile: metroPluginOptions.mainModuleName ? (0, import_projectImport.projectResolve)(viteConfig.root, metroPluginOptions.mainModuleName) : argsIn.entryFile
46
- };
48
+ ...metroPluginOptions,
49
+ watchman: metroPluginOptions.watchman ?? false
50
+ });
51
+ const args = {
52
+ ...argsIn,
53
+ entryFile: metroPluginOptions.mainModuleName ? (0, import_projectImport.projectResolve)(viteConfig.root, metroPluginOptions.mainModuleName) : argsIn.entryFile
54
+ };
47
55
  await (0, import_buildBundleWithConfig.buildBundleWithConfig)(args, metroConfig, void 0, {
48
56
  patchServer: server => {
49
57
  (0, import_patchMetroServerWithViteConfigAndMetroPluginOptions.patchMetroServerWithViteConfigAndMetroPluginOptions)(server, viteConfig, metroPluginOptions);
50
58
  }
51
- }), console.info("Done."), (0, import_exit.ensureProcessExitsAfterDelay)();
59
+ });
60
+ console.info("Done.");
61
+ (0, import_exit.ensureProcessExitsAfterDelay)();
52
62
  }
@@ -5,53 +5,63 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: !0
23
+ value: true
22
24
  }), mod);
23
25
  var buildBundle_exports = {};
24
26
  __export(buildBundle_exports, {
25
27
  buildBundle: () => buildBundle
26
28
  });
27
29
  module.exports = __toCommonJS(buildBundle_exports);
28
- var import_getMetroConfigFromViteConfig = require("../../metro-config/getMetroConfigFromViteConfig.native.js"),
29
- import_buildBundleWithConfig = require("./buildBundleWithConfig.native.js"),
30
- import_patchMetroServerWithViteConfigAndMetroPluginOptions = require("../../metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js"),
31
- import_projectImport = require("../../utils/projectImport.native.js"),
32
- import_exit = require("../../utils/exit.native.js");
30
+ var import_getMetroConfigFromViteConfig = require("../../metro-config/getMetroConfigFromViteConfig.native.js");
31
+ var import_buildBundleWithConfig = require("./buildBundleWithConfig.native.js");
32
+ var import_patchMetroServerWithViteConfigAndMetroPluginOptions = require("../../metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js");
33
+ var import_projectImport = require("../../utils/projectImport.native.js");
34
+ var import_exit = require("../../utils/exit.native.js");
33
35
  async function buildBundle(_argv, ctx, argsIn) {
34
- var bundleImpl = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null,
35
- _metroPluginOptions_watchman,
36
- {
37
- viteConfig,
38
- metroPluginOptions
39
- } = this || {};
40
- if (!viteConfig) throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has viteConfig property.");
41
- if (!metroPluginOptions) throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has metroPluginOptions property.");
42
- if (process.env.IS_VXRN_CLI) throw new Error("IS_VXRN_CLI should not be set while using @vxrn/vite-plugin-metro buildBundle, it is not supported");
36
+ var bundleImpl = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
37
+ var _metroPluginOptions_watchman;
38
+ var {
39
+ viteConfig,
40
+ metroPluginOptions
41
+ } = this || {};
42
+ if (!viteConfig) {
43
+ throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has viteConfig property.");
44
+ }
45
+ if (!metroPluginOptions) {
46
+ throw new Error("[vxrn/buildBundle.metro] Expect the buildBundle function to be bind with an object that has metroPluginOptions property.");
47
+ }
48
+ if (process.env.IS_VXRN_CLI) {
49
+ throw new Error("IS_VXRN_CLI should not be set while using @vxrn/vite-plugin-metro buildBundle, it is not supported");
50
+ }
43
51
  var metroConfig = await (0, import_getMetroConfigFromViteConfig.getMetroConfigFromViteConfig)(viteConfig, {
44
- ...metroPluginOptions,
45
- watchman: (_metroPluginOptions_watchman = metroPluginOptions.watchman) !== null && _metroPluginOptions_watchman !== void 0 ? _metroPluginOptions_watchman : !1
46
- }),
47
- args = {
48
- ...argsIn,
49
- entryFile: metroPluginOptions.mainModuleName ? (0, import_projectImport.projectResolve)(viteConfig.root, metroPluginOptions.mainModuleName) : argsIn.entryFile
50
- };
52
+ ...metroPluginOptions,
53
+ watchman: (_metroPluginOptions_watchman = metroPluginOptions.watchman) !== null && _metroPluginOptions_watchman !== void 0 ? _metroPluginOptions_watchman : false
54
+ });
55
+ var args = {
56
+ ...argsIn,
57
+ entryFile: metroPluginOptions.mainModuleName ? (0, import_projectImport.projectResolve)(viteConfig.root, metroPluginOptions.mainModuleName) : argsIn.entryFile
58
+ };
51
59
  await (0, import_buildBundleWithConfig.buildBundleWithConfig)(args, metroConfig, void 0, {
52
60
  patchServer: function (server) {
53
61
  (0, import_patchMetroServerWithViteConfigAndMetroPluginOptions.patchMetroServerWithViteConfigAndMetroPluginOptions)(server, viteConfig, metroPluginOptions);
54
62
  }
55
- }), console.info("Done."), (0, import_exit.ensureProcessExitsAfterDelay)();
63
+ });
64
+ console.info("Done.");
65
+ (0, import_exit.ensureProcessExitsAfterDelay)();
56
66
  }
57
67
  //# sourceMappingURL=buildBundle.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","buildBundle_exports","__export","buildBundle","module","exports","import_getMetroConfigFromViteConfig","require","import_buildBundleWithConfig","import_patchMetroServerWithViteConfigAndMetroPluginOptions","import_projectImport","import_exit","_argv","ctx","argsIn","bundleImpl","arguments","length","_metroPluginOptions_watchman","viteConfig","metroPluginOptions","Error","process","env","IS_VXRN_CLI","metroConfig","getMetroConfigFromViteConfig","watchman","args","entryFile","mainModuleName","projectResolve","root","buildBundleWithConfig","patchServer","server","patchMetroServerWithViteConfigAndMetroPluginOptions","console","info","ensureProcessExitsAfterDelay"],"sources":["../../../../src/rn-commands/bundle/buildBundle.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,mBAA6C;AAO7C,IAAAK,mCAIE,GAAAC,OACA,4DACe;EAAAC,4BAAA,GAAAD,OAAA;EAAAE,0DAAA,GAAAF,OAAA;EAAAG,oBAAA,GAAAH,OAAA;EAAAI,WAAA,GAAAJ,OAAA;AACf,eAAQJ,WAAYA,CAAAS,KAAA,EAAAC,GAAA,EAAAC,MAAuB;EAC3C,IAAIC,UAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;IAAAE,4BAAA;IAAA;MAAAC,UAAA;MAAAC;IAAA;EACH,KAAAD,UAAU,QACR,IAAAE,KAAA;EAAA,IACF,CAAAD,kBAAA,EAEF,MAAK,IAAAC,KAAA;EACH,IAAAC,OAAM,CAAIC,GAAA,CAAAC,WAAA,QACR,IAAAH,KAAA;EAAA,IACFI,WAAA,aAAAnB,mCAAA,CAAAoB,4BAAA,EAAAP,UAAA;MAGF,GAAIC,kBAAY;MACdO,QAAM,EAAI,CAAAT,4BAAA,GAAAE,kBAAA,CAAAO,QAAA,cAAAT,4BAAA,cAAAA,4BAAA;IAAA;IACRU,IAAA;MACF,GAAAd,MAAA;MAIFe,SAAM,EAAAT,kBAAoB,CAAAU,cAAA,OAAApB,oBAAA,CAAAqB,cAAA,EAAAZ,UAA6B,CAAAa,IAAA,EAAAZ,kBAAY,CAAAU,cAAA,IAAAhB,MAAA,CAAAe;IAAA;EAC9D,MACH,IAAArB,4BAA6B,CAAAyB,qBAAY,EAAAL,IAAA,EAAAH,WAAA;IAC1CS,WAEY,WAAAA,CAAAC,MAAA;MACX,CAAG,GAAA1B,0DAAA,CAAA2B,mDAAA,EAAAD,MAAA,EAAAhB,UAAA,EAAAC,kBAAA;IACH;EAGF,IAAAiB,OAAA,CAAAC,IAAA,eAAA3B,WAAA,CAAA4B,4BAAA;AAEA","ignoreList":[]}
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","buildBundle_exports","__export","buildBundle","module","exports","import_getMetroConfigFromViteConfig","require","import_buildBundleWithConfig","import_patchMetroServerWithViteConfigAndMetroPluginOptions","import_projectImport","import_exit","_argv","ctx","argsIn","bundleImpl","arguments","length","_metroPluginOptions_watchman","viteConfig","metroPluginOptions","Error","process","env","IS_VXRN_CLI","metroConfig","getMetroConfigFromViteConfig","watchman","args","entryFile","mainModuleName","projectResolve","root","buildBundleWithConfig","patchServer","server","patchMetroServerWithViteConfigAndMetroPluginOptions","console","info","ensureProcessExitsAfterDelay"],"sources":["../../../../src/rn-commands/bundle/buildBundle.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAA,GAAAT,YAAA,CAAAK,mBAA6C;AAC7C,IAAAK,mCAAsC,GAAAC,OAAA;AACtC,IAAAC,4BAAA,GAAAD,OAAA,oCAAoE;AACpE,IAAAE,0DAA+B,GAAAF,OAAA;AAE/B,IAAAG,oBAA6C,GAAAH,OAAA;AAE7C,IAAAI,WAAsB,GAAAJ,OAAA,6BAIpB;AAGA,eAAQJ,WAAYA,CAAAS,KAAA,EAAAC,GAAA,EAAAC,MAAuB;EAC3C,IAAIC,UAAC,GAAYC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EACf,IAAAE,4BAAU;EAAA,IACR;IAAAC,UAAA;IAAAC;EAAA;EAAA,IACF,CAAAD,UAAA;IACF,UAAAE,KAAA;EACA;EACE,KAAAD,kBAAU;IAAA,MACR,IAAAC,KAAA;EAAA;EAEJ,IAAAC,OAAA,CAAAC,GAAA,CAAAC,WAAA;IAEA,MAAI,IAAQH,KAAI,qGAAa;EAC3B;EAAU,IACRI,WAAA,aAAAnB,mCAAA,CAAAoB,4BAAA,EAAAP,UAAA;IACF,GAAAC,kBAAA;IACFO,QAAA,GAAAT,4BAAA,GAAAE,kBAAA,CAAAO,QAAA,cAAAT,4BAAA,cAAAA,4BAAA;EAGA;EAAmE,IACjEU,IAAG;IACH,GAAAd,MAAA;IACDe,SAAA,EAAAT,kBAAA,CAAAU,cAAA,OAAApB,oBAAA,CAAAqB,cAAA,EAAAZ,UAAA,CAAAa,IAAA,EAAAZ,kBAAA,CAAAU,cAAA,IAAAhB,MAAA,CAAAe;EAED;EAAa,MACR,IAAArB,4BAAA,CAAAyB,qBAAA,EAAAL,IAAA,EAAAH,WAAA;IACHS,WAAW,WAAAA,CAAAC,MAAA,EAAmB;MAGhC,IAAA1B,0DAAA,CAAA2B,mDAAA,EAAAD,MAAA,EAAAhB,UAAA,EAAAC,kBAAA;IAEA;EAA0D,EACxD;EACEiB,OAAA,CAAAC,IAAA;EAAA,IAAA3B,WACE,CAAA4B,4BAAA;AAAA","ignoreList":[]}
@@ -2,69 +2,80 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var buildBundleWithConfig_exports = {};
33
35
  __export(buildBundleWithConfig_exports, {
34
36
  buildBundleWithConfig: () => buildBundleWithConfig
35
37
  });
36
38
  module.exports = __toCommonJS(buildBundleWithConfig_exports);
37
- var import_node_path = __toESM(require("node:path"), 1),
38
- import_node_fs = require("node:fs"),
39
- import_Server = __toESM(require("metro/private/Server"), 1),
40
- import_bundle = __toESM(require("metro/private/shared/output/bundle"), 1),
41
- import_saveAssets = __toESM(require("./saveAssets.cjs"), 1);
39
+ var import_node_path = __toESM(require("node:path"), 1);
40
+ var import_node_fs = require("node:fs");
41
+ var import_Server = __toESM(require("metro/private/Server"), 1);
42
+ var import_bundle = __toESM(require("metro/private/shared/output/bundle"), 1);
43
+ var import_saveAssets = __toESM(require("./saveAssets.cjs"), 1);
42
44
  const Server = import_Server.default.default;
43
45
  async function buildBundleWithConfig(args, config, bundleImpl = import_bundle.default, {
44
46
  patchServer
45
47
  } = {}) {
46
48
  const customResolverOptions = [];
47
- if (config.resolver.platforms.indexOf(args.platform) === -1) throw console.error(`Invalid platform ${args.platform ? `"${args.platform}" ` : ""}selected.`), console.info(`Available platforms are: ${config.resolver.platforms.map(x => `"${x}"`).join(", ")}. If you are trying to bundle for an out-of-tree platform, it may not be installed.`), new Error("Bundling failed");
49
+ if (config.resolver.platforms.indexOf(args.platform) === -1) {
50
+ console.error(`Invalid platform ${args.platform ? `"${args.platform}" ` : ""}selected.`);
51
+ console.info(`Available platforms are: ${config.resolver.platforms.map(x => `"${x}"`).join(", ")}. If you are trying to bundle for an out-of-tree platform, it may not be installed.`);
52
+ throw new Error("Bundling failed");
53
+ }
48
54
  process.env.NODE_ENV = args.dev ? "development" : "production";
49
55
  let sourceMapUrl = args.sourcemapOutput;
50
- sourceMapUrl != null && !args.sourcemapUseAbsolutePath && (sourceMapUrl = import_node_path.default.basename(sourceMapUrl));
56
+ if (sourceMapUrl != null && !args.sourcemapUseAbsolutePath) {
57
+ sourceMapUrl = import_node_path.default.basename(sourceMapUrl);
58
+ }
51
59
  const requestOpts = {
52
- entryFile: args.entryFile,
53
- sourceMapUrl,
54
- dev: args.dev,
55
- minify: args.minify !== void 0 ? args.minify : !args.dev,
56
- platform: args.platform,
57
- unstable_transformProfile: args.unstableTransformProfile,
58
- customResolverOptions
59
- },
60
- server = new Server(config);
61
- patchServer && patchServer(server);
60
+ entryFile: args.entryFile,
61
+ sourceMapUrl,
62
+ dev: args.dev,
63
+ minify: args.minify !== void 0 ? args.minify : !args.dev,
64
+ platform: args.platform,
65
+ unstable_transformProfile: args.unstableTransformProfile,
66
+ customResolverOptions
67
+ };
68
+ const server = new Server(config);
69
+ if (patchServer) {
70
+ patchServer(server);
71
+ }
62
72
  try {
63
73
  const bundle = await bundleImpl.build(server, requestOpts);
64
74
  await import_node_fs.promises.mkdir(import_node_path.default.dirname(args.bundleOutput), {
65
- recursive: !0,
75
+ recursive: true,
66
76
  mode: 493
67
- }), await bundleImpl.save(bundle, args, console.info);
77
+ });
78
+ await bundleImpl.save(bundle, args, console.info);
68
79
  const outputAssets = await server.getAssets({
69
80
  ...Server.DEFAULT_BUNDLE_OPTIONS,
70
81
  ...requestOpts