@vxrn/vite-plugin-metro 2.0.0-beta.33.1 → 2.0.0-beta.46.1
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 +84 -102
- package/dist/cjs/babel-plugins/import-meta-env-plugin.native.cjs +108 -0
- package/dist/cjs/babel-plugins/import-meta-env-plugin.native.js +90 -107
- package/dist/cjs/babel-plugins/import-meta-env-plugin.native.js.map +1 -1
- package/dist/cjs/env/platformEnv.cjs +55 -57
- package/dist/cjs/env/platformEnv.native.cjs +93 -0
- package/dist/cjs/env/platformEnv.native.js +72 -75
- package/dist/cjs/env/platformEnv.native.js.map +1 -1
- package/dist/cjs/index.cjs +22 -24
- package/dist/cjs/index.native.cjs +41 -0
- package/dist/cjs/index.native.js +22 -23
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.cjs +48 -51
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.cjs +101 -0
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.js +88 -94
- package/dist/cjs/metro-config/getMetroBabelConfigFromViteConfig.native.js.map +1 -1
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.cjs +249 -256
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.cjs +295 -0
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js +260 -266
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.cjs +38 -44
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.cjs +53 -0
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js +39 -44
- package/dist/cjs/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js.map +1 -1
- package/dist/cjs/metro-config/types.cjs +9 -11
- package/dist/cjs/metro-config/types.native.cjs +18 -0
- package/dist/cjs/metro-config/types.native.js +9 -10
- package/dist/cjs/metro-config/types.native.js.map +1 -1
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.cjs +44 -56
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.cjs +62 -0
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.js +45 -63
- package/dist/cjs/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
- package/dist/cjs/plugins/metroPlugin.cjs +210 -248
- package/dist/cjs/plugins/metroPlugin.native.cjs +242 -0
- package/dist/cjs/plugins/metroPlugin.native.js +216 -253
- package/dist/cjs/plugins/metroPlugin.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.cjs +56 -65
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.cjs +121 -0
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.js +94 -106
- package/dist/cjs/rn-commands/bundle/assetCatalogIOS.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/assetPathUtils.cjs +51 -55
- package/dist/cjs/rn-commands/bundle/assetPathUtils.native.cjs +72 -0
- package/dist/cjs/rn-commands/bundle/assetPathUtils.native.js +51 -54
- package/dist/cjs/rn-commands/bundle/assetPathUtils.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/buildBundle.cjs +37 -46
- package/dist/cjs/rn-commands/bundle/buildBundle.native.cjs +57 -0
- package/dist/cjs/rn-commands/bundle/buildBundle.native.js +39 -47
- package/dist/cjs/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.cjs +57 -68
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.cjs +81 -0
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.js +59 -70
- package/dist/cjs/rn-commands/bundle/buildBundleWithConfig.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.cjs +37 -39
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.cjs +70 -0
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.js +56 -59
- package/dist/cjs/rn-commands/bundle/filterPlatformAssetScales.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.cjs +20 -29
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.cjs +39 -0
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.js +20 -28
- package/dist/cjs/rn-commands/bundle/getAssetDestPathAndroid.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.cjs +20 -33
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.cjs +38 -0
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.js +20 -32
- package/dist/cjs/rn-commands/bundle/getAssetDestPathIOS.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.cjs +23 -32
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.cjs +38 -0
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.js +23 -31
- package/dist/cjs/rn-commands/bundle/getBuildBundleFn.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/index.cjs +15 -17
- package/dist/cjs/rn-commands/bundle/index.native.cjs +30 -0
- package/dist/cjs/rn-commands/bundle/index.native.js +15 -16
- package/dist/cjs/rn-commands/bundle/index.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/saveAssets.cjs +85 -96
- package/dist/cjs/rn-commands/bundle/saveAssets.native.cjs +129 -0
- package/dist/cjs/rn-commands/bundle/saveAssets.native.js +102 -114
- package/dist/cjs/rn-commands/bundle/saveAssets.native.js.map +1 -1
- package/dist/cjs/rn-commands/bundle/types.cjs +9 -11
- package/dist/cjs/rn-commands/bundle/types.native.cjs +18 -0
- package/dist/cjs/rn-commands/bundle/types.native.js +9 -10
- package/dist/cjs/rn-commands/bundle/types.native.js.map +1 -1
- package/dist/cjs/rn-commands/index.cjs +17 -26
- package/dist/cjs/rn-commands/index.native.cjs +32 -0
- package/dist/cjs/rn-commands/index.native.js +17 -25
- package/dist/cjs/rn-commands/index.native.js.map +1 -1
- package/dist/cjs/transformer/babel-core.cjs +16 -18
- package/dist/cjs/transformer/babel-core.native.cjs +30 -0
- package/dist/cjs/transformer/babel-core.native.js +16 -17
- package/dist/cjs/transformer/babel-core.native.js.map +1 -1
- package/dist/cjs/transformer/babel-transformer.cjs +101 -152
- package/dist/cjs/transformer/babel-transformer.native.cjs +131 -0
- package/dist/cjs/transformer/babel-transformer.native.js +106 -159
- package/dist/cjs/transformer/babel-transformer.native.js.map +1 -1
- package/dist/cjs/transformer/loadBabelConfig.cjs +44 -49
- package/dist/cjs/transformer/loadBabelConfig.native.cjs +64 -0
- package/dist/cjs/transformer/loadBabelConfig.native.js +48 -52
- package/dist/cjs/transformer/loadBabelConfig.native.js.map +1 -1
- package/dist/cjs/transformer/metroNativeWorker.cjs +1442 -1480
- package/dist/cjs/transformer/metroNativeWorker.native.cjs +2536 -0
- package/dist/cjs/transformer/metroNativeWorker.native.js +2416 -2552
- package/dist/cjs/transformer/metroNativeWorker.native.js.map +1 -1
- package/dist/cjs/transformer/transformSync.cjs +47 -63
- package/dist/cjs/transformer/transformSync.native.cjs +74 -0
- package/dist/cjs/transformer/transformSync.native.js +49 -64
- package/dist/cjs/transformer/transformSync.native.js.map +1 -1
- package/dist/cjs/transformer/types.cjs +9 -11
- package/dist/cjs/transformer/types.native.cjs +18 -0
- package/dist/cjs/transformer/types.native.js +9 -10
- package/dist/cjs/transformer/types.native.js.map +1 -1
- package/dist/cjs/utils/exit.cjs +141 -139
- package/dist/cjs/utils/exit.native.cjs +266 -0
- package/dist/cjs/utils/exit.native.js +228 -241
- package/dist/cjs/utils/exit.native.js.map +1 -1
- package/dist/cjs/utils/getTerminalReporter.cjs +35 -47
- package/dist/cjs/utils/getTerminalReporter.native.cjs +57 -0
- package/dist/cjs/utils/getTerminalReporter.native.js +38 -49
- package/dist/cjs/utils/getTerminalReporter.native.js.map +1 -1
- package/dist/cjs/utils/metroCacheManager.cjs +84 -99
- package/dist/cjs/utils/metroCacheManager.native.cjs +130 -0
- package/dist/cjs/utils/metroCacheManager.native.js +102 -118
- package/dist/cjs/utils/metroCacheManager.native.js.map +1 -1
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.cjs +24 -28
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.cjs +37 -0
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js +24 -27
- package/dist/cjs/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js.map +1 -1
- package/dist/cjs/utils/projectImport.cjs +40 -51
- package/dist/cjs/utils/projectImport.native.cjs +64 -0
- package/dist/cjs/utils/projectImport.native.js +41 -58
- package/dist/cjs/utils/projectImport.native.js.map +1 -1
- package/dist/esm/babel-plugins/import-meta-env-plugin.mjs +72 -86
- package/dist/esm/babel-plugins/import-meta-env-plugin.mjs.map +1 -1
- package/dist/esm/babel-plugins/import-meta-env-plugin.native.js +78 -92
- package/dist/esm/babel-plugins/import-meta-env-plugin.native.js.map +1 -1
- package/dist/esm/env/platformEnv.mjs +40 -39
- package/dist/esm/env/platformEnv.mjs.map +1 -1
- package/dist/esm/env/platformEnv.native.js +57 -58
- package/dist/esm/env/platformEnv.native.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.native.js +3 -3
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.mjs +35 -33
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.mjs.map +1 -1
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.native.js +75 -77
- package/dist/esm/metro-config/getMetroBabelConfigFromViteConfig.native.js.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs +233 -231
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js +244 -242
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.mjs +26 -26
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.mjs.map +1 -1
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js +27 -27
- package/dist/esm/metro-config/patchMetroServerWithViteConfigAndMetroPluginOptions.native.js.map +1 -1
- package/dist/esm/metro-config/types.mjs +0 -2
- package/dist/esm/metro-config/types.native.js +0 -2
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.mjs +32 -38
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.native.js +33 -46
- package/dist/esm/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
- package/dist/esm/plugins/metroPlugin.mjs +195 -222
- package/dist/esm/plugins/metroPlugin.mjs.map +1 -1
- package/dist/esm/plugins/metroPlugin.native.js +201 -228
- package/dist/esm/plugins/metroPlugin.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.mjs +38 -38
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.native.js +76 -80
- package/dist/esm/rn-commands/bundle/assetCatalogIOS.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/assetPathUtils.mjs +38 -37
- package/dist/esm/rn-commands/bundle/assetPathUtils.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/assetPathUtils.native.js +38 -37
- package/dist/esm/rn-commands/bundle/assetPathUtils.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundle.mjs +25 -28
- package/dist/esm/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundle.native.js +27 -30
- package/dist/esm/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.mjs +43 -43
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.native.js +45 -46
- package/dist/esm/rn-commands/bundle/buildBundleWithConfig.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.mjs +24 -21
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.native.js +43 -42
- package/dist/esm/rn-commands/bundle/filterPlatformAssetScales.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.mjs +5 -3
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.native.js +5 -3
- package/dist/esm/rn-commands/bundle/getAssetDestPathAndroid.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.mjs +5 -7
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.native.js +5 -7
- package/dist/esm/rn-commands/bundle/getAssetDestPathIOS.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.mjs +11 -14
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.native.js +11 -14
- package/dist/esm/rn-commands/bundle/getBuildBundleFn.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/index.mjs +2 -2
- package/dist/esm/rn-commands/bundle/index.native.js +2 -2
- package/dist/esm/rn-commands/bundle/saveAssets.mjs +70 -70
- package/dist/esm/rn-commands/bundle/saveAssets.mjs.map +1 -1
- package/dist/esm/rn-commands/bundle/saveAssets.native.js +87 -89
- package/dist/esm/rn-commands/bundle/saveAssets.native.js.map +1 -1
- package/dist/esm/rn-commands/bundle/types.mjs +0 -2
- package/dist/esm/rn-commands/bundle/types.native.js +0 -2
- package/dist/esm/rn-commands/index.mjs +2 -2
- package/dist/esm/rn-commands/index.native.js +2 -2
- package/dist/esm/transformer/babel-core.mjs +2 -2
- package/dist/esm/transformer/babel-core.native.js +2 -2
- package/dist/esm/transformer/babel-transformer.mjs +108 -144
- package/dist/esm/transformer/babel-transformer.mjs.map +1 -1
- package/dist/esm/transformer/babel-transformer.native.js +114 -155
- package/dist/esm/transformer/babel-transformer.native.js.map +1 -1
- package/dist/esm/transformer/loadBabelConfig.mjs +29 -23
- package/dist/esm/transformer/loadBabelConfig.mjs.map +1 -1
- package/dist/esm/transformer/loadBabelConfig.native.js +33 -27
- package/dist/esm/transformer/loadBabelConfig.native.js.map +1 -1
- package/dist/esm/transformer/metroNativeWorker.mjs +1405 -1434
- package/dist/esm/transformer/metroNativeWorker.mjs.map +1 -1
- package/dist/esm/transformer/metroNativeWorker.native.js +2379 -2507
- package/dist/esm/transformer/metroNativeWorker.native.js.map +1 -1
- package/dist/esm/transformer/transformSync.mjs +32 -37
- package/dist/esm/transformer/transformSync.mjs.map +1 -1
- package/dist/esm/transformer/transformSync.native.js +34 -39
- package/dist/esm/transformer/transformSync.native.js.map +1 -1
- package/dist/esm/transformer/types.mjs +0 -2
- package/dist/esm/transformer/types.native.js +0 -2
- package/dist/esm/utils/exit.mjs +123 -112
- package/dist/esm/utils/exit.mjs.map +1 -1
- package/dist/esm/utils/exit.native.js +210 -215
- package/dist/esm/utils/exit.native.js.map +1 -1
- package/dist/esm/utils/getTerminalReporter.mjs +20 -21
- package/dist/esm/utils/getTerminalReporter.mjs.map +1 -1
- package/dist/esm/utils/getTerminalReporter.native.js +23 -24
- package/dist/esm/utils/getTerminalReporter.native.js.map +1 -1
- package/dist/esm/utils/metroCacheManager.mjs +73 -82
- package/dist/esm/utils/metroCacheManager.mjs.map +1 -1
- package/dist/esm/utils/metroCacheManager.native.js +91 -102
- package/dist/esm/utils/metroCacheManager.native.js.map +1 -1
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.mjs +11 -10
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.mjs.map +1 -1
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js +11 -10
- package/dist/esm/utils/patchExpoGoManifestHandlerMiddlewareWithCustomMainModuleName.native.js.map +1 -1
- package/dist/esm/utils/projectImport.mjs +23 -25
- package/dist/esm/utils/projectImport.mjs.map +1 -1
- package/dist/esm/utils/projectImport.native.js +24 -33
- package/dist/esm/utils/projectImport.native.js.map +1 -1
- package/package.json +17 -18
- package/src/metro-config/getMetroConfigFromViteConfig.ts +46 -10
- package/src/transformer/loadBabelConfig.ts +2 -0
- package/src/transformer/metroNativeWorker.test.ts +267 -35
- package/src/transformer/metroNativeWorker.ts +3 -11
- package/types/babel-plugins/import-meta-env-plugin.d.ts.map +1 -1
- package/types/metro-config/getMetroConfigFromViteConfig.d.ts.map +1 -1
- package/types/rn-commands/bundle/assetPathUtils.d.ts.map +1 -1
- package/types/rn-commands/bundle/filterPlatformAssetScales.d.ts.map +1 -1
- package/types/rn-commands/bundle/getAssetDestPathAndroid.d.ts.map +1 -1
- package/types/rn-commands/bundle/getAssetDestPathIOS.d.ts.map +1 -1
- package/types/rn-commands/bundle/saveAssets.d.ts.map +1 -1
- package/types/transformer/loadBabelConfig.d.ts.map +1 -1
- package/types/transformer/metroNativeWorker.d.ts.map +1 -1
- package/dist/cjs/transformer/metroNativeWorker.test.cjs +0 -897
- package/dist/cjs/transformer/metroNativeWorker.test.native.js +0 -1010
- package/dist/cjs/transformer/metroNativeWorker.test.native.js.map +0 -1
- package/dist/cjs/transformer/transformSync.test.cjs +0 -36
- package/dist/cjs/transformer/transformSync.test.native.js +0 -49
- package/dist/cjs/transformer/transformSync.test.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/metro-config/types.mjs.map +0 -1
- package/dist/esm/metro-config/types.native.js.map +0 -1
- package/dist/esm/rn-commands/bundle/index.mjs.map +0 -1
- package/dist/esm/rn-commands/bundle/index.native.js.map +0 -1
- package/dist/esm/rn-commands/bundle/types.mjs.map +0 -1
- package/dist/esm/rn-commands/bundle/types.native.js.map +0 -1
- package/dist/esm/rn-commands/index.mjs.map +0 -1
- package/dist/esm/rn-commands/index.native.js.map +0 -1
- package/dist/esm/transformer/babel-core.mjs.map +0 -1
- package/dist/esm/transformer/babel-core.native.js.map +0 -1
- package/dist/esm/transformer/metroNativeWorker.test.mjs +0 -861
- package/dist/esm/transformer/metroNativeWorker.test.mjs.map +0 -1
- package/dist/esm/transformer/metroNativeWorker.test.native.js +0 -972
- package/dist/esm/transformer/metroNativeWorker.test.native.js.map +0 -1
- package/dist/esm/transformer/transformSync.test.mjs +0 -37
- package/dist/esm/transformer/transformSync.test.mjs.map +0 -1
- package/dist/esm/transformer/transformSync.test.native.js +0 -47
- package/dist/esm/transformer/transformSync.test.native.js.map +0 -1
- package/dist/esm/transformer/types.mjs.map +0 -1
- package/dist/esm/transformer/types.native.js.map +0 -1
- package/types/transformer/metroNativeWorker.test.d.ts +0 -2
- package/types/transformer/metroNativeWorker.test.d.ts.map +0 -1
- package/types/transformer/transformSync.test.d.ts +0 -2
- package/types/transformer/transformSync.test.d.ts.map +0 -1
|
@@ -5,60 +5,48 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
30
25
|
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
34
27
|
var getTerminalReporter_exports = {};
|
|
35
|
-
__export(getTerminalReporter_exports, {
|
|
36
|
-
getTerminalReporter: () => getTerminalReporter
|
|
37
|
-
});
|
|
28
|
+
__export(getTerminalReporter_exports, { getTerminalReporter: () => getTerminalReporter });
|
|
38
29
|
module.exports = __toCommonJS(getTerminalReporter_exports);
|
|
39
30
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
40
31
|
var import_projectImport = require("./projectImport.cjs");
|
|
41
32
|
async function getTerminalReporter(projectRoot) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const version = match[1];
|
|
54
|
-
metroWelcomeMessagePrinted = true;
|
|
55
|
-
return terminal._log(import_picocolors.default.dim(`
|
|
33
|
+
const { Terminal, TerminalReporter } = await (0, import_projectImport.projectImport)(projectRoot, "metro");
|
|
34
|
+
let metroWelcomeMessagePrinted = false;
|
|
35
|
+
const terminal = new Terminal(process.stdout);
|
|
36
|
+
terminal._log = terminal.log;
|
|
37
|
+
terminal.log = (message, ...rest) => {
|
|
38
|
+
if (!metroWelcomeMessagePrinted) {
|
|
39
|
+
const match = message.match(/Welcome to Metro.+v(\d+\.\d+\.\d+)/);
|
|
40
|
+
if (match) {
|
|
41
|
+
const version = match[1];
|
|
42
|
+
metroWelcomeMessagePrinted = true;
|
|
43
|
+
return terminal._log(import_picocolors.default.dim(`
|
|
56
44
|
Using Metro Bundler v${version}`), ...rest);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return terminal._log(message, ...rest);
|
|
48
|
+
};
|
|
49
|
+
const terminalReporter = new TerminalReporter(terminal);
|
|
50
|
+
terminalReporter._logInitializing = () => {};
|
|
51
|
+
return terminalReporter;
|
|
52
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
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, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getTerminalReporter_exports = {};
|
|
30
|
+
__export(getTerminalReporter_exports, { getTerminalReporter: () => getTerminalReporter });
|
|
31
|
+
module.exports = __toCommonJS(getTerminalReporter_exports);
|
|
32
|
+
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
33
|
+
var import_projectImport = require("./projectImport.native.js");
|
|
34
|
+
async function getTerminalReporter(projectRoot) {
|
|
35
|
+
var { Terminal, TerminalReporter } = await (0, import_projectImport.projectImport)(projectRoot, "metro");
|
|
36
|
+
var metroWelcomeMessagePrinted = false;
|
|
37
|
+
var terminal = new Terminal(process.stdout);
|
|
38
|
+
terminal._log = terminal.log;
|
|
39
|
+
terminal.log = function(message) {
|
|
40
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
41
|
+
rest[_key - 1] = arguments[_key];
|
|
42
|
+
}
|
|
43
|
+
if (!metroWelcomeMessagePrinted) {
|
|
44
|
+
var match = message.match(/Welcome to Metro.+v(\d+\.\d+\.\d+)/);
|
|
45
|
+
if (match) {
|
|
46
|
+
var version = match[1];
|
|
47
|
+
metroWelcomeMessagePrinted = true;
|
|
48
|
+
return terminal._log(import_picocolors.default.dim(`
|
|
49
|
+
Using Metro Bundler v${version}`), ...rest);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return terminal._log(message, ...rest);
|
|
53
|
+
};
|
|
54
|
+
var terminalReporter = new TerminalReporter(terminal);
|
|
55
|
+
terminalReporter._logInitializing = function() {};
|
|
56
|
+
return terminalReporter;
|
|
57
|
+
}
|
|
@@ -7,64 +7,53 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __export = (target, all) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
23
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
32
27
|
}) : target, mod));
|
|
33
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
-
value: true
|
|
35
|
-
}), mod);
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
29
|
var getTerminalReporter_exports = {};
|
|
37
|
-
__export(getTerminalReporter_exports, {
|
|
38
|
-
getTerminalReporter: () => getTerminalReporter
|
|
39
|
-
});
|
|
30
|
+
__export(getTerminalReporter_exports, { getTerminalReporter: () => getTerminalReporter });
|
|
40
31
|
module.exports = __toCommonJS(getTerminalReporter_exports);
|
|
41
32
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
42
33
|
var import_projectImport = require("./projectImport.native.js");
|
|
43
34
|
async function getTerminalReporter(projectRoot) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var version = match[1];
|
|
59
|
-
metroWelcomeMessagePrinted = true;
|
|
60
|
-
return terminal._log(import_picocolors.default.dim(`
|
|
35
|
+
var { Terminal, TerminalReporter } = await (0, import_projectImport.projectImport)(projectRoot, "metro");
|
|
36
|
+
var metroWelcomeMessagePrinted = false;
|
|
37
|
+
var terminal = new Terminal(process.stdout);
|
|
38
|
+
terminal._log = terminal.log;
|
|
39
|
+
terminal.log = function(message) {
|
|
40
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
41
|
+
rest[_key - 1] = arguments[_key];
|
|
42
|
+
}
|
|
43
|
+
if (!metroWelcomeMessagePrinted) {
|
|
44
|
+
var match = message.match(/Welcome to Metro.+v(\d+\.\d+\.\d+)/);
|
|
45
|
+
if (match) {
|
|
46
|
+
var version = match[1];
|
|
47
|
+
metroWelcomeMessagePrinted = true;
|
|
48
|
+
return terminal._log(import_picocolors.default.dim(`
|
|
61
49
|
Using Metro Bundler v${version}`), ...rest);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return terminal._log(message, ...rest);
|
|
53
|
+
};
|
|
54
|
+
var terminalReporter = new TerminalReporter(terminal);
|
|
55
|
+
terminalReporter._logInitializing = function() {};
|
|
56
|
+
return terminalReporter;
|
|
69
57
|
}
|
|
58
|
+
|
|
70
59
|
//# sourceMappingURL=getTerminalReporter.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getTerminalReporter.native.js","names":[],"sources":["cjs/utils/getTerminalReporter.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar getTerminalReporter_exports = {};\n__export(getTerminalReporter_exports, {\n getTerminalReporter: () => getTerminalReporter\n});\nmodule.exports = __toCommonJS(getTerminalReporter_exports);\nvar import_picocolors = __toESM(require(\"picocolors\"), 1);\nvar import_projectImport = require(\"./projectImport\");\nasync function getTerminalReporter(projectRoot) {\n var { Terminal, TerminalReporter } = await (0, import_projectImport.projectImport)(projectRoot, \"metro\");\n var metroWelcomeMessagePrinted = false;\n var terminal = new Terminal(process.stdout);\n terminal._log = terminal.log;\n terminal.log = function(message) {\n for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n rest[_key - 1] = arguments[_key];\n }\n if (!metroWelcomeMessagePrinted) {\n var match = message.match(/Welcome to Metro.+v(\\d+\\.\\d+\\.\\d+)/);\n if (match) {\n var version = match[1];\n metroWelcomeMessagePrinted = true;\n return terminal._log(import_picocolors.default.dim(`\n Using Metro Bundler v${version}`), ...rest);\n }\n }\n return terminal._log(message, ...rest);\n };\n var terminalReporter = new TerminalReporter(terminal);\n terminalReporter._logInitializing = function() {\n };\n return terminalReporter;\n}\n//# sourceMappingURL=getTerminalReporter.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAAI,QACzG,GACF;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,8BAA8B,CAAC;AACnC,SAAS,6BAA6B,EACpC,2BAA2B,oBAC7B,CAAC;AACD,OAAO,UAAU,aAAa,2BAA2B;AACzD,IAAI,oBAAoB,QAAQ,QAAQ,YAAY,GAAG,CAAC;AACxD,IAAI,uBAAuB,QAAQ,2BAAiB;AACpD,eAAe,oBAAoB,aAAa;CAC9C,IAAI,EAAE,UAAU,qBAAqB,OAAO,GAAG,qBAAqB,cAAa,CAAE,aAAa,OAAO;CACvG,IAAI,6BAA6B;CACjC,IAAI,WAAW,IAAI,SAAS,QAAQ,MAAM;CAC1C,SAAS,OAAO,SAAS;CACzB,SAAS,MAAM,SAAS,SAAS;EAC/B,KAAK,IAAI,OAAO,UAAU,QAAQ,OAAO,IAAI,MAAM,OAAO,IAAI,OAAO,IAAI,CAAC,GAAG,OAAO,GAAG,OAAO,MAAM,QAAQ;GAC1G,KAAK,OAAO,KAAK,UAAU;EAC7B;EACA,IAAI,CAAC,4BAA4B;GAC/B,IAAI,QAAQ,QAAQ,MAAM,oCAAoC;GAC9D,IAAI,OAAO;IACT,IAAI,UAAU,MAAM;IACpB,6BAA6B;IAC7B,OAAO,SAAS,KAAK,kBAAkB,QAAQ,IAAI;yBAClC,SAAS,GAAG,GAAG,IAAI;GACtC;EACF;EACA,OAAO,SAAS,KAAK,SAAS,GAAG,IAAI;CACvC;CACA,IAAI,mBAAmB,IAAI,iBAAiB,QAAQ;CACpD,iBAAiB,mBAAmB,WAAW,CAC/C;CACA,OAAO;AACT"}
|
|
@@ -3,123 +3,108 @@ 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
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
10
|
};
|
|
11
11
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
21
|
var metroCacheManager_exports = {};
|
|
24
|
-
__export(metroCacheManager_exports, {
|
|
25
|
-
checkAndClearMetroCacheFromVite: () => checkAndClearMetroCacheFromVite
|
|
26
|
-
});
|
|
22
|
+
__export(metroCacheManager_exports, { checkAndClearMetroCacheFromVite: () => checkAndClearMetroCacheFromVite });
|
|
27
23
|
module.exports = __toCommonJS(metroCacheManager_exports);
|
|
28
24
|
var import_node_fs = require("node:fs");
|
|
29
25
|
var import_node_path = require("node:path");
|
|
30
26
|
var import_debug = require("@vxrn/debug");
|
|
31
|
-
const {
|
|
32
|
-
debug
|
|
33
|
-
} = (0, import_debug.createDebugger)("vite-plugin-metro:cache");
|
|
27
|
+
const { debug } = (0, import_debug.createDebugger)("vite-plugin-metro:cache");
|
|
34
28
|
const CACHE_METADATA_FILE = "_vite_metro_metadata.json";
|
|
35
29
|
function getMetroCacheDir(root) {
|
|
36
|
-
|
|
30
|
+
return (0, import_node_path.join)(root, "node_modules", ".cache", "vite-plugin-metro");
|
|
37
31
|
}
|
|
38
32
|
function getMetroCachePaths(root) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
const paths = [];
|
|
34
|
+
paths.push((0, import_node_path.join)(root, "node_modules", ".cache", "metro"));
|
|
35
|
+
paths.push((0, import_node_path.join)(root, "node_modules", ".cache", "babel-loader"));
|
|
36
|
+
paths.push((0, import_node_path.join)(root, "node_modules", ".cache", "haste-map"));
|
|
37
|
+
return paths;
|
|
44
38
|
}
|
|
45
39
|
function readCacheMetadata(cacheDir) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
const metadataPath = (0, import_node_path.join)(cacheDir, CACHE_METADATA_FILE);
|
|
41
|
+
if (!(0, import_node_fs.existsSync)(metadataPath)) return null;
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse((0, import_node_fs.readFileSync)(metadataPath, "utf-8"));
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
53
47
|
}
|
|
54
48
|
function writeCacheMetadata(cacheDir, metadata) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
(0, import_node_fs.writeFileSync)((0, import_node_path.join)(cacheDir, CACHE_METADATA_FILE), JSON.stringify(metadata, null, 2));
|
|
49
|
+
if (!(0, import_node_fs.existsSync)(cacheDir)) {
|
|
50
|
+
(0, import_node_fs.mkdirSync)(cacheDir, { recursive: true });
|
|
51
|
+
}
|
|
52
|
+
(0, import_node_fs.writeFileSync)((0, import_node_path.join)(cacheDir, CACHE_METADATA_FILE), JSON.stringify(metadata, null, 2));
|
|
61
53
|
}
|
|
62
54
|
function clearMetroCache(root) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
const paths = getMetroCachePaths(root);
|
|
56
|
+
for (const cachePath of paths) {
|
|
57
|
+
if ((0, import_node_fs.existsSync)(cachePath)) {
|
|
58
|
+
try {
|
|
59
|
+
(0, import_node_fs.rmSync)(cachePath, {
|
|
60
|
+
recursive: true,
|
|
61
|
+
force: true
|
|
62
|
+
});
|
|
63
|
+
debug?.(`Cleared cache: ${cachePath}`);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
debug?.(`Failed to clear cache ${cachePath}: ${e}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
process.env.METRO_RESET_CACHE = "1";
|
|
78
70
|
}
|
|
79
71
|
const PLUGIN_VERSION = "1";
|
|
80
72
|
function checkAndClearMetroCacheFromVite(server, logger) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
120
|
-
clearMetroCache(root);
|
|
121
|
-
writeCacheMetadata(cacheDir, currentMetadata);
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
73
|
+
const { root } = server.config;
|
|
74
|
+
const cacheDir = getMetroCacheDir(root);
|
|
75
|
+
const depsOptimizer = server.environments.client?.depsOptimizer;
|
|
76
|
+
if (!depsOptimizer) {
|
|
77
|
+
debug?.("No depsOptimizer available, skipping Metro cache check");
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const { lockfileHash, configHash } = depsOptimizer.metadata;
|
|
81
|
+
const currentMetadata = {
|
|
82
|
+
lockfileHash,
|
|
83
|
+
configHash,
|
|
84
|
+
pluginVersion: PLUGIN_VERSION
|
|
85
|
+
};
|
|
86
|
+
const cachedMetadata = readCacheMetadata(cacheDir);
|
|
87
|
+
let shouldClear = false;
|
|
88
|
+
let reason = "";
|
|
89
|
+
if (!cachedMetadata) {
|
|
90
|
+
writeCacheMetadata(cacheDir, currentMetadata);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (cachedMetadata.pluginVersion !== PLUGIN_VERSION) {
|
|
94
|
+
shouldClear = true;
|
|
95
|
+
reason = "vite-plugin-metro was updated";
|
|
96
|
+
} else if (cachedMetadata.lockfileHash !== lockfileHash) {
|
|
97
|
+
shouldClear = true;
|
|
98
|
+
reason = "lockfile has changed";
|
|
99
|
+
} else if (cachedMetadata.configHash !== configHash) {
|
|
100
|
+
shouldClear = true;
|
|
101
|
+
reason = "vite config has changed";
|
|
102
|
+
}
|
|
103
|
+
if (shouldClear) {
|
|
104
|
+
logger.info(`Clearing Metro cache because ${reason}`, { timestamp: true });
|
|
105
|
+
clearMetroCache(root);
|
|
106
|
+
writeCacheMetadata(cacheDir, currentMetadata);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
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, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var metroCacheManager_exports = {};
|
|
24
|
+
__export(metroCacheManager_exports, { checkAndClearMetroCacheFromVite: () => checkAndClearMetroCacheFromVite });
|
|
25
|
+
module.exports = __toCommonJS(metroCacheManager_exports);
|
|
26
|
+
var import_fs = require("fs");
|
|
27
|
+
var import_path = require("path");
|
|
28
|
+
var import_debug = require("@vxrn/debug");
|
|
29
|
+
var { debug } = (0, import_debug.createDebugger)("vite-plugin-metro:cache");
|
|
30
|
+
var CACHE_METADATA_FILE = "_vite_metro_metadata.json";
|
|
31
|
+
function getMetroCacheDir(root) {
|
|
32
|
+
return (0, import_path.join)(root, "node_modules", ".cache", "vite-plugin-metro");
|
|
33
|
+
}
|
|
34
|
+
function getMetroCachePaths(root) {
|
|
35
|
+
var paths = [];
|
|
36
|
+
paths.push((0, import_path.join)(root, "node_modules", ".cache", "metro"));
|
|
37
|
+
paths.push((0, import_path.join)(root, "node_modules", ".cache", "babel-loader"));
|
|
38
|
+
paths.push((0, import_path.join)(root, "node_modules", ".cache", "haste-map"));
|
|
39
|
+
return paths;
|
|
40
|
+
}
|
|
41
|
+
function readCacheMetadata(cacheDir) {
|
|
42
|
+
var metadataPath = (0, import_path.join)(cacheDir, CACHE_METADATA_FILE);
|
|
43
|
+
if (!(0, import_fs.existsSync)(metadataPath)) return null;
|
|
44
|
+
try {
|
|
45
|
+
return JSON.parse((0, import_fs.readFileSync)(metadataPath, "utf-8"));
|
|
46
|
+
} catch (unused) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function writeCacheMetadata(cacheDir, metadata) {
|
|
51
|
+
if (!(0, import_fs.existsSync)(cacheDir)) {
|
|
52
|
+
(0, import_fs.mkdirSync)(cacheDir, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
(0, import_fs.writeFileSync)((0, import_path.join)(cacheDir, CACHE_METADATA_FILE), JSON.stringify(metadata, null, 2));
|
|
55
|
+
}
|
|
56
|
+
function clearMetroCache(root) {
|
|
57
|
+
var paths = getMetroCachePaths(root);
|
|
58
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
59
|
+
try {
|
|
60
|
+
for (var _iterator = paths[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
61
|
+
var cachePath = _step.value;
|
|
62
|
+
if ((0, import_fs.existsSync)(cachePath)) {
|
|
63
|
+
try {
|
|
64
|
+
(0, import_fs.rmSync)(cachePath, {
|
|
65
|
+
recursive: true,
|
|
66
|
+
force: true
|
|
67
|
+
});
|
|
68
|
+
debug === null || debug === void 0 ? void 0 : debug(`Cleared cache: ${cachePath}`);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
debug === null || debug === void 0 ? void 0 : debug(`Failed to clear cache ${cachePath}: ${e}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
_didIteratorError = true;
|
|
76
|
+
_iteratorError = err;
|
|
77
|
+
} finally {
|
|
78
|
+
try {
|
|
79
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
80
|
+
_iterator.return();
|
|
81
|
+
}
|
|
82
|
+
} finally {
|
|
83
|
+
if (_didIteratorError) {
|
|
84
|
+
throw _iteratorError;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
process.env.METRO_RESET_CACHE = "1";
|
|
89
|
+
}
|
|
90
|
+
var PLUGIN_VERSION = "1";
|
|
91
|
+
function checkAndClearMetroCacheFromVite(server, logger) {
|
|
92
|
+
var _server_environments_client;
|
|
93
|
+
var { root } = server.config;
|
|
94
|
+
var cacheDir = getMetroCacheDir(root);
|
|
95
|
+
var depsOptimizer = (_server_environments_client = server.environments.client) === null || _server_environments_client === void 0 ? void 0 : _server_environments_client.depsOptimizer;
|
|
96
|
+
if (!depsOptimizer) {
|
|
97
|
+
debug === null || debug === void 0 ? void 0 : debug("No depsOptimizer available, skipping Metro cache check");
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
var { lockfileHash, configHash } = depsOptimizer.metadata;
|
|
101
|
+
var currentMetadata = {
|
|
102
|
+
lockfileHash,
|
|
103
|
+
configHash,
|
|
104
|
+
pluginVersion: PLUGIN_VERSION
|
|
105
|
+
};
|
|
106
|
+
var cachedMetadata = readCacheMetadata(cacheDir);
|
|
107
|
+
var shouldClear = false;
|
|
108
|
+
var reason = "";
|
|
109
|
+
if (!cachedMetadata) {
|
|
110
|
+
writeCacheMetadata(cacheDir, currentMetadata);
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (cachedMetadata.pluginVersion !== PLUGIN_VERSION) {
|
|
114
|
+
shouldClear = true;
|
|
115
|
+
reason = "vite-plugin-metro was updated";
|
|
116
|
+
} else if (cachedMetadata.lockfileHash !== lockfileHash) {
|
|
117
|
+
shouldClear = true;
|
|
118
|
+
reason = "lockfile has changed";
|
|
119
|
+
} else if (cachedMetadata.configHash !== configHash) {
|
|
120
|
+
shouldClear = true;
|
|
121
|
+
reason = "vite config has changed";
|
|
122
|
+
}
|
|
123
|
+
if (shouldClear) {
|
|
124
|
+
logger.info(`Clearing Metro cache because ${reason}`, { timestamp: true });
|
|
125
|
+
clearMetroCache(root);
|
|
126
|
+
writeCacheMetadata(cacheDir, currentMetadata);
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|