vxrn 1.25.5 → 1.25.6
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 @@
|
|
|
1
|
+
{"version":3,"names":["getNativePrelude","options","dev","JSON","stringify","platform","serverUrl","trim"],"sources":["native-prelude.native.js"],"sourcesContent":["function getNativePrelude(options) {\n\treturn `\nvar __BUNDLE_START_TIME__ = globalThis.nativePerformanceNow ? nativePerformanceNow() : Date.now();\n\nvar global = typeof globalThis !== 'undefined' ? globalThis\n : typeof global !== 'undefined' ? global\n : typeof window !== 'undefined' ? window\n : this;\n\nglobalThis.global = global;\nglobalThis.__DEV__ = ${options.dev};\n\n// react native polyfills\nglobal.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__ = false;\nglobal.Event = global.Event || function() { return this; };\nglobal.dispatchEvent = global.dispatchEvent || function() {};\nglobal.window = global.window || global;\nglobal.self = global.self || global;\nglobal.navigator = global.navigator || { product: 'ReactNative', userAgent: '' };\nglobal.performance = global.performance || { now: function() { return Date.now(); } };\n\n// ErrorUtils - used by RN's error handling system\nif (!global.ErrorUtils) {\n var _handler = null;\n global.ErrorUtils = {\n setGlobalHandler: function(h) { _handler = h; },\n getGlobalHandler: function() { return _handler; },\n reportFatalError: function(e) { if (_handler) _handler(e, true); else throw e; },\n reportError: function(e) { if (_handler) _handler(e, false); },\n applyWithGuard: function(fn, ctx, args) { try { return fn.apply(ctx, args); } catch(e) { this.reportError(e); } },\n };\n}\n\nif (typeof process === 'undefined') {\n globalThis.process = { env: {} };\n}\nprocess.env.NODE_ENV = ${JSON.stringify(options.dev ? \"development\" : \"production\")};\nprocess.env.EXPO_OS = ${JSON.stringify(options.platform)};\nprocess.env.TAMAGUI_TARGET = 'native';\n${options.serverUrl ? `process.env.ONE_SERVER_URL = ${JSON.stringify(options.serverUrl)};` : \"\"}\n\n// polyfill setImmediate (used by react-native internals)\nif (typeof globalThis.setImmediate === 'undefined') {\n globalThis.setImmediate = function(fn) { return setTimeout(fn, 0); };\n globalThis.clearImmediate = function(id) { clearTimeout(id); };\n}\n\n// polyfill URLSearchParams early (before whatwg-fetch checks for it)\n// RN's polyfillGlobal sets this up later but some modules check at import time\nif (typeof globalThis.URLSearchParams === 'undefined') {\n // minimal URLSearchParams polyfill - will be overridden by RN's proper one\n globalThis.URLSearchParams = function URLSearchParams(init) {\n this._params = {};\n if (typeof init === 'string') {\n init.replace(/^\\\\?/, '').split('&').forEach(function(p) {\n var kv = p.split('=');\n if (kv[0]) this._params[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1] || '');\n }.bind(this));\n }\n };\n globalThis.URLSearchParams.prototype.get = function(k) { return this._params[k] || null; };\n globalThis.URLSearchParams.prototype.toString = function() {\n return Object.keys(this._params).map(function(k) { return encodeURIComponent(k) + '=' + encodeURIComponent(this._params[k]); }.bind(this)).join('&');\n };\n}\n\n// ensure console exists before any library prelude touches it in release bundles\nglobalThis.console = globalThis.console || {};\nvar console = globalThis.console;\nconsole.log = console.log || function() {};\nconsole.info = console.info || function() {};\nconsole.warn = console.warn || function() {};\nconsole.error = console.error || function() {};\nconsole.debug = console.debug || function() {};\nconsole.trace = console.trace || function() {};\n\n// reanimated compat - these console methods must exist to avoid EXC_BAD_ACCESS crash\nconsole.assert = console.assert || function() {};\nconsole.clear = console.clear || function() {};\nconsole.dir = console.dir || function() {};\nconsole.dirxml = console.dirxml || function() {};\nconsole.profile = console.profile || function() {};\nconsole.profileEnd = console.profileEnd || function() {};\nconsole.table = console.table || function() {};\n\n// react refresh stubs (overridden by react-refresh plugin in dev)\n${options.dev ? `\nvar $RefreshReg$ = function() {};\nvar $RefreshSig$ = function() { return function(v) { return v; }; };\n` : \"\"}\n`.trim();\n}\n\nexport { getNativePrelude };"],"mappings":"AAAA,SAASA,gBAAgBA,CAACC,OAAO,EAAE;EAClC,OAAO;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuBA,OAAO,CAACC,GAAG;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyBC,IAAI,CAACC,SAAS,CAACH,OAAO,CAACC,GAAG,GAAG,aAAa,GAAG,YAAY,CAAC;AACnF,wBAAwBC,IAAI,CAACC,SAAS,CAACH,OAAO,CAACI,QAAQ,CAAC;AACxD;AACA,EAAEJ,OAAO,CAACK,SAAS,GAAG,gCAAgCH,IAAI,CAACC,SAAS,CAACH,OAAO,CAACK,SAAS,CAAC,GAAG,GAAG,EAAE;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAEL,OAAO,CAACC,GAAG,GAAG;AAChB;AACA;AACA,CAAC,GAAG,EAAE;AACN,CAAC,CAACK,IAAI,CAAC,CAAC;AACR;AAEA,SAASP,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function isReactRefreshBoundary(moduleExports) {
|
|
2
|
+
if (globalThis.__ReactRefresh.isLikelyComponentType(moduleExports)) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
if (moduleExports === void 0 || moduleExports === null || typeof moduleExports !== "object") {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
var hasExports = false;
|
|
9
|
+
var areAllExportsComponents = true;
|
|
10
|
+
for (var key in moduleExports) {
|
|
11
|
+
hasExports = true;
|
|
12
|
+
if (key === "__esModule") continue;
|
|
13
|
+
var exportValue = moduleExports[key];
|
|
14
|
+
if (!globalThis.__ReactRefresh.isLikelyComponentType(exportValue)) {
|
|
15
|
+
areAllExportsComponents = false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return hasExports && areAllExportsComponents;
|
|
19
|
+
}
|
|
20
|
+
let timer = null;
|
|
21
|
+
function enqueueUpdate() {
|
|
22
|
+
if (timer) return;
|
|
23
|
+
timer = setTimeout(() => {
|
|
24
|
+
globalThis.__ReactRefresh.performReactRefresh();
|
|
25
|
+
timer = null;
|
|
26
|
+
}, 50);
|
|
27
|
+
}
|
|
28
|
+
export { enqueueUpdate, isReactRefreshBoundary };
|
|
29
|
+
//# sourceMappingURL=react-refresh-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isReactRefreshBoundary","moduleExports","globalThis","__ReactRefresh","isLikelyComponentType","hasExports","areAllExportsComponents","key","exportValue","timer","enqueueUpdate","setTimeout","performReactRefresh"],"sources":["../../src/runtime/react-refresh-utils.ts"],"sourcesContent":[null],"mappings":"AAAO,SAASA,uBAAuBC,aAAA,EAAwC;EAC7E,IAAIC,UAAA,CAAWC,cAAA,CAAeC,qBAAA,CAAsBH,aAAa,GAAG;IAClE,OAAO;EACT;EAEA,IACEA,aAAA,KAAkB,UAClBA,aAAA,KAAkB,QAClB,OAAOA,aAAA,KAAkB,UACzB;IACA,OAAO;EACT;EAEA,IAAII,UAAA,GAAa;EACjB,IAAIC,uBAAA,GAA0B;EAC9B,SAASC,GAAA,IAAON,aAAA,EAAe;IAC7BI,UAAA,GAAa;IACb,IAAIE,GAAA,KAAQ,cAAc;IAC1B,IAAIC,WAAA,GAAcP,aAAA,CAAcM,GAAG;IACnC,IAAI,CAACL,UAAA,CAAWC,cAAA,CAAeC,qBAAA,CAAsBI,WAAW,GAAG;MACjEF,uBAAA,GAA0B;IAC5B;EACF;EAEA,OAAOD,UAAA,IAAcC,uBAAA;AACvB;AAEA,IAAIG,KAAA,GAA8C;AAE3C,SAASC,cAAA,EAAgB;EAC9B,IAAID,KAAA,EAAO;EACXA,KAAA,GAAQE,UAAA,CAAW,MAAM;IACvBT,UAAA,CAAWC,cAAA,CAAeS,mBAAA,CAAoB;IAC9CH,KAAA,GAAQ;EACV,GAAG,EAAE;AACP","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _type_of(obj) {
|
|
2
|
+
"@swc/helpers - typeof";
|
|
3
|
+
|
|
4
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
5
|
+
}
|
|
6
|
+
function isReactRefreshBoundary(moduleExports) {
|
|
7
|
+
if (globalThis.__ReactRefresh.isLikelyComponentType(moduleExports)) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (moduleExports === void 0 || moduleExports === null || (typeof moduleExports === "undefined" ? "undefined" : _type_of(moduleExports)) !== "object") {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
var hasExports = false;
|
|
14
|
+
var areAllExportsComponents = true;
|
|
15
|
+
for (var key in moduleExports) {
|
|
16
|
+
hasExports = true;
|
|
17
|
+
if (key === "__esModule") continue;
|
|
18
|
+
var exportValue = moduleExports[key];
|
|
19
|
+
if (!globalThis.__ReactRefresh.isLikelyComponentType(exportValue)) {
|
|
20
|
+
areAllExportsComponents = false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return hasExports && areAllExportsComponents;
|
|
24
|
+
}
|
|
25
|
+
var timer = null;
|
|
26
|
+
function enqueueUpdate() {
|
|
27
|
+
if (timer) return;
|
|
28
|
+
timer = setTimeout(function () {
|
|
29
|
+
globalThis.__ReactRefresh.performReactRefresh();
|
|
30
|
+
timer = null;
|
|
31
|
+
}, 50);
|
|
32
|
+
}
|
|
33
|
+
export { enqueueUpdate, isReactRefreshBoundary };
|
|
34
|
+
//# sourceMappingURL=react-refresh-utils.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_type_of","obj","Symbol","constructor","isReactRefreshBoundary","moduleExports","globalThis","__ReactRefresh","isLikelyComponentType","hasExports","areAllExportsComponents","key","exportValue","timer","enqueueUpdate","setTimeout"],"sources":["../../src/runtime/react-refresh-utils.ts"],"sourcesContent":[null],"mappings":"AAAO,SAASA,SAAAC,GAAA;EACd,uBAAe;;EACb,OAAAA,GAAO,WAAAC,MAAA,oBAAAD,GAAA,CAAAE,WAAA,KAAAD,MAAA,qBAAAD,GAAA;AAAA;AAGT,SACEG,sBAAkBA,CAAAC,aAClB;EAGA,IAAAC,UAAO,CAAAC,cAAA,CAAAC,qBAAA,CAAAH,aAAA;IACT;EAEA;EACA,IAAIA,aAAA,eAA0BA,aAAA,qBAAAA,aAAA,iCAAAL,QAAA,CAAAK,aAAA;IAC9B,OAAS;EACP;EACA,IAAAI,UAAY;EACZ,IAAAC,uBAAkB,OAAc;EAChC,SAAKC,GAAA,IAAAN,aAAW;IACdI,UAAA;IACF,IAAAE,GAAA;IACF,IAAAC,WAAA,GAAAP,aAAA,CAAAM,GAAA;IAEA,KAAOL,UAAA,CAAAC,cAAc,CAAAC,qBAAA,CAAAI,WAAA;MACvBF,uBAAA;IAEI;EAEG;EACL,OAAID,UAAO,IAAAC,uBAAA;AACX;AACE,IAAAG,KAAA,OAAW;AACX,SAAAC,aAAQA,CAAA;EACV,IAAGD,KAAE;EACPA,KAAA,GAAAE,UAAA","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { networkInterfaces, platform } from "node:os";
|
|
3
|
+
import { getRequestListener } from "@hono/node-server";
|
|
4
|
+
import colors from "picocolors";
|
|
5
|
+
function getNetworkAddress() {
|
|
6
|
+
for (const addresses of Object.values(networkInterfaces())) {
|
|
7
|
+
for (const addr of addresses || []) {
|
|
8
|
+
if (addr.family === "IPv4" && !addr.internal) {
|
|
9
|
+
return addr.address;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const isBun = typeof process.versions.bun !== "undefined";
|
|
15
|
+
const canReusePort = !["win32", "darwin"].includes(platform()) && (isBun || (() => {
|
|
16
|
+
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
17
|
+
return major > 22 || major === 22 && minor >= 12 || major >= 23;
|
|
18
|
+
})());
|
|
19
|
+
async function honoServeNode(app, options) {
|
|
20
|
+
const port = options.port ?? 3e3;
|
|
21
|
+
const host = options.host ?? "0.0.0.0";
|
|
22
|
+
const listener = getRequestListener((request, env) => {
|
|
23
|
+
request.headers.delete("x-vxrn-peer-address");
|
|
24
|
+
const address = env.incoming.socket.remoteAddress;
|
|
25
|
+
if (address) request.headers.set("x-vxrn-peer-address", address);
|
|
26
|
+
return app.fetch(request, env);
|
|
27
|
+
});
|
|
28
|
+
const server = createServer(listener);
|
|
29
|
+
server.listen({
|
|
30
|
+
port,
|
|
31
|
+
host,
|
|
32
|
+
...(canReusePort && process.env.ONE_CLUSTER_WORKER === "1" ? {
|
|
33
|
+
reusePort: true
|
|
34
|
+
} : {})
|
|
35
|
+
});
|
|
36
|
+
const colorUrl = url => colors.cyan(url.replace(/:(\d+)\//, (_, port2) => `:${colors.bold(port2)}/`));
|
|
37
|
+
const displayHost = host === "0.0.0.0" ? "localhost" : host;
|
|
38
|
+
const localUrl = `http://${displayHost}:${port}/`;
|
|
39
|
+
console.info();
|
|
40
|
+
console.info(` ${colors.green("\u279C")} ${colors.bold("Local")}: ${colorUrl(localUrl)}`);
|
|
41
|
+
if (host === "0.0.0.0") {
|
|
42
|
+
const networkHost = getNetworkAddress();
|
|
43
|
+
if (networkHost) {
|
|
44
|
+
const networkUrl = `http://${networkHost}:${port}/`;
|
|
45
|
+
console.info(` ${colors.green("\u279C")} ${colors.bold("Network")}: ${colorUrl(networkUrl)}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
console.info();
|
|
49
|
+
const shutdown = () => server.close();
|
|
50
|
+
process.once("SIGINT", shutdown);
|
|
51
|
+
process.once("SIGTERM", shutdown);
|
|
52
|
+
await new Promise((res, rej) => {
|
|
53
|
+
server.once("error", rej);
|
|
54
|
+
server.on("close", () => {
|
|
55
|
+
process.off("SIGINT", shutdown);
|
|
56
|
+
process.off("SIGTERM", shutdown);
|
|
57
|
+
res();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export { canReusePort, honoServeNode };
|
|
62
|
+
//# sourceMappingURL=node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createServer","networkInterfaces","platform","getRequestListener","colors","getNetworkAddress","addresses","Object","values","addr","family","internal","address","isBun","process","versions","bun","canReusePort","includes","major","minor","node","split","map","Number","honoServeNode","app","options","port","host","listener","request","env","headers","delete","incoming","socket","remoteAddress","set","fetch","server","listen","ONE_CLUSTER_WORKER","reusePort","colorUrl","url","cyan","replace","_","port2","bold","displayHost","localUrl","console","info","green","networkHost","networkUrl","shutdown","close","once","Promise","res","rej","on","off"],"sources":["../../src/serve/node.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,YAAA,QAAoB;AAC7B,SAASC,iBAAA,EAAmBC,QAAA,QAAgB;AAC5C,SAASC,kBAAA,QAA0B;AAEnC,OAAOC,MAAA,MAAY;AAGnB,SAASC,kBAAA,EAAwC;EAC/C,WAAWC,SAAA,IAAaC,MAAA,CAAOC,MAAA,CAAOP,iBAAA,CAAkB,CAAC,GAAG;IAC1D,WAAWQ,IAAA,IAAQH,SAAA,IAAa,EAAC,EAAG;MAClC,IAAIG,IAAA,CAAKC,MAAA,KAAW,UAAU,CAACD,IAAA,CAAKE,QAAA,EAAU;QAC5C,OAAOF,IAAA,CAAKG,OAAA;MACd;IACF;EACF;AACF;AAEA,MAAMC,KAAA,GAAQ,OAAOC,OAAA,CAAQC,QAAA,CAASC,GAAA,KAAQ;AAI9C,MAAMC,YAAA,GACJ,CAAC,CAAC,SAAS,QAAQ,EAAEC,QAAA,CAAShB,QAAA,CAAS,CAAC,MACvCW,KAAA,KACE,MAAM;EACL,MAAM,CAACM,KAAA,EAAOC,KAAK,IAAIN,OAAA,CAAQC,QAAA,CAASM,IAAA,CAAKC,KAAA,CAAM,GAAG,EAAEC,GAAA,CAAIC,MAAM;EAClE,OAAOL,KAAA,GAAQ,MAAOA,KAAA,KAAU,MAAMC,KAAA,IAAS,MAAOD,KAAA,IAAS;AACjE,GAAG;AAIP,eAAsBM,cAAcC,GAAA,EAAWC,OAAA,EAA2B;EACxE,MAAMC,IAAA,GAAOD,OAAA,CAAQC,IAAA,IAAQ;EAC7B,MAAMC,I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ACf,MAAMC,UAAA,GAAa,UAAUD,WAAW,IAAI5B,IAAI;MAChDyB,OAAA,CAAQC,IAAA,CACN,KAAKlD,MAAA,CAAOmD,KAAA,CAAM,QAAG,CAAC,KAAKnD,MAAA,CAAO8C,IAAA,CAAK,SAAS,CAAC,KAAKN,QAAA,CAASa,UAAU,CAAC,EAC5E;IACF;EACF;EACAJ,OAAA,CAAQC,IAAA,CAAK;EAEb,MAAMI,QAAA,GAAWA,CAAA,KAAMlB,MAAA,CAAOmB,KAAA,CAAM;EAEpC7C,OAAA,CAAQ8C,IAAA,CAAK,UAAUF,QAAQ;EAC/B5C,OAAA,CAAQ8C,IAAA,CAAK,WAAWF,QAAQ;EAEhC,MAAM,IAAIG,OAAA,CAAc,CAACC,GAAA,EAAKC,GAAA,KAAQ;IACpCvB,MAAA,CAAOoB,IAAA,CAAK,SAASG,GAAG;IACxBvB,MAAA,CAAOwB,EAAA,CAAG,SAAS,MAAM;MACvBlD,OAAA,CAAQmD,GAAA,CAAI,UAAUP,QAAQ;MAC9B5C,OAAA,CAAQmD,GAAA,CAAI,WAAWP,QAAQ;MAC/BI,GAAA,CAAI;IACN,CAAC;EACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createServer } from "http";
|
|
2
|
+
import { networkInterfaces, platform } from "os";
|
|
3
|
+
import { getRequestListener } from "@hono/node-server";
|
|
4
|
+
import colors from "picocolors";
|
|
5
|
+
function getNetworkAddress() {
|
|
6
|
+
var _iteratorNormalCompletion = true,
|
|
7
|
+
_didIteratorError = false,
|
|
8
|
+
_iteratorError = void 0;
|
|
9
|
+
try {
|
|
10
|
+
for (var _iterator = Object.values(networkInterfaces())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
11
|
+
var addresses = _step.value;
|
|
12
|
+
var _iteratorNormalCompletion1 = true,
|
|
13
|
+
_didIteratorError1 = false,
|
|
14
|
+
_iteratorError1 = void 0;
|
|
15
|
+
try {
|
|
16
|
+
for (var _iterator1 = (addresses || [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
17
|
+
var addr = _step1.value;
|
|
18
|
+
if (addr.family === "IPv4" && !addr.internal) {
|
|
19
|
+
return addr.address;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_didIteratorError1 = true;
|
|
24
|
+
_iteratorError1 = err;
|
|
25
|
+
} finally {
|
|
26
|
+
try {
|
|
27
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
28
|
+
_iterator1.return();
|
|
29
|
+
}
|
|
30
|
+
} finally {
|
|
31
|
+
if (_didIteratorError1) {
|
|
32
|
+
throw _iteratorError1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch (err) {
|
|
38
|
+
_didIteratorError = true;
|
|
39
|
+
_iteratorError = err;
|
|
40
|
+
} finally {
|
|
41
|
+
try {
|
|
42
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
43
|
+
_iterator.return();
|
|
44
|
+
}
|
|
45
|
+
} finally {
|
|
46
|
+
if (_didIteratorError) {
|
|
47
|
+
throw _iteratorError;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var isBun = typeof process.versions.bun !== "undefined";
|
|
53
|
+
var canReusePort = !["win32", "darwin"].includes(platform()) && (isBun || function () {
|
|
54
|
+
var [major, minor] = process.versions.node.split(".").map(Number);
|
|
55
|
+
return major > 22 || major === 22 && minor >= 12 || major >= 23;
|
|
56
|
+
}());
|
|
57
|
+
async function honoServeNode(app, options) {
|
|
58
|
+
var _options_port, _options_host;
|
|
59
|
+
var port = (_options_port = options.port) !== null && _options_port !== void 0 ? _options_port : 3e3;
|
|
60
|
+
var host = (_options_host = options.host) !== null && _options_host !== void 0 ? _options_host : "0.0.0.0";
|
|
61
|
+
var listener = getRequestListener(function (request, env) {
|
|
62
|
+
request.headers.delete("x-vxrn-peer-address");
|
|
63
|
+
var address = env.incoming.socket.remoteAddress;
|
|
64
|
+
if (address) request.headers.set("x-vxrn-peer-address", address);
|
|
65
|
+
return app.fetch(request, env);
|
|
66
|
+
});
|
|
67
|
+
var server = createServer(listener);
|
|
68
|
+
server.listen({
|
|
69
|
+
port,
|
|
70
|
+
host,
|
|
71
|
+
...(canReusePort && process.env.ONE_CLUSTER_WORKER === "1" ? {
|
|
72
|
+
reusePort: true
|
|
73
|
+
} : {})
|
|
74
|
+
});
|
|
75
|
+
var colorUrl = function (url) {
|
|
76
|
+
return colors.cyan(url.replace(/:(\d+)\//, function (_, port2) {
|
|
77
|
+
return `:${colors.bold(port2)}/`;
|
|
78
|
+
}));
|
|
79
|
+
};
|
|
80
|
+
var displayHost = host === "0.0.0.0" ? "localhost" : host;
|
|
81
|
+
var localUrl = `http://${displayHost}:${port}/`;
|
|
82
|
+
console.info();
|
|
83
|
+
console.info(` ${colors.green("\u279C")} ${colors.bold("Local")}: ${colorUrl(localUrl)}`);
|
|
84
|
+
if (host === "0.0.0.0") {
|
|
85
|
+
var networkHost = getNetworkAddress();
|
|
86
|
+
if (networkHost) {
|
|
87
|
+
var networkUrl = `http://${networkHost}:${port}/`;
|
|
88
|
+
console.info(` ${colors.green("\u279C")} ${colors.bold("Network")}: ${colorUrl(networkUrl)}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
console.info();
|
|
92
|
+
var shutdown = function () {
|
|
93
|
+
return server.close();
|
|
94
|
+
};
|
|
95
|
+
process.once("SIGINT", shutdown);
|
|
96
|
+
process.once("SIGTERM", shutdown);
|
|
97
|
+
await new Promise(function (res, rej) {
|
|
98
|
+
server.once("error", rej);
|
|
99
|
+
server.on("close", function () {
|
|
100
|
+
process.off("SIGINT", shutdown);
|
|
101
|
+
process.off("SIGTERM", shutdown);
|
|
102
|
+
res();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export { canReusePort, honoServeNode };
|
|
107
|
+
//# sourceMappingURL=node.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createServer","networkInterfaces","platform","getRequestListener","colors","getNetworkAddress","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Object","values","Symbol","iterator","_step","next","done","addresses","value","_iteratorNormalCompletion1","_didIteratorError1","_iteratorError1","_iterator1","_step1","addr","family","internal","address","err","return","isBun","process","versions","bun","canReusePort","includes","major","minor","node","split","map","Number","honoServeNode","app","options","_options_port","_options_host","port","host","listener","request","env"],"sources":["../../src/serve/node.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,YAAA,QAAoB;AAC7B,SAASC,iBAAA,EAAmBC,QAAA,QAAgB;AAC5C,SAASC,kBAAA,QAA0B;AAEnC,OAAOC,MAAA,MAAY;AAGnB,SAASC,kBAAA,EAAwC;EAC/C,IAAAC,yBAAwB,GAAO;IAAOC,iBAAA,GAAmB,KAAG;IAAAC,cAAA;EAC1D;IACE,SAAIC,SAAK,GAAAC,MAAW,CAAAC,MAAW,CAAAV,iBAAe,IAAAW,MAAA,CAAAC,QAAA,KAAAC,KAAA,IAAAR,yBAAA,IAAAQ,KAAA,GAAAL,SAAA,CAAAM,IAAA,IAAAC,IAAA,GAAAV,yBAAA;MAC5C,IAAAW,SAAO,GAAKH,KAAA,CAAAI,KAAA;MACd,IAAAC,0BAAA;QAAAC,kBAAA;QAAAC,eAAA;MACF;QACF,SAAAC,UAAA,IAAAL,SAAA,QAAAL,MAAA,CAAAC,QAAA,KAAAU,MAAA,IAAAJ,0BAAA,IAAAI,MAAA,GAAAD,UAAA,CAAAP,IAAA,IAAAC,IAAA,GAAAG,0BAAA;UACF,IAAAK,IAAA,GAAAD,MAAA,CAAAL,KAAA;UAEM,IAAQM,IAAA,CAAAC,MAAO,KAAQ,UAAS,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A,WAAA+C,OAAA,EAAAC,GAAA","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
import { honoServeNode } from "./node.mjs";
|
|
5
|
+
describe("honoServeNode", () => {
|
|
6
|
+
test("rejects when the listener cannot bind", async () => {
|
|
7
|
+
const occupied = createServer();
|
|
8
|
+
await new Promise((resolve, reject) => {
|
|
9
|
+
occupied.once("error", reject);
|
|
10
|
+
occupied.listen(0, "127.0.0.1", resolve);
|
|
11
|
+
});
|
|
12
|
+
const address = occupied.address();
|
|
13
|
+
if (!address || typeof address === "string") throw new Error("missing test port");
|
|
14
|
+
const app = new Hono().get("/health", context => context.text("ok"));
|
|
15
|
+
await expect(honoServeNode(app, {
|
|
16
|
+
host: "127.0.0.1",
|
|
17
|
+
port: address.port
|
|
18
|
+
})).rejects.toMatchObject({
|
|
19
|
+
code: "EADDRINUSE"
|
|
20
|
+
});
|
|
21
|
+
await new Promise((resolve, reject) => occupied.close(error => error ? reject(error) : resolve()));
|
|
22
|
+
});
|
|
23
|
+
test("overwrites the trusted peer address header from the socket", async () => {
|
|
24
|
+
const reservation = createServer();
|
|
25
|
+
await new Promise((resolve, reject) => {
|
|
26
|
+
reservation.once("error", reject);
|
|
27
|
+
reservation.listen(0, "127.0.0.1", resolve);
|
|
28
|
+
});
|
|
29
|
+
const address = reservation.address();
|
|
30
|
+
if (!address || typeof address === "string") throw new Error("missing test port");
|
|
31
|
+
await new Promise((resolve, reject) => reservation.close(error => error ? reject(error) : resolve()));
|
|
32
|
+
const app = new Hono().get("/peer", context => context.text(context.req.header("x-vxrn-peer-address") || ""));
|
|
33
|
+
const running = honoServeNode(app, {
|
|
34
|
+
host: "127.0.0.1",
|
|
35
|
+
port: address.port
|
|
36
|
+
});
|
|
37
|
+
await new Promise((resolve, reject) => {
|
|
38
|
+
const startedAt = Date.now();
|
|
39
|
+
const probe = async () => {
|
|
40
|
+
try {
|
|
41
|
+
const response = await fetch(`http://127.0.0.1:${address.port}/peer`, {
|
|
42
|
+
headers: {
|
|
43
|
+
"x-vxrn-peer-address": "203.0.113.9"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
expect(await response.text()).toBe("127.0.0.1");
|
|
47
|
+
resolve();
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (Date.now() - startedAt > 2e3) reject(error);else setTimeout(probe, 20);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
void probe();
|
|
53
|
+
});
|
|
54
|
+
const shutdown = process.listeners("SIGTERM").at(-1);
|
|
55
|
+
expect(shutdown).toBeTypeOf("function");
|
|
56
|
+
shutdown?.("SIGTERM");
|
|
57
|
+
await running;
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=node.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createServer","Hono","describe","expect","test","honoServeNode","occupied","Promise","resolve","reject","once","listen","address","Error","app","get","context","text","host","port","rejects","toMatchObject","code","close","error","reservation","req","header","running","startedAt","Date","now","probe","response","fetch","headers","toBe","setTimeout","shutdown","process","listeners","at","toBeTypeOf"],"sources":["../../src/serve/node.test.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,YAAA,QAAoB;AAC7B,SAASC,IAAA,QAAY;AACrB,SAASC,QAAA,EAAUC,MAAA,EAAQC,IAAA,QAAY;AACvC,SAASC,aAAA,QAAqB;AAE9BH,QAAA,CAAS,iBAAiB,MAAM;EAC9BE,IAAA,CAAK,yCAAyC,YAAY;IACxD,MAAME,QAAA,GAAWN,YAAA,CAAa;IAC9B,MAAM,IAAIO,OAAA,CAAc,CAACC,OAAA,EAASC,MAAA,KAAW;MAC3CH,QAAA,CAASI,IAAA,CAAK,SAASD,MAAM;MAC7BH,QAAA,CAASK,MAAA,CAAO,GAAG,aAAaH,OAAO;IACzC,CAAC;IACD,MAA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c,GAAA,CAAI,SAAUC,OAAA,IACnCA,OAAA,CAAQC,IAAA,CAAKD,OAAA,CAAQU,GAAA,CAAIC,MAAA,CAAO,qBAAqB,KAAK,EAAE,CAC9D;IACA,MAAMC,OAAA,GAAUvB,aAAA,CAAcS,GAAA,EAAK;MAAEI,IAAA,EAAM;MAAaC,IAAA,EAAMP,OAAA,CAAQO;IAAK,CAAC;IAC5E,MAAM,IAAIZ,OAAA,CAAc,CAACC,OAAA,EAASC,MAAA,KAAW;MAC3C,MAAMoB,SAAA,GAAYC,IAAA,CAAKC,GAAA,CAAI;MAC3B,MAAMC,KAAA,GAAQ,MAAAA,CAAA,KAAY;QACxB,IAAI;UACF,MAAMC,QAAA,GAAW,MAAMC,KAAA,CAAM,oBAAoBtB,OAAA,CAAQO,IAAI,SAAS;YACpEgB,OAAA,EAAS;cAAE,uBAAuB;YAAc;UAClD,CAAC;UACDhC,MAAA,CAAO,MAAM8B,QAAA,CAAShB,IAAA,CAAK,CAAC,EAAEmB,IAAA,CAAK,WAAW;UAC9C5B,OAAA,CAAQ;QACV,SAASgB,KAAA,EAAO;UACd,IAAIM,IAAA,CAAKC,GAAA,CAAI,IAAIF,SAAA,GAAY,KAAOpB,MAAA,CAAOe,KAAK,OAC3Ca,UAAA,CAAWL,KAAA,EAAO,EAAE;QAC3B;MACF;MACA,KAAKA,KAAA,CAAM;IACb,CAAC;IACD,MAAMM,QAAA,GAAWC,OAAA,CAAQC,SAAA,CAAU,SAAS,EAAEC,EAAA,CAAG,EAAE;IACnDtC,MAAA,CAAOmC,QAAQ,EAAEI,UAAA,CAAW,UAAU;IACtCJ,QAAA,GAAW,SAAS;IACpB,MAAMV,OAAA;EACR,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createServer } from "http";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
import { honoServeNode } from "./node.native.js";
|
|
5
|
+
describe("honoServeNode", function () {
|
|
6
|
+
test("rejects when the listener cannot bind", async function () {
|
|
7
|
+
var occupied = createServer();
|
|
8
|
+
await new Promise(function (resolve, reject) {
|
|
9
|
+
occupied.once("error", reject);
|
|
10
|
+
occupied.listen(0, "127.0.0.1", resolve);
|
|
11
|
+
});
|
|
12
|
+
var address = occupied.address();
|
|
13
|
+
if (!address || typeof address === "string") throw new Error("missing test port");
|
|
14
|
+
var app = new Hono().get("/health", function (context) {
|
|
15
|
+
return context.text("ok");
|
|
16
|
+
});
|
|
17
|
+
await expect(honoServeNode(app, {
|
|
18
|
+
host: "127.0.0.1",
|
|
19
|
+
port: address.port
|
|
20
|
+
})).rejects.toMatchObject({
|
|
21
|
+
code: "EADDRINUSE"
|
|
22
|
+
});
|
|
23
|
+
await new Promise(function (resolve, reject) {
|
|
24
|
+
return occupied.close(function (error) {
|
|
25
|
+
return error ? reject(error) : resolve();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
test("overwrites the trusted peer address header from the socket", async function () {
|
|
30
|
+
var reservation = createServer();
|
|
31
|
+
await new Promise(function (resolve, reject) {
|
|
32
|
+
reservation.once("error", reject);
|
|
33
|
+
reservation.listen(0, "127.0.0.1", resolve);
|
|
34
|
+
});
|
|
35
|
+
var address = reservation.address();
|
|
36
|
+
if (!address || typeof address === "string") throw new Error("missing test port");
|
|
37
|
+
await new Promise(function (resolve, reject) {
|
|
38
|
+
return reservation.close(function (error) {
|
|
39
|
+
return error ? reject(error) : resolve();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var app = new Hono().get("/peer", function (context) {
|
|
43
|
+
return context.text(context.req.header("x-vxrn-peer-address") || "");
|
|
44
|
+
});
|
|
45
|
+
var running = honoServeNode(app, {
|
|
46
|
+
host: "127.0.0.1",
|
|
47
|
+
port: address.port
|
|
48
|
+
});
|
|
49
|
+
await new Promise(function (resolve, reject) {
|
|
50
|
+
var startedAt = Date.now();
|
|
51
|
+
var probe = async function () {
|
|
52
|
+
try {
|
|
53
|
+
var response = await fetch(`http://127.0.0.1:${address.port}/peer`, {
|
|
54
|
+
headers: {
|
|
55
|
+
"x-vxrn-peer-address": "203.0.113.9"
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
expect(await response.text()).toBe("127.0.0.1");
|
|
59
|
+
resolve();
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (Date.now() - startedAt > 2e3) reject(error);else setTimeout(probe, 20);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
void probe();
|
|
65
|
+
});
|
|
66
|
+
var shutdown = process.listeners("SIGTERM").at(-1);
|
|
67
|
+
expect(shutdown).toBeTypeOf("function");
|
|
68
|
+
shutdown === null || shutdown === void 0 ? void 0 : shutdown("SIGTERM");
|
|
69
|
+
await running;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=node.test.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createServer","Hono","describe","expect","test","honoServeNode","occupied","Promise","resolve","reject","once","listen","address","Error","app","get","context","text","host","port","rejects","toMatchObject","code","close","error","reservation","req","header","running","startedAt","Date","now","probe","response","fetch","headers","toBe"],"sources":["../../src/serve/node.test.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,YAAA,QAAoB;AAC7B,SAASC,IAAA,QAAY;AACrB,SAASC,QAAA,EAAUC,MAAA,EAAQC,IAAA,QAAY;AACvC,SAASC,aAAA,QAAqB;AAE9BH,QAAA,CAAS,iBAAiB,YAAM;EAC9BE,IAAA,CAAK,yCAAyC,kBAAY;IACxD,IAAAE,QAAM,GAAAN,YAAW;IACjB,MAAM,IAAIO,OAAA,CAAc,UAACC,OAAS,EAAAC,MAAW;MAC3CH,QAAA,CAASI,IAAA,CAAK,SAASD,MAAM;MAC7BH,QAAA,CAASK,MAAA,CAAO,GAAG,aAAaH,OAAO;IACzC,CAAC;IACD,IAAAI,OAAM,GAAAN,QAAU,CAAAM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GAAA,EAAK;MAC3BI,IAAA,aAAQ;MAAAC,IACV,EAAAP,OAAS,CAAAO;IACP;IAAgD,UAC3CZ,OAAA,WAAWC,OAAS,EAAAC,MAAA;MAAA,IAC3BoB,SAAA,GAAAC,IAAA,CAAAC,GAAA;MACF,IAAAC,KAAA,kBAAAA,CAAA;QACA,IAAK;UACN,IAAAC,QAAA,SAAAC,KAAA,qBAAAtB,OAAA,CAAAO,IAAA;YACKgB,OAAA,EAAW;cACV,qBAAqB;YAC5B;UACM;UACPhC,MAAA,OAAA8B,QAAA,CAAAhB,IAAA,IAAAmB,IAAA;UACF5B,OAAA","ignoreList":[]}
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|