@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 transformSync_exports = {};
|
|
35
37
|
__export(transformSync_exports, {
|
|
36
38
|
transformSync: () => transformSync
|
|
@@ -38,26 +40,32 @@ __export(transformSync_exports, {
|
|
|
38
40
|
module.exports = __toCommonJS(transformSync_exports);
|
|
39
41
|
var babel = __toESM(require("./babel-core.native.js"), 1);
|
|
40
42
|
function isTypeScriptSource(fileName) {
|
|
41
|
-
return fileName
|
|
43
|
+
return fileName === null || fileName === void 0 ? void 0 : fileName.endsWith(".ts");
|
|
42
44
|
}
|
|
43
45
|
function isTSXSource(fileName) {
|
|
44
|
-
return fileName
|
|
46
|
+
return fileName === null || fileName === void 0 ? void 0 : fileName.endsWith(".tsx");
|
|
45
47
|
}
|
|
46
48
|
function transformSync(src, babelConfig, param) {
|
|
47
49
|
var {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
hermesParser
|
|
51
|
+
} = param;
|
|
52
|
+
var isTypeScript = isTypeScriptSource(babelConfig.filename) || isTSXSource(babelConfig.filename);
|
|
53
|
+
if (isTypeScript) {
|
|
54
|
+
return parseWithBabel(src, babelConfig);
|
|
55
|
+
}
|
|
56
|
+
if (!isTypeScript && (
|
|
52
57
|
// The Hermes parser doesn't support comments or babel proposals such as export default from, meaning it has lower compatibility with larger parts
|
|
53
58
|
// of the ecosystem.
|
|
54
59
|
// However, React Native ships with flow syntax that isn't supported in Babel so we need to use Hermes for those files.
|
|
55
60
|
// We can try to quickly detect if the file uses flow syntax by checking for the @flow pragma which is present in every React Native file.
|
|
56
|
-
hermesParser || src.includes(" @flow"))
|
|
61
|
+
hermesParser || src.includes(" @flow"))) {
|
|
62
|
+
return parseWithHermes(src, babelConfig);
|
|
63
|
+
}
|
|
64
|
+
return parseWithBabel(src, babelConfig);
|
|
57
65
|
}
|
|
58
66
|
function parseWithHermes(src, babelConfig) {
|
|
59
67
|
var sourceAst = require("hermes-parser").parse(src, {
|
|
60
|
-
babel:
|
|
68
|
+
babel: true,
|
|
61
69
|
sourceType: babelConfig.sourceType
|
|
62
70
|
});
|
|
63
71
|
return babel.transformFromAstSync(sourceAst, src, babelConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformSync_exports","__export","transformSync","module","exports","babel","__toESM","require","isTypeScriptSource","fileName","endsWith","isTSXSource","src","babelConfig","param","hermesParser","isTypeScript","filename","parseWithBabel","includes","parseWithHermes","sourceAst","parse","sourceType","transformFromAstSync"],"sources":["../../../src/transformer/transformSync.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","transformSync_exports","__export","transformSync","module","exports","babel","__toESM","require","isTypeScriptSource","fileName","endsWith","isTSXSource","src","babelConfig","param","hermesParser","isTypeScript","filename","parseWithBabel","includes","parseWithHermes","sourceAst","parse","sourceType","transformFromAstSync"],"sources":["../../../src/transformer/transformSync.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,qBAAA;AAAAC,QAAA,CAAAD,qBAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AAMAC,MAAA,CAAAC,OAAuB,GAAAT,YAAA,CAAAK,qBAAA;AAGvB,IAAAK,KAAS,GAAAC,OAAA,CAAAC,OAAA,CAAmB,wBAA2B;AACrD,SAAOC,kBAAUA,CAASC,QAAK;EACjC,OAAAA,QAAA,aAAAA,QAAA,uBAAAA,QAAA,CAAAC,QAAA;AAEA;AACE,SAAOC,WAAUA,CAAAF,QAAS;EAC5B,OAAAA,QAAA,aAAAA,QAAA,uBAAAA,QAAA,CAAAC,QAAA;AAEO;AAKL,SAAMR,cACJU,GAAA,EAAAC,WAAA,EAAAC,KAAmB;EAErB,IAAI;IAAAC;EAAc,IAAAD,KAAA;EAChB,IAAAE,YAAO,GAAAR,kBAAoB,CAAAK,WAAW,CAAAI,QAAA,KAAAN,WAAA,CAAAE,WAAA,CAAAI,QAAA;EACxC,IAAAD,YAAA;IAEA,OACGE,cAAA,CAAAN,GAAA,EAAAC,WAAA;EAAA;EAAA,KAAAG,YAAA;EAAA;EAAA;EAAA;EAOD;EACFD,YAAA,IAAAH,GAAA,CAAAO,QAAA;IAEA,OAAOC,eAAe,CAAAR,GAAK,EAAAC,WAAW;EACxC;EAEA,OAASK,cAAA,CAAAN,GAAgB,EAAAC,WAAa;AACpC;AAAsD,SACpDO,eAAOA,CAAAR,GAAA,EAAAC,WAAA;EAAA,IACPQ,SAAA,GAAYd,OAAA,gBAAY,EAAAe,KAAA,CAAAV,GAAA;IACzBP,KAAA;IACDkB,UAAO,EAAMV,WAAA,CAAAU;EACf;EAEA,OAASlB,KAAA,CAAAmB,oBAA4B,CAAAH,SAAqC,EAAAT,GAAA,EAAAC,WAAA;AACxE;AACF,SAAAK,eAAAN,GAAA,EAAAC,WAAA","ignoreList":[]}
|
|
@@ -3,14 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
8
|
+
get: () => from[key],
|
|
9
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
10
|
+
});
|
|
11
|
+
}
|
|
10
12
|
return to;
|
|
11
13
|
};
|
|
12
14
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
13
|
-
value:
|
|
15
|
+
value: true
|
|
14
16
|
}), mod);
|
|
15
17
|
var types_exports = {};
|
|
16
18
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -5,14 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
12
14
|
return to;
|
|
13
15
|
};
|
|
14
16
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
-
value:
|
|
17
|
+
value: true
|
|
16
18
|
}), mod);
|
|
17
19
|
var types_exports = {};
|
|
18
20
|
module.exports = __toCommonJS(types_exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../../src/transformer/types.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../../src/transformer/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
|
package/dist/cjs/utils/exit.cjs
CHANGED
|
@@ -2,33 +2,35 @@ 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 exit_exports = {};
|
|
33
35
|
__export(exit_exports, {
|
|
34
36
|
ensureProcessExitsAfterDelay: () => ensureProcessExitsAfterDelay,
|
|
@@ -37,71 +39,111 @@ __export(exit_exports, {
|
|
|
37
39
|
warn: () => warn
|
|
38
40
|
});
|
|
39
41
|
module.exports = __toCommonJS(exit_exports);
|
|
40
|
-
var import_node_child_process = require("node:child_process")
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const debug = (..._) => {}
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
var import_node_child_process = require("node:child_process");
|
|
43
|
+
var import_node_process = __toESM(require("node:process"), 1);
|
|
44
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
45
|
+
const debug = (..._) => {};
|
|
46
|
+
const PRE_EXIT_SIGNALS = ["SIGHUP", "SIGINT", "SIGTERM", "SIGBREAK"];
|
|
47
|
+
const queue = [];
|
|
46
48
|
let unsubscribe = null;
|
|
47
49
|
function installExitHooks(asyncExitHook) {
|
|
48
|
-
|
|
50
|
+
if (!queue.length) {
|
|
51
|
+
unsubscribe = attachMasterListener();
|
|
52
|
+
}
|
|
53
|
+
queue.push(asyncExitHook);
|
|
54
|
+
return () => {
|
|
49
55
|
const index = queue.indexOf(asyncExitHook);
|
|
50
|
-
index >= 0
|
|
56
|
+
if (index >= 0) {
|
|
57
|
+
queue.splice(index, 1);
|
|
58
|
+
}
|
|
59
|
+
if (!queue.length) {
|
|
60
|
+
unsubscribe?.();
|
|
61
|
+
}
|
|
51
62
|
};
|
|
52
63
|
}
|
|
53
64
|
function createExitHook(signal) {
|
|
54
65
|
return guardAsync(async () => {
|
|
55
66
|
debug(`pre-exit (signal: ${signal}, queue length: ${queue.length})`);
|
|
56
|
-
for (const [index, hookAsync] of Object.entries(queue))
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
for (const [index, hookAsync] of Object.entries(queue)) {
|
|
68
|
+
try {
|
|
69
|
+
await hookAsync(signal);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
debug(`Error in exit hook: %O (queue: ${index})`, error);
|
|
72
|
+
}
|
|
60
73
|
}
|
|
61
|
-
debug(`post-exit (code: ${import_node_process.default.exitCode ?? 0})`)
|
|
74
|
+
debug(`post-exit (code: ${import_node_process.default.exitCode ?? 0})`);
|
|
75
|
+
import_node_process.default.exit();
|
|
62
76
|
});
|
|
63
77
|
}
|
|
64
78
|
function attachMasterListener() {
|
|
65
79
|
const hooks = [];
|
|
66
80
|
for (const signal of PRE_EXIT_SIGNALS) {
|
|
67
81
|
const hook = createExitHook(signal);
|
|
68
|
-
hooks.push([signal, hook])
|
|
82
|
+
hooks.push([signal, hook]);
|
|
83
|
+
import_node_process.default.on(signal, hook);
|
|
69
84
|
}
|
|
70
85
|
return () => {
|
|
71
|
-
for (const [signal, hook] of hooks)
|
|
86
|
+
for (const [signal, hook] of hooks) {
|
|
87
|
+
import_node_process.default.removeListener(signal, hook);
|
|
88
|
+
}
|
|
72
89
|
};
|
|
73
90
|
}
|
|
74
91
|
function ensureProcessExitsAfterDelay(waitUntilExitMs = 1e4, startedAtMs = Date.now()) {
|
|
75
|
-
const expectedResources = [import_node_process.default.stdout.isTTY ? "TTYWrap" : "PipeWrap", import_node_process.default.stderr.isTTY ? "TTYWrap" : "PipeWrap", import_node_process.default.stdin.isTTY ? "TTYWrap" : "PipeWrap"]
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
const expectedResources = [import_node_process.default.stdout.isTTY ? "TTYWrap" : "PipeWrap", import_node_process.default.stderr.isTTY ? "TTYWrap" : "PipeWrap", import_node_process.default.stdin.isTTY ? "TTYWrap" : "PipeWrap"];
|
|
93
|
+
const activeResources = import_node_process.default.getActiveResourcesInfo();
|
|
94
|
+
const unexpectedActiveResources = activeResources.filter(activeResource => {
|
|
95
|
+
const index = expectedResources.indexOf(activeResource);
|
|
96
|
+
if (index >= 0) {
|
|
97
|
+
expectedResources.splice(index, 1);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
});
|
|
102
|
+
const canExitProcess = !unexpectedActiveResources.length;
|
|
103
|
+
if (canExitProcess) {
|
|
104
|
+
return debug("no active resources detected, process can safely exit");
|
|
105
|
+
}
|
|
106
|
+
debug(`process is trying to exit, but is stuck on unexpected active resources:`, unexpectedActiveResources);
|
|
107
|
+
const elapsedTime = Date.now() - startedAtMs;
|
|
108
|
+
if (elapsedTime > waitUntilExitMs) {
|
|
109
|
+
debug("active handles detected past the exit delay, forcefully exiting:", activeResources);
|
|
110
|
+
tryWarnActiveProcesses();
|
|
111
|
+
return import_node_process.default.exit(0);
|
|
112
|
+
}
|
|
83
113
|
const timeoutId = setTimeout(() => {
|
|
84
|
-
clearTimeout(timeoutId)
|
|
114
|
+
clearTimeout(timeoutId);
|
|
115
|
+
ensureProcessExitsAfterDelay(waitUntilExitMs, startedAtMs);
|
|
85
116
|
}, 100);
|
|
86
117
|
}
|
|
87
118
|
function tryWarnActiveProcesses() {
|
|
88
119
|
let activeProcesses = [];
|
|
89
120
|
try {
|
|
90
121
|
const children = import_node_process.default._getActiveHandles().filter(handle => handle instanceof import_node_child_process.ChildProcess);
|
|
91
|
-
|
|
122
|
+
if (children.length) {
|
|
123
|
+
activeProcesses = children.map(child => child.spawnargs.join(" "));
|
|
124
|
+
}
|
|
92
125
|
} catch (error) {
|
|
93
126
|
debug("failed to get active process information:", error);
|
|
94
127
|
}
|
|
95
|
-
if (!activeProcesses.length)
|
|
128
|
+
if (!activeProcesses.length) {
|
|
129
|
+
warn("Something prevented Expo from exiting, forcefully exiting now.");
|
|
130
|
+
} else {
|
|
96
131
|
const singularOrPlural = activeProcesses.length === 1 ? "1 process" : `${activeProcesses.length} processes`;
|
|
97
|
-
warn(`Detected ${singularOrPlural} preventing process from exiting, forcefully exiting now.`)
|
|
98
|
-
-
|
|
132
|
+
warn(`Detected ${singularOrPlural} preventing process from exiting, forcefully exiting now.`);
|
|
133
|
+
warn(" - " + activeProcesses.join("\n - "));
|
|
99
134
|
}
|
|
100
135
|
}
|
|
101
136
|
function guardAsync(fn) {
|
|
102
|
-
let invoked =
|
|
103
|
-
|
|
104
|
-
|
|
137
|
+
let invoked = false;
|
|
138
|
+
let returnValue;
|
|
139
|
+
const guard = async (...args) => {
|
|
140
|
+
if (!invoked) {
|
|
141
|
+
invoked = true;
|
|
142
|
+
returnValue = await fn(...args);
|
|
143
|
+
}
|
|
144
|
+
return returnValue;
|
|
145
|
+
};
|
|
146
|
+
return guard;
|
|
105
147
|
}
|
|
106
148
|
function warn(...message) {
|
|
107
149
|
console.warn(...message.map(value => import_picocolors.default.yellow(value)));
|