@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.
- package/dist/cjs/babel-plugins/import-meta-env-plugin.cjs +55 -37
- package/dist/cjs/babel-plugins/import-meta-env-plugin.native.js +111 -94
- package/dist/cjs/babel-plugins/import-meta-env-plugin.native.js.map +1 -1
- package/dist/cjs/env/platformEnv.cjs +21 -14
- package/dist/cjs/env/platformEnv.native.js +30 -20
- package/dist/cjs/env/platformEnv.native.js.map +1 -1
- package/dist/cjs/index.cjs +16 -14
- package/dist/cjs/index.native.js +16 -14
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.cjs +25 -19
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.js +39 -29
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.js.map +1 -1
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.cjs +103 -92
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js +111 -104
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.cjs +17 -13
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js +23 -19
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js.map +1 -1
- package/dist/cjs/metro-config/types.cjs +7 -5
- package/dist/cjs/metro-config/types.native.js +7 -5
- package/dist/cjs/metro-config/types.native.js.map +1 -1
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.cjs +37 -25
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.js +49 -33
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
- package/dist/cjs/plugins/metroPlugin.cjs +184 -126
- package/dist/cjs/plugins/metroPlugin.native.js +193 -140
- package/dist/cjs/plugins/metroPlugin.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.cjs +34 -30
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.js +56 -44
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/assetPathUtils.cjs +26 -15
- package/dist/cjs/rn-commands/bundle/assetPathUtils.native.js +22 -13
- package/dist/cjs/rn-commands/bundle/assetPathUtils.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/buildBundle.cjs +36 -26
- package/dist/cjs/rn-commands/bundle/buildBundle.native.js +42 -32
- package/dist/cjs/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.cjs +52 -41
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.js +57 -46
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.cjs +23 -15
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.js +30 -19
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.cjs +28 -26
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.js +28 -26
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.cjs +26 -24
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.js +26 -24
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.cjs +22 -16
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.js +16 -14
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/index.cjs +14 -12
- package/dist/cjs/rn-commands/bundle/index.native.js +14 -12
- package/dist/cjs/rn-commands/bundle/index.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/saveAssets.cjs +69 -51
- package/dist/cjs/rn-commands/bundle/saveAssets.native.js +75 -55
- package/dist/cjs/rn-commands/bundle/saveAssets.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/types.cjs +7 -5
- package/dist/cjs/rn-commands/bundle/types.native.js +7 -5
- package/dist/cjs/rn-commands/bundle/types.native.js.map +1 -1
- package/dist/cjs/rn-commands/index.cjs +24 -22
- package/dist/cjs/rn-commands/index.native.js +24 -22
- package/dist/cjs/rn-commands/index.native.js.map +1 -1
- package/dist/cjs/transformer/babel-core.cjs +12 -10
- package/dist/cjs/transformer/babel-core.native.js +12 -10
- package/dist/cjs/transformer/babel-core.native.js.map +1 -1
- package/dist/cjs/transformer/babel-transformer.cjs +106 -89
- package/dist/cjs/transformer/babel-transformer.native.js +106 -96
- package/dist/cjs/transformer/babel-transformer.native.js.map +1 -1
- package/dist/cjs/transformer/loadBabelConfig.cjs +43 -32
- package/dist/cjs/transformer/loadBabelConfig.native.js +51 -41
- package/dist/cjs/transformer/loadBabelConfig.native.js.map +1 -1
- package/dist/cjs/transformer/transformSync.cjs +33 -25
- package/dist/cjs/transformer/transformSync.native.js +38 -30
- package/dist/cjs/transformer/transformSync.native.js.map +1 -1
- package/dist/cjs/transformer/types.cjs +7 -5
- package/dist/cjs/transformer/types.native.js +7 -5
- package/dist/cjs/transformer/types.native.js.map +1 -1
- package/dist/cjs/utils/exit.cjs +95 -53
- package/dist/cjs/utils/exit.native.js +138 -81
- package/dist/cjs/utils/exit.native.js.map +1 -1
- package/dist/cjs/utils/getTerminalReporter.cjs +33 -28
- package/dist/cjs/utils/getTerminalReporter.native.js +40 -33
- package/dist/cjs/utils/getTerminalReporter.native.js.map +1 -1
- package/dist/cjs/utils/metroCacheManager.cjs +82 -46
- package/dist/cjs/utils/metroCacheManager.native.js +96 -57
- package/dist/cjs/utils/metroCacheManager.native.js.map +1 -1
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.cjs +21 -17
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js +12 -10
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js.map +1 -1
- package/dist/cjs/utils/projectImport.cjs +40 -30
- package/dist/cjs/utils/projectImport.native.js +49 -37
- package/dist/cjs/utils/projectImport.native.js.map +1 -1
- package/dist/esm/babel-plugins/import-meta-env-plugin.mjs +28 -12
- package/dist/esm/babel-plugins/import-meta-env-plugin.mjs.map +1 -1
- package/dist/esm/babel-plugins/import-meta-env-plugin.native.js +83 -68
- package/dist/esm/babel-plugins/import-meta-env-plugin.native.js.map +1 -1
- package/dist/esm/env/platformEnv.mjs +9 -4
- package/dist/esm/env/platformEnv.mjs.map +1 -1
- package/dist/esm/env/platformEnv.native.js +18 -10
- package/dist/esm/env/platformEnv.native.js.map +1 -1
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.mjs +13 -9
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.mjs.map +1 -1
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.native.js +27 -19
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.native.js.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs +75 -66
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js +83 -78
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.mjs +5 -3
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.mjs.map +1 -1
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js +11 -9
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js.map +1 -1
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.mjs +22 -12
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.native.js +34 -20
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
- package/dist/esm/plugins/metroPlugin.mjs +152 -96
- package/dist/esm/plugins/metroPlugin.mjs.map +1 -1
- package/dist/esm/plugins/metroPlugin.native.js +158 -107
- package/dist/esm/plugins/metroPlugin.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.mjs +7 -5
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.native.js +29 -19
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/assetPathUtils.mjs +14 -5
- package/dist/esm/rn-commands/bundle/assetPathUtils.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/assetPathUtils.native.js +10 -3
- package/dist/esm/rn-commands/bundle/assetPathUtils.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundle.mjs +19 -11
- package/dist/esm/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundle.native.js +25 -17
- package/dist/esm/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.mjs +23 -14
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.native.js +27 -18
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.mjs +11 -5
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.native.js +18 -9
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.mjs +2 -2
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.native.js +2 -2
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.mjs +2 -2
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.native.js +2 -2
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.mjs +8 -4
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.native.js +2 -2
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/saveAssets.mjs +39 -23
- package/dist/esm/rn-commands/bundle/saveAssets.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/saveAssets.native.js +45 -27
- package/dist/esm/rn-commands/bundle/saveAssets.native.js.map +1 -1
- package/dist/esm/transformer/babel-transformer.mjs +84 -69
- package/dist/esm/transformer/babel-transformer.mjs.map +1 -1
- package/dist/esm/transformer/babel-transformer.native.js +94 -86
- package/dist/esm/transformer/babel-transformer.native.js.map +1 -1
- package/dist/esm/transformer/loadBabelConfig.mjs +17 -8
- package/dist/esm/transformer/loadBabelConfig.mjs.map +1 -1
- package/dist/esm/transformer/loadBabelConfig.native.js +19 -11
- package/dist/esm/transformer/loadBabelConfig.native.js.map +1 -1
- package/dist/esm/transformer/transformSync.mjs +9 -3
- package/dist/esm/transformer/transformSync.mjs.map +1 -1
- package/dist/esm/transformer/transformSync.native.js +14 -8
- package/dist/esm/transformer/transformSync.native.js.map +1 -1
- package/dist/esm/utils/exit.mjs +68 -28
- package/dist/esm/utils/exit.mjs.map +1 -1
- package/dist/esm/utils/exit.native.js +111 -56
- package/dist/esm/utils/exit.native.js.map +1 -1
- package/dist/esm/utils/getTerminalReporter.mjs +7 -4
- package/dist/esm/utils/getTerminalReporter.mjs.map +1 -1
- package/dist/esm/utils/getTerminalReporter.native.js +14 -9
- package/dist/esm/utils/getTerminalReporter.native.js.map +1 -1
- package/dist/esm/utils/metroCacheManager.mjs +67 -33
- package/dist/esm/utils/metroCacheManager.mjs.map +1 -1
- package/dist/esm/utils/metroCacheManager.native.js +80 -43
- package/dist/esm/utils/metroCacheManager.native.js.map +1 -1
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.mjs +9 -7
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.mjs.map +1 -1
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js.map +1 -1
- package/dist/esm/utils/projectImport.mjs +14 -6
- package/dist/esm/utils/projectImport.mjs.map +1 -1
- package/dist/esm/utils/projectImport.native.js +23 -13
- package/dist/esm/utils/projectImport.native.js.map +1 -1
- 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
|
-
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
22
24
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_didIteratorError =
|
|
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 =
|
|
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:
|
|
57
|
-
force:
|
|
58
|
+
recursive: true,
|
|
59
|
+
force: true
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
} catch (err) {
|
|
61
|
-
_didIteratorError =
|
|
63
|
+
_didIteratorError = true;
|
|
64
|
+
_iteratorError = err;
|
|
62
65
|
} finally {
|
|
63
66
|
try {
|
|
64
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
67
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
68
|
+
_iterator.return();
|
|
69
|
+
}
|
|
65
70
|
} finally {
|
|
66
|
-
if (_didIteratorError)
|
|
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:
|
|
96
|
+
recursive: true
|
|
90
97
|
});
|
|
91
|
-
var _iteratorNormalCompletion =
|
|
92
|
-
_didIteratorError =
|
|
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 =
|
|
96
|
-
var file = _step.value
|
|
97
|
-
|
|
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 =
|
|
108
|
+
_didIteratorError = true;
|
|
109
|
+
_iteratorError = err;
|
|
102
110
|
} finally {
|
|
103
111
|
try {
|
|
104
|
-
!_iteratorNormalCompletion && _iterator.return != null
|
|
112
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
113
|
+
_iterator.return();
|
|
114
|
+
}
|
|
105
115
|
} finally {
|
|
106
|
-
if (_didIteratorError)
|
|
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"
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
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))
|
|
48
|
+
if (!drawableFileTypes.has(asset.type)) {
|
|
49
|
+
return "raw";
|
|
50
|
+
}
|
|
47
51
|
const suffix = getAndroidAssetSuffix(scale);
|
|
48
|
-
if (!suffix)
|
|
49
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
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))
|
|
50
|
+
if (!drawableFileTypes.has(asset.type)) {
|
|
51
|
+
return "raw";
|
|
52
|
+
}
|
|
49
53
|
var suffix = getAndroidAssetSuffix(scale);
|
|
50
|
-
if (!suffix)
|
|
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
|
-
|
|
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":"
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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)
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
})
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value:
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!viteConfig)
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
})
|
|
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":"
|
|
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
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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)
|
|
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
|
|
56
|
+
if (sourceMapUrl != null && !args.sourcemapUseAbsolutePath) {
|
|
57
|
+
sourceMapUrl = import_node_path.default.basename(sourceMapUrl);
|
|
58
|
+
}
|
|
51
59
|
const requestOpts = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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:
|
|
75
|
+
recursive: true,
|
|
66
76
|
mode: 493
|
|
67
|
-
})
|
|
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
|