vxrn 1.25.3 → 1.25.5
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/package.json +11 -11
- package/src/plugins/reactNativeDevServer.ts +57 -17
- package/src/utils/createNativeDevEngine.test.ts +95 -0
- package/src/utils/createNativeDevEngine.ts +157 -80
- package/types/utils/createNativeDevEngine.d.ts +17 -6
- package/dist/cli.mjs +0 -288
- package/dist/cli.mjs.map +0 -1
- package/dist/cli.native.js +0 -292
- package/dist/cli.native.js.map +0 -1
- package/dist/config/getAdditionalViteConfig.mjs +0 -67
- package/dist/config/getAdditionalViteConfig.mjs.map +0 -1
- package/dist/config/getAdditionalViteConfig.native.js +0 -67
- package/dist/config/getAdditionalViteConfig.native.js.map +0 -1
- package/dist/config/getBaseViteConfigOnly.mjs +0 -84
- package/dist/config/getBaseViteConfigOnly.mjs.map +0 -1
- package/dist/config/getBaseViteConfigOnly.native.js +0 -86
- package/dist/config/getBaseViteConfigOnly.native.js.map +0 -1
- package/dist/config/getBaseViteConfigWithPlugins.mjs +0 -10
- package/dist/config/getBaseViteConfigWithPlugins.mjs.map +0 -1
- package/dist/config/getBaseViteConfigWithPlugins.native.js +0 -10
- package/dist/config/getBaseViteConfigWithPlugins.native.js.map +0 -1
- package/dist/config/getBaseVitePlugins.mjs +0 -141
- package/dist/config/getBaseVitePlugins.mjs.map +0 -1
- package/dist/config/getBaseVitePlugins.native.js +0 -163
- package/dist/config/getBaseVitePlugins.native.js.map +0 -1
- package/dist/config/getNonCliModeOnlyVitePlugins.mjs +0 -8
- package/dist/config/getNonCliModeOnlyVitePlugins.mjs.map +0 -1
- package/dist/config/getNonCliModeOnlyVitePlugins.native.js +0 -6
- package/dist/config/getNonCliModeOnlyVitePlugins.native.js.map +0 -1
- package/dist/config/getOptimizeDeps.mjs +0 -47
- package/dist/config/getOptimizeDeps.mjs.map +0 -1
- package/dist/config/getOptimizeDeps.native.js +0 -47
- package/dist/config/getOptimizeDeps.native.js.map +0 -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/getOptionsFilled.mjs +0 -69
- package/dist/config/getOptionsFilled.mjs.map +0 -1
- package/dist/config/getOptionsFilled.native.js +0 -73
- package/dist/config/getOptionsFilled.native.js.map +0 -1
- package/dist/config/getReactNativePlugins.mjs +0 -23
- package/dist/config/getReactNativePlugins.mjs.map +0 -1
- package/dist/config/getReactNativePlugins.native.js +0 -25
- package/dist/config/getReactNativePlugins.native.js.map +0 -1
- package/dist/config/getServerOptionsFilled.mjs +0 -40
- package/dist/config/getServerOptionsFilled.mjs.map +0 -1
- package/dist/config/getServerOptionsFilled.native.js +0 -43
- package/dist/config/getServerOptionsFilled.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.mjs +0 -51
- package/dist/config/getViteServerConfig.mjs.map +0 -1
- package/dist/config/getViteServerConfig.native.js +0 -52
- package/dist/config/getViteServerConfig.native.js.map +0 -1
- package/dist/config/mergeUserConfig.mjs +0 -37
- package/dist/config/mergeUserConfig.mjs.map +0 -1
- package/dist/config/mergeUserConfig.native.js +0 -47
- package/dist/config/mergeUserConfig.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/constants/defaults.mjs +0 -15
- package/dist/constants/defaults.mjs.map +0 -1
- package/dist/constants/defaults.native.js +0 -15
- package/dist/constants/defaults.native.js.map +0 -1
- package/dist/constants.mjs +0 -10
- package/dist/constants.mjs.map +0 -1
- package/dist/constants.native.js +0 -10
- package/dist/constants.native.js.map +0 -1
- package/dist/exports/build.mjs +0 -294
- package/dist/exports/build.mjs.map +0 -1
- package/dist/exports/build.native.js +0 -307
- package/dist/exports/build.native.js.map +0 -1
- package/dist/exports/clean.mjs +0 -99
- package/dist/exports/clean.mjs.map +0 -1
- package/dist/exports/clean.native.js +0 -111
- package/dist/exports/clean.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/createServer.mjs +0 -56
- package/dist/exports/createServer.mjs.map +0 -1
- package/dist/exports/createServer.native.js +0 -57
- package/dist/exports/createServer.native.js.map +0 -1
- package/dist/exports/dev.mjs +0 -204
- package/dist/exports/dev.mjs.map +0 -1
- package/dist/exports/dev.native.js +0 -218
- package/dist/exports/dev.native.js.map +0 -1
- package/dist/exports/loadEnv.mjs +0 -65
- package/dist/exports/loadEnv.mjs.map +0 -1
- package/dist/exports/loadEnv.native.js +0 -74
- package/dist/exports/loadEnv.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/exports/patch.mjs +0 -12
- package/dist/exports/patch.mjs.map +0 -1
- package/dist/exports/patch.native.js +0 -12
- package/dist/exports/patch.native.js.map +0 -1
- package/dist/exports/prebuild.mjs +0 -212
- package/dist/exports/prebuild.mjs.map +0 -1
- package/dist/exports/prebuild.native.js +0 -215
- package/dist/exports/prebuild.native.js.map +0 -1
- package/dist/exports/prebuildWithoutExpo.mjs +0 -53
- package/dist/exports/prebuildWithoutExpo.mjs.map +0 -1
- package/dist/exports/prebuildWithoutExpo.native.js +0 -54
- package/dist/exports/prebuildWithoutExpo.native.js.map +0 -1
- package/dist/exports/runAndroid.mjs +0 -14
- package/dist/exports/runAndroid.mjs.map +0 -1
- package/dist/exports/runAndroid.native.js +0 -15
- package/dist/exports/runAndroid.native.js.map +0 -1
- package/dist/exports/runIos.mjs +0 -14
- package/dist/exports/runIos.mjs.map +0 -1
- package/dist/exports/runIos.native.js +0 -15
- package/dist/exports/runIos.native.js.map +0 -1
- package/dist/exports/serve.mjs +0 -37
- package/dist/exports/serve.mjs.map +0 -1
- package/dist/exports/serve.native.js +0 -40
- package/dist/exports/serve.native.js.map +0 -1
- package/dist/exports/serveStaticAssets.mjs +0 -133
- package/dist/exports/serveStaticAssets.mjs.map +0 -1
- package/dist/exports/serveStaticAssets.native.js +0 -213
- package/dist/exports/serveStaticAssets.native.js.map +0 -1
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -22
- package/dist/index.mjs.map +0 -1
- package/dist/index.native.js +0 -22
- package/dist/index.native.js.map +0 -1
- package/dist/patches/builtInDepPatches.mjs +0 -483
- package/dist/patches/builtInDepPatches.mjs.map +0 -1
- package/dist/patches/builtInDepPatches.native.js +0 -486
- package/dist/patches/builtInDepPatches.native.js.map +0 -1
- package/dist/plugins/applyBuiltInPatchesPlugin.mjs +0 -17
- package/dist/plugins/applyBuiltInPatchesPlugin.mjs.map +0 -1
- package/dist/plugins/applyBuiltInPatchesPlugin.native.js +0 -17
- package/dist/plugins/applyBuiltInPatchesPlugin.native.js.map +0 -1
- package/dist/plugins/autoDepOptimizePlugin.mjs +0 -108
- package/dist/plugins/autoDepOptimizePlugin.mjs.map +0 -1
- package/dist/plugins/autoDepOptimizePlugin.native.js +0 -121
- package/dist/plugins/autoDepOptimizePlugin.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/clientInjectPlugin.mjs +0 -16
- package/dist/plugins/clientInjectPlugin.mjs.map +0 -1
- package/dist/plugins/clientInjectPlugin.native.js +0 -16
- package/dist/plugins/clientInjectPlugin.native.js.map +0 -1
- package/dist/plugins/defaultDepOptimizePlugin.mjs +0 -30
- package/dist/plugins/defaultDepOptimizePlugin.mjs.map +0 -1
- package/dist/plugins/defaultDepOptimizePlugin.native.js +0 -30
- package/dist/plugins/defaultDepOptimizePlugin.native.js.map +0 -1
- package/dist/plugins/expoManifestRequestHandlerPlugin.mjs +0 -189
- package/dist/plugins/expoManifestRequestHandlerPlugin.mjs.map +0 -1
- package/dist/plugins/expoManifestRequestHandlerPlugin.native.js +0 -202
- package/dist/plugins/expoManifestRequestHandlerPlugin.native.js.map +0 -1
- package/dist/plugins/getResolvedConfigSubset.mjs +0 -12
- package/dist/plugins/getResolvedConfigSubset.mjs.map +0 -1
- package/dist/plugins/getResolvedConfigSubset.native.js +0 -12
- package/dist/plugins/getResolvedConfigSubset.native.js.map +0 -1
- package/dist/plugins/reactNativeCommonJsPlugin.mjs +0 -194
- package/dist/plugins/reactNativeCommonJsPlugin.mjs.map +0 -1
- package/dist/plugins/reactNativeCommonJsPlugin.native.js +0 -275
- package/dist/plugins/reactNativeCommonJsPlugin.native.js.map +0 -1
- package/dist/plugins/reactNativeDevAssetPlugin.mjs +0 -99
- package/dist/plugins/reactNativeDevAssetPlugin.mjs.map +0 -1
- package/dist/plugins/reactNativeDevAssetPlugin.native.js +0 -108
- package/dist/plugins/reactNativeDevAssetPlugin.native.js.map +0 -1
- package/dist/plugins/reactNativeDevServer.mjs +0 -190
- package/dist/plugins/reactNativeDevServer.mjs.map +0 -1
- package/dist/plugins/reactNativeDevServer.native.js +0 -232
- package/dist/plugins/reactNativeDevServer.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/rollupRemoveUnusedImports.mjs +0 -11
- package/dist/plugins/rollupRemoveUnusedImports.mjs.map +0 -1
- package/dist/plugins/rollupRemoveUnusedImports.native.js +0 -11
- package/dist/plugins/rollupRemoveUnusedImports.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/rn-commands/bundle/buildBundle.mjs +0 -68
- package/dist/rn-commands/bundle/buildBundle.mjs.map +0 -1
- package/dist/rn-commands/bundle/buildBundle.native.js +0 -75
- package/dist/rn-commands/bundle/buildBundle.native.js.map +0 -1
- package/dist/runtime/hmr-client.mjs +0 -145
- package/dist/runtime/hmr-client.mjs.map +0 -1
- package/dist/runtime/hmr-client.native.js +0 -237
- package/dist/runtime/hmr-client.native.js.map +0 -1
- package/dist/runtime/hmr-runtime.mjs +0 -200
- package/dist/runtime/hmr-runtime.mjs.map +0 -1
- package/dist/runtime/hmr-runtime.native.js +0 -441
- package/dist/runtime/hmr-runtime.native.js.map +0 -1
- package/dist/runtime/hmr-types.mjs +0 -2
- package/dist/runtime/hmr-types.mjs.map +0 -1
- package/dist/runtime/hmr-types.native.js +0 -2
- package/dist/runtime/hmr-types.native.js.map +0 -1
- package/dist/runtime/native-prelude.mjs +0 -94
- package/dist/runtime/native-prelude.mjs.map +0 -1
- package/dist/runtime/native-prelude.native.js +0 -94
- package/dist/runtime/native-prelude.native.js.map +0 -1
- package/dist/runtime/react-refresh-utils.mjs +0 -29
- package/dist/runtime/react-refresh-utils.mjs.map +0 -1
- package/dist/runtime/react-refresh-utils.native.js +0 -34
- package/dist/runtime/react-refresh-utils.native.js.map +0 -1
- package/dist/serve/node.mjs +0 -62
- package/dist/serve/node.mjs.map +0 -1
- package/dist/serve/node.native.js +0 -107
- package/dist/serve/node.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 +0 -2
- package/dist/types.mjs.map +0 -1
- package/dist/types.native.js +0 -2
- package/dist/types.native.js.map +0 -1
- package/dist/user-interface/index.mjs +0 -312
- package/dist/user-interface/index.mjs.map +0 -1
- package/dist/user-interface/index.native.js +0 -349
- package/dist/user-interface/index.native.js.map +0 -1
- package/dist/utils/assert.mjs +0 -12
- package/dist/utils/assert.mjs.map +0 -1
- package/dist/utils/assert.native.js +0 -24
- package/dist/utils/assert.native.js.map +0 -1
- package/dist/utils/bindKeypressInput.mjs +0 -47
- package/dist/utils/bindKeypressInput.mjs.map +0 -1
- package/dist/utils/bindKeypressInput.native.js +0 -47
- package/dist/utils/bindKeypressInput.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/coerceToArray.mjs +0 -5
- package/dist/utils/coerceToArray.mjs.map +0 -1
- package/dist/utils/coerceToArray.native.js +0 -5
- package/dist/utils/coerceToArray.native.js.map +0 -1
- package/dist/utils/connectedNativeClients.mjs +0 -9
- package/dist/utils/connectedNativeClients.mjs.map +0 -1
- package/dist/utils/connectedNativeClients.native.js +0 -9
- package/dist/utils/connectedNativeClients.native.js.map +0 -1
- package/dist/utils/createNativeDevEngine.mjs +0 -875
- package/dist/utils/createNativeDevEngine.mjs.map +0 -1
- package/dist/utils/createNativeDevEngine.native.js +0 -932
- package/dist/utils/createNativeDevEngine.native.js.map +0 -1
- package/dist/utils/createNativeDevEngine.test.mjs +0 -93
- package/dist/utils/createNativeDevEngine.test.mjs.map +0 -1
- package/dist/utils/createNativeDevEngine.test.native.js +0 -106
- package/dist/utils/createNativeDevEngine.test.native.js.map +0 -1
- package/dist/utils/dispose.mjs +0 -9
- package/dist/utils/dispose.mjs.map +0 -1
- package/dist/utils/dispose.native.js +0 -11
- package/dist/utils/dispose.native.js.map +0 -1
- package/dist/utils/environmentUtils.mjs +0 -14
- package/dist/utils/environmentUtils.mjs.map +0 -1
- package/dist/utils/environmentUtils.native.js +0 -14
- package/dist/utils/environmentUtils.native.js.map +0 -1
- package/dist/utils/execSync.mjs +0 -9
- package/dist/utils/execSync.mjs.map +0 -1
- package/dist/utils/execSync.native.js +0 -9
- package/dist/utils/execSync.native.js.map +0 -1
- package/dist/utils/expoRun.mjs +0 -48
- package/dist/utils/expoRun.mjs.map +0 -1
- package/dist/utils/expoRun.native.js +0 -49
- package/dist/utils/expoRun.native.js.map +0 -1
- package/dist/utils/filterViteServerResolvedUrls.mjs +0 -29
- package/dist/utils/filterViteServerResolvedUrls.mjs.map +0 -1
- package/dist/utils/filterViteServerResolvedUrls.native.js +0 -70
- package/dist/utils/filterViteServerResolvedUrls.native.js.map +0 -1
- package/dist/utils/getBoundPort.mjs +0 -9
- package/dist/utils/getBoundPort.mjs.map +0 -1
- package/dist/utils/getBoundPort.native.js +0 -16
- package/dist/utils/getBoundPort.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/getCacheDir.mjs +0 -6
- package/dist/utils/getCacheDir.mjs.map +0 -1
- package/dist/utils/getCacheDir.native.js +0 -6
- package/dist/utils/getCacheDir.native.js.map +0 -1
- package/dist/utils/getServerEntry.mjs +0 -10
- package/dist/utils/getServerEntry.mjs.map +0 -1
- package/dist/utils/getServerEntry.native.js +0 -17
- package/dist/utils/getServerEntry.native.js.map +0 -1
- package/dist/utils/getVitePath.mjs +0 -49
- package/dist/utils/getVitePath.mjs.map +0 -1
- package/dist/utils/getVitePath.native.js +0 -48
- package/dist/utils/getVitePath.native.js.map +0 -1
- package/dist/utils/globDir.mjs +0 -18
- package/dist/utils/globDir.mjs.map +0 -1
- package/dist/utils/globDir.native.js +0 -21
- package/dist/utils/globDir.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/isWithin.mjs +0 -7
- package/dist/utils/isWithin.mjs.map +0 -1
- package/dist/utils/isWithin.native.js +0 -7
- package/dist/utils/isWithin.native.js.map +0 -1
- package/dist/utils/patches.mjs +0 -279
- package/dist/utils/patches.mjs.map +0 -1
- package/dist/utils/patches.native.js +0 -508
- package/dist/utils/patches.native.js.map +0 -1
- package/dist/utils/patches.test.mjs +0 -214
- package/dist/utils/patches.test.mjs.map +0 -1
- package/dist/utils/patches.test.native.js +0 -224
- package/dist/utils/patches.test.native.js.map +0 -1
- package/dist/utils/printServerUrls.mjs +0 -12
- package/dist/utils/printServerUrls.mjs.map +0 -1
- package/dist/utils/printServerUrls.native.js +0 -56
- package/dist/utils/printServerUrls.native.js.map +0 -1
- package/dist/utils/removeUndefined.mjs +0 -11
- package/dist/utils/removeUndefined.mjs.map +0 -1
- package/dist/utils/removeUndefined.native.js +0 -11
- package/dist/utils/removeUndefined.native.js.map +0 -1
- package/dist/utils/scanDepsToOptimize.mjs +0 -176
- package/dist/utils/scanDepsToOptimize.mjs.map +0 -1
- package/dist/utils/scanDepsToOptimize.native.js +0 -212
- package/dist/utils/scanDepsToOptimize.native.js.map +0 -1
- package/dist/utils/state.mjs +0 -28
- package/dist/utils/state.mjs.map +0 -1
- package/dist/utils/state.native.js +0 -28
- package/dist/utils/state.native.js.map +0 -1
- package/dist/utils/uniq.mjs +0 -5
- package/dist/utils/uniq.mjs.map +0 -1
- package/dist/utils/uniq.native.js +0 -5
- package/dist/utils/uniq.native.js.map +0 -1
- package/dist/utils/utils.mjs +0 -32
- package/dist/utils/utils.mjs.map +0 -1
- package/dist/utils/utils.native.js +0 -53
- package/dist/utils/utils.native.js.map +0 -1
- package/dist/vendor/debugger-app/index.mjs +0 -2
- package/dist/vendor/debugger-app/index.mjs.map +0 -1
- package/dist/vendor/debugger-app/index.native.js +0 -2
- package/dist/vendor/debugger-app/index.native.js.map +0 -1
- package/dist/vendor/debugger-app/src/debuggerWorker.mjs +0 -2
- package/dist/vendor/debugger-app/src/debuggerWorker.mjs.map +0 -1
- package/dist/vendor/debugger-app/src/debuggerWorker.native.js +0 -2
- package/dist/vendor/debugger-app/src/debuggerWorker.native.js.map +0 -1
- package/dist/vendor/debugger-app/src/index.css +0 -41
- package/dist/vendor/debugger-app/src/index.css.map +0 -6
- package/dist/vendor/debugger-app/src/index.mjs +0 -2
- package/dist/vendor/debugger-app/src/index.mjs.map +0 -1
- package/dist/vendor/debugger-app/src/index.native.js +0 -2
- package/dist/vendor/debugger-app/src/index.native.js.map +0 -1
- package/dist/vxrn-vite-plugin.mjs +0 -44
- package/dist/vxrn-vite-plugin.mjs.map +0 -1
- package/dist/vxrn-vite-plugin.native.js +0 -45
- package/dist/vxrn-vite-plugin.native.js.map +0 -1
- package/types/cli.d.ts.map +0 -1
- package/types/config/getAdditionalViteConfig.d.ts.map +0 -1
- package/types/config/getBaseViteConfigOnly.d.ts.map +0 -1
- package/types/config/getBaseViteConfigWithPlugins.d.ts.map +0 -1
- package/types/config/getBaseVitePlugins.d.ts.map +0 -1
- package/types/config/getNonCliModeOnlyVitePlugins.d.ts.map +0 -1
- package/types/config/getOptimizeDeps.d.ts.map +0 -1
- package/types/config/getOptimizeDeps.test.d.ts.map +0 -1
- package/types/config/getOptionsFilled.d.ts.map +0 -1
- package/types/config/getReactNativePlugins.d.ts.map +0 -1
- package/types/config/getServerOptionsFilled.d.ts.map +0 -1
- package/types/config/getServerOptionsFilled.test.d.ts.map +0 -1
- package/types/config/getViteServerConfig.d.ts.map +0 -1
- package/types/config/mergeUserConfig.d.ts.map +0 -1
- package/types/config/mergeUserConfig.test.d.ts.map +0 -1
- package/types/constants/defaults.d.ts.map +0 -1
- package/types/constants.d.ts.map +0 -1
- package/types/exports/build.d.ts.map +0 -1
- package/types/exports/clean.d.ts.map +0 -1
- package/types/exports/clean.test.d.ts.map +0 -1
- package/types/exports/createServer.d.ts.map +0 -1
- package/types/exports/dev.d.ts.map +0 -1
- package/types/exports/loadEnv.d.ts.map +0 -1
- package/types/exports/loadEnv.test.d.ts.map +0 -1
- package/types/exports/patch.d.ts.map +0 -1
- package/types/exports/prebuild.d.ts.map +0 -1
- package/types/exports/prebuildWithoutExpo.d.ts.map +0 -1
- package/types/exports/runAndroid.d.ts.map +0 -1
- package/types/exports/runIos.d.ts.map +0 -1
- package/types/exports/serve.d.ts.map +0 -1
- package/types/exports/serveStaticAssets.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/patches/builtInDepPatches.d.ts.map +0 -1
- package/types/plugins/applyBuiltInPatchesPlugin.d.ts.map +0 -1
- package/types/plugins/autoDepOptimizePlugin.d.ts.map +0 -1
- package/types/plugins/autoDepOptimizePlugin.test.d.ts.map +0 -1
- package/types/plugins/clientInjectPlugin.d.ts.map +0 -1
- package/types/plugins/defaultDepOptimizePlugin.d.ts.map +0 -1
- package/types/plugins/expoManifestRequestHandlerPlugin.d.ts.map +0 -1
- package/types/plugins/getResolvedConfigSubset.d.ts.map +0 -1
- package/types/plugins/reactNativeCommonJsPlugin.d.ts.map +0 -1
- package/types/plugins/reactNativeDevAssetPlugin.d.ts.map +0 -1
- package/types/plugins/reactNativeDevServer.d.ts.map +0 -1
- package/types/plugins/resolveIdScan.test.d.ts.map +0 -1
- package/types/plugins/rollupRemoveUnusedImports.d.ts.map +0 -1
- package/types/plugins/serverExtensions.test.d.ts.map +0 -1
- package/types/rn-commands/bundle/buildBundle.d.ts.map +0 -1
- package/types/runtime/hmr-client.d.ts.map +0 -1
- package/types/runtime/hmr-runtime.d.ts.map +0 -1
- package/types/runtime/hmr-types.d.ts.map +0 -1
- package/types/runtime/native-prelude.d.ts.map +0 -1
- package/types/runtime/react-refresh-utils.d.ts.map +0 -1
- package/types/serve/node.d.ts.map +0 -1
- package/types/serve/node.test.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- package/types/user-interface/index.d.ts.map +0 -1
- package/types/utils/assert.d.ts.map +0 -1
- package/types/utils/bindKeypressInput.d.ts.map +0 -1
- package/types/utils/bindKeypressInput.test.d.ts.map +0 -1
- package/types/utils/coerceToArray.d.ts.map +0 -1
- package/types/utils/connectedNativeClients.d.ts.map +0 -1
- package/types/utils/createNativeDevEngine.d.ts.map +0 -1
- package/types/utils/createNativeDevEngine.test.d.ts.map +0 -1
- package/types/utils/dispose.d.ts.map +0 -1
- package/types/utils/environmentUtils.d.ts.map +0 -1
- package/types/utils/execSync.d.ts.map +0 -1
- package/types/utils/expoRun.d.ts.map +0 -1
- package/types/utils/filterViteServerResolvedUrls.d.ts.map +0 -1
- package/types/utils/getBoundPort.d.ts.map +0 -1
- package/types/utils/getBoundPort.test.d.ts.map +0 -1
- package/types/utils/getCacheDir.d.ts.map +0 -1
- package/types/utils/getServerEntry.d.ts.map +0 -1
- package/types/utils/getVitePath.d.ts.map +0 -1
- package/types/utils/globDir.d.ts.map +0 -1
- package/types/utils/imageSizePatch.test.d.ts.map +0 -1
- package/types/utils/isWithin.d.ts.map +0 -1
- package/types/utils/patches.d.ts.map +0 -1
- package/types/utils/patches.test.d.ts.map +0 -1
- package/types/utils/printServerUrls.d.ts.map +0 -1
- package/types/utils/removeUndefined.d.ts.map +0 -1
- package/types/utils/scanDepsToOptimize.d.ts.map +0 -1
- package/types/utils/state.d.ts.map +0 -1
- package/types/utils/uniq.d.ts.map +0 -1
- package/types/utils/utils.d.ts.map +0 -1
- package/types/vxrn-vite-plugin.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxrn",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -62,16 +62,16 @@
|
|
|
62
62
|
"@expo/config-plugins": "~57.0.6",
|
|
63
63
|
"@hono/node-server": "^1.19.14",
|
|
64
64
|
"@react-native/dev-middleware": "^0.86.2",
|
|
65
|
-
"@vxrn/compiler": "1.25.
|
|
66
|
-
"@vxrn/debug": "1.25.
|
|
67
|
-
"@vxrn/query-string": "1.25.
|
|
68
|
-
"@vxrn/resolve": "1.25.
|
|
69
|
-
"@vxrn/safe-area": "1.25.
|
|
70
|
-
"@vxrn/url-parse": "1.25.
|
|
71
|
-
"@vxrn/utils": "1.25.
|
|
72
|
-
"@vxrn/vendor": "1.25.
|
|
73
|
-
"@vxrn/vite-flow": "1.25.
|
|
74
|
-
"@vxrn/vite-plugin-metro": "1.25.
|
|
65
|
+
"@vxrn/compiler": "1.25.5",
|
|
66
|
+
"@vxrn/debug": "1.25.5",
|
|
67
|
+
"@vxrn/query-string": "1.25.5",
|
|
68
|
+
"@vxrn/resolve": "1.25.5",
|
|
69
|
+
"@vxrn/safe-area": "1.25.5",
|
|
70
|
+
"@vxrn/url-parse": "1.25.5",
|
|
71
|
+
"@vxrn/utils": "1.25.5",
|
|
72
|
+
"@vxrn/vendor": "1.25.5",
|
|
73
|
+
"@vxrn/vite-flow": "1.25.5",
|
|
74
|
+
"@vxrn/vite-plugin-metro": "1.25.5",
|
|
75
75
|
"citty": "^0.1.6",
|
|
76
76
|
"dotenv": "^17.2.1",
|
|
77
77
|
"dotenv-expand": "^12.0.2",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Connect, Plugin, ViteDevServer } from 'vite'
|
|
2
|
-
import { WebSocketServer } from 'ws'
|
|
2
|
+
import { WebSocketServer, type WebSocket } from 'ws'
|
|
3
3
|
import { createMessageSocket } from '@vxrn/utils'
|
|
4
4
|
import {
|
|
5
5
|
addConnectedNativeClient,
|
|
@@ -17,6 +17,11 @@ type ClientMessage = {
|
|
|
17
17
|
data: string[]
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
type NativeHmrSocket = WebSocket & {
|
|
21
|
+
vxrnClientId: string
|
|
22
|
+
vxrnPlatform: 'ios' | 'android'
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
export function createReactNativeDevServerPlugin(
|
|
21
26
|
options?: Partial<
|
|
22
27
|
Pick<VXRNOptionsFilled, 'cacheDir' | 'debugBundle' | 'debugBundlePaths' | 'entries'>
|
|
@@ -61,18 +66,17 @@ export function createReactNativeDevServerPlugin(
|
|
|
61
66
|
|
|
62
67
|
// rolldown HMR socket (used by rolldown dev() HMR client)
|
|
63
68
|
if (url.startsWith('/hot')) {
|
|
69
|
+
const hmrUrl = new URL(url, `http://${req.headers.host || 'localhost'}`)
|
|
70
|
+
const platform = validPlatforms[hmrUrl.searchParams.get('platform') || '']
|
|
71
|
+
const clientId = hmrUrl.searchParams.get('clientId')
|
|
72
|
+
if (!platform || !clientId) {
|
|
73
|
+
socket.destroy()
|
|
74
|
+
return
|
|
75
|
+
}
|
|
64
76
|
hmrWSS.handleUpgrade(req, socket, head, (ws) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const msg = JSON.parse(data.toString())
|
|
69
|
-
if (msg.type === 'hmr:module-registered' && msg.modules) {
|
|
70
|
-
const currentEngine = devEngines['ios'] || devEngines['android']
|
|
71
|
-
if (currentEngine?.engine) {
|
|
72
|
-
await currentEngine.engine.registerModules('vxrn-dev', msg.modules)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch {}
|
|
77
|
+
Object.assign(ws, {
|
|
78
|
+
vxrnClientId: clientId,
|
|
79
|
+
vxrnPlatform: platform,
|
|
76
80
|
})
|
|
77
81
|
hmrWSS.emit('connection', ws, req)
|
|
78
82
|
})
|
|
@@ -95,17 +99,47 @@ export function createReactNativeDevServerPlugin(
|
|
|
95
99
|
}
|
|
96
100
|
})
|
|
97
101
|
|
|
98
|
-
hmrWSS.on('connection', (socket) => {
|
|
102
|
+
hmrWSS.on('connection', async (socket: NativeHmrSocket) => {
|
|
103
|
+
const currentEngine = devEngines[socket.vxrnPlatform]
|
|
104
|
+
if (!currentEngine) {
|
|
105
|
+
socket.close(1013, 'native dev engine unavailable')
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
await currentEngine.engine.registerClient(socket.vxrnClientId)
|
|
111
|
+
} catch (error) {
|
|
112
|
+
console.error('[hmr] failed to register native client', error)
|
|
113
|
+
socket.close(1011, 'native HMR registration failed')
|
|
114
|
+
return
|
|
115
|
+
}
|
|
99
116
|
addConnectedNativeClient()
|
|
100
117
|
|
|
101
|
-
socket.on('message', (message) => {
|
|
102
|
-
|
|
118
|
+
socket.on('message', async (message) => {
|
|
119
|
+
const value = message.toString()
|
|
120
|
+
if (value === 'ping') {
|
|
103
121
|
socket.send('pong')
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let update: { type?: string }
|
|
126
|
+
try {
|
|
127
|
+
update = JSON.parse(value)
|
|
128
|
+
} catch {
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
if (update.type === 'hmr:invalidate') {
|
|
132
|
+
currentEngine.engine.triggerFullBuild()
|
|
133
|
+
await currentEngine.engine.ensureLatestBuildOutput()
|
|
134
|
+
socket.send(JSON.stringify({ type: 'hmr:reload' }))
|
|
104
135
|
}
|
|
105
136
|
})
|
|
106
137
|
|
|
107
138
|
socket.on('close', () => {
|
|
108
139
|
removeConnectedNativeClient()
|
|
140
|
+
currentEngine.engine.removeClient(socket.vxrnClientId).catch((error) => {
|
|
141
|
+
console.error('[hmr] failed to remove native client', error)
|
|
142
|
+
})
|
|
109
143
|
})
|
|
110
144
|
|
|
111
145
|
socket.on('error', (error) => {
|
|
@@ -181,8 +215,14 @@ export function createReactNativeDevServerPlugin(
|
|
|
181
215
|
serverUrl: `http://${typeof host === 'string' && host !== '0.0.0.0' ? host : 'localhost'}:${getBoundPort(server)}`,
|
|
182
216
|
onHmrUpdate: (update) => {
|
|
183
217
|
const msg = JSON.stringify(update)
|
|
184
|
-
hmrWSS.clients.forEach((client
|
|
185
|
-
|
|
218
|
+
hmrWSS.clients.forEach((client) => {
|
|
219
|
+
const nativeClient = client as NativeHmrSocket
|
|
220
|
+
if (
|
|
221
|
+
nativeClient.readyState === 1 &&
|
|
222
|
+
nativeClient.vxrnPlatform === platform &&
|
|
223
|
+
(update.type === 'hmr:error' ||
|
|
224
|
+
nativeClient.vxrnClientId === update.clientId)
|
|
225
|
+
) {
|
|
186
226
|
client.send(msg)
|
|
187
227
|
}
|
|
188
228
|
})
|
|
@@ -1,12 +1,107 @@
|
|
|
1
|
+
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { dev } from 'rolldown/experimental'
|
|
1
5
|
import { describe, expect, it } from 'vitest'
|
|
2
6
|
import {
|
|
3
7
|
getHermesSWCIncludes,
|
|
8
|
+
getHmrRuntimeSource,
|
|
4
9
|
getNativeTransformConfig,
|
|
5
10
|
hmrClientNoopPlugin,
|
|
6
11
|
vxrnCompilerPlugin,
|
|
7
12
|
wrapNativeBundleModuleScope,
|
|
8
13
|
} from './createNativeDevEngine'
|
|
9
14
|
|
|
15
|
+
describe('native Rolldown HMR runtime', () => {
|
|
16
|
+
it(
|
|
17
|
+
'registers a Rolldown 1.2 client and applies a self-accepted patch',
|
|
18
|
+
{ timeout: 30_000 },
|
|
19
|
+
async () => {
|
|
20
|
+
const testRoot = await mkdtemp(join(tmpdir(), 'vxrn-native-hmr-'))
|
|
21
|
+
const entry = join(testRoot, 'entry.js')
|
|
22
|
+
const source = (version: string) => `
|
|
23
|
+
globalThis.__vxrnHmrBody = '${version}'
|
|
24
|
+
export const value = '${version}'
|
|
25
|
+
if (import.meta.hot) {
|
|
26
|
+
import.meta.hot.accept((next) => {
|
|
27
|
+
globalThis.__vxrnHmrAccepted = next.value
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
`
|
|
31
|
+
await writeFile(entry, source('v1'))
|
|
32
|
+
|
|
33
|
+
let resolveInitialOutput!: (output: any) => void
|
|
34
|
+
const initialOutput = new Promise<any>((resolve) => {
|
|
35
|
+
resolveInitialOutput = resolve
|
|
36
|
+
})
|
|
37
|
+
let resolveHmrUpdate!: (output: any) => void
|
|
38
|
+
const hmrUpdate = new Promise<any>((resolve) => {
|
|
39
|
+
resolveHmrUpdate = resolve
|
|
40
|
+
})
|
|
41
|
+
const engine = await dev(
|
|
42
|
+
{
|
|
43
|
+
cwd: testRoot,
|
|
44
|
+
input: entry,
|
|
45
|
+
experimental: { devMode: { implement: getHmrRuntimeSource() } },
|
|
46
|
+
},
|
|
47
|
+
{ format: 'esm' },
|
|
48
|
+
{
|
|
49
|
+
onOutput(result) {
|
|
50
|
+
resolveInitialOutput(result)
|
|
51
|
+
},
|
|
52
|
+
onHmrUpdates(result) {
|
|
53
|
+
if (!(result instanceof Error) && result.changedFiles.length) {
|
|
54
|
+
resolveHmrUpdate(result)
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
await engine.run()
|
|
62
|
+
const initial = await initialOutput
|
|
63
|
+
if (initial instanceof Error) throw initial
|
|
64
|
+
const chunk = initial.output.find(
|
|
65
|
+
(item: any) => item.type === 'chunk' && item.isEntry
|
|
66
|
+
)
|
|
67
|
+
expect(chunk).toBeTruthy()
|
|
68
|
+
|
|
69
|
+
delete (globalThis as any).__rolldown_runtime__
|
|
70
|
+
await import(
|
|
71
|
+
`data:text/javascript;base64,${Buffer.from(chunk.code).toString('base64')}`
|
|
72
|
+
)
|
|
73
|
+
const runtime = (globalThis as any).__rolldown_runtime__
|
|
74
|
+
expect(typeof runtime.clientId).toBe('string')
|
|
75
|
+
await engine.registerClient(runtime.clientId)
|
|
76
|
+
|
|
77
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
78
|
+
await writeFile(entry, source('v2'))
|
|
79
|
+
const result = await Promise.race([
|
|
80
|
+
hmrUpdate,
|
|
81
|
+
new Promise((_, reject) =>
|
|
82
|
+
setTimeout(() => reject(new Error('timed out waiting for HMR patch')), 10_000)
|
|
83
|
+
),
|
|
84
|
+
])
|
|
85
|
+
const patch = result.updates.find(
|
|
86
|
+
(item: any) =>
|
|
87
|
+
item.clientId === runtime.clientId && item.update.type === 'Patch'
|
|
88
|
+
)?.update
|
|
89
|
+
expect(patch).toBeTruthy()
|
|
90
|
+
|
|
91
|
+
expect(runtime.applyHmrUpdate(patch.code, patch.changedIds, patch.seq)).toBe(true)
|
|
92
|
+
expect((globalThis as any).__vxrnHmrBody).toBe('v2')
|
|
93
|
+
expect((globalThis as any).__vxrnHmrAccepted).toBe('v2')
|
|
94
|
+
} finally {
|
|
95
|
+
await engine.close()
|
|
96
|
+
await rm(testRoot, { recursive: true, force: true })
|
|
97
|
+
delete (globalThis as any).__rolldown_runtime__
|
|
98
|
+
delete (globalThis as any).__vxrnHmrBody
|
|
99
|
+
delete (globalThis as any).__vxrnHmrAccepted
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
})
|
|
104
|
+
|
|
10
105
|
// use a root with no .env files so only the platform defines are present
|
|
11
106
|
const root = '/tmp/vxrn-native-env-define-test-nonexistent'
|
|
12
107
|
|
|
@@ -10,6 +10,7 @@ import { basename, dirname, extname, join, relative, resolve } from 'node:path'
|
|
|
10
10
|
import { copyFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs'
|
|
11
11
|
import { pathToFileURL } from 'node:url'
|
|
12
12
|
import type { InputOptions, OutputOptions, Plugin, RolldownOutput } from 'rolldown'
|
|
13
|
+
import type { DevEngine } from 'rolldown/experimental'
|
|
13
14
|
import { normalizePath } from 'vite'
|
|
14
15
|
import { DEFAULT_ASSET_EXTS } from '../constants/defaults'
|
|
15
16
|
import { getNativePrelude } from '../runtime/native-prelude'
|
|
@@ -47,11 +48,22 @@ interface NativeDevEngineOptions {
|
|
|
47
48
|
platform: 'ios' | 'android'
|
|
48
49
|
serverUrl?: string
|
|
49
50
|
plugins?: Plugin[]
|
|
50
|
-
onHmrUpdate?: (update:
|
|
51
|
+
onHmrUpdate?: (update: NativeHmrUpdate) => void
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
export type NativeHmrUpdate =
|
|
55
|
+
| {
|
|
56
|
+
type: 'hmr:update'
|
|
57
|
+
clientId: string
|
|
58
|
+
code: string
|
|
59
|
+
changedIds: string[]
|
|
60
|
+
seq: number
|
|
61
|
+
}
|
|
62
|
+
| { type: 'hmr:reload'; clientId: string }
|
|
63
|
+
| { type: 'hmr:error' }
|
|
64
|
+
|
|
53
65
|
interface NativeDevEngineResult {
|
|
54
|
-
engine:
|
|
66
|
+
engine: DevEngine
|
|
55
67
|
getBundle: () => Promise<{ code: string }>
|
|
56
68
|
close: () => Promise<void>
|
|
57
69
|
}
|
|
@@ -227,7 +239,7 @@ function getNativePlugins(
|
|
|
227
239
|
// flowStripPlugin so react-native's Flow `.js` specs reach codegen with their
|
|
228
240
|
// type argument intact. stripping Flow first would erase it (which is why the
|
|
229
241
|
// codegen "didn't run for <Component>" warning fired).
|
|
230
|
-
vxrnCompilerPlugin(platform, dev),
|
|
242
|
+
vxrnCompilerPlugin(platform, dev, root),
|
|
231
243
|
// strip Flow from any react-native / @react-native `.js` the compiler didn't
|
|
232
244
|
// handle, the guaranteed safety net before rolldown's oxc core parse (which
|
|
233
245
|
// can't parse Flow). now downstream of the compiler, so codegen sees the types.
|
|
@@ -450,18 +462,18 @@ export async function createNativeDevEngine(
|
|
|
450
462
|
outro: `
|
|
451
463
|
try {
|
|
452
464
|
var __WS = (init_WebSocket(), __toCommonJS(WebSocket_exports)).default;
|
|
453
|
-
var __hmrUrl = 'ws://${resolvedHost}:${port}/hot';
|
|
465
|
+
var __hmrUrl = 'ws://${resolvedHost}:${port}/hot?platform=${platform}&clientId=' + encodeURIComponent(__rolldown_runtime__.clientId);
|
|
454
466
|
var __hmrWS = new __WS(__hmrUrl);
|
|
455
467
|
__hmrWS.onmessage = function(event) {
|
|
456
468
|
try {
|
|
457
469
|
var msg = JSON.parse(event.data);
|
|
458
470
|
var g = typeof global !== 'undefined' ? global : globalThis;
|
|
459
471
|
if (msg.type === 'hmr:update' && msg.code) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
472
|
+
var applied = __rolldown_runtime__.applyHmrUpdate(msg.code, msg.changedIds, msg.seq);
|
|
473
|
+
if (!applied) {
|
|
474
|
+
var updateSettings = g.__turboModuleProxy ? g.__turboModuleProxy('DevSettings') : null;
|
|
475
|
+
if (updateSettings && updateSettings.reload) updateSettings.reload();
|
|
476
|
+
}
|
|
465
477
|
} else if (msg.type === 'hmr:reload') {
|
|
466
478
|
var ds = g.__turboModuleProxy ? g.__turboModuleProxy('DevSettings') : null;
|
|
467
479
|
if (ds && ds.reload) ds.reload();
|
|
@@ -470,7 +482,7 @@ try {
|
|
|
470
482
|
};
|
|
471
483
|
__hmrWS.onopen = function() {
|
|
472
484
|
if (typeof __rolldown_runtime__ !== 'undefined' && __rolldown_runtime__.setup) {
|
|
473
|
-
__rolldown_runtime__.setup(__hmrWS
|
|
485
|
+
__rolldown_runtime__.setup(__hmrWS);
|
|
474
486
|
}
|
|
475
487
|
};
|
|
476
488
|
__hmrWS.onerror = function(e) { console.warn('[vxrn] HMR connection error:', e.message || e); };
|
|
@@ -515,38 +527,36 @@ try {
|
|
|
515
527
|
onHmrUpdate?.({ type: 'hmr:error' })
|
|
516
528
|
return
|
|
517
529
|
}
|
|
518
|
-
const
|
|
519
|
-
for (const item of updates) {
|
|
520
|
-
const update = item.update || item
|
|
530
|
+
for (const { clientId, update } of result.updates) {
|
|
521
531
|
if (update.type === 'Patch' && update.code) {
|
|
522
|
-
onHmrUpdate?.({
|
|
532
|
+
onHmrUpdate?.({
|
|
533
|
+
type: 'hmr:update',
|
|
534
|
+
clientId,
|
|
535
|
+
code: update.code,
|
|
536
|
+
changedIds: update.changedIds,
|
|
537
|
+
seq: update.seq,
|
|
538
|
+
})
|
|
523
539
|
} else if (update.type === 'FullReload') {
|
|
524
|
-
onHmrUpdate?.({ type: 'hmr:reload' })
|
|
540
|
+
onHmrUpdate?.({ type: 'hmr:reload', clientId })
|
|
525
541
|
}
|
|
526
542
|
}
|
|
527
|
-
|
|
528
|
-
if (updates.length === 0) {
|
|
529
|
-
onHmrUpdate?.({ type: 'hmr:reload' })
|
|
530
|
-
}
|
|
531
543
|
},
|
|
532
544
|
|
|
533
|
-
//
|
|
534
|
-
//
|
|
535
|
-
// already awaits ensureLatestBuildOutput(), which is that explicit pull,
|
|
536
|
-
// so 'never' keeps the same behavior without rebuilding on every hmr patch.
|
|
545
|
+
// patches update the registered client runtime directly. a full bundle rebuild
|
|
546
|
+
// is only needed when the runtime requests a reload.
|
|
537
547
|
rebuildStrategy: 'never',
|
|
538
548
|
watch: {},
|
|
539
549
|
})
|
|
540
550
|
|
|
541
551
|
await engine.run()
|
|
542
552
|
|
|
543
|
-
// modules are registered via WebSocket messages from the HMR client
|
|
544
|
-
// (the devMode runtime sends hmr:module-registered messages)
|
|
545
|
-
|
|
546
553
|
return {
|
|
547
554
|
engine,
|
|
548
555
|
|
|
549
556
|
async getBundle() {
|
|
557
|
+
// a runtime invalidation marks the full output stale before reloading. pull
|
|
558
|
+
// that output before serving the cached bundle to the restarted app.
|
|
559
|
+
await engine.ensureLatestBuildOutput()
|
|
550
560
|
if (currentBundle) return currentBundle
|
|
551
561
|
if (!bundlePromise) {
|
|
552
562
|
let timeoutId: ReturnType<typeof setTimeout>
|
|
@@ -561,8 +571,6 @@ try {
|
|
|
561
571
|
)
|
|
562
572
|
})
|
|
563
573
|
}
|
|
564
|
-
await engine.ensureLatestBuildOutput()
|
|
565
|
-
if (currentBundle) return currentBundle
|
|
566
574
|
return bundlePromise
|
|
567
575
|
},
|
|
568
576
|
|
|
@@ -889,7 +897,11 @@ function cssStubPlugin(): Plugin {
|
|
|
889
897
|
* react-native codegen, react compiler, and react-refresh (dev only) —
|
|
890
898
|
* same pipeline as metro, single babel pass per file.
|
|
891
899
|
*/
|
|
892
|
-
export function vxrnCompilerPlugin(
|
|
900
|
+
export function vxrnCompilerPlugin(
|
|
901
|
+
platform: string,
|
|
902
|
+
dev: boolean,
|
|
903
|
+
projectRoot = process.cwd()
|
|
904
|
+
): Plugin {
|
|
893
905
|
let compiler: typeof import('@vxrn/compiler') | null = null
|
|
894
906
|
|
|
895
907
|
// whether a file is a user file that should get react-refresh wiring
|
|
@@ -913,6 +925,7 @@ export function vxrnCompilerPlugin(platform: string, dev: boolean): Plugin {
|
|
|
913
925
|
const props = {
|
|
914
926
|
id,
|
|
915
927
|
code,
|
|
928
|
+
projectRoot,
|
|
916
929
|
development: dev,
|
|
917
930
|
environment: platform as 'ios' | 'android',
|
|
918
931
|
reactForRNVersion: '19' as const,
|
|
@@ -1145,33 +1158,40 @@ function hermesCompatSWCPlugin(dev: boolean): Plugin {
|
|
|
1145
1158
|
|
|
1146
1159
|
// --- HMR runtime ---
|
|
1147
1160
|
|
|
1148
|
-
function getHmrRuntimeSource(): string {
|
|
1161
|
+
export function getHmrRuntimeSource(): string {
|
|
1149
1162
|
return `
|
|
1150
1163
|
// vxrn HMR runtime for rolldown devMode
|
|
1151
1164
|
var BaseDevRuntime = DevRuntime;
|
|
1152
1165
|
|
|
1153
1166
|
class ReactNativeDevRuntime extends BaseDevRuntime {
|
|
1154
1167
|
constructor() {
|
|
1155
|
-
var _shared = { _socket: null, _queue: [] };
|
|
1156
1168
|
var clientId = 'rn-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
1157
|
-
super(
|
|
1158
|
-
var s = JSON.stringify(msg);
|
|
1159
|
-
if (_shared._socket && _shared._socket.readyState === 1) { _shared._socket.send(s); }
|
|
1160
|
-
else { _shared._queue.push(s); }
|
|
1161
|
-
}}, clientId);
|
|
1162
|
-
this._shared = _shared;
|
|
1169
|
+
super(clientId);
|
|
1163
1170
|
this._socket = null;
|
|
1164
|
-
this._queue = [];
|
|
1165
1171
|
this.moduleHotContexts = {};
|
|
1172
|
+
this.lastSeq = 0;
|
|
1166
1173
|
}
|
|
1167
1174
|
|
|
1168
1175
|
createModuleHotContext(moduleId) {
|
|
1176
|
+
var runtime = this;
|
|
1169
1177
|
var ctx = {
|
|
1170
1178
|
acceptCallbacks: [],
|
|
1171
|
-
accept: function(
|
|
1172
|
-
if (
|
|
1179
|
+
accept: function(deps, callback) {
|
|
1180
|
+
if (typeof deps === 'function' || !deps) {
|
|
1181
|
+
ctx.acceptCallbacks.push({
|
|
1182
|
+
deps: [moduleId],
|
|
1183
|
+
fn: function(modules) { if (typeof deps === 'function') deps(modules[0]); }
|
|
1184
|
+
});
|
|
1185
|
+
} else if (typeof deps === 'string') {
|
|
1186
|
+
ctx.acceptCallbacks.push({
|
|
1187
|
+
deps: [deps],
|
|
1188
|
+
fn: function(modules) { if (callback) callback(modules[0]); }
|
|
1189
|
+
});
|
|
1190
|
+
} else if (Array.isArray(deps)) {
|
|
1191
|
+
ctx.acceptCallbacks.push({ deps: deps, fn: callback || function() {} });
|
|
1192
|
+
}
|
|
1173
1193
|
},
|
|
1174
|
-
invalidate: function() {},
|
|
1194
|
+
invalidate: function() { runtime.requestReload('module invalidated: ' + moduleId); },
|
|
1175
1195
|
on: function() {},
|
|
1176
1196
|
off: function() {},
|
|
1177
1197
|
send: function() {},
|
|
@@ -1202,55 +1222,112 @@ class ReactNativeDevRuntime extends BaseDevRuntime {
|
|
|
1202
1222
|
return ctx;
|
|
1203
1223
|
}
|
|
1204
1224
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1225
|
+
isSelfAccepted(moduleId) {
|
|
1226
|
+
var ctx = this.moduleHotContexts[moduleId];
|
|
1227
|
+
return !!(ctx && ctx.acceptCallbacks.some(function(callback) {
|
|
1228
|
+
return callback.deps.indexOf(moduleId) !== -1;
|
|
1229
|
+
}));
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
acceptsDependency(parentId, moduleId) {
|
|
1233
|
+
var ctx = this.moduleHotContexts[parentId];
|
|
1234
|
+
return !!(ctx && ctx.acceptCallbacks.some(function(callback) {
|
|
1235
|
+
return callback.deps.indexOf(moduleId) !== -1;
|
|
1236
|
+
}));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
findBoundaries(moduleId, traversed, updateSet, boundaries) {
|
|
1240
|
+
if (traversed.has(moduleId)) return true;
|
|
1241
|
+
traversed.add(moduleId);
|
|
1242
|
+
updateSet.add(moduleId);
|
|
1243
|
+
|
|
1244
|
+
if (this.isSelfAccepted(moduleId)) {
|
|
1245
|
+
boundaries.push({ boundary: moduleId, acceptedVia: moduleId });
|
|
1246
|
+
return true;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
var importers = this.getImporters(moduleId).filter(function(importer) {
|
|
1250
|
+
return this.isExecuted(importer);
|
|
1251
|
+
}, this);
|
|
1252
|
+
if (importers.length === 0) return false;
|
|
1253
|
+
|
|
1254
|
+
for (var i = 0; i < importers.length; i++) {
|
|
1255
|
+
var importer = importers[i];
|
|
1256
|
+
if (this.acceptsDependency(importer, moduleId)) {
|
|
1257
|
+
boundaries.push({ boundary: importer, acceptedVia: moduleId });
|
|
1258
|
+
} else if (!this.findBoundaries(importer, traversed, updateSet, boundaries)) {
|
|
1259
|
+
return false;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
return true;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
applyHmrUpdate(code, changedIds, seq) {
|
|
1266
|
+
if (seq !== this.lastSeq + 1) return false;
|
|
1267
|
+
this.lastSeq = seq;
|
|
1268
|
+
|
|
1269
|
+
var traversed = new Set();
|
|
1270
|
+
var updateSet = new Set();
|
|
1271
|
+
var boundaries = [];
|
|
1272
|
+
for (var i = 0; i < changedIds.length; i++) {
|
|
1273
|
+
var changedId = changedIds[i];
|
|
1274
|
+
if (!this.isExecuted(changedId)) continue;
|
|
1275
|
+
if (!this.findBoundaries(changedId, traversed, updateSet, boundaries)) return false;
|
|
1276
|
+
}
|
|
1277
|
+
if (boundaries.length === 0) return true;
|
|
1278
|
+
|
|
1279
|
+
var callbacks = boundaries.map(function(item) {
|
|
1280
|
+
var ctx = this.moduleHotContexts[item.boundary];
|
|
1281
|
+
return {
|
|
1282
|
+
boundary: item.boundary,
|
|
1283
|
+
acceptedVia: item.acceptedVia,
|
|
1284
|
+
callbacks: ctx ? ctx.acceptCallbacks.filter(function(callback) {
|
|
1285
|
+
return callback.deps.indexOf(item.acceptedVia) !== -1;
|
|
1286
|
+
}) : []
|
|
1287
|
+
};
|
|
1288
|
+
}, this);
|
|
1289
|
+
|
|
1290
|
+
if (globalThis.globalEvalWithSourceUrl) globalThis.globalEvalWithSourceUrl(code);
|
|
1291
|
+
else (0, eval)(code);
|
|
1292
|
+
|
|
1293
|
+
var modulesToReplace = Array.from(updateSet);
|
|
1294
|
+
for (var j = 0; j < modulesToReplace.length; j++) {
|
|
1295
|
+
if (!this.hasFactory(modulesToReplace[j])) return false;
|
|
1296
|
+
}
|
|
1297
|
+
for (var k = 0; k < modulesToReplace.length; k++) {
|
|
1298
|
+
this.removeModuleCache(modulesToReplace[k]);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
for (var m = 0; m < callbacks.length; m++) {
|
|
1302
|
+
var apply = callbacks[m];
|
|
1303
|
+
this.initModule(apply.acceptedVia);
|
|
1304
|
+
var freshExports = this.loadExports(apply.acceptedVia);
|
|
1305
|
+
for (var n = 0; n < apply.callbacks.length; n++) {
|
|
1306
|
+
apply.callbacks[n].fn([freshExports]);
|
|
1213
1307
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
// and the web route-update event has no equivalent on the native /hot
|
|
1218
|
-
// socket, so this generic vxrn global is the bridge.
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
for (var p = 0; p < changedIds.length; p++) {
|
|
1219
1311
|
try {
|
|
1220
|
-
if (globalThis.__VXRN_ON_MODULE_UPDATED__
|
|
1312
|
+
if (globalThis.__VXRN_ON_MODULE_UPDATED__) {
|
|
1313
|
+
globalThis.__VXRN_ON_MODULE_UPDATED__(changedIds[p]);
|
|
1314
|
+
}
|
|
1221
1315
|
} catch (error) {
|
|
1222
1316
|
console.error('[vxrn HMR]: module update hook failed', error);
|
|
1223
1317
|
}
|
|
1224
1318
|
}
|
|
1319
|
+
return true;
|
|
1225
1320
|
}
|
|
1226
1321
|
|
|
1227
|
-
|
|
1228
|
-
if (this._socket)
|
|
1229
|
-
|
|
1230
|
-
// also set the shared messenger socket so queued messages can flush
|
|
1231
|
-
if (this._shared) this._shared._socket = socket;
|
|
1232
|
-
|
|
1233
|
-
var flushQueues = function() {
|
|
1234
|
-
// flush messenger queue
|
|
1235
|
-
if (this._shared && this._shared._queue.length) {
|
|
1236
|
-
for (var i = 0; i < this._shared._queue.length; i++) socket.send(this._shared._queue[i]);
|
|
1237
|
-
this._shared._queue = [];
|
|
1238
|
-
}
|
|
1239
|
-
// flush instance queue
|
|
1240
|
-
for (var i = 0; i < this._queue.length; i++) socket.send(this._queue[i]);
|
|
1241
|
-
this._queue = [];
|
|
1242
|
-
}.bind(this);
|
|
1243
|
-
|
|
1244
|
-
if (socket.readyState === 1) {
|
|
1245
|
-
flushQueues();
|
|
1246
|
-
} else {
|
|
1247
|
-
socket.addEventListener('open', function() {
|
|
1248
|
-
flushQueues();
|
|
1249
|
-
}, { once: true });
|
|
1322
|
+
requestReload(reason) {
|
|
1323
|
+
if (this._socket && this._socket.readyState === 1) {
|
|
1324
|
+
this._socket.send(JSON.stringify({ type: 'hmr:invalidate', reason: reason }));
|
|
1250
1325
|
}
|
|
1326
|
+
}
|
|
1251
1327
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1328
|
+
setup(socket) {
|
|
1329
|
+
if (this._socket) return;
|
|
1330
|
+
this._socket = socket;
|
|
1254
1331
|
}
|
|
1255
1332
|
}
|
|
1256
1333
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* https://github.com/leegeunhyeok/rollipop
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'rolldown';
|
|
9
|
+
import type { DevEngine } from 'rolldown/experimental';
|
|
9
10
|
/** SWC `env.include` for Hermes-compatible downleveling; see HERMES_CLASS_TRANSFORMS. */
|
|
10
11
|
export declare function getHermesSWCIncludes(dev: boolean): string[];
|
|
11
12
|
interface NativeDevEngineOptions {
|
|
@@ -15,13 +16,22 @@ interface NativeDevEngineOptions {
|
|
|
15
16
|
platform: 'ios' | 'android';
|
|
16
17
|
serverUrl?: string;
|
|
17
18
|
plugins?: Plugin[];
|
|
18
|
-
onHmrUpdate?: (update:
|
|
19
|
-
type: string;
|
|
20
|
-
code?: string;
|
|
21
|
-
}) => void;
|
|
19
|
+
onHmrUpdate?: (update: NativeHmrUpdate) => void;
|
|
22
20
|
}
|
|
21
|
+
export type NativeHmrUpdate = {
|
|
22
|
+
type: 'hmr:update';
|
|
23
|
+
clientId: string;
|
|
24
|
+
code: string;
|
|
25
|
+
changedIds: string[];
|
|
26
|
+
seq: number;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'hmr:reload';
|
|
29
|
+
clientId: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: 'hmr:error';
|
|
32
|
+
};
|
|
23
33
|
interface NativeDevEngineResult {
|
|
24
|
-
engine:
|
|
34
|
+
engine: DevEngine;
|
|
25
35
|
getBundle: () => Promise<{
|
|
26
36
|
code: string;
|
|
27
37
|
}>;
|
|
@@ -102,6 +112,7 @@ export declare function hmrClientNoopPlugin(): Plugin;
|
|
|
102
112
|
* react-native codegen, react compiler, and react-refresh (dev only) —
|
|
103
113
|
* same pipeline as metro, single babel pass per file.
|
|
104
114
|
*/
|
|
105
|
-
export declare function vxrnCompilerPlugin(platform: string, dev: boolean): Plugin;
|
|
115
|
+
export declare function vxrnCompilerPlugin(platform: string, dev: boolean, projectRoot?: string): Plugin;
|
|
116
|
+
export declare function getHmrRuntimeSource(): string;
|
|
106
117
|
export {};
|
|
107
118
|
//# sourceMappingURL=createNativeDevEngine.d.ts.map
|