vxrn 1.27.1 → 2.0.0-beta.45.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/cli.mjs +212 -261
- package/dist/cli.mjs.map +1 -1
- package/dist/cli.native.js +216 -265
- package/dist/cli.native.js.map +1 -1
- package/dist/config/getAdditionalViteConfig.mjs +33 -62
- package/dist/config/getAdditionalViteConfig.mjs.map +1 -1
- package/dist/config/getAdditionalViteConfig.native.js +33 -62
- package/dist/config/getAdditionalViteConfig.native.js.map +1 -1
- package/dist/config/getBaseViteConfigOnly.mjs +84 -77
- package/dist/config/getBaseViteConfigOnly.mjs.map +1 -1
- package/dist/config/getBaseViteConfigOnly.native.js +86 -79
- package/dist/config/getBaseViteConfigOnly.native.js.map +1 -1
- package/dist/config/getBaseViteConfigWithPlugins.mjs +6 -4
- package/dist/config/getBaseViteConfigWithPlugins.mjs.map +1 -1
- package/dist/config/getBaseViteConfigWithPlugins.native.js +6 -4
- package/dist/config/getBaseViteConfigWithPlugins.native.js.map +1 -1
- package/dist/config/getBaseVitePlugins.mjs +102 -130
- package/dist/config/getBaseVitePlugins.mjs.map +1 -1
- package/dist/config/getBaseVitePlugins.native.js +123 -152
- package/dist/config/getBaseVitePlugins.native.js.map +1 -1
- package/dist/config/getNonCliModeOnlyVitePlugins.mjs +3 -3
- package/dist/config/getNonCliModeOnlyVitePlugins.mjs.map +1 -1
- package/dist/config/getNonCliModeOnlyVitePlugins.native.js +3 -1
- package/dist/config/getNonCliModeOnlyVitePlugins.native.js.map +1 -1
- package/dist/config/getOptimizeDeps.mjs +138 -42
- package/dist/config/getOptimizeDeps.mjs.map +1 -1
- package/dist/config/getOptimizeDeps.native.js +138 -42
- package/dist/config/getOptimizeDeps.native.js.map +1 -1
- package/dist/config/getOptionsFilled.mjs +48 -52
- package/dist/config/getOptionsFilled.mjs.map +1 -1
- package/dist/config/getOptionsFilled.native.js +51 -55
- package/dist/config/getOptionsFilled.native.js.map +1 -1
- package/dist/config/getReactNativePlugins.mjs +23 -15
- package/dist/config/getReactNativePlugins.mjs.map +1 -1
- package/dist/config/getReactNativePlugins.native.js +25 -16
- package/dist/config/getReactNativePlugins.native.js.map +1 -1
- package/dist/config/getServerOptionsFilled.mjs +33 -35
- package/dist/config/getServerOptionsFilled.mjs.map +1 -1
- package/dist/config/getServerOptionsFilled.native.js +35 -38
- package/dist/config/getServerOptionsFilled.native.js.map +1 -1
- package/dist/config/getViteServerConfig.mjs +34 -45
- package/dist/config/getViteServerConfig.mjs.map +1 -1
- package/dist/config/getViteServerConfig.native.js +35 -46
- package/dist/config/getViteServerConfig.native.js.map +1 -1
- package/dist/config/mergeUserConfig.mjs +50 -28
- package/dist/config/mergeUserConfig.mjs.map +1 -1
- package/dist/config/mergeUserConfig.native.js +60 -38
- package/dist/config/mergeUserConfig.native.js.map +1 -1
- package/dist/constants/defaults.mjs +29 -12
- package/dist/constants/defaults.mjs.map +1 -1
- package/dist/constants/defaults.native.js +29 -12
- package/dist/constants/defaults.native.js.map +1 -1
- package/dist/constants.mjs +41 -6
- package/dist/constants.mjs.map +1 -1
- package/dist/constants.native.js +41 -6
- package/dist/constants.native.js.map +1 -1
- package/dist/exports/build.mjs +218 -270
- package/dist/exports/build.mjs.map +1 -1
- package/dist/exports/build.native.js +226 -283
- package/dist/exports/build.native.js.map +1 -1
- package/dist/exports/clean.mjs +71 -78
- package/dist/exports/clean.mjs.map +1 -1
- package/dist/exports/clean.native.js +76 -90
- package/dist/exports/clean.native.js.map +1 -1
- package/dist/exports/createServer.mjs +43 -46
- package/dist/exports/createServer.mjs.map +1 -1
- package/dist/exports/createServer.native.js +45 -48
- package/dist/exports/createServer.native.js.map +1 -1
- package/dist/exports/dev.mjs +177 -201
- package/dist/exports/dev.mjs.map +1 -1
- package/dist/exports/dev.native.js +191 -215
- package/dist/exports/dev.native.js.map +1 -1
- package/dist/exports/loadEnv.mjs +51 -48
- package/dist/exports/loadEnv.mjs.map +1 -1
- package/dist/exports/loadEnv.native.js +59 -57
- package/dist/exports/loadEnv.native.js.map +1 -1
- package/dist/exports/patch.mjs +9 -7
- package/dist/exports/patch.mjs.map +1 -1
- package/dist/exports/patch.native.js +9 -7
- package/dist/exports/patch.native.js.map +1 -1
- package/dist/exports/prebuild.mjs +177 -157
- package/dist/exports/prebuild.mjs.map +1 -1
- package/dist/exports/prebuild.native.js +197 -160
- package/dist/exports/prebuild.native.js.map +1 -1
- package/dist/exports/prebuildWithoutExpo.mjs +46 -44
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -1
- package/dist/exports/prebuildWithoutExpo.native.js +48 -46
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -1
- package/dist/exports/runAndroid.mjs +9 -10
- package/dist/exports/runAndroid.mjs.map +1 -1
- package/dist/exports/runAndroid.native.js +10 -11
- package/dist/exports/runAndroid.native.js.map +1 -1
- package/dist/exports/runIos.mjs +9 -10
- package/dist/exports/runIos.mjs.map +1 -1
- package/dist/exports/runIos.native.js +10 -11
- package/dist/exports/runIos.native.js.map +1 -1
- package/dist/exports/serve.mjs +23 -31
- package/dist/exports/serve.mjs.map +1 -1
- package/dist/exports/serve.native.js +26 -34
- package/dist/exports/serve.native.js.map +1 -1
- package/dist/exports/serveStaticAssets.mjs +109 -113
- package/dist/exports/serveStaticAssets.mjs.map +1 -1
- package/dist/exports/serveStaticAssets.native.js +180 -192
- package/dist/exports/serveStaticAssets.native.js.map +1 -1
- package/dist/index.js +25 -14
- package/dist/index.mjs +25 -14
- package/dist/index.native.js +25 -14
- package/dist/patches/builtInDepPatches.mjs +346 -435
- package/dist/patches/builtInDepPatches.mjs.map +1 -1
- package/dist/patches/builtInDepPatches.native.js +349 -438
- package/dist/patches/builtInDepPatches.native.js.map +1 -1
- package/dist/plugins/applyBuiltInPatchesPlugin.mjs +11 -11
- package/dist/plugins/applyBuiltInPatchesPlugin.mjs.map +1 -1
- package/dist/plugins/applyBuiltInPatchesPlugin.native.js +11 -11
- package/dist/plugins/applyBuiltInPatchesPlugin.native.js.map +1 -1
- package/dist/plugins/autoDepOptimizePlugin.mjs +87 -90
- package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -1
- package/dist/plugins/autoDepOptimizePlugin.native.js +99 -102
- package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -1
- package/dist/plugins/clientInjectPlugin.mjs +13 -11
- package/dist/plugins/clientInjectPlugin.mjs.map +1 -1
- package/dist/plugins/clientInjectPlugin.native.js +13 -11
- package/dist/plugins/clientInjectPlugin.native.js.map +1 -1
- package/dist/plugins/defaultDepOptimizePlugin.mjs +15 -23
- package/dist/plugins/defaultDepOptimizePlugin.mjs.map +1 -1
- package/dist/plugins/defaultDepOptimizePlugin.native.js +15 -23
- package/dist/plugins/defaultDepOptimizePlugin.native.js.map +1 -1
- package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +163 -179
- package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -1
- package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +169 -191
- package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -1
- package/dist/plugins/getResolvedConfigSubset.mjs +6 -5
- package/dist/plugins/getResolvedConfigSubset.mjs.map +1 -1
- package/dist/plugins/getResolvedConfigSubset.native.js +6 -5
- package/dist/plugins/getResolvedConfigSubset.native.js.map +1 -1
- package/dist/plugins/reactNativeCommonJsPlugin.mjs +210 -178
- package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -1
- package/dist/plugins/reactNativeCommonJsPlugin.native.js +283 -259
- package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -1
- package/dist/plugins/reactNativeDevAssetPlugin.mjs +72 -83
- package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -1
- package/dist/plugins/reactNativeDevAssetPlugin.native.js +75 -92
- package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -1
- package/dist/plugins/reactNativeDevServer.mjs +283 -328
- package/dist/plugins/reactNativeDevServer.mjs.map +1 -1
- package/dist/plugins/reactNativeDevServer.native.js +332 -391
- package/dist/plugins/reactNativeDevServer.native.js.map +1 -1
- package/dist/plugins/rnCodegenPlugin.mjs +13 -12
- package/dist/plugins/rnCodegenPlugin.mjs.map +1 -1
- package/dist/plugins/rnCodegenPlugin.native.js +13 -12
- package/dist/plugins/rnCodegenPlugin.native.js.map +1 -1
- package/dist/plugins/rollupRemoveUnusedImports.mjs +8 -7
- package/dist/plugins/rollupRemoveUnusedImports.mjs.map +1 -1
- package/dist/plugins/rollupRemoveUnusedImports.native.js +8 -7
- package/dist/plugins/rollupRemoveUnusedImports.native.js.map +1 -1
- package/dist/plugins/workletImportsPlugin.mjs +127 -132
- package/dist/plugins/workletImportsPlugin.mjs.map +1 -1
- package/dist/plugins/workletImportsPlugin.native.js +192 -203
- package/dist/plugins/workletImportsPlugin.native.js.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.mjs +45 -79
- package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -1
- package/dist/rn-commands/bundle/buildBundle.native.js +45 -85
- package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -1
- package/dist/runtime/hmr-client.mjs +133 -140
- package/dist/runtime/hmr-client.mjs.map +1 -1
- package/dist/runtime/hmr-client.native.js +223 -222
- package/dist/runtime/hmr-client.native.js.map +1 -1
- package/dist/runtime/hmr-runtime.mjs +192 -194
- package/dist/runtime/hmr-runtime.mjs.map +1 -1
- package/dist/runtime/hmr-runtime.native.js +424 -411
- package/dist/runtime/hmr-runtime.native.js.map +1 -1
- package/dist/runtime/hmr-types.mjs +0 -2
- package/dist/runtime/hmr-types.native.js +0 -2
- package/dist/runtime/native-prelude.mjs +2 -1
- package/dist/runtime/native-prelude.mjs.map +1 -1
- package/dist/runtime/native-prelude.native.js +2 -1
- package/dist/runtime/native-prelude.native.js.map +1 -1
- package/dist/runtime/react-refresh-utils.mjs +23 -22
- package/dist/runtime/react-refresh-utils.mjs.map +1 -1
- package/dist/runtime/react-refresh-utils.native.js +23 -27
- package/dist/runtime/react-refresh-utils.native.js.map +1 -1
- package/dist/serve/node.mjs +49 -49
- package/dist/serve/node.mjs.map +1 -1
- package/dist/serve/node.native.js +92 -96
- package/dist/serve/node.native.js.map +1 -1
- package/dist/types.mjs +0 -2
- package/dist/types.native.js +0 -2
- package/dist/user-interface/index.mjs +245 -262
- package/dist/user-interface/index.mjs.map +1 -1
- package/dist/user-interface/index.native.js +274 -298
- package/dist/user-interface/index.native.js.map +1 -1
- package/dist/utils/assert.mjs +7 -6
- package/dist/utils/assert.mjs.map +1 -1
- package/dist/utils/assert.native.js +7 -18
- package/dist/utils/assert.native.js.map +1 -1
- package/dist/utils/bindKeypressInput.mjs +36 -38
- package/dist/utils/bindKeypressInput.mjs.map +1 -1
- package/dist/utils/bindKeypressInput.native.js +36 -38
- package/dist/utils/bindKeypressInput.native.js.map +1 -1
- package/dist/utils/coerceToArray.mjs +2 -1
- package/dist/utils/coerceToArray.mjs.map +1 -1
- package/dist/utils/coerceToArray.native.js +2 -1
- package/dist/utils/coerceToArray.native.js.map +1 -1
- package/dist/utils/connectedNativeClients.mjs +3 -2
- package/dist/utils/connectedNativeClients.mjs.map +1 -1
- package/dist/utils/connectedNativeClients.native.js +3 -2
- package/dist/utils/connectedNativeClients.native.js.map +1 -1
- package/dist/utils/createNativeDevEngine.mjs +992 -966
- package/dist/utils/createNativeDevEngine.mjs.map +1 -1
- package/dist/utils/createNativeDevEngine.native.js +1184 -1179
- package/dist/utils/createNativeDevEngine.native.js.map +1 -1
- package/dist/utils/dispose.mjs +4 -3
- package/dist/utils/dispose.mjs.map +1 -1
- package/dist/utils/dispose.native.js +6 -5
- package/dist/utils/dispose.native.js.map +1 -1
- package/dist/utils/environmentUtils.mjs +5 -4
- package/dist/utils/environmentUtils.mjs.map +1 -1
- package/dist/utils/environmentUtils.native.js +5 -4
- package/dist/utils/environmentUtils.native.js.map +1 -1
- package/dist/utils/execSync.mjs +7 -5
- package/dist/utils/execSync.mjs.map +1 -1
- package/dist/utils/execSync.native.js +8 -6
- package/dist/utils/execSync.native.js.map +1 -1
- package/dist/utils/expoRun.mjs +27 -35
- package/dist/utils/expoRun.mjs.map +1 -1
- package/dist/utils/expoRun.native.js +27 -35
- package/dist/utils/expoRun.native.js.map +1 -1
- package/dist/utils/filterViteServerResolvedUrls.mjs +24 -22
- package/dist/utils/filterViteServerResolvedUrls.mjs.map +1 -1
- package/dist/utils/filterViteServerResolvedUrls.native.js +61 -63
- package/dist/utils/filterViteServerResolvedUrls.native.js.map +1 -1
- package/dist/utils/getBoundPort.mjs +6 -5
- package/dist/utils/getBoundPort.mjs.map +1 -1
- package/dist/utils/getBoundPort.native.js +8 -12
- package/dist/utils/getBoundPort.native.js.map +1 -1
- package/dist/utils/getCacheDir.mjs +3 -1
- package/dist/utils/getCacheDir.mjs.map +1 -1
- package/dist/utils/getCacheDir.native.js +3 -1
- package/dist/utils/getCacheDir.native.js.map +1 -1
- package/dist/utils/getServerEntry.mjs +6 -4
- package/dist/utils/getServerEntry.mjs.map +1 -1
- package/dist/utils/getServerEntry.native.js +8 -11
- package/dist/utils/getServerEntry.native.js.map +1 -1
- package/dist/utils/getVitePath.mjs +42 -42
- package/dist/utils/getVitePath.mjs.map +1 -1
- package/dist/utils/getVitePath.native.js +43 -41
- package/dist/utils/getVitePath.native.js.map +1 -1
- package/dist/utils/globDir.mjs +7 -11
- package/dist/utils/globDir.mjs.map +1 -1
- package/dist/utils/globDir.native.js +10 -14
- package/dist/utils/globDir.native.js.map +1 -1
- package/dist/utils/isWithin.mjs +4 -2
- package/dist/utils/isWithin.mjs.map +1 -1
- package/dist/utils/isWithin.native.js +4 -2
- package/dist/utils/isWithin.native.js.map +1 -1
- package/dist/utils/patches.mjs +233 -255
- package/dist/utils/patches.mjs.map +1 -1
- package/dist/utils/patches.native.js +415 -460
- package/dist/utils/patches.native.js.map +1 -1
- package/dist/utils/printServerUrls.mjs +9 -7
- package/dist/utils/printServerUrls.mjs.map +1 -1
- package/dist/utils/printServerUrls.native.js +48 -51
- package/dist/utils/printServerUrls.native.js.map +1 -1
- package/dist/utils/removeUndefined.mjs +8 -7
- package/dist/utils/removeUndefined.mjs.map +1 -1
- package/dist/utils/removeUndefined.native.js +8 -7
- package/dist/utils/removeUndefined.native.js.map +1 -1
- package/dist/utils/scanDepsToOptimize.mjs +194 -161
- package/dist/utils/scanDepsToOptimize.mjs.map +1 -1
- package/dist/utils/scanDepsToOptimize.native.js +227 -197
- package/dist/utils/scanDepsToOptimize.native.js.map +1 -1
- package/dist/utils/state.mjs +18 -18
- package/dist/utils/state.mjs.map +1 -1
- package/dist/utils/state.native.js +18 -18
- package/dist/utils/state.native.js.map +1 -1
- package/dist/utils/symbolicateNativeStack.mjs +54 -54
- package/dist/utils/symbolicateNativeStack.mjs.map +1 -1
- package/dist/utils/symbolicateNativeStack.native.js +58 -58
- package/dist/utils/symbolicateNativeStack.native.js.map +1 -1
- package/dist/utils/uniq.mjs +2 -1
- package/dist/utils/uniq.mjs.map +1 -1
- package/dist/utils/uniq.native.js +2 -1
- package/dist/utils/uniq.native.js.map +1 -1
- package/dist/utils/utils.mjs +19 -19
- package/dist/utils/utils.mjs.map +1 -1
- package/dist/utils/utils.native.js +38 -40
- package/dist/utils/utils.native.js.map +1 -1
- package/dist/vendor/debugger-app/index.mjs +0 -2
- package/dist/vendor/debugger-app/index.native.js +0 -2
- package/dist/vendor/debugger-app/src/debuggerWorker.mjs +0 -2
- package/dist/vendor/debugger-app/src/debuggerWorker.native.js +0 -2
- package/dist/vendor/debugger-app/src/index.mjs +0 -2
- package/dist/vendor/debugger-app/src/index.native.js +0 -2
- package/dist/vxrn-vite-plugin.mjs +34 -33
- package/dist/vxrn-vite-plugin.mjs.map +1 -1
- package/dist/vxrn-vite-plugin.native.js +35 -34
- package/dist/vxrn-vite-plugin.native.js.map +1 -1
- package/expo-plugin.cjs +12 -6
- package/package.json +12 -13
- package/src/config/getBaseViteConfigOnly.ts +6 -0
- package/src/exports/prebuild.ts +40 -12
- package/src/patches/builtInDepPatches.ts +24 -48
- package/src/utils/createNativeDevEngine.test.ts +1 -1
- package/src/utils/createNativeDevEngine.ts +15 -9
- package/src/utils/scanDepsToOptimize.ts +0 -3
- package/types/config/getBaseViteConfigOnly.d.ts.map +1 -1
- package/types/config/getOptimizeDeps.d.ts.map +1 -1
- package/types/config/getOptionsFilled.d.ts +15 -15
- package/types/config/getOptionsFilled.d.ts.map +1 -1
- package/types/exports/build.d.ts +11 -11
- package/types/exports/build.d.ts.map +1 -1
- package/types/exports/clean.d.ts +1 -1
- package/types/exports/clean.d.ts.map +1 -1
- package/types/exports/createServer.d.ts.map +1 -1
- package/types/exports/dev.d.ts.map +1 -1
- package/types/exports/patch.d.ts.map +1 -1
- package/types/exports/prebuild.d.ts +3 -3
- package/types/exports/prebuild.d.ts.map +1 -1
- package/types/exports/prebuildWithoutExpo.d.ts +1 -1
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -1
- package/types/exports/runAndroid.d.ts.map +1 -1
- package/types/exports/runIos.d.ts.map +1 -1
- package/types/exports/serve.d.ts.map +1 -1
- package/types/patches/builtInDepPatches.d.ts.map +1 -1
- package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -1
- package/types/plugins/rollupRemoveUnusedImports.d.ts.map +1 -1
- package/types/runtime/hmr-client.d.ts.map +1 -1
- package/types/runtime/hmr-runtime.d.ts.map +1 -1
- package/types/runtime/hmr-types.d.ts.map +1 -1
- package/types/utils/createNativeDevEngine.d.ts +1 -1
- package/types/utils/createNativeDevEngine.d.ts.map +1 -1
- package/types/utils/execSync.d.ts.map +1 -1
- package/types/utils/getServerEntry.d.ts.map +1 -1
- package/types/utils/scanDepsToOptimize.d.ts.map +1 -1
- package/types/vxrn-vite-plugin.d.ts.map +1 -1
- package/dist/config/getOptimizeDeps.test.mjs +0 -20
- package/dist/config/getOptimizeDeps.test.mjs.map +0 -1
- package/dist/config/getOptimizeDeps.test.native.js +0 -39
- package/dist/config/getOptimizeDeps.test.native.js.map +0 -1
- package/dist/config/getServerOptionsFilled.test.mjs +0 -20
- package/dist/config/getServerOptionsFilled.test.mjs.map +0 -1
- package/dist/config/getServerOptionsFilled.test.native.js +0 -20
- package/dist/config/getServerOptionsFilled.test.native.js.map +0 -1
- package/dist/config/getViteServerConfig.test.mjs +0 -26
- package/dist/config/getViteServerConfig.test.mjs.map +0 -1
- package/dist/config/getViteServerConfig.test.native.js +0 -26
- package/dist/config/getViteServerConfig.test.native.js.map +0 -1
- package/dist/config/mergeUserConfig.test.mjs +0 -108
- package/dist/config/mergeUserConfig.test.mjs.map +0 -1
- package/dist/config/mergeUserConfig.test.native.js +0 -108
- package/dist/config/mergeUserConfig.test.native.js.map +0 -1
- package/dist/exports/clean.test.mjs +0 -81
- package/dist/exports/clean.test.mjs.map +0 -1
- package/dist/exports/clean.test.native.js +0 -88
- package/dist/exports/clean.test.native.js.map +0 -1
- package/dist/exports/loadEnv.test.mjs +0 -65
- package/dist/exports/loadEnv.test.mjs.map +0 -1
- package/dist/exports/loadEnv.test.native.js +0 -65
- package/dist/exports/loadEnv.test.native.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/index.native.js.map +0 -1
- package/dist/plugins/autoDepOptimizePlugin.test.mjs +0 -31
- package/dist/plugins/autoDepOptimizePlugin.test.mjs.map +0 -1
- package/dist/plugins/autoDepOptimizePlugin.test.native.js +0 -39
- package/dist/plugins/autoDepOptimizePlugin.test.native.js.map +0 -1
- package/dist/plugins/resolveIdScan.test.mjs +0 -31
- package/dist/plugins/resolveIdScan.test.mjs.map +0 -1
- package/dist/plugins/resolveIdScan.test.native.js +0 -38
- package/dist/plugins/resolveIdScan.test.native.js.map +0 -1
- package/dist/plugins/rnCodegenPlugin.test.mjs +0 -239
- package/dist/plugins/rnCodegenPlugin.test.mjs.map +0 -1
- package/dist/plugins/rnCodegenPlugin.test.native.js +0 -242
- package/dist/plugins/rnCodegenPlugin.test.native.js.map +0 -1
- package/dist/plugins/serverExtensions.test.mjs +0 -106
- package/dist/plugins/serverExtensions.test.mjs.map +0 -1
- package/dist/plugins/serverExtensions.test.native.js +0 -117
- package/dist/plugins/serverExtensions.test.native.js.map +0 -1
- package/dist/runtime/hmr-types.mjs.map +0 -1
- package/dist/runtime/hmr-types.native.js.map +0 -1
- package/dist/serve/node.test.mjs +0 -60
- package/dist/serve/node.test.mjs.map +0 -1
- package/dist/serve/node.test.native.js +0 -72
- package/dist/serve/node.test.native.js.map +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/types.native.js.map +0 -1
- package/dist/utils/bindKeypressInput.test.mjs +0 -48
- package/dist/utils/bindKeypressInput.test.mjs.map +0 -1
- package/dist/utils/bindKeypressInput.test.native.js +0 -48
- package/dist/utils/bindKeypressInput.test.native.js.map +0 -1
- package/dist/utils/createNativeDevEngine.test.mjs +0 -1788
- package/dist/utils/createNativeDevEngine.test.mjs.map +0 -1
- package/dist/utils/createNativeDevEngine.test.native.js +0 -1942
- package/dist/utils/createNativeDevEngine.test.native.js.map +0 -1
- package/dist/utils/createNativeDevEngineFailure.test.mjs +0 -44
- package/dist/utils/createNativeDevEngineFailure.test.mjs.map +0 -1
- package/dist/utils/createNativeDevEngineFailure.test.native.js +0 -54
- package/dist/utils/createNativeDevEngineFailure.test.native.js.map +0 -1
- package/dist/utils/getBoundPort.test.mjs +0 -71
- package/dist/utils/getBoundPort.test.mjs.map +0 -1
- package/dist/utils/getBoundPort.test.native.js +0 -82
- package/dist/utils/getBoundPort.test.native.js.map +0 -1
- package/dist/utils/imageSizePatch.test.mjs +0 -29
- package/dist/utils/imageSizePatch.test.mjs.map +0 -1
- package/dist/utils/imageSizePatch.test.native.js +0 -30
- package/dist/utils/imageSizePatch.test.native.js.map +0 -1
- package/dist/utils/patches.test.mjs +0 -242
- package/dist/utils/patches.test.mjs.map +0 -1
- package/dist/utils/patches.test.native.js +0 -271
- package/dist/utils/patches.test.native.js.map +0 -1
- package/dist/utils/symbolicateNativeStack.test.mjs +0 -96
- package/dist/utils/symbolicateNativeStack.test.mjs.map +0 -1
- package/dist/utils/symbolicateNativeStack.test.native.js +0 -96
- package/dist/utils/symbolicateNativeStack.test.native.js.map +0 -1
- package/dist/vendor/debugger-app/index.mjs.map +0 -1
- package/dist/vendor/debugger-app/index.native.js.map +0 -1
- package/dist/vendor/debugger-app/src/debuggerWorker.mjs.map +0 -1
- package/dist/vendor/debugger-app/src/debuggerWorker.native.js.map +0 -1
- package/dist/vendor/debugger-app/src/index.mjs.map +0 -1
- package/dist/vendor/debugger-app/src/index.native.js.map +0 -1
- package/types/config/getOptimizeDeps.test.d.ts +0 -2
- package/types/config/getOptimizeDeps.test.d.ts.map +0 -1
- package/types/config/getServerOptionsFilled.test.d.ts +0 -2
- package/types/config/getServerOptionsFilled.test.d.ts.map +0 -1
- package/types/config/getViteServerConfig.test.d.ts +0 -2
- package/types/config/getViteServerConfig.test.d.ts.map +0 -1
- package/types/config/mergeUserConfig.test.d.ts +0 -2
- package/types/config/mergeUserConfig.test.d.ts.map +0 -1
- package/types/exports/clean.test.d.ts +0 -2
- package/types/exports/clean.test.d.ts.map +0 -1
- package/types/exports/loadEnv.test.d.ts +0 -2
- package/types/exports/loadEnv.test.d.ts.map +0 -1
- package/types/plugins/autoDepOptimizePlugin.test.d.ts +0 -2
- package/types/plugins/autoDepOptimizePlugin.test.d.ts.map +0 -1
- package/types/plugins/resolveIdScan.test.d.ts +0 -2
- package/types/plugins/resolveIdScan.test.d.ts.map +0 -1
- package/types/plugins/rnCodegenPlugin.test.d.ts +0 -2
- package/types/plugins/rnCodegenPlugin.test.d.ts.map +0 -1
- package/types/plugins/serverExtensions.test.d.ts +0 -2
- package/types/plugins/serverExtensions.test.d.ts.map +0 -1
- package/types/serve/node.test.d.ts +0 -2
- package/types/serve/node.test.d.ts.map +0 -1
- package/types/utils/bindKeypressInput.test.d.ts +0 -2
- package/types/utils/bindKeypressInput.test.d.ts.map +0 -1
- package/types/utils/createNativeDevEngine.test.d.ts +0 -2
- package/types/utils/createNativeDevEngine.test.d.ts.map +0 -1
- package/types/utils/createNativeDevEngineFailure.test.d.ts +0 -2
- package/types/utils/createNativeDevEngineFailure.test.d.ts.map +0 -1
- package/types/utils/getBoundPort.test.d.ts +0 -2
- package/types/utils/getBoundPort.test.d.ts.map +0 -1
- package/types/utils/imageSizePatch.test.d.ts +0 -2
- package/types/utils/imageSizePatch.test.d.ts.map +0 -1
- package/types/utils/patches.test.d.ts +0 -2
- package/types/utils/patches.test.d.ts.map +0 -1
- package/types/utils/symbolicateNativeStack.test.d.ts +0 -2
- package/types/utils/symbolicateNativeStack.test.d.ts.map +0 -1
|
@@ -9,334 +9,355 @@ import { resolvePath } from "@vxrn/resolve";
|
|
|
9
9
|
import { DEFAULT_ASSET_EXTS } from "../constants/defaults.native.js";
|
|
10
10
|
import { getNativePrelude } from "../runtime/native-prelude.native.js";
|
|
11
11
|
import { rnCodegenPlugin } from "../plugins/rnCodegenPlugin.native.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
var HERMES_CLASS_TRANSFORMS = [
|
|
14
|
+
"transform-classes",
|
|
15
|
+
"transform-parameters",
|
|
16
|
+
"transform-block-scoping",
|
|
17
|
+
"transform-class-properties",
|
|
18
|
+
"transform-class-static-block",
|
|
19
|
+
"transform-private-methods",
|
|
20
|
+
"transform-private-property-in-object"
|
|
21
|
+
];
|
|
16
22
|
var HERMES_ASYNC_TRANSFORMS = ["transform-async-to-generator"];
|
|
17
23
|
function getHermesSWCIncludes(dev) {
|
|
18
|
-
|
|
24
|
+
return [...HERMES_CLASS_TRANSFORMS, ...HERMES_ASYNC_TRANSFORMS];
|
|
19
25
|
}
|
|
20
26
|
function getResolveExtensions(platform) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
var platformExts = platform === "ios" ? [
|
|
28
|
+
".ios.tsx",
|
|
29
|
+
".ios.ts",
|
|
30
|
+
".ios.jsx",
|
|
31
|
+
".ios.js"
|
|
32
|
+
] : [
|
|
33
|
+
".android.tsx",
|
|
34
|
+
".android.ts",
|
|
35
|
+
".android.jsx",
|
|
36
|
+
".android.js"
|
|
37
|
+
];
|
|
38
|
+
var nativeExts = [
|
|
39
|
+
".native.tsx",
|
|
40
|
+
".native.ts",
|
|
41
|
+
".native.jsx",
|
|
42
|
+
".native.js"
|
|
43
|
+
];
|
|
44
|
+
var defaultExts = [
|
|
45
|
+
".tsx",
|
|
46
|
+
".ts",
|
|
47
|
+
".jsx",
|
|
48
|
+
".js",
|
|
49
|
+
".mjs",
|
|
50
|
+
".cjs",
|
|
51
|
+
".json"
|
|
52
|
+
];
|
|
53
|
+
return [
|
|
54
|
+
...platformExts,
|
|
55
|
+
...nativeExts,
|
|
56
|
+
...defaultExts
|
|
57
|
+
];
|
|
25
58
|
}
|
|
26
59
|
function getNativeResolveConfig(platform) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
return {
|
|
61
|
+
extensions: getResolveExtensions(platform),
|
|
62
|
+
conditionNames: ["react-native"],
|
|
63
|
+
mainFields: [
|
|
64
|
+
"react-native",
|
|
65
|
+
"module",
|
|
66
|
+
"main"
|
|
67
|
+
]
|
|
68
|
+
};
|
|
32
69
|
}
|
|
33
70
|
function getNativeTransformConfig(platform, dev, root) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"import.meta.env": JSON.stringify(envObject),
|
|
133
|
-
"import.meta.env.MODE": JSON.stringify(mode),
|
|
134
|
-
"import.meta.env.DEV": dev ? "true" : "false",
|
|
135
|
-
"import.meta.env.PROD": dev ? "false" : "true",
|
|
136
|
-
"import.meta.env.SSR": "false",
|
|
137
|
-
"import.meta.env.VITE_ENVIRONMENT": JSON.stringify(platform),
|
|
138
|
-
"import.meta.env.VITE_NATIVE": "\"1\"",
|
|
139
|
-
"import.meta.env.EXPO_OS": JSON.stringify(platform),
|
|
140
|
-
"import.meta.env.TAMAGUI_TARGET": "\"native\"",
|
|
141
|
-
"import.meta.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
|
|
142
|
-
...setupFileDefines
|
|
143
|
-
},
|
|
144
|
-
inject: {
|
|
145
|
-
React: "react"
|
|
146
|
-
}
|
|
147
|
-
};
|
|
71
|
+
var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
|
|
72
|
+
var setupFileDefines = (function() {
|
|
73
|
+
var sf = entryConfig.setupFile;
|
|
74
|
+
if (!sf) return {};
|
|
75
|
+
var files = typeof sf === "string" ? {
|
|
76
|
+
client: sf,
|
|
77
|
+
server: sf,
|
|
78
|
+
ios: sf,
|
|
79
|
+
android: sf
|
|
80
|
+
} : "native" in sf ? {
|
|
81
|
+
client: sf.client,
|
|
82
|
+
server: sf.server,
|
|
83
|
+
ios: sf.native,
|
|
84
|
+
android: sf.native
|
|
85
|
+
} : sf;
|
|
86
|
+
return {
|
|
87
|
+
...files.client && { "process.env.ONE_SETUP_FILE_CLIENT": JSON.stringify(files.client) },
|
|
88
|
+
...files.server && { "process.env.ONE_SETUP_FILE_SERVER": JSON.stringify(files.server) },
|
|
89
|
+
...files.ios && { "process.env.ONE_SETUP_FILE_IOS": JSON.stringify(files.ios) },
|
|
90
|
+
...files.android && { "process.env.ONE_SETUP_FILE_ANDROID": JSON.stringify(files.android) }
|
|
91
|
+
};
|
|
92
|
+
})();
|
|
93
|
+
var userDefines = {};
|
|
94
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
95
|
+
try {
|
|
96
|
+
for (var _iterator = Object.entries(globalThis.__vxrnNativeUserDefine || {})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
97
|
+
var [key, value] = _step.value;
|
|
98
|
+
userDefines[key] = typeof value === "string" ? value : JSON.stringify(value);
|
|
99
|
+
}
|
|
100
|
+
} catch (err) {
|
|
101
|
+
_didIteratorError = true;
|
|
102
|
+
_iteratorError = err;
|
|
103
|
+
} finally {
|
|
104
|
+
try {
|
|
105
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
106
|
+
} finally {
|
|
107
|
+
if (_didIteratorError) throw _iteratorError;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var mode = dev ? "development" : "production";
|
|
111
|
+
var publicEnv = loadEnv(mode, root, ["VITE_", "EXPO_PUBLIC_"]);
|
|
112
|
+
var envDefines = {};
|
|
113
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
114
|
+
try {
|
|
115
|
+
for (var _iterator1 = Object.entries(publicEnv)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
116
|
+
var [key1, value1] = _step1.value;
|
|
117
|
+
envDefines[`import.meta.env.${key1}`] = JSON.stringify(value1);
|
|
118
|
+
envDefines[`process.env.${key1}`] = JSON.stringify(value1);
|
|
119
|
+
}
|
|
120
|
+
} catch (err) {
|
|
121
|
+
_didIteratorError1 = true;
|
|
122
|
+
_iteratorError1 = err;
|
|
123
|
+
} finally {
|
|
124
|
+
try {
|
|
125
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
|
|
126
|
+
} finally {
|
|
127
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
var envObject = {
|
|
131
|
+
...publicEnv,
|
|
132
|
+
MODE: mode,
|
|
133
|
+
DEV: dev,
|
|
134
|
+
PROD: !dev,
|
|
135
|
+
SSR: false,
|
|
136
|
+
VITE_ENVIRONMENT: platform,
|
|
137
|
+
VITE_NATIVE: "1",
|
|
138
|
+
EXPO_OS: platform,
|
|
139
|
+
TAMAGUI_TARGET: "native",
|
|
140
|
+
TAMAGUI_ENVIRONMENT: platform
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
jsx: { runtime: "classic" },
|
|
144
|
+
define: {
|
|
145
|
+
...userDefines,
|
|
146
|
+
...envDefines,
|
|
147
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
148
|
+
"process.env.VXRN_REACT_19": "false",
|
|
149
|
+
"process.env.VITE_ENVIRONMENT": JSON.stringify(platform),
|
|
150
|
+
"process.env.VITE_NATIVE": "\"1\"",
|
|
151
|
+
"process.env.EXPO_OS": JSON.stringify(platform),
|
|
152
|
+
"process.env.TAMAGUI_TARGET": "\"native\"",
|
|
153
|
+
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
|
|
154
|
+
__DEV__: dev ? "true" : "false",
|
|
155
|
+
"import.meta.env": JSON.stringify(envObject),
|
|
156
|
+
"import.meta.env.MODE": JSON.stringify(mode),
|
|
157
|
+
"import.meta.env.DEV": dev ? "true" : "false",
|
|
158
|
+
"import.meta.env.PROD": dev ? "false" : "true",
|
|
159
|
+
"import.meta.env.SSR": "false",
|
|
160
|
+
"import.meta.env.VITE_ENVIRONMENT": JSON.stringify(platform),
|
|
161
|
+
"import.meta.env.VITE_NATIVE": "\"1\"",
|
|
162
|
+
"import.meta.env.EXPO_OS": JSON.stringify(platform),
|
|
163
|
+
"import.meta.env.TAMAGUI_TARGET": "\"native\"",
|
|
164
|
+
"import.meta.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
|
|
165
|
+
...setupFileDefines
|
|
166
|
+
},
|
|
167
|
+
inject: { React: "react" }
|
|
168
|
+
};
|
|
148
169
|
}
|
|
149
170
|
function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, onAsset) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
var sourceMaps = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : false, userPlugins = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : [];
|
|
172
|
+
var context = {
|
|
173
|
+
root,
|
|
174
|
+
platform,
|
|
175
|
+
dev
|
|
176
|
+
};
|
|
177
|
+
return [
|
|
178
|
+
...globalThis.__vxrnAddNativePlugins || [],
|
|
179
|
+
serverFileExclusionPlugin(),
|
|
180
|
+
environmentGuardPlugin(),
|
|
181
|
+
hmrClientNoopPlugin(),
|
|
182
|
+
{
|
|
183
|
+
name: "vxrn:legacy-asset-registry",
|
|
184
|
+
resolveId(source, importer) {
|
|
185
|
+
if (source === "@react-native/assets-registry/registry") return this.resolve("react-native/asset-registry", importer, { skipSelf: true });
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
...dev ? [reactNativeDedupePlugin(root)] : [],
|
|
189
|
+
cssStubPlugin(),
|
|
190
|
+
viteImportGlobPlugin({ root }),
|
|
191
|
+
vxrnCompilerPlugin(platform, dev, root, sourceMaps),
|
|
192
|
+
rnCodegenPlugin({ projectRoot: root }),
|
|
193
|
+
flowStripPlugin(),
|
|
194
|
+
nativeAnimatedGuardPlugin(),
|
|
195
|
+
assetPlugin({
|
|
196
|
+
root,
|
|
197
|
+
platform,
|
|
198
|
+
assetsDest,
|
|
199
|
+
onAsset
|
|
200
|
+
}),
|
|
201
|
+
hermesCompatSWCPlugin(dev, sourceMaps),
|
|
202
|
+
hermesLoopsPlugin(sourceMaps),
|
|
203
|
+
...userPlugins
|
|
204
|
+
].map(function(plugin) {
|
|
205
|
+
var _plugin_api;
|
|
206
|
+
return ((_plugin_api = plugin.api) === null || _plugin_api === void 0 ? void 0 : _plugin_api.vxrnNative) ? plugin.api.vxrnNative(context) : plugin;
|
|
207
|
+
});
|
|
170
208
|
}
|
|
171
209
|
function getNativeOutputOptions(prelude, sourcemap, minify) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
210
|
+
return {
|
|
211
|
+
format: "esm",
|
|
212
|
+
sourcemap,
|
|
213
|
+
sourcemapPathTransform: function(relativeSourcePath, sourcemapPath) {
|
|
214
|
+
return normalizePath(resolve(dirname(sourcemapPath), relativeSourcePath));
|
|
215
|
+
},
|
|
216
|
+
intro: prelude,
|
|
217
|
+
codeSplitting: false,
|
|
218
|
+
strictExecutionOrder: true,
|
|
219
|
+
minify: minify || "dce-only"
|
|
220
|
+
};
|
|
183
221
|
}
|
|
184
222
|
function normalizeNativeCommonJSInterop(code) {
|
|
185
|
-
|
|
223
|
+
return code.replace(/(\b__toESM(?:\$\d+)?\(\s*(?:require[\w$]*\(\)|__rolldown_runtime__\.loadExports\("(?:\\.|[^"\\])*"\))\s*),\s*1(\s*\))/g, "$1$2");
|
|
186
224
|
}
|
|
187
225
|
function blankPreservingLines(match) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
226
|
+
var _ref;
|
|
227
|
+
var _match_match;
|
|
228
|
+
return "\n".repeat((_ref = (_match_match = match.match(/\n/g)) === null || _match_match === void 0 ? void 0 : _match_match.length) !== null && _ref !== void 0 ? _ref : 0);
|
|
191
229
|
}
|
|
192
230
|
function countLines(code) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
231
|
+
var _ref;
|
|
232
|
+
var _code_match;
|
|
233
|
+
return ((_ref = (_code_match = code.match(/\n/g)) === null || _code_match === void 0 ? void 0 : _code_match.length) !== null && _ref !== void 0 ? _ref : 0) + 1;
|
|
196
234
|
}
|
|
197
235
|
function assertBundleLinesPreserved(before, after, stage) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
236
|
+
var beforeLines = countLines(before);
|
|
237
|
+
var afterLines = countLines(after);
|
|
238
|
+
if (beforeLines !== afterLines) throw new Error(`[vxrn] native bundle post-processing (${stage}) changed the line count (${beforeLines} -> ${afterLines}), which invalidates the source map. Every pass after Rolldown emits the map must preserve lines.`);
|
|
201
239
|
}
|
|
202
240
|
function postProcessNativeBundle(code) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
241
|
+
code = normalizeNativeCommonJSInterop(code);
|
|
242
|
+
code = code.replace(/\btypeof\s+import\.meta\b/g, "\"object\"");
|
|
243
|
+
code = code.replace(/^[^\S\n]*export[^\S\n]*\{[^}]*\}[^\S\n]*;?[^\S\n]*$/gm, blankPreservingLines);
|
|
244
|
+
code = code.replace(/^([^\S\n]*)export[^\S\n]+default[^\S\n]+([^;\n]+);?[^\S\n]*$/gm, "$1$2;");
|
|
245
|
+
code = code.replace(/^if \(import\.meta\.hot\).*$/gm, "");
|
|
246
|
+
var idx = code.indexOf("NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;");
|
|
247
|
+
if (idx !== -1) {
|
|
248
|
+
var beforeMarker = code.lastIndexOf("NativeAnimatedModule = ", idx);
|
|
249
|
+
if (beforeMarker !== -1) {
|
|
250
|
+
var lineStart = code.lastIndexOf("\n", beforeMarker);
|
|
251
|
+
var snippet = code.slice(lineStart + 1, beforeMarker + 50);
|
|
252
|
+
if (snippet.includes("(function()") || snippet.includes("new Proxy")) {
|
|
253
|
+
var afterMarker = code.indexOf("})();", idx);
|
|
254
|
+
if (afterMarker !== -1) {
|
|
255
|
+
var end = afterMarker + 5;
|
|
256
|
+
var removed = code.slice(beforeMarker, end);
|
|
257
|
+
code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + blankPreservingLines(removed) + code.slice(end);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return code;
|
|
225
263
|
}
|
|
226
264
|
function wrapNativeBundleModuleScope(code) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
265
|
+
var idx = code.indexOf("//#region \\0rolldown/runtime.js");
|
|
266
|
+
if (idx === -1) return code;
|
|
267
|
+
return code.slice(0, idx) + ";(function() {" + code.slice(idx) + "\n})();\n";
|
|
230
268
|
}
|
|
231
269
|
async function downlevelClassFieldsInBundle(code) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return e.message;
|
|
254
|
-
}).join("\n"));
|
|
255
|
-
var transformedCode = result.code.trimEnd();
|
|
256
|
-
var transformed = transformedCode.includes(startMarker) ? transformedCode : `${startMarker}
|
|
270
|
+
var _ref, _ref1;
|
|
271
|
+
var _runtimeSection_match, _result_errors, _transformed_match;
|
|
272
|
+
var startMarker = "//#region \\0rolldown/runtime.js";
|
|
273
|
+
var endMarker = "//#endregion";
|
|
274
|
+
var startIdx = code.indexOf(startMarker);
|
|
275
|
+
if (startIdx === -1) return code;
|
|
276
|
+
var endIdx = code.indexOf(endMarker, startIdx);
|
|
277
|
+
if (endIdx === -1) return code;
|
|
278
|
+
var runtimeEnd = endIdx + endMarker.length;
|
|
279
|
+
var runtimeSection = code.slice(startIdx, runtimeEnd);
|
|
280
|
+
var originalNewlines = (_ref = (_runtimeSection_match = runtimeSection.match(/\n/g)) === null || _runtimeSection_match === void 0 ? void 0 : _runtimeSection_match.length) !== null && _ref !== void 0 ? _ref : 0;
|
|
281
|
+
var { transformSync } = await import("oxc-transform");
|
|
282
|
+
var result = transformSync("rolldown-runtime.js", runtimeSection, {
|
|
283
|
+
target: "es2020",
|
|
284
|
+
assumptions: { setPublicClassFields: true }
|
|
285
|
+
});
|
|
286
|
+
if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) throw new Error(result.errors.map(function(e) {
|
|
287
|
+
return e.message;
|
|
288
|
+
}).join("\n"));
|
|
289
|
+
var transformedCode = result.code.trimEnd();
|
|
290
|
+
var transformed = transformedCode.includes(startMarker) ? transformedCode : `${startMarker}
|
|
257
291
|
${transformedCode}`;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
292
|
+
var transformedNewlines = (_ref1 = (_transformed_match = transformed.match(/\n/g)) === null || _transformed_match === void 0 ? void 0 : _transformed_match.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
|
|
293
|
+
if (transformedNewlines > originalNewlines) throw new Error("[vxrn] Hermes runtime transform added lines and would invalidate the production source map");
|
|
294
|
+
var linePreservingRuntime = transformed + "\n".repeat(originalNewlines - transformedNewlines);
|
|
295
|
+
return code.slice(0, startIdx) + linePreservingRuntime + code.slice(runtimeEnd);
|
|
262
296
|
}
|
|
263
297
|
function nativeBundlePostProcessPlugin() {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
298
|
+
return {
|
|
299
|
+
name: "vxrn:native-post-process",
|
|
300
|
+
async renderChunk(code) {
|
|
301
|
+
var processed = await downlevelClassFieldsInBundle(postProcessNativeBundle(code));
|
|
302
|
+
assertBundleLinesPreserved(code, processed, "production");
|
|
303
|
+
return {
|
|
304
|
+
code: processed,
|
|
305
|
+
map: null
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
};
|
|
275
309
|
}
|
|
276
310
|
async function createNativeDevEngine(options) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
incrementalBuild: true,
|
|
328
|
-
lazyBarrel: true
|
|
329
|
-
},
|
|
330
|
-
treeshake: false,
|
|
331
|
-
shimMissingExports: true,
|
|
332
|
-
moduleTypes: {
|
|
333
|
-
".js": "jsx"
|
|
334
|
-
},
|
|
335
|
-
plugins: [virtualEntry.plugin, ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, true, userPlugins)]
|
|
336
|
-
};
|
|
337
|
-
var outputOptions = {
|
|
338
|
-
...getNativeOutputOptions(prelude, true, false),
|
|
339
|
-
outro: `
|
|
311
|
+
var _statSync;
|
|
312
|
+
var { root, port, host = "localhost", platform, serverUrl, plugins: userPlugins = [], onHmrUpdate } = options;
|
|
313
|
+
var { dev, viteImportGlobPlugin } = await import("rolldown/experimental");
|
|
314
|
+
var hmrRuntimeSource = getHmrRuntimeSource();
|
|
315
|
+
var prelude = getNativePrelude({
|
|
316
|
+
dev: true,
|
|
317
|
+
platform,
|
|
318
|
+
serverUrl: serverUrl || `http://${host}:${port}`
|
|
319
|
+
});
|
|
320
|
+
var assetRegistry = createNativeDevAssetRegistry();
|
|
321
|
+
var currentBundle = null;
|
|
322
|
+
var firstBuildError = null;
|
|
323
|
+
var bundleResolve = null;
|
|
324
|
+
var bundleReject = null;
|
|
325
|
+
var bundlePromise = null;
|
|
326
|
+
var resolvedHost = host === "0.0.0.0" ? "localhost" : host;
|
|
327
|
+
var virtualEntry = nativeVirtualEntryPlugin(root, {
|
|
328
|
+
dev: true,
|
|
329
|
+
platform,
|
|
330
|
+
dynamicRoutes: true
|
|
331
|
+
});
|
|
332
|
+
var engineWork = Promise.resolve();
|
|
333
|
+
var queueEngineWork = function(work) {
|
|
334
|
+
var result = engineWork.then(work, work);
|
|
335
|
+
engineWork = result.catch(function() {});
|
|
336
|
+
return result;
|
|
337
|
+
};
|
|
338
|
+
var inputOptions = {
|
|
339
|
+
input: VIRTUAL_NATIVE_ENTRY,
|
|
340
|
+
cwd: root,
|
|
341
|
+
platform: "neutral",
|
|
342
|
+
resolve: getNativeResolveConfig(platform),
|
|
343
|
+
transform: getNativeTransformConfig(platform, true, root),
|
|
344
|
+
experimental: {
|
|
345
|
+
devMode: {
|
|
346
|
+
implement: hmrRuntimeSource,
|
|
347
|
+
host,
|
|
348
|
+
port
|
|
349
|
+
},
|
|
350
|
+
incrementalBuild: true,
|
|
351
|
+
lazyBarrel: true
|
|
352
|
+
},
|
|
353
|
+
treeshake: false,
|
|
354
|
+
shimMissingExports: true,
|
|
355
|
+
moduleTypes: { ".js": "jsx" },
|
|
356
|
+
plugins: [virtualEntry.plugin, ...getNativePlugins(root, platform, viteImportGlobPlugin, true, void 0, assetRegistry.register, true, userPlugins)]
|
|
357
|
+
};
|
|
358
|
+
var outputOptions = {
|
|
359
|
+
...getNativeOutputOptions(prelude, true, false),
|
|
360
|
+
outro: `
|
|
340
361
|
try {
|
|
341
362
|
var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
|
|
342
363
|
var __hmrUrl = 'ws://${resolvedHost}:${port}/hot?platform=${platform}&clientId=' + encodeURIComponent(__rolldown_runtime__.clientId);
|
|
@@ -347,256 +368,238 @@ try {
|
|
|
347
368
|
console.error('[vxrn] HMR client failed to start:', (e && e.message) || e);
|
|
348
369
|
}
|
|
349
370
|
`
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
reject(/* @__PURE__ */new Error("[vxrn] bundle build timed out after 120s"));
|
|
512
|
-
}, 12e4);
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
return bundlePromise;
|
|
516
|
-
},
|
|
517
|
-
getAsset(pathname, hash) {
|
|
518
|
-
return assetRegistry.resolve(pathname, hash);
|
|
519
|
-
},
|
|
520
|
-
async close() {
|
|
521
|
-
routeWatcher === null || routeWatcher === void 0 || routeWatcher.close();
|
|
522
|
-
await engine.close();
|
|
523
|
-
}
|
|
524
|
-
};
|
|
371
|
+
};
|
|
372
|
+
var outputProcessed = Promise.resolve();
|
|
373
|
+
var engine;
|
|
374
|
+
var routeWatcher;
|
|
375
|
+
var rebuildIfRouteGraphChanged = function() {
|
|
376
|
+
return queueEngineWork(async function() {
|
|
377
|
+
var { files: knownRoutes, scanFiles, updateFiles } = virtualEntry.routes;
|
|
378
|
+
var currentRoutes = scanFiles();
|
|
379
|
+
if (!(currentRoutes.size !== knownRoutes.size || [...currentRoutes].some(function(route) {
|
|
380
|
+
return !knownRoutes.has(route);
|
|
381
|
+
}))) return false;
|
|
382
|
+
updateFiles(currentRoutes);
|
|
383
|
+
return true;
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
engine = await dev(inputOptions, outputOptions, {
|
|
387
|
+
onOutput: async function(result) {
|
|
388
|
+
var finishOutput = function() {};
|
|
389
|
+
outputProcessed = new Promise(function(resolve2) {
|
|
390
|
+
finishOutput = resolve2;
|
|
391
|
+
});
|
|
392
|
+
try {
|
|
393
|
+
await handleOutput(result);
|
|
394
|
+
} finally {
|
|
395
|
+
finishOutput();
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
onHmrUpdates: async function(result) {
|
|
399
|
+
if (result instanceof Error) {
|
|
400
|
+
console.error("[vxrn] HMR error:", result.message);
|
|
401
|
+
onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({ type: "hmr:error" });
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (await rebuildIfRouteGraphChanged()) return;
|
|
405
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
406
|
+
try {
|
|
407
|
+
for (var _iterator = result.updates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
408
|
+
var { clientId, update } = _step.value;
|
|
409
|
+
if (update.type === "Patch" && update.code) onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
|
|
410
|
+
type: "hmr:update",
|
|
411
|
+
clientId,
|
|
412
|
+
code: normalizeNativeCommonJSInterop(update.code),
|
|
413
|
+
changedIds: update.changedIds,
|
|
414
|
+
seq: update.seq
|
|
415
|
+
});
|
|
416
|
+
else if (update.type === "FullReload") onHmrUpdate === null || onHmrUpdate === void 0 || onHmrUpdate({
|
|
417
|
+
type: "hmr:reload",
|
|
418
|
+
clientId
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
} catch (err) {
|
|
422
|
+
_didIteratorError = true;
|
|
423
|
+
_iteratorError = err;
|
|
424
|
+
} finally {
|
|
425
|
+
try {
|
|
426
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
427
|
+
} finally {
|
|
428
|
+
if (_didIteratorError) throw _iteratorError;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
rebuildStrategy: "never",
|
|
433
|
+
watch: {}
|
|
434
|
+
});
|
|
435
|
+
async function handleOutput(result) {
|
|
436
|
+
if (result instanceof Error) {
|
|
437
|
+
console.error("[vxrn] native bundle error:", result.message);
|
|
438
|
+
if (/panic/i.test(result.message)) console.error("[vxrn] rolldown itself panicked. Fast Refresh will full-reload until you restart the dev server.");
|
|
439
|
+
if (!currentBundle) {
|
|
440
|
+
firstBuildError || (firstBuildError = result);
|
|
441
|
+
if (bundleReject) {
|
|
442
|
+
var reject = bundleReject;
|
|
443
|
+
bundleResolve = null;
|
|
444
|
+
bundleReject = null;
|
|
445
|
+
bundlePromise = null;
|
|
446
|
+
reject(firstBuildError);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
var chunk = result.output.find(function(o) {
|
|
452
|
+
return o.type === "chunk" && o.isEntry;
|
|
453
|
+
});
|
|
454
|
+
if (chunk && "code" in chunk) {
|
|
455
|
+
firstBuildError = null;
|
|
456
|
+
var code = postProcessNativeBundle(chunk.code);
|
|
457
|
+
code = await downlevelClassFieldsInBundle(code);
|
|
458
|
+
assertBundleLinesPreserved(chunk.code, code, "dev");
|
|
459
|
+
code = wrapNativeBundleModuleScope(code);
|
|
460
|
+
if (!chunk.map) throw new Error("[vxrn] rolldown produced no source map for the dev bundle, so /symbolicate cannot resolve a frame");
|
|
461
|
+
currentBundle = {
|
|
462
|
+
code,
|
|
463
|
+
map: chunk.map.toString()
|
|
464
|
+
};
|
|
465
|
+
console.info(`[vxrn] native bundle ready (${Math.round(code.length / 1024)}KB)`);
|
|
466
|
+
if (bundleResolve) {
|
|
467
|
+
bundleResolve(currentBundle);
|
|
468
|
+
bundleResolve = null;
|
|
469
|
+
bundleReject = null;
|
|
470
|
+
bundlePromise = null;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
await engine.run();
|
|
475
|
+
var routeWatchTarget = virtualEntry.routes.routeRoot;
|
|
476
|
+
while (!((_statSync = statSync(routeWatchTarget, { throwIfNoEntry: false })) === null || _statSync === void 0 ? void 0 : _statSync.isDirectory())) {
|
|
477
|
+
var parent = dirname(routeWatchTarget);
|
|
478
|
+
if (parent === routeWatchTarget) break;
|
|
479
|
+
routeWatchTarget = parent;
|
|
480
|
+
}
|
|
481
|
+
var normalizedRouteRoot = normalizePath(virtualEntry.routes.routeRoot);
|
|
482
|
+
routeWatcher = watch(routeWatchTarget, { recursive: true }, function(_eventType, file) {
|
|
483
|
+
if (file === null) return;
|
|
484
|
+
var changed = normalizePath(resolve(routeWatchTarget, file.toString()));
|
|
485
|
+
if (changed !== normalizedRouteRoot && !changed.startsWith(`${normalizedRouteRoot}/`)) return;
|
|
486
|
+
rebuildIfRouteGraphChanged().catch(function(error) {
|
|
487
|
+
console.error(`[vxrn] rebuilding the native route map failed`, error);
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
routeWatcher.on("error", function(error) {
|
|
491
|
+
console.error(`[vxrn] watching the native route map failed`, error);
|
|
492
|
+
});
|
|
493
|
+
await rebuildIfRouteGraphChanged();
|
|
494
|
+
return {
|
|
495
|
+
engine,
|
|
496
|
+
async getBundle() {
|
|
497
|
+
await queueEngineWork(async function() {
|
|
498
|
+
await engine.ensureLatestBuildOutput();
|
|
499
|
+
await outputProcessed;
|
|
500
|
+
});
|
|
501
|
+
if (currentBundle) return currentBundle;
|
|
502
|
+
if (firstBuildError) throw firstBuildError;
|
|
503
|
+
if (!bundlePromise) {
|
|
504
|
+
var timeoutId;
|
|
505
|
+
bundlePromise = new Promise(function(resolve2, reject) {
|
|
506
|
+
bundleResolve = function(value) {
|
|
507
|
+
clearTimeout(timeoutId);
|
|
508
|
+
resolve2(value);
|
|
509
|
+
};
|
|
510
|
+
bundleReject = function(error) {
|
|
511
|
+
clearTimeout(timeoutId);
|
|
512
|
+
reject(error);
|
|
513
|
+
};
|
|
514
|
+
timeoutId = setTimeout(function() {
|
|
515
|
+
bundleResolve = null;
|
|
516
|
+
bundleReject = null;
|
|
517
|
+
bundlePromise = null;
|
|
518
|
+
reject(/* @__PURE__ */ new Error("[vxrn] bundle build timed out after 120s"));
|
|
519
|
+
}, 12e4);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return bundlePromise;
|
|
523
|
+
},
|
|
524
|
+
getAsset(pathname, hash) {
|
|
525
|
+
return assetRegistry.resolve(pathname, hash);
|
|
526
|
+
},
|
|
527
|
+
async close() {
|
|
528
|
+
routeWatcher === null || routeWatcher === void 0 || routeWatcher.close();
|
|
529
|
+
await engine.close();
|
|
530
|
+
}
|
|
531
|
+
};
|
|
525
532
|
}
|
|
526
533
|
async function buildNativeBundle(options) {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
plugins: [...(entryFile ? [] : [nativeVirtualEntryPlugin(root, {
|
|
565
|
-
dev,
|
|
566
|
-
platform
|
|
567
|
-
}).plugin]), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins), nativeBundlePostProcessPlugin()],
|
|
568
|
-
output: getNativeOutputOptions(prelude, sourcemap, minify)
|
|
569
|
-
})).output.find(function (o) {
|
|
570
|
-
return o.type === "chunk" && o.isEntry;
|
|
571
|
-
});
|
|
572
|
-
if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
|
|
573
|
-
if (sourcemap && !chunk.map) throw new Error("[vxrn] a source map was requested but rolldown produced none for the production bundle");
|
|
574
|
-
return {
|
|
575
|
-
code: chunk.code,
|
|
576
|
-
map: sourcemap ? (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString() : void 0
|
|
577
|
-
};
|
|
534
|
+
var _chunk_map;
|
|
535
|
+
var { root, platform, dev = false, serverUrl, entryFile, assetsDest, plugins: userPlugins = [], sourcemap = false, minify = !dev } = options;
|
|
536
|
+
var { build } = await import("rolldown");
|
|
537
|
+
var { viteImportGlobPlugin } = await import("rolldown/experimental");
|
|
538
|
+
var prelude = getNativePrelude({
|
|
539
|
+
dev,
|
|
540
|
+
platform,
|
|
541
|
+
serverUrl
|
|
542
|
+
});
|
|
543
|
+
var chunk = (await build({
|
|
544
|
+
input: entryFile ? normalizePath(resolve(root, entryFile)) : VIRTUAL_NATIVE_ENTRY,
|
|
545
|
+
cwd: root,
|
|
546
|
+
platform: "neutral",
|
|
547
|
+
resolve: getNativeResolveConfig(platform),
|
|
548
|
+
transform: getNativeTransformConfig(platform, dev, root),
|
|
549
|
+
treeshake: !dev,
|
|
550
|
+
experimental: { lazyBarrel: false },
|
|
551
|
+
shimMissingExports: true,
|
|
552
|
+
moduleTypes: { ".js": "jsx" },
|
|
553
|
+
plugins: [
|
|
554
|
+
...entryFile ? [] : [nativeVirtualEntryPlugin(root, {
|
|
555
|
+
dev,
|
|
556
|
+
platform
|
|
557
|
+
}).plugin],
|
|
558
|
+
...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest, void 0, sourcemap, userPlugins),
|
|
559
|
+
nativeBundlePostProcessPlugin()
|
|
560
|
+
],
|
|
561
|
+
output: getNativeOutputOptions(prelude, sourcemap, minify)
|
|
562
|
+
})).output.find(function(o) {
|
|
563
|
+
return o.type === "chunk" && o.isEntry;
|
|
564
|
+
});
|
|
565
|
+
if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
|
|
566
|
+
if (sourcemap && !chunk.map) throw new Error("[vxrn] a source map was requested but rolldown produced none for the production bundle");
|
|
567
|
+
return {
|
|
568
|
+
code: chunk.code,
|
|
569
|
+
map: sourcemap ? (_chunk_map = chunk.map) === null || _chunk_map === void 0 ? void 0 : _chunk_map.toString() : void 0
|
|
570
|
+
};
|
|
578
571
|
}
|
|
579
572
|
var VIRTUAL_NATIVE_ENTRY = "virtual:native-entry";
|
|
580
573
|
function nativeVirtualEntryPlugin(root, opts) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
574
|
+
var isDev = (opts === null || opts === void 0 ? void 0 : opts.dev) !== false;
|
|
575
|
+
var useDynamicRouteRegistry = opts.dynamicRoutes === true;
|
|
576
|
+
var resolvedId = normalizePath(resolve(root, "__virtual-native-entry.tsx"));
|
|
577
|
+
var entryConfig = globalThis.__vxrnNativeEntryConfig || {};
|
|
578
|
+
var routerRoot = entryConfig.routerRoot || "app";
|
|
579
|
+
var flags = entryConfig.flags || {};
|
|
580
|
+
var linking = entryConfig.linking;
|
|
581
|
+
var setupFileImport = (function() {
|
|
582
|
+
var sf = entryConfig.setupFile;
|
|
583
|
+
if (!sf) return "";
|
|
584
|
+
var file = typeof sf === "string" ? sf : "native" in sf ? sf.native : sf.ios;
|
|
585
|
+
if (!file) return "";
|
|
586
|
+
var resolved = pathToFileURL(resolve(root, file)).href;
|
|
587
|
+
return `import ${JSON.stringify(resolved)};`;
|
|
588
|
+
})();
|
|
589
|
+
var routeGlobs = [
|
|
590
|
+
`./${routerRoot}/**/*.tsx`,
|
|
591
|
+
`./${routerRoot}/**/*.ts`,
|
|
592
|
+
`!./${routerRoot}/**/*+api.*`,
|
|
593
|
+
`!./${routerRoot}/**/*.test.*`,
|
|
594
|
+
`!./${routerRoot}/**/*.d.ts`,
|
|
595
|
+
`!./${routerRoot}/**/*.server.*`,
|
|
596
|
+
`!./${routerRoot}/**/_middleware.*`,
|
|
597
|
+
`!./${routerRoot}/**/*.web.*`,
|
|
598
|
+
...(entryConfig.ignoredRouteFiles || []).map(function(pattern) {
|
|
599
|
+
return `!./${routerRoot}/${pattern}`;
|
|
600
|
+
})
|
|
601
|
+
];
|
|
602
|
+
var refreshSetup = isDev ? `
|
|
600
603
|
// react-refresh/runtime MUST initialize before React loads
|
|
601
604
|
import RefreshRuntime from 'react-refresh/runtime';
|
|
602
605
|
RefreshRuntime.injectIntoGlobalHook(globalThis);
|
|
@@ -606,8 +609,8 @@ globalThis.$RefreshReg$ = function(type, id) {
|
|
|
606
609
|
};
|
|
607
610
|
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
608
611
|
` : "";
|
|
609
|
-
|
|
610
|
-
|
|
612
|
+
var entryCode = function() {
|
|
613
|
+
return `
|
|
611
614
|
${refreshSetup}
|
|
612
615
|
import * as ReactNativeInitializeCore from 'react-native/Libraries/Core/InitializeCore';
|
|
613
616
|
import NativeWebSocket from 'react-native/Libraries/WebSocket/WebSocket';
|
|
@@ -635,365 +638,357 @@ createApp({
|
|
|
635
638
|
|
|
636
639
|
${routeHmr}
|
|
637
640
|
`;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
var routeKey = `/${normalizePath(relative(root, file))}`;
|
|
699
|
-
var importPath = normalizePath(relative(dirname(registryPath), file));
|
|
700
|
-
if (!importPath.startsWith(".")) importPath = `./${importPath}`;
|
|
701
|
-
return ` ${JSON.stringify(routeKey)}: () => import(${JSON.stringify(importPath)})`;
|
|
702
|
-
}).join(",\n")}
|
|
641
|
+
};
|
|
642
|
+
var routeRoot = resolve(root, routerRoot);
|
|
643
|
+
var stripDot = function(pattern) {
|
|
644
|
+
return pattern.replace(/^\.\//, "");
|
|
645
|
+
};
|
|
646
|
+
var includeGlobs = routeGlobs.filter(function(p) {
|
|
647
|
+
return !p.startsWith("!");
|
|
648
|
+
}).map(stripDot);
|
|
649
|
+
var excludeGlobs = routeGlobs.filter(function(p) {
|
|
650
|
+
return p.startsWith("!");
|
|
651
|
+
}).map(function(p) {
|
|
652
|
+
return stripDot(p.slice(1));
|
|
653
|
+
});
|
|
654
|
+
var isRouteFile = function(file) {
|
|
655
|
+
var relativeToRoot = normalizePath(relative(root, file));
|
|
656
|
+
return micromatch.isMatch(relativeToRoot, includeGlobs) && !micromatch.isMatch(relativeToRoot, excludeGlobs);
|
|
657
|
+
};
|
|
658
|
+
var scanFiles = function() {
|
|
659
|
+
var _statSync;
|
|
660
|
+
var files = /* @__PURE__ */ new Set();
|
|
661
|
+
var walkRouteRoot = function(dir) {
|
|
662
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
663
|
+
try {
|
|
664
|
+
for (var _iterator = readdirSync(dir, { withFileTypes: true })[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
665
|
+
var entry = _step.value;
|
|
666
|
+
var child = resolve(dir, entry.name);
|
|
667
|
+
if (entry.isDirectory()) walkRouteRoot(child);
|
|
668
|
+
else if (isRouteFile(child)) files.add(normalizePath(child));
|
|
669
|
+
}
|
|
670
|
+
} catch (err) {
|
|
671
|
+
_didIteratorError = true;
|
|
672
|
+
_iteratorError = err;
|
|
673
|
+
} finally {
|
|
674
|
+
try {
|
|
675
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
676
|
+
} finally {
|
|
677
|
+
if (_didIteratorError) throw _iteratorError;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
if ((_statSync = statSync(routeRoot, { throwIfNoEntry: false })) === null || _statSync === void 0 ? void 0 : _statSync.isDirectory()) walkRouteRoot(routeRoot);
|
|
682
|
+
return files;
|
|
683
|
+
};
|
|
684
|
+
var registrySpecifier = `./node_modules/.vxrn/native-routes-${opts.platform}.mjs`;
|
|
685
|
+
var registryPath = resolve(root, registrySpecifier);
|
|
686
|
+
var routes = {
|
|
687
|
+
routeRoot,
|
|
688
|
+
files: /* @__PURE__ */ new Set(),
|
|
689
|
+
isRouteFile,
|
|
690
|
+
scanFiles,
|
|
691
|
+
updateFiles(files) {
|
|
692
|
+
routes.files = files;
|
|
693
|
+
if (!useDynamicRouteRegistry) return;
|
|
694
|
+
var source = `export const routes = {
|
|
695
|
+
${[...files].sort().map(function(file) {
|
|
696
|
+
var routeKey = `/${normalizePath(relative(root, file))}`;
|
|
697
|
+
var importPath = normalizePath(relative(dirname(registryPath), file));
|
|
698
|
+
if (!importPath.startsWith(".")) importPath = `./${importPath}`;
|
|
699
|
+
return ` ${JSON.stringify(routeKey)}: () => import(${JSON.stringify(importPath)})`;
|
|
700
|
+
}).join(",\n")}
|
|
703
701
|
}
|
|
704
702
|
`;
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
routes.updateFiles(routes.scanFiles());
|
|
712
|
-
var routeImports = useDynamicRouteRegistry ? `import { routes } from ${JSON.stringify(registrySpecifier)};` : `var _routes = import.meta.glob(${JSON.stringify(routeGlobs)}, { exhaustive: true });
|
|
703
|
+
mkdirSync(dirname(registryPath), { recursive: true });
|
|
704
|
+
if (!existsSync(registryPath) || readFileSync(registryPath, "utf8") !== source) writeFileSync(registryPath, source);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
routes.updateFiles(routes.scanFiles());
|
|
708
|
+
var routeImports = useDynamicRouteRegistry ? `import { routes } from ${JSON.stringify(registrySpecifier)};` : `var _routes = import.meta.glob(${JSON.stringify(routeGlobs)}, { exhaustive: true });
|
|
713
709
|
// fix route keys: One expects '/${routerRoot}/...' prefix but import.meta.glob returns './${routerRoot}/...'
|
|
714
710
|
var routes = {};
|
|
715
711
|
Object.keys(_routes).forEach(function(key) {
|
|
716
712
|
var normalizedKey = key.replace(/^\\.\\//, '');
|
|
717
713
|
routes['/' + normalizedKey] = _routes[key];
|
|
718
714
|
});`;
|
|
719
|
-
|
|
715
|
+
var routeHmr = useDynamicRouteRegistry ? `if (import.meta.hot) {
|
|
720
716
|
import.meta.hot.accept(${JSON.stringify(registrySpecifier)}, function(next) {
|
|
721
717
|
if (globalThis.__VXRN_UPDATE_NATIVE_ROUTES__) {
|
|
722
718
|
globalThis.__VXRN_UPDATE_NATIVE_ROUTES__(next.routes);
|
|
723
719
|
}
|
|
724
720
|
});
|
|
725
721
|
}` : "";
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
722
|
+
return {
|
|
723
|
+
routes,
|
|
724
|
+
plugin: {
|
|
725
|
+
name: "vxrn:native-virtual-entry",
|
|
726
|
+
resolveId(id) {
|
|
727
|
+
if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
|
|
728
|
+
},
|
|
729
|
+
load(id) {
|
|
730
|
+
if (id !== resolvedId) return;
|
|
731
|
+
return entryCode();
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
};
|
|
739
735
|
}
|
|
740
736
|
function nativeAnimatedGuardPlugin() {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
737
|
+
return {
|
|
738
|
+
name: "vxrn:native-animated-guard",
|
|
739
|
+
transform(code, id) {
|
|
740
|
+
if (!id.includes("animated/NativeAnimatedHelper")) return;
|
|
741
|
+
var target = "const method = nullthrows(NativeAnimatedModule)[methodName];";
|
|
742
|
+
if (!code.includes(target)) return;
|
|
743
|
+
return {
|
|
744
|
+
code: code.replace(target, `${target} if (typeof method !== 'function') return;`),
|
|
745
|
+
map: {
|
|
746
|
+
version: 3,
|
|
747
|
+
sources: [id],
|
|
748
|
+
sourcesContent: [code],
|
|
749
|
+
names: [],
|
|
750
|
+
mappings: code.split("\n").map(function(_, index) {
|
|
751
|
+
return index === 0 ? "AAAA" : "AACA";
|
|
752
|
+
}).join(";")
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
};
|
|
761
757
|
}
|
|
762
758
|
function serverFileExclusionPlugin() {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
759
|
+
return {
|
|
760
|
+
name: "vxrn:server-file-exclusion",
|
|
761
|
+
load(id) {
|
|
762
|
+
if (/\.server\.\w+$/.test(id)) return {
|
|
763
|
+
code: "export default undefined;",
|
|
764
|
+
moduleType: "js"
|
|
765
|
+
};
|
|
766
|
+
if (/[\\/]_middleware\.\w+$/.test(id)) return {
|
|
767
|
+
code: "export default undefined;",
|
|
768
|
+
moduleType: "js"
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
};
|
|
776
772
|
}
|
|
777
773
|
function environmentGuardPlugin() {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
774
|
+
var THROWING = [
|
|
775
|
+
"server-only",
|
|
776
|
+
"client-only",
|
|
777
|
+
"web-only"
|
|
778
|
+
];
|
|
779
|
+
var NOOP = ["native-only"];
|
|
780
|
+
return {
|
|
781
|
+
name: "vxrn:environment-guard",
|
|
782
|
+
resolveId(source) {
|
|
783
|
+
if (THROWING.includes(source)) return {
|
|
784
|
+
id: `\0env-guard-throw:${source}`,
|
|
785
|
+
external: false
|
|
786
|
+
};
|
|
787
|
+
if (NOOP.includes(source)) return {
|
|
788
|
+
id: `\0env-guard-noop:${source}`,
|
|
789
|
+
external: false
|
|
790
|
+
};
|
|
791
|
+
},
|
|
792
|
+
load(id) {
|
|
793
|
+
if (id.startsWith("\0env-guard-throw:")) return {
|
|
794
|
+
code: `throw new Error("Cannot import '${id.slice(17)}' in a native bundle.");`,
|
|
795
|
+
moduleType: "js"
|
|
796
|
+
};
|
|
797
|
+
if (id.startsWith("\0env-guard-noop:")) return {
|
|
798
|
+
code: "",
|
|
799
|
+
moduleType: "js"
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
803
|
}
|
|
804
804
|
function hmrClientNoopPlugin() {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
805
|
+
var RN_HMR_CLIENT_RE = /(^|[\\/])Utilities[\\/]HMRClient(\.[cm]?[jt]sx?)?$/;
|
|
806
|
+
return {
|
|
807
|
+
name: "vxrn:hmr-client-noop",
|
|
808
|
+
resolveId(source, importer) {
|
|
809
|
+
if ((source.startsWith("react-native/") || importer != null && /(^|[\\/])react-native[\\/]/.test(importer)) && RN_HMR_CLIENT_RE.test(source)) return {
|
|
810
|
+
id: "\0vxrn-hmr-client-noop",
|
|
811
|
+
external: false
|
|
812
|
+
};
|
|
813
|
+
},
|
|
814
|
+
load(id) {
|
|
815
|
+
if (id === "\0vxrn-hmr-client-noop") return {
|
|
816
|
+
code: `const HMRClient = { setup() {}, enable() {}, disable() {}, registerBundle() {}, log() {}, isEnabled() { return false } }
|
|
817
817
|
export default HMRClient`,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
818
|
+
moduleType: "js"
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
822
|
}
|
|
823
823
|
function reactNativeDedupePlugin(root) {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
}
|
|
835
|
-
};
|
|
824
|
+
var reactNativeRoot;
|
|
825
|
+
return {
|
|
826
|
+
name: "vxrn:react-native-dedupe",
|
|
827
|
+
async resolveId(source, importer) {
|
|
828
|
+
if (source !== "react-native" && !source.startsWith("react-native/")) return;
|
|
829
|
+
reactNativeRoot || (reactNativeRoot = realpathSync(dirname(resolvePath("react-native/package.json", root))));
|
|
830
|
+
var subpath = source === "react-native" ? "index.js" : source.slice(13);
|
|
831
|
+
return this.resolve(normalizePath(resolve(reactNativeRoot, subpath)), importer, { skipSelf: true });
|
|
832
|
+
}
|
|
833
|
+
};
|
|
836
834
|
}
|
|
837
835
|
function cssStubPlugin() {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
};
|
|
836
|
+
return {
|
|
837
|
+
name: "vxrn:css-stub",
|
|
838
|
+
load: { handler(id) {
|
|
839
|
+
if (id.endsWith(".css")) return {
|
|
840
|
+
code: "",
|
|
841
|
+
moduleType: "js"
|
|
842
|
+
};
|
|
843
|
+
} }
|
|
844
|
+
};
|
|
849
845
|
}
|
|
850
846
|
function vxrnCompilerPlugin(platform, dev) {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
var header = `var __prevRefreshReg = globalThis.$RefreshReg$;
|
|
847
|
+
var projectRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : process.cwd(), sourceMaps = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
|
|
848
|
+
var compiler = null;
|
|
849
|
+
var isRefreshCandidate = function(id) {
|
|
850
|
+
return dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
|
|
851
|
+
};
|
|
852
|
+
return {
|
|
853
|
+
name: "vxrn:compiler",
|
|
854
|
+
async transform(code, id) {
|
|
855
|
+
var _ref;
|
|
856
|
+
var _babelOptions_plugins, _babelOptions_plugins1;
|
|
857
|
+
if (!/\.[cm]?[jt]sx?$/.test(id)) return;
|
|
858
|
+
if (id.includes("\0") || id.includes("virtual:")) return;
|
|
859
|
+
var needsRefresh = isRefreshCandidate(id);
|
|
860
|
+
if (!compiler) compiler = await import("@vxrn/compiler");
|
|
861
|
+
var props = {
|
|
862
|
+
id,
|
|
863
|
+
code,
|
|
864
|
+
projectRoot,
|
|
865
|
+
development: dev,
|
|
866
|
+
environment: platform,
|
|
867
|
+
reactForRNVersion: "19"
|
|
868
|
+
};
|
|
869
|
+
var babelOptions = compiler.getBabelOptions(props);
|
|
870
|
+
var curCode = code;
|
|
871
|
+
var intermediateMaps = [];
|
|
872
|
+
var isWorkletPlugin = function(entry) {
|
|
873
|
+
if (!entry) return false;
|
|
874
|
+
var name = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : null;
|
|
875
|
+
return typeof name === "string" && (name.includes("react-native-worklets") || name.includes("react-native-reanimated"));
|
|
876
|
+
};
|
|
877
|
+
var workletEntry = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins = babelOptions.plugins) === null || _babelOptions_plugins === void 0 ? void 0 : _babelOptions_plugins.find(isWorkletPlugin);
|
|
878
|
+
var workletPluginOptions = Array.isArray(workletEntry) ? workletEntry[1] : void 0;
|
|
879
|
+
var useWorklets = compiler.isNativeWorkletsEnabled() && (Boolean(workletEntry) || compiler.shouldTransformWorklets({
|
|
880
|
+
id,
|
|
881
|
+
code
|
|
882
|
+
}));
|
|
883
|
+
var compilerPluginIndex = (_ref = babelOptions === null || babelOptions === void 0 ? void 0 : (_babelOptions_plugins1 = babelOptions.plugins) === null || _babelOptions_plugins1 === void 0 ? void 0 : _babelOptions_plugins1.findIndex(function(x) {
|
|
884
|
+
return Array.isArray(x) && x[0] === "babel-plugin-react-compiler";
|
|
885
|
+
})) !== null && _ref !== void 0 ? _ref : -1;
|
|
886
|
+
if (compilerPluginIndex !== -1) {
|
|
887
|
+
if (useWorklets) {
|
|
888
|
+
var prepared = compiler.prepareWorkletsForReactCompiler(id, curCode, sourceMaps);
|
|
889
|
+
if (prepared) {
|
|
890
|
+
curCode = prepared.code;
|
|
891
|
+
if (prepared.map) intermediateMaps.push(prepared.map);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
var compilerPluginOptions = babelOptions.plugins[compilerPluginIndex][1] || {};
|
|
895
|
+
if (!(compilerPluginOptions.compiler === "babel" || process.env.ONE_REACT_COMPILER === "babel" || process.env.VXRN_REACT_COMPILER === "babel")) {
|
|
896
|
+
var compilerOut = await compiler.transformOxcReactCompiler(id, curCode, compilerPluginOptions, sourceMaps);
|
|
897
|
+
if (compilerOut === null || compilerOut === void 0 ? void 0 : compilerOut.code) {
|
|
898
|
+
curCode = compilerOut.code;
|
|
899
|
+
if (sourceMaps && compilerOut.map) intermediateMaps.push(compilerOut.map);
|
|
900
|
+
}
|
|
901
|
+
babelOptions.plugins.splice(compilerPluginIndex, 1);
|
|
902
|
+
if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
if (useWorklets) {
|
|
906
|
+
var workletOut = await compiler.transformWorklets(id, curCode, sourceMaps, {
|
|
907
|
+
projectRoot,
|
|
908
|
+
...workletPluginOptions
|
|
909
|
+
});
|
|
910
|
+
if (workletOut === null || workletOut === void 0 ? void 0 : workletOut.code) {
|
|
911
|
+
curCode = workletOut.code;
|
|
912
|
+
if (sourceMaps && workletOut.map) intermediateMaps.push(workletOut.map);
|
|
913
|
+
}
|
|
914
|
+
if (babelOptions === null || babelOptions === void 0 ? void 0 : babelOptions.plugins) {
|
|
915
|
+
babelOptions.plugins = babelOptions.plugins.filter(function(entry) {
|
|
916
|
+
return !isWorkletPlugin(entry);
|
|
917
|
+
});
|
|
918
|
+
if (babelOptions.plugins.length === 0 && !babelOptions.configFile && !babelOptions.babelrc) babelOptions = null;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
if (!babelOptions && !needsRefresh) {
|
|
922
|
+
if (curCode !== code) {
|
|
923
|
+
var finalMap = void 0;
|
|
924
|
+
if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap = intermediateMaps[0];
|
|
925
|
+
else {
|
|
926
|
+
var remapping = (await import("@jridgewell/remapping")).default;
|
|
927
|
+
finalMap = remapping(intermediateMaps.slice().reverse(), function() {
|
|
928
|
+
return null;
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
return {
|
|
932
|
+
code: curCode,
|
|
933
|
+
map: finalMap
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
if (sourceMaps && babelOptions) {
|
|
939
|
+
babelOptions = {
|
|
940
|
+
...babelOptions,
|
|
941
|
+
sourceMaps: true,
|
|
942
|
+
sourceFileName: id
|
|
943
|
+
};
|
|
944
|
+
delete babelOptions.inputSourceMap;
|
|
945
|
+
}
|
|
946
|
+
if (babelOptions) {
|
|
947
|
+
var result = await compiler.transformBabel(id, curCode, babelOptions);
|
|
948
|
+
if (result === null || result === void 0 ? void 0 : result.code) {
|
|
949
|
+
curCode = result.code;
|
|
950
|
+
if (sourceMaps && result.map) intermediateMaps.push(result.map);
|
|
951
|
+
if (!needsRefresh) {
|
|
952
|
+
var finalMap1 = void 0;
|
|
953
|
+
if (sourceMaps && intermediateMaps.length > 0) if (intermediateMaps.length === 1) finalMap1 = intermediateMaps[0];
|
|
954
|
+
else {
|
|
955
|
+
var remapping1 = (await import("@jridgewell/remapping")).default;
|
|
956
|
+
finalMap1 = remapping1(intermediateMaps.slice().reverse(), function() {
|
|
957
|
+
return null;
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
return {
|
|
961
|
+
code: curCode,
|
|
962
|
+
map: finalMap1
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
if (needsRefresh) {
|
|
968
|
+
var _compiler_configuration;
|
|
969
|
+
var { transformSync } = await import("oxc-transform-react");
|
|
970
|
+
var jsxImportSource = ((_compiler_configuration = compiler.configuration) === null || _compiler_configuration === void 0 ? void 0 : _compiler_configuration.enableNativewind) && !id.includes("node_modules") ? "nativewind" : "react";
|
|
971
|
+
var res = transformSync(id, curCode, {
|
|
972
|
+
jsx: {
|
|
973
|
+
development: dev,
|
|
974
|
+
runtime: "automatic",
|
|
975
|
+
importSource: jsxImportSource,
|
|
976
|
+
refresh: {
|
|
977
|
+
refreshReg: "__vxrnRefreshReg",
|
|
978
|
+
refreshSig: "__vxrnRefreshSig"
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
reactCompiler: false,
|
|
982
|
+
sourcemap: sourceMaps
|
|
983
|
+
});
|
|
984
|
+
if (res.fatal) {
|
|
985
|
+
var _res_errors;
|
|
986
|
+
throw new Error(`[vxrn:compiler] oxc react transform failed on ${id}: ${((_res_errors = res.errors) !== null && _res_errors !== void 0 ? _res_errors : []).map(function(e) {
|
|
987
|
+
var _e_message;
|
|
988
|
+
return (_e_message = e.message) !== null && _e_message !== void 0 ? _e_message : String(e);
|
|
989
|
+
}).join(", ")}`);
|
|
990
|
+
}
|
|
991
|
+
var header = `var __prevRefreshReg = globalThis.$RefreshReg$;
|
|
997
992
|
var __prevRefreshSig = globalThis.$RefreshSig$;
|
|
998
993
|
if (globalThis.__ReactRefresh) {
|
|
999
994
|
globalThis.$RefreshReg$ = function(type, id) {
|
|
@@ -1006,7 +1001,7 @@ var __vxrnRefreshReg = globalThis.$RefreshReg$;
|
|
|
1006
1001
|
var __vxrnRefreshSig = globalThis.$RefreshSig$;
|
|
1007
1002
|
|
|
1008
1003
|
`;
|
|
1009
|
-
|
|
1004
|
+
var footer = `
|
|
1010
1005
|
|
|
1011
1006
|
globalThis.$RefreshReg$ = __prevRefreshReg;
|
|
1012
1007
|
globalThis.$RefreshSig$ = __prevRefreshSig;
|
|
@@ -1018,338 +1013,347 @@ if (import.meta.hot) {
|
|
|
1018
1013
|
});
|
|
1019
1014
|
}
|
|
1020
1015
|
`;
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1016
|
+
var out;
|
|
1017
|
+
var finalMap2 = void 0;
|
|
1018
|
+
if (sourceMaps) {
|
|
1019
|
+
var MagicString = (await import("magic-string")).default;
|
|
1020
|
+
var ms = new MagicString(res.code);
|
|
1021
|
+
ms.prepend(header);
|
|
1022
|
+
ms.append(footer);
|
|
1023
|
+
out = ms.toString();
|
|
1024
|
+
var allMaps = [
|
|
1025
|
+
ms.generateMap({
|
|
1026
|
+
source: id,
|
|
1027
|
+
hires: true
|
|
1028
|
+
}),
|
|
1029
|
+
res.map,
|
|
1030
|
+
...intermediateMaps.slice().reverse()
|
|
1031
|
+
].filter(Boolean);
|
|
1032
|
+
var remapping2 = (await import("@jridgewell/remapping")).default;
|
|
1033
|
+
finalMap2 = remapping2(allMaps, function() {
|
|
1034
|
+
return null;
|
|
1035
|
+
});
|
|
1036
|
+
} else out = header + res.code + footer;
|
|
1037
|
+
return {
|
|
1038
|
+
code: out,
|
|
1039
|
+
map: finalMap2
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1045
1044
|
}
|
|
1046
1045
|
function flowStripPlugin() {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
return {
|
|
1060
|
-
code: result.code,
|
|
1061
|
-
map: result.map
|
|
1062
|
-
};
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
};
|
|
1046
|
+
return {
|
|
1047
|
+
name: "vxrn:flow-strip",
|
|
1048
|
+
transform: { async handler(code, id) {
|
|
1049
|
+
if (!shouldStripFlow(id, code)) return;
|
|
1050
|
+
var { stripFlowTypes } = await import("@vxrn/compiler");
|
|
1051
|
+
var result = await stripFlowTypes(id, code);
|
|
1052
|
+
return {
|
|
1053
|
+
code: result.code,
|
|
1054
|
+
map: result.map
|
|
1055
|
+
};
|
|
1056
|
+
} }
|
|
1057
|
+
};
|
|
1066
1058
|
}
|
|
1067
1059
|
function assetPlugin(opts) {
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1060
|
+
var assetRegex = new RegExp(`\\.(?:${DEFAULT_ASSET_EXTS.join("|")})$`);
|
|
1061
|
+
return {
|
|
1062
|
+
name: "vxrn:asset",
|
|
1063
|
+
load: { async handler(id) {
|
|
1064
|
+
var _opts_onAsset;
|
|
1065
|
+
if (!assetRegex.test(id)) return;
|
|
1066
|
+
var assetData = await getNativeAssetData(id, opts.root, opts.platform);
|
|
1067
|
+
(_opts_onAsset = opts.onAsset) === null || _opts_onAsset === void 0 || _opts_onAsset.call(opts, assetData);
|
|
1068
|
+
if (opts.assetsDest) copyNativeAssetFiles(assetData, opts.assetsDest, opts.platform);
|
|
1069
|
+
return {
|
|
1070
|
+
code: `module.exports = require('react-native/asset-registry').registerAsset(${JSON.stringify(assetData)});`,
|
|
1071
|
+
moduleType: "js"
|
|
1072
|
+
};
|
|
1073
|
+
} }
|
|
1074
|
+
};
|
|
1085
1075
|
}
|
|
1086
1076
|
function createNativeDevAssetRegistry() {
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
};
|
|
1077
|
+
var assets = /* @__PURE__ */ new Map();
|
|
1078
|
+
return {
|
|
1079
|
+
register(asset) {
|
|
1080
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1081
|
+
try {
|
|
1082
|
+
for (var _iterator = asset.scales.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
1083
|
+
var [index, scale] = _step.value;
|
|
1084
|
+
var filePath = asset.files[index];
|
|
1085
|
+
if (!filePath) continue;
|
|
1086
|
+
var fileName = `${asset.name}${scale === 1 ? "" : `@${scale}x`}.${asset.type}`;
|
|
1087
|
+
assets.set(`${asset.httpServerLocation}/${fileName}`, {
|
|
1088
|
+
filePath,
|
|
1089
|
+
hash: asset.hash,
|
|
1090
|
+
type: asset.type
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
} catch (err) {
|
|
1094
|
+
_didIteratorError = true;
|
|
1095
|
+
_iteratorError = err;
|
|
1096
|
+
} finally {
|
|
1097
|
+
try {
|
|
1098
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
1099
|
+
} finally {
|
|
1100
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
resolve(pathname, hash) {
|
|
1105
|
+
var asset = assets.get(pathname);
|
|
1106
|
+
if (!asset || hash !== void 0 && hash !== asset.hash) return;
|
|
1107
|
+
return asset;
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1122
1110
|
}
|
|
1123
|
-
var NATIVE_IMAGE_EXTS = /* @__PURE__ */new Set([
|
|
1111
|
+
var NATIVE_IMAGE_EXTS = /* @__PURE__ */ new Set([
|
|
1112
|
+
"png",
|
|
1113
|
+
"jpg",
|
|
1114
|
+
"jpeg",
|
|
1115
|
+
"gif",
|
|
1116
|
+
"webp",
|
|
1117
|
+
"bmp",
|
|
1118
|
+
"psd",
|
|
1119
|
+
"svg",
|
|
1120
|
+
"tiff",
|
|
1121
|
+
"ktx"
|
|
1122
|
+
]);
|
|
1124
1123
|
function parseNativeAssetName(filePath) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1124
|
+
var _ref;
|
|
1125
|
+
var type = extname(filePath).slice(1);
|
|
1126
|
+
if (!type) return;
|
|
1127
|
+
var stem = basename(filePath, `.${type}`);
|
|
1128
|
+
var platformMatch = stem.match(/^(.*)\.(ios|android)$/);
|
|
1129
|
+
var platform = platformMatch === null || platformMatch === void 0 ? void 0 : platformMatch[2];
|
|
1130
|
+
var scaleMatch = ((_ref = platformMatch === null || platformMatch === void 0 ? void 0 : platformMatch[1]) !== null && _ref !== void 0 ? _ref : stem).match(/^(.+?)(?:@([\d.]+)x)?$/);
|
|
1131
|
+
if (!scaleMatch) return;
|
|
1132
|
+
var scale = scaleMatch[2] === void 0 ? 1 : Number.parseFloat(scaleMatch[2]);
|
|
1133
|
+
if (!Number.isFinite(scale) || scale <= 0) return;
|
|
1134
|
+
return {
|
|
1135
|
+
name: scaleMatch[1],
|
|
1136
|
+
scale,
|
|
1137
|
+
platform,
|
|
1138
|
+
type
|
|
1139
|
+
};
|
|
1141
1140
|
}
|
|
1142
1141
|
function getNativeAssetUrlDirectory(root, assetDirectory) {
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1142
|
+
var safeDirectory = relative(realpathSync(root), realpathSync(assetDirectory)).replace(/\\/g, "/").split("/").filter(function(segment) {
|
|
1143
|
+
return segment && segment !== ".";
|
|
1144
|
+
}).map(function(segment) {
|
|
1145
|
+
return segment === ".." ? "_" : segment;
|
|
1146
|
+
}).join("/");
|
|
1147
|
+
return safeDirectory ? `/assets/${safeDirectory}` : "/assets";
|
|
1149
1148
|
}
|
|
1150
1149
|
async function getNativeAssetData(id, root, platform) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
} = await import("image-size");
|
|
1220
|
-
var dims = imageSize(files[0]);
|
|
1221
|
-
assetData.width = dims.width === void 0 ? void 0 : dims.width / scales[0];
|
|
1222
|
-
assetData.height = dims.height === void 0 ? void 0 : dims.height / scales[0];
|
|
1223
|
-
} catch (unused) {}
|
|
1224
|
-
return assetData;
|
|
1150
|
+
var requested = parseNativeAssetName(id);
|
|
1151
|
+
if (!requested) throw new Error(`[vxrn] invalid native asset path: ${id}`);
|
|
1152
|
+
var assetDirectory = dirname(id);
|
|
1153
|
+
var filesByScale = /* @__PURE__ */ new Map();
|
|
1154
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1155
|
+
try {
|
|
1156
|
+
for (var _iterator = readdirSync(assetDirectory)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
1157
|
+
var fileName = _step.value;
|
|
1158
|
+
var candidate = parseNativeAssetName(fileName);
|
|
1159
|
+
if (!candidate || candidate.name !== requested.name || candidate.type !== requested.type || candidate.platform !== void 0 && candidate.platform !== platform) continue;
|
|
1160
|
+
var platformSpecific = candidate.platform === platform;
|
|
1161
|
+
var existing = filesByScale.get(candidate.scale);
|
|
1162
|
+
if (!existing || platformSpecific && !existing.platformSpecific) filesByScale.set(candidate.scale, {
|
|
1163
|
+
file: join(assetDirectory, fileName),
|
|
1164
|
+
platformSpecific
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
} catch (err) {
|
|
1168
|
+
_didIteratorError = true;
|
|
1169
|
+
_iteratorError = err;
|
|
1170
|
+
} finally {
|
|
1171
|
+
try {
|
|
1172
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
1173
|
+
} finally {
|
|
1174
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
var scales = [...filesByScale.keys()].sort(function(a, b) {
|
|
1178
|
+
return a - b;
|
|
1179
|
+
});
|
|
1180
|
+
var files = scales.map(function(scale) {
|
|
1181
|
+
return filesByScale.get(scale).file;
|
|
1182
|
+
});
|
|
1183
|
+
if (files.length === 0) throw new Error(`[vxrn] native asset has no files for ${platform}: ${id}`);
|
|
1184
|
+
var hash = createHash("md5");
|
|
1185
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
1186
|
+
try {
|
|
1187
|
+
for (var _iterator1 = files[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
1188
|
+
var file = _step1.value;
|
|
1189
|
+
hash.update(readFileSync(file));
|
|
1190
|
+
}
|
|
1191
|
+
} catch (err) {
|
|
1192
|
+
_didIteratorError1 = true;
|
|
1193
|
+
_iteratorError1 = err;
|
|
1194
|
+
} finally {
|
|
1195
|
+
try {
|
|
1196
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
|
|
1197
|
+
} finally {
|
|
1198
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
var assetData = {
|
|
1202
|
+
__packager_asset: true,
|
|
1203
|
+
name: requested.name,
|
|
1204
|
+
type: requested.type,
|
|
1205
|
+
scales,
|
|
1206
|
+
files,
|
|
1207
|
+
httpServerLocation: getNativeAssetUrlDirectory(root, assetDirectory),
|
|
1208
|
+
fileSystemLocation: assetDirectory,
|
|
1209
|
+
hash: hash.digest("hex")
|
|
1210
|
+
};
|
|
1211
|
+
if (NATIVE_IMAGE_EXTS.has(requested.type)) try {
|
|
1212
|
+
var { imageSize } = await import("image-size");
|
|
1213
|
+
var dims = imageSize(files[0]);
|
|
1214
|
+
assetData.width = dims.width === void 0 ? void 0 : dims.width / scales[0];
|
|
1215
|
+
assetData.height = dims.height === void 0 ? void 0 : dims.height / scales[0];
|
|
1216
|
+
} catch (unused) {}
|
|
1217
|
+
return assetData;
|
|
1225
1218
|
}
|
|
1226
1219
|
function getIOSAssetScales(scales) {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1220
|
+
var _scales_find;
|
|
1221
|
+
var supported = scales.filter(function(scale) {
|
|
1222
|
+
return scale === 1 || scale === 2 || scale === 3;
|
|
1223
|
+
});
|
|
1224
|
+
if (supported.length > 0 || scales.length === 0) return supported;
|
|
1225
|
+
return [(_scales_find = scales.find(function(scale) {
|
|
1226
|
+
return scale > 3;
|
|
1227
|
+
})) !== null && _scales_find !== void 0 ? _scales_find : scales[scales.length - 1]];
|
|
1235
1228
|
}
|
|
1236
1229
|
function getAndroidAssetDirectory(type, scale) {
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1230
|
+
if (!(/* @__PURE__ */ new Set([
|
|
1231
|
+
"gif",
|
|
1232
|
+
"heic",
|
|
1233
|
+
"heif",
|
|
1234
|
+
"jpeg",
|
|
1235
|
+
"jpg",
|
|
1236
|
+
"ktx",
|
|
1237
|
+
"png",
|
|
1238
|
+
"webp",
|
|
1239
|
+
"xml"
|
|
1240
|
+
])).has(type)) return "raw";
|
|
1241
|
+
var density = (/* @__PURE__ */ new Map([
|
|
1242
|
+
[.75, "ldpi"],
|
|
1243
|
+
[1, "mdpi"],
|
|
1244
|
+
[1.5, "hdpi"],
|
|
1245
|
+
[2, "xhdpi"],
|
|
1246
|
+
[3, "xxhdpi"],
|
|
1247
|
+
[4, "xxxhdpi"]
|
|
1248
|
+
])).get(scale);
|
|
1249
|
+
if (density) return `drawable-${density}`;
|
|
1250
|
+
return `drawable-${Math.round(scale * 160)}dpi`;
|
|
1241
1251
|
}
|
|
1242
1252
|
function getAndroidAssetName(asset) {
|
|
1243
|
-
|
|
1253
|
+
return `${asset.httpServerLocation}/${asset.name}`.toLowerCase().replace(/^\//, "").replace(/\//g, "_").replace(/([^a-z0-9_])/g, "").replace(/^assets_/, "");
|
|
1244
1254
|
}
|
|
1245
1255
|
function copyNativeAssetFiles(asset, assetsDest, platform) {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
} finally {
|
|
1267
|
-
if (_didIteratorError) throw _iteratorError;
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1256
|
+
var validIOSScales = new Set(getIOSAssetScales(asset.scales));
|
|
1257
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
1258
|
+
try {
|
|
1259
|
+
for (var _iterator = asset.scales.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
1260
|
+
var [index, scale] = _step.value;
|
|
1261
|
+
if (platform === "ios" && !validIOSScales.has(scale)) continue;
|
|
1262
|
+
var destination = platform === "android" ? join(assetsDest, getAndroidAssetDirectory(asset.type, scale), `${getAndroidAssetName(asset)}.${asset.type}`) : join(assetsDest, asset.httpServerLocation.slice(1), `${asset.name}${scale === 1 ? "" : `@${scale}x`}.${asset.type}`);
|
|
1263
|
+
mkdirSync(dirname(destination), { recursive: true });
|
|
1264
|
+
copyFileSync(asset.files[index], destination);
|
|
1265
|
+
}
|
|
1266
|
+
} catch (err) {
|
|
1267
|
+
_didIteratorError = true;
|
|
1268
|
+
_iteratorError = err;
|
|
1269
|
+
} finally {
|
|
1270
|
+
try {
|
|
1271
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
1272
|
+
} finally {
|
|
1273
|
+
if (_didIteratorError) throw _iteratorError;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1270
1276
|
}
|
|
1271
1277
|
function hermesCompatSWCPlugin(dev) {
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
var err = result.errors[0];
|
|
1301
|
-
throw new Error(err.message + (err.codeframe ? `
|
|
1278
|
+
var sourceMaps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1279
|
+
var oxc = null;
|
|
1280
|
+
return {
|
|
1281
|
+
name: "vxrn:hermes-compat",
|
|
1282
|
+
async transform(code, id) {
|
|
1283
|
+
var _ref;
|
|
1284
|
+
if (!/\.[cm]?[jt]sx?$/.test(id)) return;
|
|
1285
|
+
if (id.includes("\0") || id.includes("virtual:")) return;
|
|
1286
|
+
var hasClass = code.includes("class ") || code.includes("class{");
|
|
1287
|
+
var hasAsync = code.includes("async");
|
|
1288
|
+
var hasBlockScopedLoop = /\bfor\s*\(\s*(?:const|let)\b/.test(code);
|
|
1289
|
+
if (!hasClass && !hasAsync && !hasBlockScopedLoop) return;
|
|
1290
|
+
var output;
|
|
1291
|
+
if (code.length <= 5e5) {
|
|
1292
|
+
var _result_errors;
|
|
1293
|
+
if (!oxc) oxc = await import("oxc-transform");
|
|
1294
|
+
var lang = /\.[cm]?ts$/.test(id) ? "ts" : id.endsWith(".tsx") ? "tsx" : "jsx";
|
|
1295
|
+
var result = oxc.transformSync(id, code, {
|
|
1296
|
+
lang,
|
|
1297
|
+
target: "es2020",
|
|
1298
|
+
assumptions: { setPublicClassFields: true },
|
|
1299
|
+
jsx: "preserve",
|
|
1300
|
+
sourcemap: sourceMaps,
|
|
1301
|
+
sourceType: id.endsWith(".cjs") ? "script" : "module"
|
|
1302
|
+
});
|
|
1303
|
+
if ((_result_errors = result.errors) === null || _result_errors === void 0 ? void 0 : _result_errors.length) {
|
|
1304
|
+
var err = result.errors[0];
|
|
1305
|
+
throw new Error(err.message + (err.codeframe ? `
|
|
1302
1306
|
${err.codeframe}` : ""));
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1307
|
+
}
|
|
1308
|
+
output = {
|
|
1309
|
+
code: result.code,
|
|
1310
|
+
map: sourceMaps ? result.map : void 0
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
var lowered = await transformHermesAsync((_ref = output === null || output === void 0 ? void 0 : output.code) !== null && _ref !== void 0 ? _ref : code, id, sourceMaps);
|
|
1314
|
+
if (!lowered) return output;
|
|
1315
|
+
if (lowered.map && (output === null || output === void 0 ? void 0 : output.map)) {
|
|
1316
|
+
var remapping = (await import("@jridgewell/remapping")).default;
|
|
1317
|
+
lowered.map = remapping([lowered.map, output.map], function() {
|
|
1318
|
+
return null;
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
return lowered;
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1320
1324
|
}
|
|
1321
1325
|
var hermesCompatPlugin = hermesCompatSWCPlugin;
|
|
1322
1326
|
function hermesLoopsPlugin() {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1327
|
+
var sourceMaps = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
1328
|
+
var compiler = null;
|
|
1329
|
+
return {
|
|
1330
|
+
name: "vxrn:hermes-loops",
|
|
1331
|
+
async transform(code, id) {
|
|
1332
|
+
if (!/\.[cm]?[jt]sx?$/.test(id)) return;
|
|
1333
|
+
if (id.includes("\0") || id.includes("virtual:")) return;
|
|
1334
|
+
if (!compiler) compiler = await import("@vxrn/compiler");
|
|
1335
|
+
var result = compiler.transformHermesLoops(code, id);
|
|
1336
|
+
if (!result) return;
|
|
1337
|
+
if (!sourceMaps) return {
|
|
1338
|
+
code: result.code,
|
|
1339
|
+
map: null
|
|
1340
|
+
};
|
|
1341
|
+
if (result.maps.length === 1) return {
|
|
1342
|
+
code: result.code,
|
|
1343
|
+
map: result.maps[0]
|
|
1344
|
+
};
|
|
1345
|
+
var remapping = (await import("@jridgewell/remapping")).default;
|
|
1346
|
+
return {
|
|
1347
|
+
code: result.code,
|
|
1348
|
+
map: remapping(result.maps.slice().reverse(), function() {
|
|
1349
|
+
return null;
|
|
1350
|
+
})
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1350
1354
|
}
|
|
1351
1355
|
function getHmrRuntimeSource() {
|
|
1352
|
-
|
|
1356
|
+
return `
|
|
1353
1357
|
// vxrn HMR runtime for rolldown devMode
|
|
1354
1358
|
var BaseDevRuntime = DevRuntime;
|
|
1355
1359
|
|
|
@@ -1586,5 +1590,6 @@ class ReactNativeDevRuntime extends BaseDevRuntime {
|
|
|
1586
1590
|
globalThis.__rolldown_runtime__ = new ReactNativeDevRuntime();
|
|
1587
1591
|
`;
|
|
1588
1592
|
}
|
|
1593
|
+
|
|
1589
1594
|
export { buildNativeBundle, createNativeDevAssetRegistry, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeAssetData, getNativeTransformConfig, hermesCompatPlugin, hermesCompatSWCPlugin, hermesLoopsPlugin, hmrClientNoopPlugin, nativeAnimatedGuardPlugin, normalizeNativeCommonJSInterop, postProcessNativeBundle, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
|
|
1590
1595
|
//# sourceMappingURL=createNativeDevEngine.native.js.map
|