vxrn 1.25.5 → 1.25.7
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 +288 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/cli.native.js +292 -0
- package/dist/cli.native.js.map +1 -0
- package/dist/config/getAdditionalViteConfig.mjs +67 -0
- package/dist/config/getAdditionalViteConfig.mjs.map +1 -0
- package/dist/config/getAdditionalViteConfig.native.js +67 -0
- package/dist/config/getAdditionalViteConfig.native.js.map +1 -0
- package/dist/config/getBaseViteConfigOnly.mjs +84 -0
- package/dist/config/getBaseViteConfigOnly.mjs.map +1 -0
- package/dist/config/getBaseViteConfigOnly.native.js +86 -0
- package/dist/config/getBaseViteConfigOnly.native.js.map +1 -0
- package/dist/config/getBaseViteConfigWithPlugins.mjs +10 -0
- package/dist/config/getBaseViteConfigWithPlugins.mjs.map +1 -0
- package/dist/config/getBaseViteConfigWithPlugins.native.js +10 -0
- package/dist/config/getBaseViteConfigWithPlugins.native.js.map +1 -0
- package/dist/config/getBaseVitePlugins.mjs +141 -0
- package/dist/config/getBaseVitePlugins.mjs.map +1 -0
- package/dist/config/getBaseVitePlugins.native.js +163 -0
- package/dist/config/getBaseVitePlugins.native.js.map +1 -0
- package/dist/config/getNonCliModeOnlyVitePlugins.mjs +8 -0
- package/dist/config/getNonCliModeOnlyVitePlugins.mjs.map +1 -0
- package/dist/config/getNonCliModeOnlyVitePlugins.native.js +6 -0
- package/dist/config/getNonCliModeOnlyVitePlugins.native.js.map +1 -0
- package/dist/config/getOptimizeDeps.mjs +47 -0
- package/dist/config/getOptimizeDeps.mjs.map +1 -0
- package/dist/config/getOptimizeDeps.native.js +47 -0
- package/dist/config/getOptimizeDeps.native.js.map +1 -0
- package/dist/config/getOptimizeDeps.test.mjs +20 -0
- package/dist/config/getOptimizeDeps.test.mjs.map +1 -0
- package/dist/config/getOptimizeDeps.test.native.js +39 -0
- package/dist/config/getOptimizeDeps.test.native.js.map +1 -0
- package/dist/config/getOptionsFilled.mjs +69 -0
- package/dist/config/getOptionsFilled.mjs.map +1 -0
- package/dist/config/getOptionsFilled.native.js +73 -0
- package/dist/config/getOptionsFilled.native.js.map +1 -0
- package/dist/config/getReactNativePlugins.mjs +23 -0
- package/dist/config/getReactNativePlugins.mjs.map +1 -0
- package/dist/config/getReactNativePlugins.native.js +25 -0
- package/dist/config/getReactNativePlugins.native.js.map +1 -0
- package/dist/config/getServerOptionsFilled.mjs +40 -0
- package/dist/config/getServerOptionsFilled.mjs.map +1 -0
- package/dist/config/getServerOptionsFilled.native.js +43 -0
- package/dist/config/getServerOptionsFilled.native.js.map +1 -0
- package/dist/config/getServerOptionsFilled.test.mjs +20 -0
- package/dist/config/getServerOptionsFilled.test.mjs.map +1 -0
- package/dist/config/getServerOptionsFilled.test.native.js +20 -0
- package/dist/config/getServerOptionsFilled.test.native.js.map +1 -0
- package/dist/config/getViteServerConfig.mjs +51 -0
- package/dist/config/getViteServerConfig.mjs.map +1 -0
- package/dist/config/getViteServerConfig.native.js +52 -0
- package/dist/config/getViteServerConfig.native.js.map +1 -0
- package/dist/config/mergeUserConfig.mjs +37 -0
- package/dist/config/mergeUserConfig.mjs.map +1 -0
- package/dist/config/mergeUserConfig.native.js +47 -0
- package/dist/config/mergeUserConfig.native.js.map +1 -0
- package/dist/config/mergeUserConfig.test.mjs +108 -0
- package/dist/config/mergeUserConfig.test.mjs.map +1 -0
- package/dist/config/mergeUserConfig.test.native.js +108 -0
- package/dist/config/mergeUserConfig.test.native.js.map +1 -0
- package/dist/constants/defaults.mjs +15 -0
- package/dist/constants/defaults.mjs.map +1 -0
- package/dist/constants/defaults.native.js +15 -0
- package/dist/constants/defaults.native.js.map +1 -0
- package/dist/constants.mjs +10 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/constants.native.js +10 -0
- package/dist/constants.native.js.map +1 -0
- package/dist/exports/build.mjs +294 -0
- package/dist/exports/build.mjs.map +1 -0
- package/dist/exports/build.native.js +307 -0
- package/dist/exports/build.native.js.map +1 -0
- package/dist/exports/clean.mjs +99 -0
- package/dist/exports/clean.mjs.map +1 -0
- package/dist/exports/clean.native.js +111 -0
- package/dist/exports/clean.native.js.map +1 -0
- package/dist/exports/clean.test.mjs +81 -0
- package/dist/exports/clean.test.mjs.map +1 -0
- package/dist/exports/clean.test.native.js +88 -0
- package/dist/exports/clean.test.native.js.map +1 -0
- package/dist/exports/createServer.mjs +56 -0
- package/dist/exports/createServer.mjs.map +1 -0
- package/dist/exports/createServer.native.js +57 -0
- package/dist/exports/createServer.native.js.map +1 -0
- package/dist/exports/dev.mjs +204 -0
- package/dist/exports/dev.mjs.map +1 -0
- package/dist/exports/dev.native.js +218 -0
- package/dist/exports/dev.native.js.map +1 -0
- package/dist/exports/loadEnv.mjs +65 -0
- package/dist/exports/loadEnv.mjs.map +1 -0
- package/dist/exports/loadEnv.native.js +74 -0
- package/dist/exports/loadEnv.native.js.map +1 -0
- package/dist/exports/loadEnv.test.mjs +65 -0
- package/dist/exports/loadEnv.test.mjs.map +1 -0
- package/dist/exports/loadEnv.test.native.js +65 -0
- package/dist/exports/loadEnv.test.native.js.map +1 -0
- package/dist/exports/patch.mjs +12 -0
- package/dist/exports/patch.mjs.map +1 -0
- package/dist/exports/patch.native.js +12 -0
- package/dist/exports/patch.native.js.map +1 -0
- package/dist/exports/prebuild.mjs +212 -0
- package/dist/exports/prebuild.mjs.map +1 -0
- package/dist/exports/prebuild.native.js +215 -0
- package/dist/exports/prebuild.native.js.map +1 -0
- package/dist/exports/prebuildWithoutExpo.mjs +53 -0
- package/dist/exports/prebuildWithoutExpo.mjs.map +1 -0
- package/dist/exports/prebuildWithoutExpo.native.js +54 -0
- package/dist/exports/prebuildWithoutExpo.native.js.map +1 -0
- package/dist/exports/runAndroid.mjs +14 -0
- package/dist/exports/runAndroid.mjs.map +1 -0
- package/dist/exports/runAndroid.native.js +15 -0
- package/dist/exports/runAndroid.native.js.map +1 -0
- package/dist/exports/runIos.mjs +14 -0
- package/dist/exports/runIos.mjs.map +1 -0
- package/dist/exports/runIos.native.js +15 -0
- package/dist/exports/runIos.native.js.map +1 -0
- package/dist/exports/serve.mjs +37 -0
- package/dist/exports/serve.mjs.map +1 -0
- package/dist/exports/serve.native.js +40 -0
- package/dist/exports/serve.native.js.map +1 -0
- package/dist/exports/serveStaticAssets.mjs +133 -0
- package/dist/exports/serveStaticAssets.mjs.map +1 -0
- package/dist/exports/serveStaticAssets.native.js +213 -0
- package/dist/exports/serveStaticAssets.native.js.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.native.js +22 -0
- package/dist/index.native.js.map +1 -0
- package/dist/patches/builtInDepPatches.mjs +483 -0
- package/dist/patches/builtInDepPatches.mjs.map +1 -0
- package/dist/patches/builtInDepPatches.native.js +486 -0
- package/dist/patches/builtInDepPatches.native.js.map +1 -0
- package/dist/plugins/applyBuiltInPatchesPlugin.mjs +17 -0
- package/dist/plugins/applyBuiltInPatchesPlugin.mjs.map +1 -0
- package/dist/plugins/applyBuiltInPatchesPlugin.native.js +17 -0
- package/dist/plugins/applyBuiltInPatchesPlugin.native.js.map +1 -0
- package/dist/plugins/autoDepOptimizePlugin.mjs +108 -0
- package/dist/plugins/autoDepOptimizePlugin.mjs.map +1 -0
- package/dist/plugins/autoDepOptimizePlugin.native.js +121 -0
- package/dist/plugins/autoDepOptimizePlugin.native.js.map +1 -0
- package/dist/plugins/autoDepOptimizePlugin.test.mjs +31 -0
- package/dist/plugins/autoDepOptimizePlugin.test.mjs.map +1 -0
- package/dist/plugins/autoDepOptimizePlugin.test.native.js +39 -0
- package/dist/plugins/autoDepOptimizePlugin.test.native.js.map +1 -0
- package/dist/plugins/clientInjectPlugin.mjs +16 -0
- package/dist/plugins/clientInjectPlugin.mjs.map +1 -0
- package/dist/plugins/clientInjectPlugin.native.js +16 -0
- package/dist/plugins/clientInjectPlugin.native.js.map +1 -0
- package/dist/plugins/defaultDepOptimizePlugin.mjs +30 -0
- package/dist/plugins/defaultDepOptimizePlugin.mjs.map +1 -0
- package/dist/plugins/defaultDepOptimizePlugin.native.js +30 -0
- package/dist/plugins/defaultDepOptimizePlugin.native.js.map +1 -0
- package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +189 -0
- package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +1 -0
- package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +202 -0
- package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +1 -0
- package/dist/plugins/getResolvedConfigSubset.mjs +12 -0
- package/dist/plugins/getResolvedConfigSubset.mjs.map +1 -0
- package/dist/plugins/getResolvedConfigSubset.native.js +12 -0
- package/dist/plugins/getResolvedConfigSubset.native.js.map +1 -0
- package/dist/plugins/reactNativeCommonJsPlugin.mjs +194 -0
- package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +1 -0
- package/dist/plugins/reactNativeCommonJsPlugin.native.js +275 -0
- package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +1 -0
- package/dist/plugins/reactNativeDevAssetPlugin.mjs +99 -0
- package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +1 -0
- package/dist/plugins/reactNativeDevAssetPlugin.native.js +108 -0
- package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +1 -0
- package/dist/plugins/reactNativeDevServer.mjs +221 -0
- package/dist/plugins/reactNativeDevServer.mjs.map +1 -0
- package/dist/plugins/reactNativeDevServer.native.js +263 -0
- package/dist/plugins/reactNativeDevServer.native.js.map +1 -0
- package/dist/plugins/resolveIdScan.test.mjs +31 -0
- package/dist/plugins/resolveIdScan.test.mjs.map +1 -0
- package/dist/plugins/resolveIdScan.test.native.js +38 -0
- package/dist/plugins/resolveIdScan.test.native.js.map +1 -0
- package/dist/plugins/rollupRemoveUnusedImports.mjs +11 -0
- package/dist/plugins/rollupRemoveUnusedImports.mjs.map +1 -0
- package/dist/plugins/rollupRemoveUnusedImports.native.js +11 -0
- package/dist/plugins/rollupRemoveUnusedImports.native.js.map +1 -0
- package/dist/plugins/serverExtensions.test.mjs +106 -0
- package/dist/plugins/serverExtensions.test.mjs.map +1 -0
- package/dist/plugins/serverExtensions.test.native.js +117 -0
- package/dist/plugins/serverExtensions.test.native.js.map +1 -0
- package/dist/rn-commands/bundle/buildBundle.mjs +68 -0
- package/dist/rn-commands/bundle/buildBundle.mjs.map +1 -0
- package/dist/rn-commands/bundle/buildBundle.native.js +75 -0
- package/dist/rn-commands/bundle/buildBundle.native.js.map +1 -0
- package/dist/runtime/hmr-client.mjs +145 -0
- package/dist/runtime/hmr-client.mjs.map +1 -0
- package/dist/runtime/hmr-client.native.js +237 -0
- package/dist/runtime/hmr-client.native.js.map +1 -0
- package/dist/runtime/hmr-runtime.mjs +200 -0
- package/dist/runtime/hmr-runtime.mjs.map +1 -0
- package/dist/runtime/hmr-runtime.native.js +441 -0
- package/dist/runtime/hmr-runtime.native.js.map +1 -0
- package/dist/runtime/hmr-types.mjs +2 -0
- package/dist/runtime/hmr-types.mjs.map +1 -0
- package/dist/runtime/hmr-types.native.js +2 -0
- package/dist/runtime/hmr-types.native.js.map +1 -0
- package/dist/runtime/native-prelude.mjs +94 -0
- package/dist/runtime/native-prelude.mjs.map +1 -0
- package/dist/runtime/native-prelude.native.js +94 -0
- package/dist/runtime/native-prelude.native.js.map +1 -0
- package/dist/runtime/react-refresh-utils.mjs +29 -0
- package/dist/runtime/react-refresh-utils.mjs.map +1 -0
- package/dist/runtime/react-refresh-utils.native.js +34 -0
- package/dist/runtime/react-refresh-utils.native.js.map +1 -0
- package/dist/serve/node.mjs +62 -0
- package/dist/serve/node.mjs.map +1 -0
- package/dist/serve/node.native.js +107 -0
- package/dist/serve/node.native.js.map +1 -0
- package/dist/serve/node.test.mjs +60 -0
- package/dist/serve/node.test.mjs.map +1 -0
- package/dist/serve/node.test.native.js +72 -0
- package/dist/serve/node.test.native.js.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/types.native.js +2 -0
- package/dist/types.native.js.map +1 -0
- package/dist/user-interface/index.mjs +312 -0
- package/dist/user-interface/index.mjs.map +1 -0
- package/dist/user-interface/index.native.js +349 -0
- package/dist/user-interface/index.native.js.map +1 -0
- package/dist/utils/assert.mjs +12 -0
- package/dist/utils/assert.mjs.map +1 -0
- package/dist/utils/assert.native.js +24 -0
- package/dist/utils/assert.native.js.map +1 -0
- package/dist/utils/bindKeypressInput.mjs +47 -0
- package/dist/utils/bindKeypressInput.mjs.map +1 -0
- package/dist/utils/bindKeypressInput.native.js +47 -0
- package/dist/utils/bindKeypressInput.native.js.map +1 -0
- package/dist/utils/bindKeypressInput.test.mjs +48 -0
- package/dist/utils/bindKeypressInput.test.mjs.map +1 -0
- package/dist/utils/bindKeypressInput.test.native.js +48 -0
- package/dist/utils/bindKeypressInput.test.native.js.map +1 -0
- package/dist/utils/coerceToArray.mjs +5 -0
- package/dist/utils/coerceToArray.mjs.map +1 -0
- package/dist/utils/coerceToArray.native.js +5 -0
- package/dist/utils/coerceToArray.native.js.map +1 -0
- package/dist/utils/connectedNativeClients.mjs +9 -0
- package/dist/utils/connectedNativeClients.mjs.map +1 -0
- package/dist/utils/connectedNativeClients.native.js +9 -0
- package/dist/utils/connectedNativeClients.native.js.map +1 -0
- package/dist/utils/createNativeDevEngine.mjs +939 -0
- package/dist/utils/createNativeDevEngine.mjs.map +1 -0
- package/dist/utils/createNativeDevEngine.native.js +999 -0
- package/dist/utils/createNativeDevEngine.native.js.map +1 -0
- package/dist/utils/createNativeDevEngine.test.mjs +169 -0
- package/dist/utils/createNativeDevEngine.test.mjs.map +1 -0
- package/dist/utils/createNativeDevEngine.test.native.js +203 -0
- package/dist/utils/createNativeDevEngine.test.native.js.map +1 -0
- package/dist/utils/dispose.mjs +9 -0
- package/dist/utils/dispose.mjs.map +1 -0
- package/dist/utils/dispose.native.js +11 -0
- package/dist/utils/dispose.native.js.map +1 -0
- package/dist/utils/environmentUtils.mjs +14 -0
- package/dist/utils/environmentUtils.mjs.map +1 -0
- package/dist/utils/environmentUtils.native.js +14 -0
- package/dist/utils/environmentUtils.native.js.map +1 -0
- package/dist/utils/execSync.mjs +9 -0
- package/dist/utils/execSync.mjs.map +1 -0
- package/dist/utils/execSync.native.js +9 -0
- package/dist/utils/execSync.native.js.map +1 -0
- package/dist/utils/expoRun.mjs +48 -0
- package/dist/utils/expoRun.mjs.map +1 -0
- package/dist/utils/expoRun.native.js +49 -0
- package/dist/utils/expoRun.native.js.map +1 -0
- package/dist/utils/filterViteServerResolvedUrls.mjs +29 -0
- package/dist/utils/filterViteServerResolvedUrls.mjs.map +1 -0
- package/dist/utils/filterViteServerResolvedUrls.native.js +70 -0
- package/dist/utils/filterViteServerResolvedUrls.native.js.map +1 -0
- package/dist/utils/getBoundPort.mjs +9 -0
- package/dist/utils/getBoundPort.mjs.map +1 -0
- package/dist/utils/getBoundPort.native.js +16 -0
- package/dist/utils/getBoundPort.native.js.map +1 -0
- package/dist/utils/getBoundPort.test.mjs +71 -0
- package/dist/utils/getBoundPort.test.mjs.map +1 -0
- package/dist/utils/getBoundPort.test.native.js +82 -0
- package/dist/utils/getBoundPort.test.native.js.map +1 -0
- package/dist/utils/getCacheDir.mjs +6 -0
- package/dist/utils/getCacheDir.mjs.map +1 -0
- package/dist/utils/getCacheDir.native.js +6 -0
- package/dist/utils/getCacheDir.native.js.map +1 -0
- package/dist/utils/getServerEntry.mjs +10 -0
- package/dist/utils/getServerEntry.mjs.map +1 -0
- package/dist/utils/getServerEntry.native.js +17 -0
- package/dist/utils/getServerEntry.native.js.map +1 -0
- package/dist/utils/getVitePath.mjs +49 -0
- package/dist/utils/getVitePath.mjs.map +1 -0
- package/dist/utils/getVitePath.native.js +48 -0
- package/dist/utils/getVitePath.native.js.map +1 -0
- package/dist/utils/globDir.mjs +18 -0
- package/dist/utils/globDir.mjs.map +1 -0
- package/dist/utils/globDir.native.js +21 -0
- package/dist/utils/globDir.native.js.map +1 -0
- package/dist/utils/imageSizePatch.test.mjs +29 -0
- package/dist/utils/imageSizePatch.test.mjs.map +1 -0
- package/dist/utils/imageSizePatch.test.native.js +30 -0
- package/dist/utils/imageSizePatch.test.native.js.map +1 -0
- package/dist/utils/isWithin.mjs +7 -0
- package/dist/utils/isWithin.mjs.map +1 -0
- package/dist/utils/isWithin.native.js +7 -0
- package/dist/utils/isWithin.native.js.map +1 -0
- package/dist/utils/patches.mjs +279 -0
- package/dist/utils/patches.mjs.map +1 -0
- package/dist/utils/patches.native.js +508 -0
- package/dist/utils/patches.native.js.map +1 -0
- package/dist/utils/patches.test.mjs +214 -0
- package/dist/utils/patches.test.mjs.map +1 -0
- package/dist/utils/patches.test.native.js +224 -0
- package/dist/utils/patches.test.native.js.map +1 -0
- package/dist/utils/printServerUrls.mjs +12 -0
- package/dist/utils/printServerUrls.mjs.map +1 -0
- package/dist/utils/printServerUrls.native.js +56 -0
- package/dist/utils/printServerUrls.native.js.map +1 -0
- package/dist/utils/removeUndefined.mjs +11 -0
- package/dist/utils/removeUndefined.mjs.map +1 -0
- package/dist/utils/removeUndefined.native.js +11 -0
- package/dist/utils/removeUndefined.native.js.map +1 -0
- package/dist/utils/scanDepsToOptimize.mjs +176 -0
- package/dist/utils/scanDepsToOptimize.mjs.map +1 -0
- package/dist/utils/scanDepsToOptimize.native.js +212 -0
- package/dist/utils/scanDepsToOptimize.native.js.map +1 -0
- package/dist/utils/state.mjs +28 -0
- package/dist/utils/state.mjs.map +1 -0
- package/dist/utils/state.native.js +28 -0
- package/dist/utils/state.native.js.map +1 -0
- package/dist/utils/uniq.mjs +5 -0
- package/dist/utils/uniq.mjs.map +1 -0
- package/dist/utils/uniq.native.js +5 -0
- package/dist/utils/uniq.native.js.map +1 -0
- package/dist/utils/utils.mjs +32 -0
- package/dist/utils/utils.mjs.map +1 -0
- package/dist/utils/utils.native.js +53 -0
- package/dist/utils/utils.native.js.map +1 -0
- package/dist/vendor/debugger-app/index.mjs +2 -0
- package/dist/vendor/debugger-app/index.mjs.map +1 -0
- package/dist/vendor/debugger-app/index.native.js +2 -0
- package/dist/vendor/debugger-app/index.native.js.map +1 -0
- package/dist/vendor/debugger-app/src/debuggerWorker.mjs +2 -0
- package/dist/vendor/debugger-app/src/debuggerWorker.mjs.map +1 -0
- package/dist/vendor/debugger-app/src/debuggerWorker.native.js +2 -0
- package/dist/vendor/debugger-app/src/debuggerWorker.native.js.map +1 -0
- package/dist/vendor/debugger-app/src/index.css +41 -0
- package/dist/vendor/debugger-app/src/index.css.map +6 -0
- package/dist/vendor/debugger-app/src/index.mjs +2 -0
- package/dist/vendor/debugger-app/src/index.mjs.map +1 -0
- package/dist/vendor/debugger-app/src/index.native.js +2 -0
- package/dist/vendor/debugger-app/src/index.native.js.map +1 -0
- package/dist/vxrn-vite-plugin.mjs +44 -0
- package/dist/vxrn-vite-plugin.mjs.map +1 -0
- package/dist/vxrn-vite-plugin.native.js +45 -0
- package/dist/vxrn-vite-plugin.native.js.map +1 -0
- package/package.json +11 -11
- package/types/cli.d.ts.map +1 -0
- package/types/config/getAdditionalViteConfig.d.ts.map +1 -0
- package/types/config/getBaseViteConfigOnly.d.ts.map +1 -0
- package/types/config/getBaseViteConfigWithPlugins.d.ts.map +1 -0
- package/types/config/getBaseVitePlugins.d.ts.map +1 -0
- package/types/config/getNonCliModeOnlyVitePlugins.d.ts.map +1 -0
- package/types/config/getOptimizeDeps.d.ts.map +1 -0
- package/types/config/getOptimizeDeps.test.d.ts.map +1 -0
- package/types/config/getOptionsFilled.d.ts.map +1 -0
- package/types/config/getReactNativePlugins.d.ts.map +1 -0
- package/types/config/getServerOptionsFilled.d.ts.map +1 -0
- package/types/config/getServerOptionsFilled.test.d.ts.map +1 -0
- package/types/config/getViteServerConfig.d.ts.map +1 -0
- package/types/config/mergeUserConfig.d.ts.map +1 -0
- package/types/config/mergeUserConfig.test.d.ts.map +1 -0
- package/types/constants/defaults.d.ts.map +1 -0
- package/types/constants.d.ts.map +1 -0
- package/types/exports/build.d.ts.map +1 -0
- package/types/exports/clean.d.ts.map +1 -0
- package/types/exports/clean.test.d.ts.map +1 -0
- package/types/exports/createServer.d.ts.map +1 -0
- package/types/exports/dev.d.ts.map +1 -0
- package/types/exports/loadEnv.d.ts.map +1 -0
- package/types/exports/loadEnv.test.d.ts.map +1 -0
- package/types/exports/patch.d.ts.map +1 -0
- package/types/exports/prebuild.d.ts.map +1 -0
- package/types/exports/prebuildWithoutExpo.d.ts.map +1 -0
- package/types/exports/runAndroid.d.ts.map +1 -0
- package/types/exports/runIos.d.ts.map +1 -0
- package/types/exports/serve.d.ts.map +1 -0
- package/types/exports/serveStaticAssets.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
- package/types/patches/builtInDepPatches.d.ts.map +1 -0
- package/types/plugins/applyBuiltInPatchesPlugin.d.ts.map +1 -0
- package/types/plugins/autoDepOptimizePlugin.d.ts.map +1 -0
- package/types/plugins/autoDepOptimizePlugin.test.d.ts.map +1 -0
- package/types/plugins/clientInjectPlugin.d.ts.map +1 -0
- package/types/plugins/defaultDepOptimizePlugin.d.ts.map +1 -0
- package/types/plugins/expoManifestRequestHandlerPlugin.d.ts.map +1 -0
- package/types/plugins/getResolvedConfigSubset.d.ts.map +1 -0
- package/types/plugins/reactNativeCommonJsPlugin.d.ts.map +1 -0
- package/types/plugins/reactNativeDevAssetPlugin.d.ts.map +1 -0
- package/types/plugins/reactNativeDevServer.d.ts.map +1 -0
- package/types/plugins/resolveIdScan.test.d.ts.map +1 -0
- package/types/plugins/rollupRemoveUnusedImports.d.ts.map +1 -0
- package/types/plugins/serverExtensions.test.d.ts.map +1 -0
- package/types/rn-commands/bundle/buildBundle.d.ts.map +1 -0
- package/types/runtime/hmr-client.d.ts.map +1 -0
- package/types/runtime/hmr-runtime.d.ts.map +1 -0
- package/types/runtime/hmr-types.d.ts.map +1 -0
- package/types/runtime/native-prelude.d.ts.map +1 -0
- package/types/runtime/react-refresh-utils.d.ts.map +1 -0
- package/types/serve/node.d.ts.map +1 -0
- package/types/serve/node.test.d.ts.map +1 -0
- package/types/types.d.ts.map +1 -0
- package/types/user-interface/index.d.ts.map +1 -0
- package/types/utils/assert.d.ts.map +1 -0
- package/types/utils/bindKeypressInput.d.ts.map +1 -0
- package/types/utils/bindKeypressInput.test.d.ts.map +1 -0
- package/types/utils/coerceToArray.d.ts.map +1 -0
- package/types/utils/connectedNativeClients.d.ts.map +1 -0
- package/types/utils/createNativeDevEngine.d.ts.map +1 -0
- package/types/utils/createNativeDevEngine.test.d.ts.map +1 -0
- package/types/utils/dispose.d.ts.map +1 -0
- package/types/utils/environmentUtils.d.ts.map +1 -0
- package/types/utils/execSync.d.ts.map +1 -0
- package/types/utils/expoRun.d.ts.map +1 -0
- package/types/utils/filterViteServerResolvedUrls.d.ts.map +1 -0
- package/types/utils/getBoundPort.d.ts.map +1 -0
- package/types/utils/getBoundPort.test.d.ts.map +1 -0
- package/types/utils/getCacheDir.d.ts.map +1 -0
- package/types/utils/getServerEntry.d.ts.map +1 -0
- package/types/utils/getVitePath.d.ts.map +1 -0
- package/types/utils/globDir.d.ts.map +1 -0
- package/types/utils/imageSizePatch.test.d.ts.map +1 -0
- package/types/utils/isWithin.d.ts.map +1 -0
- package/types/utils/patches.d.ts.map +1 -0
- package/types/utils/patches.test.d.ts.map +1 -0
- package/types/utils/printServerUrls.d.ts.map +1 -0
- package/types/utils/removeUndefined.d.ts.map +1 -0
- package/types/utils/scanDepsToOptimize.d.ts.map +1 -0
- package/types/utils/state.d.ts.map +1 -0
- package/types/utils/uniq.d.ts.map +1 -0
- package/types/utils/utils.d.ts.map +1 -0
- package/types/vxrn-vite-plugin.d.ts.map +1 -0
|
@@ -0,0 +1,939 @@
|
|
|
1
|
+
import { basename, dirname, extname, join, relative, resolve } from "node:path";
|
|
2
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
|
+
import { normalizePath } from "vite";
|
|
5
|
+
import { DEFAULT_ASSET_EXTS } from "../constants/defaults.mjs";
|
|
6
|
+
import { getNativePrelude } from "../runtime/native-prelude.mjs";
|
|
7
|
+
const FLOW_FILE_PATTERN = /node_modules[\\/](?:react-native|@react-native)[\\/].*\.js$/;
|
|
8
|
+
const HERMES_CLASS_TRANSFORMS = ["transform-classes", "transform-class-properties", "transform-class-static-block", "transform-private-methods", "transform-private-property-in-object"];
|
|
9
|
+
const HERMES_PROD_TRANSFORMS = ["transform-async-to-generator"];
|
|
10
|
+
function getHermesSWCIncludes(dev) {
|
|
11
|
+
return [...HERMES_CLASS_TRANSFORMS, ...(dev ? [] : HERMES_PROD_TRANSFORMS)];
|
|
12
|
+
}
|
|
13
|
+
function getResolveExtensions(platform) {
|
|
14
|
+
const platformExts = platform === "ios" ? [".ios.tsx", ".ios.ts", ".ios.jsx", ".ios.js"] : [".android.tsx", ".android.ts", ".android.jsx", ".android.js"];
|
|
15
|
+
const nativeExts = [".native.tsx", ".native.ts", ".native.jsx", ".native.js"];
|
|
16
|
+
const defaultExts = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs", ".json"];
|
|
17
|
+
return [...platformExts, ...nativeExts, ...defaultExts];
|
|
18
|
+
}
|
|
19
|
+
function getNativeResolveConfig(platform) {
|
|
20
|
+
return {
|
|
21
|
+
extensions: getResolveExtensions(platform),
|
|
22
|
+
conditionNames: ["react-native", "import", "require", "default"],
|
|
23
|
+
mainFields: ["react-native", "module", "main"]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function getNativeTransformConfig(platform, dev, root) {
|
|
27
|
+
const entryConfig = globalThis.__vxrnNativeEntryConfig || {};
|
|
28
|
+
const setupFileDefines = (() => {
|
|
29
|
+
const sf = entryConfig.setupFile;
|
|
30
|
+
if (!sf) return {};
|
|
31
|
+
const files = typeof sf === "string" ? {
|
|
32
|
+
client: sf,
|
|
33
|
+
server: sf,
|
|
34
|
+
ios: sf,
|
|
35
|
+
android: sf
|
|
36
|
+
} : "native" in sf ? {
|
|
37
|
+
client: sf.client,
|
|
38
|
+
server: sf.server,
|
|
39
|
+
ios: sf.native,
|
|
40
|
+
android: sf.native
|
|
41
|
+
} : sf;
|
|
42
|
+
return {
|
|
43
|
+
...(files.client && {
|
|
44
|
+
"process.env.ONE_SETUP_FILE_CLIENT": JSON.stringify(files.client)
|
|
45
|
+
}),
|
|
46
|
+
...(files.server && {
|
|
47
|
+
"process.env.ONE_SETUP_FILE_SERVER": JSON.stringify(files.server)
|
|
48
|
+
}),
|
|
49
|
+
...(files.ios && {
|
|
50
|
+
"process.env.ONE_SETUP_FILE_IOS": JSON.stringify(files.ios)
|
|
51
|
+
}),
|
|
52
|
+
...(files.android && {
|
|
53
|
+
"process.env.ONE_SETUP_FILE_ANDROID": JSON.stringify(files.android)
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
})();
|
|
57
|
+
const envDefines = (() => {
|
|
58
|
+
const defines = {};
|
|
59
|
+
try {
|
|
60
|
+
const mode2 = dev ? "development" : "production";
|
|
61
|
+
for (const envFile of [".env", ".env.local", `.env.${mode2}`, `.env.${mode2}.local`]) {
|
|
62
|
+
const envPath = join(root, envFile);
|
|
63
|
+
if (!existsSync(envPath)) continue;
|
|
64
|
+
const content = readFileSync(envPath, "utf8");
|
|
65
|
+
for (const line of content.split("\n")) {
|
|
66
|
+
const match = line.match(/^\s*(VITE_\w+)\s*=\s*(.*)$/);
|
|
67
|
+
if (match) {
|
|
68
|
+
const [, key, rawVal] = match;
|
|
69
|
+
const val = rawVal.replace(/^['"]|['"]$/g, "").trim();
|
|
70
|
+
defines[`import.meta.env.${key}`] = JSON.stringify(val);
|
|
71
|
+
defines[`process.env.${key}`] = JSON.stringify(val);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch {}
|
|
76
|
+
return defines;
|
|
77
|
+
})();
|
|
78
|
+
const mode = dev ? "development" : "production";
|
|
79
|
+
const envObject = {
|
|
80
|
+
MODE: mode,
|
|
81
|
+
DEV: dev,
|
|
82
|
+
PROD: !dev,
|
|
83
|
+
SSR: false,
|
|
84
|
+
VITE_ENVIRONMENT: platform,
|
|
85
|
+
VITE_NATIVE: "1",
|
|
86
|
+
EXPO_OS: platform,
|
|
87
|
+
TAMAGUI_TARGET: "native",
|
|
88
|
+
TAMAGUI_ENVIRONMENT: platform
|
|
89
|
+
};
|
|
90
|
+
for (const [key, val] of Object.entries(envDefines)) {
|
|
91
|
+
const match = key.match(/^import\.meta\.env\.(.+)$/);
|
|
92
|
+
if (match) try {
|
|
93
|
+
envObject[match[1]] = JSON.parse(val);
|
|
94
|
+
} catch {
|
|
95
|
+
envObject[match[1]] = val;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
jsx: {
|
|
100
|
+
runtime: "classic"
|
|
101
|
+
},
|
|
102
|
+
define: {
|
|
103
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
104
|
+
"process.env.VXRN_REACT_19": "false",
|
|
105
|
+
"process.env.VITE_ENVIRONMENT": JSON.stringify(platform),
|
|
106
|
+
"process.env.VITE_NATIVE": "\"1\"",
|
|
107
|
+
"process.env.EXPO_OS": JSON.stringify(platform),
|
|
108
|
+
"process.env.TAMAGUI_TARGET": "\"native\"",
|
|
109
|
+
"process.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
|
|
110
|
+
__DEV__: dev ? "true" : "false",
|
|
111
|
+
"import.meta.env": JSON.stringify(envObject),
|
|
112
|
+
"import.meta.env.MODE": JSON.stringify(mode),
|
|
113
|
+
"import.meta.env.DEV": dev ? "true" : "false",
|
|
114
|
+
"import.meta.env.PROD": dev ? "false" : "true",
|
|
115
|
+
"import.meta.env.SSR": "false",
|
|
116
|
+
"import.meta.env.VITE_ENVIRONMENT": JSON.stringify(platform),
|
|
117
|
+
"import.meta.env.VITE_NATIVE": "\"1\"",
|
|
118
|
+
"import.meta.env.EXPO_OS": JSON.stringify(platform),
|
|
119
|
+
"import.meta.env.TAMAGUI_TARGET": "\"native\"",
|
|
120
|
+
"import.meta.env.TAMAGUI_ENVIRONMENT": JSON.stringify(platform),
|
|
121
|
+
...envDefines,
|
|
122
|
+
...setupFileDefines
|
|
123
|
+
},
|
|
124
|
+
inject: {
|
|
125
|
+
React: "react"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest) {
|
|
130
|
+
return [...(globalThis.__vxrnAddNativePlugins || []), serverFileExclusionPlugin(), environmentGuardPlugin(), hmrClientNoopPlugin(), cssStubPlugin(), viteImportGlobPlugin({
|
|
131
|
+
root
|
|
132
|
+
}), vxrnCompilerPlugin(platform, dev, root), flowStripPlugin(), nativeAnimatedGuardPlugin(), assetPlugin({
|
|
133
|
+
root,
|
|
134
|
+
platform,
|
|
135
|
+
assetsDest
|
|
136
|
+
}), hermesCompatSWCPlugin(dev)];
|
|
137
|
+
}
|
|
138
|
+
function getNativeOutputOptions(prelude, sourcemap) {
|
|
139
|
+
return {
|
|
140
|
+
format: "esm",
|
|
141
|
+
sourcemap,
|
|
142
|
+
intro: prelude,
|
|
143
|
+
codeSplitting: false,
|
|
144
|
+
strictExecutionOrder: true
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function postProcessNativeBundle(code) {
|
|
148
|
+
code = code.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm, "");
|
|
149
|
+
code = code.replace(/^\s*export\s+default\s+([^;\n]+);?\s*$/gm, "$1;");
|
|
150
|
+
code = code.replace(/^if \(import\.meta\.hot\).*$/gm, "");
|
|
151
|
+
{
|
|
152
|
+
const idx = code.indexOf("NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;");
|
|
153
|
+
if (idx !== -1) {
|
|
154
|
+
const beforeMarker = code.lastIndexOf("NativeAnimatedModule = ", idx);
|
|
155
|
+
if (beforeMarker !== -1) {
|
|
156
|
+
const lineStart = code.lastIndexOf("\n", beforeMarker);
|
|
157
|
+
const snippet = code.slice(lineStart + 1, beforeMarker + 50);
|
|
158
|
+
if (snippet.includes("(function()") || snippet.includes("new Proxy")) {
|
|
159
|
+
const afterMarker = code.indexOf("})();", idx);
|
|
160
|
+
if (afterMarker !== -1) {
|
|
161
|
+
const end = afterMarker + 5;
|
|
162
|
+
code = code.slice(0, beforeMarker) + "NativeAnimatedModule = NativeAnimatedModule_default ?? NativeAnimatedTurboModule_default;" + code.slice(end);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return code;
|
|
169
|
+
}
|
|
170
|
+
function wrapNativeBundleModuleScope(code) {
|
|
171
|
+
const idx = code.indexOf("//#region \\0rolldown/runtime.js");
|
|
172
|
+
if (idx === -1) return code;
|
|
173
|
+
return code.slice(0, idx) + ";(function() {\n" + code.slice(idx) + "\n})();\n";
|
|
174
|
+
}
|
|
175
|
+
async function downlevelClassFieldsInBundle(code) {
|
|
176
|
+
const startMarker = "//#region \\0rolldown/runtime.js";
|
|
177
|
+
const endMarker = "//#endregion";
|
|
178
|
+
const startIdx = code.indexOf(startMarker);
|
|
179
|
+
if (startIdx === -1) return code;
|
|
180
|
+
const endIdx = code.indexOf(endMarker, startIdx);
|
|
181
|
+
if (endIdx === -1) return code;
|
|
182
|
+
const runtimeEnd = endIdx + 12;
|
|
183
|
+
const runtimeSection = code.slice(startIdx, runtimeEnd);
|
|
184
|
+
try {
|
|
185
|
+
const result = await (await import("@swc/core")).transform(runtimeSection, {
|
|
186
|
+
filename: "rolldown-runtime.js",
|
|
187
|
+
configFile: false,
|
|
188
|
+
swcrc: false,
|
|
189
|
+
sourceMaps: false,
|
|
190
|
+
inputSourceMap: false,
|
|
191
|
+
isModule: false,
|
|
192
|
+
env: {
|
|
193
|
+
targets: {
|
|
194
|
+
node: 9999
|
|
195
|
+
},
|
|
196
|
+
include: [...HERMES_CLASS_TRANSFORMS]
|
|
197
|
+
},
|
|
198
|
+
jsc: {
|
|
199
|
+
parser: {
|
|
200
|
+
syntax: "ecmascript"
|
|
201
|
+
},
|
|
202
|
+
transform: {
|
|
203
|
+
react: {
|
|
204
|
+
runtime: "preserve"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
externalHelpers: false,
|
|
208
|
+
assumptions: {
|
|
209
|
+
setPublicClassFields: true,
|
|
210
|
+
privateFieldsAsProperties: true
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return code.slice(0, startIdx) + result.code + code.slice(runtimeEnd);
|
|
215
|
+
} catch (err) {
|
|
216
|
+
console.warn("[vxrn] downlevelClassFieldsInBundle failed, returning original:", err);
|
|
217
|
+
return code;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async function createNativeDevEngine(options) {
|
|
221
|
+
const {
|
|
222
|
+
root,
|
|
223
|
+
port,
|
|
224
|
+
host = "localhost",
|
|
225
|
+
platform,
|
|
226
|
+
serverUrl,
|
|
227
|
+
plugins: userPlugins = [],
|
|
228
|
+
onHmrUpdate
|
|
229
|
+
} = options;
|
|
230
|
+
const {
|
|
231
|
+
dev,
|
|
232
|
+
viteImportGlobPlugin
|
|
233
|
+
} = await import("rolldown/experimental");
|
|
234
|
+
const hmrRuntimeSource = getHmrRuntimeSource();
|
|
235
|
+
const prelude = getNativePrelude({
|
|
236
|
+
dev: true,
|
|
237
|
+
platform,
|
|
238
|
+
serverUrl: serverUrl || `http://${host}:${port}`
|
|
239
|
+
});
|
|
240
|
+
let currentBundle = null;
|
|
241
|
+
let bundleResolve = null;
|
|
242
|
+
let bundlePromise = null;
|
|
243
|
+
const resolvedHost = host === "0.0.0.0" ? "localhost" : host;
|
|
244
|
+
const engine = await dev({
|
|
245
|
+
input: VIRTUAL_NATIVE_ENTRY,
|
|
246
|
+
cwd: root,
|
|
247
|
+
platform: "neutral",
|
|
248
|
+
resolve: getNativeResolveConfig(platform),
|
|
249
|
+
transform: getNativeTransformConfig(platform, true, root),
|
|
250
|
+
experimental: {
|
|
251
|
+
devMode: {
|
|
252
|
+
implement: hmrRuntimeSource,
|
|
253
|
+
host,
|
|
254
|
+
port
|
|
255
|
+
},
|
|
256
|
+
incrementalBuild: true,
|
|
257
|
+
lazyBarrel: true
|
|
258
|
+
},
|
|
259
|
+
treeshake: false,
|
|
260
|
+
shimMissingExports: true,
|
|
261
|
+
moduleTypes: {
|
|
262
|
+
".js": "jsx"
|
|
263
|
+
},
|
|
264
|
+
plugins: [nativeVirtualEntryPlugin(root, {
|
|
265
|
+
dev: true
|
|
266
|
+
}), ...getNativePlugins(root, platform, viteImportGlobPlugin, true), ...userPlugins]
|
|
267
|
+
}, {
|
|
268
|
+
...getNativeOutputOptions(prelude, false),
|
|
269
|
+
outro: `
|
|
270
|
+
try {
|
|
271
|
+
var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
|
|
272
|
+
var __hmrUrl = 'ws://${resolvedHost}:${port}/hot?platform=${platform}&clientId=' + encodeURIComponent(__rolldown_runtime__.clientId);
|
|
273
|
+
var __hmrWS = new __WS(__hmrUrl);
|
|
274
|
+
__hmrWS.onmessage = function(event) {
|
|
275
|
+
try {
|
|
276
|
+
var msg = JSON.parse(event.data);
|
|
277
|
+
var g = typeof global !== 'undefined' ? global : globalThis;
|
|
278
|
+
if (msg.type === 'hmr:update' && msg.code) {
|
|
279
|
+
var applied = __rolldown_runtime__.applyHmrUpdate(msg.code, msg.changedIds, msg.seq);
|
|
280
|
+
if (!applied) {
|
|
281
|
+
var updateSettings = g.__turboModuleProxy ? g.__turboModuleProxy('DevSettings') : null;
|
|
282
|
+
if (updateSettings && updateSettings.reload) updateSettings.reload();
|
|
283
|
+
}
|
|
284
|
+
} else if (msg.type === 'hmr:reload') {
|
|
285
|
+
var ds = g.__turboModuleProxy ? g.__turboModuleProxy('DevSettings') : null;
|
|
286
|
+
if (ds && ds.reload) ds.reload();
|
|
287
|
+
}
|
|
288
|
+
} catch(e) { console.error('[vxrn] HMR eval error:', e); }
|
|
289
|
+
};
|
|
290
|
+
__hmrWS.onopen = function() {
|
|
291
|
+
if (typeof __rolldown_runtime__ !== 'undefined' && __rolldown_runtime__.setup) {
|
|
292
|
+
__rolldown_runtime__.setup(__hmrWS);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
__hmrWS.onerror = function(e) { console.warn('[vxrn] HMR connection error:', e.message || e); };
|
|
296
|
+
} catch(e) {}
|
|
297
|
+
`
|
|
298
|
+
}, {
|
|
299
|
+
onOutput: async result => {
|
|
300
|
+
if (result instanceof Error) {
|
|
301
|
+
console.error("[vxrn] native bundle error:", result.message);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const chunk = result.output.find(o => o.type === "chunk" && o.isEntry);
|
|
305
|
+
if (chunk && "code" in chunk) {
|
|
306
|
+
let code = postProcessNativeBundle(chunk.code);
|
|
307
|
+
code = await downlevelClassFieldsInBundle(code);
|
|
308
|
+
code = wrapNativeBundleModuleScope(code);
|
|
309
|
+
currentBundle = {
|
|
310
|
+
code
|
|
311
|
+
};
|
|
312
|
+
console.info(`[vxrn] native bundle ready (${Math.round(code.length / 1024)}KB)`);
|
|
313
|
+
if (bundleResolve) {
|
|
314
|
+
bundleResolve(currentBundle);
|
|
315
|
+
bundleResolve = null;
|
|
316
|
+
bundlePromise = null;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
onHmrUpdates: async result => {
|
|
321
|
+
if (result instanceof Error) {
|
|
322
|
+
console.error("[vxrn] HMR error:", result.message);
|
|
323
|
+
onHmrUpdate?.({
|
|
324
|
+
type: "hmr:error"
|
|
325
|
+
});
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
for (const {
|
|
329
|
+
clientId,
|
|
330
|
+
update
|
|
331
|
+
} of result.updates) if (update.type === "Patch" && update.code) onHmrUpdate?.({
|
|
332
|
+
type: "hmr:update",
|
|
333
|
+
clientId,
|
|
334
|
+
code: update.code,
|
|
335
|
+
changedIds: update.changedIds,
|
|
336
|
+
seq: update.seq
|
|
337
|
+
});else if (update.type === "FullReload") onHmrUpdate?.({
|
|
338
|
+
type: "hmr:reload",
|
|
339
|
+
clientId
|
|
340
|
+
});
|
|
341
|
+
},
|
|
342
|
+
rebuildStrategy: "never",
|
|
343
|
+
watch: {}
|
|
344
|
+
});
|
|
345
|
+
await engine.run();
|
|
346
|
+
return {
|
|
347
|
+
engine,
|
|
348
|
+
async getBundle() {
|
|
349
|
+
await engine.ensureLatestBuildOutput();
|
|
350
|
+
if (currentBundle) return currentBundle;
|
|
351
|
+
if (!bundlePromise) {
|
|
352
|
+
let timeoutId;
|
|
353
|
+
bundlePromise = new Promise((resolve2, reject) => {
|
|
354
|
+
bundleResolve = value => {
|
|
355
|
+
clearTimeout(timeoutId);
|
|
356
|
+
resolve2(value);
|
|
357
|
+
};
|
|
358
|
+
timeoutId = setTimeout(() => reject(/* @__PURE__ */new Error("[vxrn] bundle build timed out after 120s")), 12e4);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
return bundlePromise;
|
|
362
|
+
},
|
|
363
|
+
async close() {
|
|
364
|
+
await engine.close();
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async function buildNativeBundle(options) {
|
|
369
|
+
const {
|
|
370
|
+
root,
|
|
371
|
+
platform,
|
|
372
|
+
dev = false,
|
|
373
|
+
serverUrl,
|
|
374
|
+
entryFile,
|
|
375
|
+
assetsDest,
|
|
376
|
+
plugins: userPlugins = [],
|
|
377
|
+
sourcemap = false
|
|
378
|
+
} = options;
|
|
379
|
+
const {
|
|
380
|
+
build
|
|
381
|
+
} = await import("rolldown");
|
|
382
|
+
const {
|
|
383
|
+
viteImportGlobPlugin
|
|
384
|
+
} = await import("rolldown/experimental");
|
|
385
|
+
const prelude = getNativePrelude({
|
|
386
|
+
dev,
|
|
387
|
+
platform,
|
|
388
|
+
serverUrl
|
|
389
|
+
});
|
|
390
|
+
const chunk = (await build({
|
|
391
|
+
input: entryFile ? normalizePath(resolve(root, entryFile)) : VIRTUAL_NATIVE_ENTRY,
|
|
392
|
+
cwd: root,
|
|
393
|
+
platform: "neutral",
|
|
394
|
+
resolve: getNativeResolveConfig(platform),
|
|
395
|
+
transform: getNativeTransformConfig(platform, dev, root),
|
|
396
|
+
treeshake: !dev,
|
|
397
|
+
experimental: {
|
|
398
|
+
lazyBarrel: false
|
|
399
|
+
},
|
|
400
|
+
shimMissingExports: true,
|
|
401
|
+
moduleTypes: {
|
|
402
|
+
".js": "jsx"
|
|
403
|
+
},
|
|
404
|
+
plugins: [...(entryFile ? [] : [nativeVirtualEntryPlugin(root, {
|
|
405
|
+
dev
|
|
406
|
+
})]), ...getNativePlugins(root, platform, viteImportGlobPlugin, dev, assetsDest), ...userPlugins],
|
|
407
|
+
output: getNativeOutputOptions(prelude, sourcemap)
|
|
408
|
+
})).output.find(o => o.type === "chunk" && o.isEntry);
|
|
409
|
+
if (!chunk || !("code" in chunk)) throw new Error("[vxrn] production build produced no output");
|
|
410
|
+
let code = postProcessNativeBundle(chunk.code);
|
|
411
|
+
code = await downlevelClassFieldsInBundle(code);
|
|
412
|
+
return {
|
|
413
|
+
code,
|
|
414
|
+
map: sourcemap ? chunk.map?.toString() : void 0
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
const VIRTUAL_NATIVE_ENTRY = "virtual:native-entry";
|
|
418
|
+
function nativeVirtualEntryPlugin(root, opts) {
|
|
419
|
+
const isDev = opts?.dev !== false;
|
|
420
|
+
const resolvedId = normalizePath(resolve(root, "__virtual-native-entry.tsx"));
|
|
421
|
+
const entryConfig = globalThis.__vxrnNativeEntryConfig || {};
|
|
422
|
+
const routerRoot = entryConfig.routerRoot || "app";
|
|
423
|
+
const flags = entryConfig.flags || {};
|
|
424
|
+
const linking = entryConfig.linking;
|
|
425
|
+
const setupFileImport = (() => {
|
|
426
|
+
const sf = entryConfig.setupFile;
|
|
427
|
+
if (!sf) return "";
|
|
428
|
+
const file = typeof sf === "string" ? sf : "native" in sf ? sf.native : sf.ios;
|
|
429
|
+
if (!file) return "";
|
|
430
|
+
const resolved = pathToFileURL(resolve(root, file)).href;
|
|
431
|
+
return `import ${JSON.stringify(resolved)};`;
|
|
432
|
+
})();
|
|
433
|
+
const routeGlobs = [`./${routerRoot}/**/*.tsx`, `./${routerRoot}/**/*.ts`, `!./${routerRoot}/**/*+api.*`, `!./${routerRoot}/**/*.test.*`, `!./${routerRoot}/**/*.d.ts`, `!./${routerRoot}/**/*.server.*`, `!./${routerRoot}/**/_middleware.*`, `!./${routerRoot}/**/*.web.*`, ...(entryConfig.ignoredRouteFiles || []).map(pattern => `!./${routerRoot}/${pattern}`)];
|
|
434
|
+
const entryCode = `
|
|
435
|
+
${isDev ? `
|
|
436
|
+
// react-refresh/runtime MUST initialize before React loads
|
|
437
|
+
import RefreshRuntime from 'react-refresh/runtime';
|
|
438
|
+
RefreshRuntime.injectIntoGlobalHook(globalThis);
|
|
439
|
+
globalThis.__ReactRefresh = RefreshRuntime;
|
|
440
|
+
globalThis.$RefreshReg$ = function(type, id) {
|
|
441
|
+
RefreshRuntime.register(type, id);
|
|
442
|
+
};
|
|
443
|
+
globalThis.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
|
|
444
|
+
` : ""}
|
|
445
|
+
import * as ReactNativeInitializeCore from 'react-native/Libraries/Core/InitializeCore';
|
|
446
|
+
import NativeWebSocket from 'react-native/Libraries/WebSocket/WebSocket';
|
|
447
|
+
${setupFileImport}
|
|
448
|
+
import { createApp } from 'one';
|
|
449
|
+
|
|
450
|
+
void ReactNativeInitializeCore;
|
|
451
|
+
globalThis.WebSocket = NativeWebSocket;
|
|
452
|
+
|
|
453
|
+
var _routes = import.meta.glob(${JSON.stringify(routeGlobs)}, { exhaustive: true });
|
|
454
|
+
// fix route keys: One expects '/${routerRoot}/...' prefix but import.meta.glob returns './${routerRoot}/...'
|
|
455
|
+
var routes = {};
|
|
456
|
+
Object.keys(_routes).forEach(function(key) {
|
|
457
|
+
var normalizedKey = key.replace(/^\\.\\//, '');
|
|
458
|
+
routes['/' + normalizedKey] = _routes[key];
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
createApp({
|
|
462
|
+
routes: routes,
|
|
463
|
+
routerRoot: ${JSON.stringify(routerRoot)},
|
|
464
|
+
flags: ${JSON.stringify(flags)},
|
|
465
|
+
linking: ${JSON.stringify(linking)},
|
|
466
|
+
});
|
|
467
|
+
`;
|
|
468
|
+
return {
|
|
469
|
+
name: "vxrn:native-virtual-entry",
|
|
470
|
+
resolveId(id) {
|
|
471
|
+
if (id === VIRTUAL_NATIVE_ENTRY) return resolvedId;
|
|
472
|
+
},
|
|
473
|
+
load(id) {
|
|
474
|
+
if (id === resolvedId) return entryCode;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function nativeAnimatedGuardPlugin() {
|
|
479
|
+
return {
|
|
480
|
+
name: "vxrn:native-animated-guard",
|
|
481
|
+
transform(code, id) {
|
|
482
|
+
if (!id.includes("animated/NativeAnimatedHelper")) return;
|
|
483
|
+
const target = "const method = nullthrows(NativeAnimatedModule)[methodName];";
|
|
484
|
+
if (!code.includes(target)) return;
|
|
485
|
+
return {
|
|
486
|
+
code: code.replace(target, `const method = nullthrows(NativeAnimatedModule)[methodName];
|
|
487
|
+
if (typeof method !== 'function') return;`)
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function serverFileExclusionPlugin() {
|
|
493
|
+
return {
|
|
494
|
+
name: "vxrn:server-file-exclusion",
|
|
495
|
+
load(id) {
|
|
496
|
+
if (/\.server\.\w+$/.test(id)) return {
|
|
497
|
+
code: "export default undefined;",
|
|
498
|
+
moduleType: "js"
|
|
499
|
+
};
|
|
500
|
+
if (/[\\/]_middleware\.\w+$/.test(id)) return {
|
|
501
|
+
code: "export default undefined;",
|
|
502
|
+
moduleType: "js"
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function environmentGuardPlugin() {
|
|
508
|
+
const THROWING = ["server-only", "client-only", "web-only"];
|
|
509
|
+
const NOOP = ["native-only"];
|
|
510
|
+
return {
|
|
511
|
+
name: "vxrn:environment-guard",
|
|
512
|
+
resolveId(source) {
|
|
513
|
+
if (THROWING.includes(source)) return {
|
|
514
|
+
id: `\0env-guard-throw:${source}`,
|
|
515
|
+
external: false
|
|
516
|
+
};
|
|
517
|
+
if (NOOP.includes(source)) return {
|
|
518
|
+
id: `\0env-guard-noop:${source}`,
|
|
519
|
+
external: false
|
|
520
|
+
};
|
|
521
|
+
},
|
|
522
|
+
load(id) {
|
|
523
|
+
if (id.startsWith("\0env-guard-throw:")) return {
|
|
524
|
+
code: `throw new Error("Cannot import '${id.slice(17)}' in a native bundle.");`,
|
|
525
|
+
moduleType: "js"
|
|
526
|
+
};
|
|
527
|
+
if (id.startsWith("\0env-guard-noop:")) return {
|
|
528
|
+
code: "",
|
|
529
|
+
moduleType: "js"
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function hmrClientNoopPlugin() {
|
|
535
|
+
const RN_HMR_CLIENT_RE = /(^|[\\/])Utilities[\\/]HMRClient(\.[cm]?[jt]sx?)?$/;
|
|
536
|
+
return {
|
|
537
|
+
name: "vxrn:hmr-client-noop",
|
|
538
|
+
resolveId(source, importer) {
|
|
539
|
+
if ((source.startsWith("react-native/") || importer != null && /(^|[\\/])react-native[\\/]/.test(importer)) && RN_HMR_CLIENT_RE.test(source)) return {
|
|
540
|
+
id: "\0vxrn-hmr-client-noop",
|
|
541
|
+
external: false
|
|
542
|
+
};
|
|
543
|
+
},
|
|
544
|
+
load(id) {
|
|
545
|
+
if (id === "\0vxrn-hmr-client-noop") return {
|
|
546
|
+
code: `const HMRClient = { setup() {}, enable() {}, disable() {}, registerBundle() {}, log() {}, isEnabled() { return false } }
|
|
547
|
+
export default HMRClient`,
|
|
548
|
+
moduleType: "js"
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function cssStubPlugin() {
|
|
554
|
+
return {
|
|
555
|
+
name: "vxrn:css-stub",
|
|
556
|
+
load: {
|
|
557
|
+
handler(id) {
|
|
558
|
+
if (id.endsWith(".css")) return {
|
|
559
|
+
code: "",
|
|
560
|
+
moduleType: "js"
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function vxrnCompilerPlugin(platform, dev, projectRoot = process.cwd()) {
|
|
567
|
+
let compiler = null;
|
|
568
|
+
const isRefreshCandidate = id => dev && !id.includes("node_modules") && !id.includes("__virtual-native-entry") && /\.[tj]sx?$/.test(id);
|
|
569
|
+
return {
|
|
570
|
+
name: "vxrn:compiler",
|
|
571
|
+
async transform(code, id) {
|
|
572
|
+
if (!/\.[cm]?[jt]sx?$/.test(id)) return;
|
|
573
|
+
if (id.includes("\0") || id.includes("virtual:")) return;
|
|
574
|
+
const needsRefresh = isRefreshCandidate(id);
|
|
575
|
+
try {
|
|
576
|
+
if (!compiler) compiler = await import("@vxrn/compiler");
|
|
577
|
+
const props = {
|
|
578
|
+
id,
|
|
579
|
+
code,
|
|
580
|
+
projectRoot,
|
|
581
|
+
development: dev,
|
|
582
|
+
environment: platform,
|
|
583
|
+
reactForRNVersion: "19"
|
|
584
|
+
};
|
|
585
|
+
let babelOptions = compiler.getBabelOptions(props);
|
|
586
|
+
if (needsRefresh) {
|
|
587
|
+
const existingPlugins = babelOptions?.plugins || [];
|
|
588
|
+
babelOptions = {
|
|
589
|
+
...babelOptions,
|
|
590
|
+
plugins: [...existingPlugins, ["react-refresh/babel", {
|
|
591
|
+
skipEnvCheck: true,
|
|
592
|
+
refreshReg: "__vxrnRefreshReg",
|
|
593
|
+
refreshSig: "__vxrnRefreshSig"
|
|
594
|
+
}]]
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
if (!babelOptions) return;
|
|
598
|
+
const result = await compiler.transformBabel(id, code, babelOptions);
|
|
599
|
+
if (result?.code) {
|
|
600
|
+
let out = result.code;
|
|
601
|
+
if (needsRefresh) out = `
|
|
602
|
+
var __prevRefreshReg = globalThis.$RefreshReg$;
|
|
603
|
+
var __prevRefreshSig = globalThis.$RefreshSig$;
|
|
604
|
+
if (globalThis.__ReactRefresh) {
|
|
605
|
+
globalThis.$RefreshReg$ = function(type, id) {
|
|
606
|
+
globalThis.__ReactRefresh.register(type, "${id.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}" + " " + id);
|
|
607
|
+
};
|
|
608
|
+
globalThis.$RefreshSig$ = globalThis.__ReactRefresh.createSignatureFunctionForTransform;
|
|
609
|
+
}
|
|
610
|
+
// keep registration calls local so rolldown retains them in the initial bundle.
|
|
611
|
+
var __vxrnRefreshReg = globalThis.$RefreshReg$;
|
|
612
|
+
var __vxrnRefreshSig = globalThis.$RefreshSig$;
|
|
613
|
+
|
|
614
|
+
${out}
|
|
615
|
+
|
|
616
|
+
globalThis.$RefreshReg$ = __prevRefreshReg;
|
|
617
|
+
globalThis.$RefreshSig$ = __prevRefreshSig;
|
|
618
|
+
if (import.meta.hot) {
|
|
619
|
+
import.meta.hot.accept(function() {
|
|
620
|
+
if (globalThis.__ReactRefresh) {
|
|
621
|
+
setTimeout(function() { globalThis.__ReactRefresh.performReactRefresh(); }, 30);
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
`;
|
|
626
|
+
return {
|
|
627
|
+
code: out
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
} catch (err) {
|
|
631
|
+
if (dev) console.warn(`[vxrn:compiler] ${id}: ${err.message || err}`);
|
|
632
|
+
if (needsRefresh) return {
|
|
633
|
+
code: code + `
|
|
634
|
+
if (import.meta.hot) { import.meta.hot.accept(); }
|
|
635
|
+
`
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
function flowStripPlugin() {
|
|
642
|
+
return {
|
|
643
|
+
name: "vxrn:flow-strip",
|
|
644
|
+
transform: {
|
|
645
|
+
async handler(code, id) {
|
|
646
|
+
if (!FLOW_FILE_PATTERN.test(id)) return;
|
|
647
|
+
try {
|
|
648
|
+
const result = await (await import("fast-flow-transform")).default({
|
|
649
|
+
filename: id,
|
|
650
|
+
source: code,
|
|
651
|
+
sourcemap: true,
|
|
652
|
+
dialect: "flow",
|
|
653
|
+
format: "pretty"
|
|
654
|
+
});
|
|
655
|
+
return {
|
|
656
|
+
code: result.code,
|
|
657
|
+
map: result.map
|
|
658
|
+
};
|
|
659
|
+
} catch (err) {
|
|
660
|
+
console.warn(`[vxrn:flow-strip] ${id}: ${err.message}`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
function assetPlugin(opts) {
|
|
667
|
+
const assetRegex = new RegExp(`\\.(?:${DEFAULT_ASSET_EXTS.join("|")})$`);
|
|
668
|
+
return {
|
|
669
|
+
name: "vxrn:asset",
|
|
670
|
+
load: {
|
|
671
|
+
async handler(id) {
|
|
672
|
+
if (!assetRegex.test(id)) return;
|
|
673
|
+
const ext = extname(id).slice(1);
|
|
674
|
+
const name = basename(id, `.${ext}`);
|
|
675
|
+
const dir = dirname(id);
|
|
676
|
+
const relativePath = relative(opts.root, id);
|
|
677
|
+
const assetData = {
|
|
678
|
+
__packager_asset: true,
|
|
679
|
+
name,
|
|
680
|
+
type: ext,
|
|
681
|
+
scales: [1],
|
|
682
|
+
httpServerLocation: "/assets/" + dirname(relativePath).replace(/\\/g, "/"),
|
|
683
|
+
fileSystemLocation: dir,
|
|
684
|
+
hash: "",
|
|
685
|
+
width: void 0,
|
|
686
|
+
height: void 0
|
|
687
|
+
};
|
|
688
|
+
if (["png", "jpg", "jpeg", "gif", "webp", "bmp"].includes(ext)) try {
|
|
689
|
+
const {
|
|
690
|
+
imageSize
|
|
691
|
+
} = await import("image-size");
|
|
692
|
+
const dims = imageSize(id);
|
|
693
|
+
assetData.width = dims.width;
|
|
694
|
+
assetData.height = dims.height;
|
|
695
|
+
} catch {}
|
|
696
|
+
if (opts.assetsDest) {
|
|
697
|
+
const relativeAssetDir = dirname(relativePath).replace(/\\/g, "/");
|
|
698
|
+
const assetDestDir = join(opts.assetsDest, "assets", relativeAssetDir);
|
|
699
|
+
mkdirSync(assetDestDir, {
|
|
700
|
+
recursive: true
|
|
701
|
+
});
|
|
702
|
+
copyFileSync(id, join(assetDestDir, `${name}.${ext}`));
|
|
703
|
+
}
|
|
704
|
+
return {
|
|
705
|
+
code: `module.exports = require('react-native/Libraries/Image/AssetRegistry').registerAsset(${JSON.stringify(assetData)});`,
|
|
706
|
+
moduleType: "js"
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
function hermesCompatSWCPlugin(dev) {
|
|
713
|
+
let swc = null;
|
|
714
|
+
return {
|
|
715
|
+
name: "vxrn:hermes-compat",
|
|
716
|
+
async transform(code, id) {
|
|
717
|
+
if (!/\.[cm]?[jt]sx?$/.test(id)) return;
|
|
718
|
+
if (id.includes("\0") || id.includes("virtual:")) return;
|
|
719
|
+
const hasClass = code.includes("class ") || code.includes("class{");
|
|
720
|
+
const hasAsync = !dev && code.includes("async ");
|
|
721
|
+
if (!hasClass && !hasAsync) return;
|
|
722
|
+
if (code.length > 5e5) return;
|
|
723
|
+
try {
|
|
724
|
+
if (!swc) swc = await import("@swc/core");
|
|
725
|
+
const envIncludes = getHermesSWCIncludes(dev);
|
|
726
|
+
return {
|
|
727
|
+
code: (await swc.transform(code, {
|
|
728
|
+
filename: id,
|
|
729
|
+
configFile: false,
|
|
730
|
+
swcrc: false,
|
|
731
|
+
sourceMaps: false,
|
|
732
|
+
inputSourceMap: false,
|
|
733
|
+
env: {
|
|
734
|
+
targets: {
|
|
735
|
+
node: 9999
|
|
736
|
+
},
|
|
737
|
+
include: envIncludes
|
|
738
|
+
},
|
|
739
|
+
jsc: {
|
|
740
|
+
parser: {
|
|
741
|
+
syntax: "typescript",
|
|
742
|
+
tsx: true
|
|
743
|
+
},
|
|
744
|
+
transform: {
|
|
745
|
+
react: {
|
|
746
|
+
runtime: "preserve"
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
externalHelpers: false,
|
|
750
|
+
assumptions: {
|
|
751
|
+
setPublicClassFields: true,
|
|
752
|
+
privateFieldsAsProperties: true
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
isModule: !id.endsWith(".cjs")
|
|
756
|
+
})).code
|
|
757
|
+
};
|
|
758
|
+
} catch (err) {}
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
function getHmrRuntimeSource() {
|
|
763
|
+
return `
|
|
764
|
+
// vxrn HMR runtime for rolldown devMode
|
|
765
|
+
var BaseDevRuntime = DevRuntime;
|
|
766
|
+
|
|
767
|
+
class ReactNativeDevRuntime extends BaseDevRuntime {
|
|
768
|
+
constructor() {
|
|
769
|
+
var clientId = 'rn-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
770
|
+
super(clientId);
|
|
771
|
+
this._socket = null;
|
|
772
|
+
this.moduleHotContexts = {};
|
|
773
|
+
this.lastSeq = 0;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
createModuleHotContext(moduleId) {
|
|
777
|
+
var runtime = this;
|
|
778
|
+
var ctx = {
|
|
779
|
+
acceptCallbacks: [],
|
|
780
|
+
accept: function(deps, callback) {
|
|
781
|
+
if (typeof deps === 'function' || !deps) {
|
|
782
|
+
ctx.acceptCallbacks.push({
|
|
783
|
+
deps: [moduleId],
|
|
784
|
+
fn: function(modules) { if (typeof deps === 'function') deps(modules[0]); }
|
|
785
|
+
});
|
|
786
|
+
} else if (typeof deps === 'string') {
|
|
787
|
+
ctx.acceptCallbacks.push({
|
|
788
|
+
deps: [deps],
|
|
789
|
+
fn: function(modules) { if (callback) callback(modules[0]); }
|
|
790
|
+
});
|
|
791
|
+
} else if (Array.isArray(deps)) {
|
|
792
|
+
ctx.acceptCallbacks.push({ deps: deps, fn: callback || function() {} });
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
invalidate: function() { runtime.requestReload('module invalidated: ' + moduleId); },
|
|
796
|
+
on: function() {},
|
|
797
|
+
off: function() {},
|
|
798
|
+
send: function() {},
|
|
799
|
+
get refresh() { return globalThis.__ReactRefresh; },
|
|
800
|
+
get refreshUtils() {
|
|
801
|
+
return {
|
|
802
|
+
isReactRefreshBoundary: function(exports) {
|
|
803
|
+
if (!globalThis.__ReactRefresh) return false;
|
|
804
|
+
if (globalThis.__ReactRefresh.isLikelyComponentType(exports)) return true;
|
|
805
|
+
if (!exports || typeof exports !== 'object') return false;
|
|
806
|
+
var hasExports = false, allComponents = true;
|
|
807
|
+
for (var key in exports) {
|
|
808
|
+
hasExports = true;
|
|
809
|
+
if (key === '__esModule') continue;
|
|
810
|
+
if (!globalThis.__ReactRefresh.isLikelyComponentType(exports[key])) allComponents = false;
|
|
811
|
+
}
|
|
812
|
+
return hasExports && allComponents;
|
|
813
|
+
},
|
|
814
|
+
enqueueUpdate: function() {
|
|
815
|
+
if (globalThis.__ReactRefresh) {
|
|
816
|
+
setTimeout(function() { globalThis.__ReactRefresh.performReactRefresh(); }, 50);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
this.moduleHotContexts[moduleId] = ctx;
|
|
823
|
+
return ctx;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
isSelfAccepted(moduleId) {
|
|
827
|
+
var ctx = this.moduleHotContexts[moduleId];
|
|
828
|
+
return !!(ctx && ctx.acceptCallbacks.some(function(callback) {
|
|
829
|
+
return callback.deps.indexOf(moduleId) !== -1;
|
|
830
|
+
}));
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
acceptsDependency(parentId, moduleId) {
|
|
834
|
+
var ctx = this.moduleHotContexts[parentId];
|
|
835
|
+
return !!(ctx && ctx.acceptCallbacks.some(function(callback) {
|
|
836
|
+
return callback.deps.indexOf(moduleId) !== -1;
|
|
837
|
+
}));
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
findBoundaries(moduleId, traversed, updateSet, boundaries) {
|
|
841
|
+
if (traversed.has(moduleId)) return true;
|
|
842
|
+
traversed.add(moduleId);
|
|
843
|
+
updateSet.add(moduleId);
|
|
844
|
+
|
|
845
|
+
if (this.isSelfAccepted(moduleId)) {
|
|
846
|
+
boundaries.push({ boundary: moduleId, acceptedVia: moduleId });
|
|
847
|
+
return true;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
var importers = this.getImporters(moduleId).filter(function(importer) {
|
|
851
|
+
return this.isExecuted(importer);
|
|
852
|
+
}, this);
|
|
853
|
+
if (importers.length === 0) return false;
|
|
854
|
+
|
|
855
|
+
for (var i = 0; i < importers.length; i++) {
|
|
856
|
+
var importer = importers[i];
|
|
857
|
+
if (this.acceptsDependency(importer, moduleId)) {
|
|
858
|
+
boundaries.push({ boundary: importer, acceptedVia: moduleId });
|
|
859
|
+
} else if (!this.findBoundaries(importer, traversed, updateSet, boundaries)) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
applyHmrUpdate(code, changedIds, seq) {
|
|
867
|
+
if (seq !== this.lastSeq + 1) return false;
|
|
868
|
+
this.lastSeq = seq;
|
|
869
|
+
|
|
870
|
+
var traversed = new Set();
|
|
871
|
+
var updateSet = new Set();
|
|
872
|
+
var boundaries = [];
|
|
873
|
+
for (var i = 0; i < changedIds.length; i++) {
|
|
874
|
+
var changedId = changedIds[i];
|
|
875
|
+
if (!this.isExecuted(changedId)) continue;
|
|
876
|
+
if (!this.findBoundaries(changedId, traversed, updateSet, boundaries)) return false;
|
|
877
|
+
}
|
|
878
|
+
if (boundaries.length === 0) return true;
|
|
879
|
+
|
|
880
|
+
var callbacks = boundaries.map(function(item) {
|
|
881
|
+
var ctx = this.moduleHotContexts[item.boundary];
|
|
882
|
+
return {
|
|
883
|
+
boundary: item.boundary,
|
|
884
|
+
acceptedVia: item.acceptedVia,
|
|
885
|
+
callbacks: ctx ? ctx.acceptCallbacks.filter(function(callback) {
|
|
886
|
+
return callback.deps.indexOf(item.acceptedVia) !== -1;
|
|
887
|
+
}) : []
|
|
888
|
+
};
|
|
889
|
+
}, this);
|
|
890
|
+
|
|
891
|
+
if (globalThis.globalEvalWithSourceUrl) globalThis.globalEvalWithSourceUrl(code);
|
|
892
|
+
else (0, eval)(code);
|
|
893
|
+
|
|
894
|
+
var modulesToReplace = Array.from(updateSet);
|
|
895
|
+
for (var j = 0; j < modulesToReplace.length; j++) {
|
|
896
|
+
if (!this.hasFactory(modulesToReplace[j])) return false;
|
|
897
|
+
}
|
|
898
|
+
for (var k = 0; k < modulesToReplace.length; k++) {
|
|
899
|
+
this.removeModuleCache(modulesToReplace[k]);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
for (var m = 0; m < callbacks.length; m++) {
|
|
903
|
+
var apply = callbacks[m];
|
|
904
|
+
this.initModule(apply.acceptedVia);
|
|
905
|
+
var freshExports = this.loadExports(apply.acceptedVia);
|
|
906
|
+
for (var n = 0; n < apply.callbacks.length; n++) {
|
|
907
|
+
apply.callbacks[n].fn([freshExports]);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
for (var p = 0; p < changedIds.length; p++) {
|
|
912
|
+
try {
|
|
913
|
+
if (globalThis.__VXRN_ON_MODULE_UPDATED__) {
|
|
914
|
+
globalThis.__VXRN_ON_MODULE_UPDATED__(changedIds[p]);
|
|
915
|
+
}
|
|
916
|
+
} catch (error) {
|
|
917
|
+
console.error('[vxrn HMR]: module update hook failed', error);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return true;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
requestReload(reason) {
|
|
924
|
+
if (this._socket && this._socket.readyState === 1) {
|
|
925
|
+
this._socket.send(JSON.stringify({ type: 'hmr:invalidate', reason: reason }));
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
setup(socket) {
|
|
930
|
+
if (this._socket) return;
|
|
931
|
+
this._socket = socket;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
globalThis.__rolldown_runtime__ = new ReactNativeDevRuntime();
|
|
936
|
+
`;
|
|
937
|
+
}
|
|
938
|
+
export { buildNativeBundle, createNativeDevEngine, getHermesSWCIncludes, getHmrRuntimeSource, getNativeTransformConfig, hmrClientNoopPlugin, vxrnCompilerPlugin, wrapNativeBundleModuleScope };
|
|
939
|
+
//# sourceMappingURL=createNativeDevEngine.mjs.map
|