one 1.1.298 → 1.1.299

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) hide show
  1. package/dist/cjs/vite/replaceLoader.js +7 -1
  2. package/dist/cjs/vite/replaceLoader.js.map +1 -1
  3. package/dist/cjs/vite/replaceLoader.native.js +7 -1
  4. package/dist/cjs/vite/replaceLoader.native.js.map +1 -1
  5. package/dist/esm/Root.native.js +110 -104
  6. package/dist/esm/Root.native.js.map +6 -1
  7. package/dist/esm/Route.native.js +12 -10
  8. package/dist/esm/Route.native.js.map +6 -1
  9. package/dist/esm/cleanUrl.native.js +12 -13
  10. package/dist/esm/cleanUrl.native.js.map +6 -1
  11. package/dist/esm/cli/label-process.native.js +5 -4
  12. package/dist/esm/cli/label-process.native.js.map +6 -1
  13. package/dist/esm/cli/main.native.js +8 -13
  14. package/dist/esm/cli/main.native.js.map +6 -1
  15. package/dist/esm/cli/prebuild.native.js +5 -5
  16. package/dist/esm/cli/prebuild.native.js.map +6 -1
  17. package/dist/esm/cli/run.native.js +21 -28
  18. package/dist/esm/cli/run.native.js.map +6 -1
  19. package/dist/esm/cli.native.js +119 -148
  20. package/dist/esm/cli.native.js.map +6 -1
  21. package/dist/esm/clientLoaderResolver.native.js +9 -6
  22. package/dist/esm/clientLoaderResolver.native.js.map +6 -1
  23. package/dist/esm/config.native.js +12 -11
  24. package/dist/esm/config.native.js.map +6 -1
  25. package/dist/esm/constants.native.js +7 -5
  26. package/dist/esm/constants.native.js.map +6 -1
  27. package/dist/esm/createApp.native.js +13 -9
  28. package/dist/esm/createApp.native.js.map +6 -1
  29. package/dist/esm/createHandleRequest.native.js +55 -64
  30. package/dist/esm/createHandleRequest.native.js.map +6 -1
  31. package/dist/esm/createRoute.native.js +16 -16
  32. package/dist/esm/createRoute.native.js.map +6 -1
  33. package/dist/esm/fallbackViews/Sitemap.native.js +6 -3
  34. package/dist/esm/fallbackViews/Sitemap.native.js.map +6 -1
  35. package/dist/esm/fallbackViews/Unmatched.native.js +5 -3
  36. package/dist/esm/fallbackViews/Unmatched.native.js.map +6 -1
  37. package/dist/esm/fork/NavigationContainer.native.js +24 -31
  38. package/dist/esm/fork/NavigationContainer.native.js.map +6 -1
  39. package/dist/esm/fork/createMemoryHistory.native.js +99 -115
  40. package/dist/esm/fork/createMemoryHistory.native.js.map +6 -1
  41. package/dist/esm/fork/extractPathFromURL.native.js +16 -15
  42. package/dist/esm/fork/extractPathFromURL.native.js.map +6 -1
  43. package/dist/esm/fork/findFocusedRoute.native.js +6 -5
  44. package/dist/esm/fork/findFocusedRoute.native.js.map +6 -1
  45. package/dist/esm/fork/getPathFromState.native.js +127 -140
  46. package/dist/esm/fork/getPathFromState.native.js.map +6 -1
  47. package/dist/esm/fork/getStateFromPath.native.js +292 -288
  48. package/dist/esm/fork/getStateFromPath.native.js.map +6 -1
  49. package/dist/esm/fork/useLinking.native.js +70 -61
  50. package/dist/esm/fork/useLinking.native.js.map +6 -1
  51. package/dist/esm/fork/validatePathConfig.native.js +15 -9
  52. package/dist/esm/fork/validatePathConfig.native.js.map +6 -1
  53. package/dist/esm/getLinkingConfig.native.js +11 -6
  54. package/dist/esm/getLinkingConfig.native.js.map +6 -1
  55. package/dist/esm/getReactNavigationConfig.native.js +28 -20
  56. package/dist/esm/getReactNavigationConfig.native.js.map +6 -1
  57. package/dist/esm/getRoutes.native.js +249 -229
  58. package/dist/esm/getRoutes.native.js.map +6 -1
  59. package/dist/esm/getURL.native.js +4 -4
  60. package/dist/esm/getURL.native.js.map +6 -1
  61. package/dist/esm/head/Head.android.js +5 -3
  62. package/dist/esm/head/Head.android.js.map +6 -1
  63. package/dist/esm/head/Head.ios.js +144 -132
  64. package/dist/esm/head/Head.ios.js.map +6 -1
  65. package/dist/esm/head/Head.native.js +7 -7
  66. package/dist/esm/head/Head.native.js.map +6 -1
  67. package/dist/esm/head/HeadModule.native.js +6 -6
  68. package/dist/esm/head/HeadModule.native.js.map +6 -1
  69. package/dist/esm/head/index.native.js +2 -2
  70. package/dist/esm/head/index.native.js.map +6 -1
  71. package/dist/esm/head/types.native.js +1 -2
  72. package/dist/esm/head/types.native.js.map +6 -1
  73. package/dist/esm/head/url.native.js +10 -8
  74. package/dist/esm/head/url.native.js.map +6 -1
  75. package/dist/esm/hooks.native.js +53 -34
  76. package/dist/esm/hooks.native.js.map +6 -1
  77. package/dist/esm/imperative-api.native.js +9 -6
  78. package/dist/esm/imperative-api.native.js.map +6 -1
  79. package/dist/esm/import-mode/index.android.js +4 -3
  80. package/dist/esm/import-mode/index.android.js.map +6 -1
  81. package/dist/esm/import-mode/index.ios.js +4 -3
  82. package/dist/esm/import-mode/index.ios.js.map +6 -1
  83. package/dist/esm/import-mode/index.native.js +3 -1
  84. package/dist/esm/import-mode/index.native.js.map +6 -1
  85. package/dist/esm/index.native.js +65 -27
  86. package/dist/esm/index.native.js.map +6 -1
  87. package/dist/esm/interfaces/router.native.js +4 -2
  88. package/dist/esm/interfaces/router.native.js.map +6 -1
  89. package/dist/esm/layouts/Drawer.native.js +7 -6
  90. package/dist/esm/layouts/Drawer.native.js.map +6 -1
  91. package/dist/esm/layouts/Stack.native.js +7 -6
  92. package/dist/esm/layouts/Stack.native.js.map +6 -1
  93. package/dist/esm/layouts/Tabs.native.js +42 -39
  94. package/dist/esm/layouts/Tabs.native.js.map +6 -1
  95. package/dist/esm/layouts/withLayoutContext.native.js +51 -48
  96. package/dist/esm/layouts/withLayoutContext.native.js.map +6 -1
  97. package/dist/esm/link/Link.native.js +62 -53
  98. package/dist/esm/link/Link.native.js.map +6 -1
  99. package/dist/esm/link/Redirect.native.js +8 -9
  100. package/dist/esm/link/Redirect.native.js.map +6 -1
  101. package/dist/esm/link/href.native.js +28 -27
  102. package/dist/esm/link/href.native.js.map +6 -1
  103. package/dist/esm/link/linking.native.js +51 -40
  104. package/dist/esm/link/linking.native.js.map +6 -1
  105. package/dist/esm/link/path.native.js +28 -19
  106. package/dist/esm/link/path.native.js.map +6 -1
  107. package/dist/esm/link/useLinkTo.native.js +22 -20
  108. package/dist/esm/link/useLinkTo.native.js.map +6 -1
  109. package/dist/esm/link/useLoadedNavigation.native.js +30 -23
  110. package/dist/esm/link/useLoadedNavigation.native.js.map +6 -1
  111. package/dist/esm/matchers.native.js +16 -3
  112. package/dist/esm/matchers.native.js.map +6 -1
  113. package/dist/esm/platform.native.js +4 -2
  114. package/dist/esm/platform.native.js.map +6 -1
  115. package/dist/esm/polyfills-mobile.native.js +4 -5
  116. package/dist/esm/polyfills-mobile.native.js.map +6 -1
  117. package/dist/esm/polyfills-server.native.js +1 -1
  118. package/dist/esm/polyfills-server.native.js.map +6 -1
  119. package/dist/esm/render.native.js +3 -1
  120. package/dist/esm/render.native.js.map +6 -1
  121. package/dist/esm/router/RouterStore.native.js +1 -2
  122. package/dist/esm/router/RouterStore.native.js.map +6 -1
  123. package/dist/esm/router/constants.native.js +4 -2
  124. package/dist/esm/router/constants.native.js.map +6 -1
  125. package/dist/esm/router/getNormalizedStatePath.native.js +18 -17
  126. package/dist/esm/router/getNormalizedStatePath.native.js.map +6 -1
  127. package/dist/esm/router/lastAction.native.js +10 -9
  128. package/dist/esm/router/lastAction.native.js.map +6 -1
  129. package/dist/esm/router/router.native.js +135 -114
  130. package/dist/esm/router/router.native.js.map +6 -1
  131. package/dist/esm/router/serverLocationContext.native.js +4 -2
  132. package/dist/esm/router/serverLocationContext.native.js.map +6 -1
  133. package/dist/esm/router/useInitializeOneRouter.native.js +8 -5
  134. package/dist/esm/router/useInitializeOneRouter.native.js.map +6 -1
  135. package/dist/esm/serve.native.js +77 -104
  136. package/dist/esm/serve.native.js.map +6 -1
  137. package/dist/esm/server/createRoutesManifest.native.js +14 -11
  138. package/dist/esm/server/createRoutesManifest.native.js.map +6 -1
  139. package/dist/esm/server/getServerManifest.native.js +61 -67
  140. package/dist/esm/server/getServerManifest.native.js.map +6 -1
  141. package/dist/esm/server-render.native.js +9 -10
  142. package/dist/esm/server-render.native.js.map +6 -1
  143. package/dist/esm/sortRoutes.native.js +27 -17
  144. package/dist/esm/sortRoutes.native.js.map +6 -1
  145. package/dist/esm/typed-routes/generateRouteTypes.native.js +10 -11
  146. package/dist/esm/typed-routes/generateRouteTypes.native.js.map +6 -1
  147. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js +38 -37
  148. package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +6 -1
  149. package/dist/esm/types.native.js +1 -2
  150. package/dist/esm/types.native.js.map +6 -1
  151. package/dist/esm/useFocusEffect.native.js +25 -22
  152. package/dist/esm/useFocusEffect.native.js.map +6 -1
  153. package/dist/esm/useLoader.native.js +50 -50
  154. package/dist/esm/useLoader.native.js.map +6 -1
  155. package/dist/esm/useNavigation.native.js +23 -19
  156. package/dist/esm/useNavigation.native.js.map +6 -1
  157. package/dist/esm/useScreens.native.js +143 -160
  158. package/dist/esm/useScreens.native.js.map +6 -1
  159. package/dist/esm/useViteRoutes.native.js +25 -28
  160. package/dist/esm/useViteRoutes.native.js.map +6 -1
  161. package/dist/esm/utils/assertIsReady.native.js +6 -3
  162. package/dist/esm/utils/assertIsReady.native.js.map +6 -1
  163. package/dist/esm/utils/dynamicImport.native.js +5 -3
  164. package/dist/esm/utils/dynamicImport.native.js.map +6 -1
  165. package/dist/esm/utils/existsAsync.native.js +6 -4
  166. package/dist/esm/utils/existsAsync.native.js.map +6 -1
  167. package/dist/esm/utils/getPageExport.native.js +12 -11
  168. package/dist/esm/utils/getPageExport.native.js.map +6 -1
  169. package/dist/esm/utils/globDir.native.js +5 -3
  170. package/dist/esm/utils/globDir.native.js.map +6 -1
  171. package/dist/esm/utils/hashString.native.js +4 -2
  172. package/dist/esm/utils/hashString.native.js.map +6 -1
  173. package/dist/esm/utils/isResponse.native.js +4 -2
  174. package/dist/esm/utils/isResponse.native.js.map +6 -1
  175. package/dist/esm/utils/isStatus.native.js +4 -2
  176. package/dist/esm/utils/isStatus.native.js.map +6 -1
  177. package/dist/esm/utils/promiseWithResolvers.native.js +7 -7
  178. package/dist/esm/utils/promiseWithResolvers.native.js.map +6 -1
  179. package/dist/esm/utils/rand.native.js +5 -3
  180. package/dist/esm/utils/rand.native.js.map +6 -1
  181. package/dist/esm/utils/redirect.native.js +7 -5
  182. package/dist/esm/utils/redirect.native.js.map +6 -1
  183. package/dist/esm/utils/removeSearch.native.js +4 -2
  184. package/dist/esm/utils/removeSearch.native.js.map +6 -1
  185. package/dist/esm/utils/removeUndefined.native.js +6 -3
  186. package/dist/esm/utils/removeUndefined.native.js.map +6 -1
  187. package/dist/esm/utils/requireResolve.native.js +4 -2
  188. package/dist/esm/utils/requireResolve.native.js.map +6 -1
  189. package/dist/esm/utils/url.native.js +6 -2
  190. package/dist/esm/utils/url.native.js.map +6 -1
  191. package/dist/esm/utils/weakKey.native.js +11 -10
  192. package/dist/esm/utils/weakKey.native.js.map +6 -1
  193. package/dist/esm/utils/weakMemo.native.js +8 -8
  194. package/dist/esm/utils/weakMemo.native.js.map +6 -1
  195. package/dist/esm/views/EmptyRoute.native.js +5 -3
  196. package/dist/esm/views/EmptyRoute.native.js.map +6 -1
  197. package/dist/esm/views/ErrorBoundary.native.js +5 -8
  198. package/dist/esm/views/ErrorBoundary.native.js.map +6 -1
  199. package/dist/esm/views/LoadProgressBar.native.js +58 -57
  200. package/dist/esm/views/LoadProgressBar.native.js.map +6 -1
  201. package/dist/esm/views/Navigator.native.js +54 -71
  202. package/dist/esm/views/Navigator.native.js.map +6 -1
  203. package/dist/esm/views/PreloadLinks.native.js +3 -1
  204. package/dist/esm/views/PreloadLinks.native.js.map +6 -1
  205. package/dist/esm/views/RootErrorBoundary.native.js +39 -29
  206. package/dist/esm/views/RootErrorBoundary.native.js.map +6 -1
  207. package/dist/esm/views/Screen.native.js +12 -12
  208. package/dist/esm/views/Screen.native.js.map +6 -1
  209. package/dist/esm/views/ScrollRestoration.native.js +27 -27
  210. package/dist/esm/views/ScrollRestoration.native.js.map +6 -1
  211. package/dist/esm/views/Try.native.js +40 -37
  212. package/dist/esm/views/Try.native.js.map +6 -1
  213. package/dist/esm/vite/build.native.js +260 -295
  214. package/dist/esm/vite/build.native.js.map +6 -1
  215. package/dist/esm/vite/clientTreeShakePlugin.native.js +34 -33
  216. package/dist/esm/vite/clientTreeShakePlugin.native.js.map +6 -1
  217. package/dist/esm/vite/constants.native.js +6 -4
  218. package/dist/esm/vite/constants.native.js.map +6 -1
  219. package/dist/esm/vite/createFileSystemRouter.native.js +99 -130
  220. package/dist/esm/vite/createFileSystemRouter.native.js.map +6 -1
  221. package/dist/esm/vite/customNodeExternals.native.js +9 -10
  222. package/dist/esm/vite/customNodeExternals.native.js.map +6 -1
  223. package/dist/esm/vite/ensureTsConfig.native.js +7 -5
  224. package/dist/esm/vite/ensureTsConfig.native.js.map +6 -1
  225. package/dist/esm/vite/findDepsToOptimize.native.js +27 -19
  226. package/dist/esm/vite/findDepsToOptimize.native.js.map +6 -1
  227. package/dist/esm/vite/fixDependenciesPlugin.native.js +5 -3
  228. package/dist/esm/vite/fixDependenciesPlugin.native.js.map +6 -1
  229. package/dist/esm/vite/generateTypesForRoutes.native.js +9 -9
  230. package/dist/esm/vite/generateTypesForRoutes.native.js.map +6 -1
  231. package/dist/esm/vite/getManifest.native.js +6 -4
  232. package/dist/esm/vite/getManifest.native.js.map +6 -1
  233. package/dist/esm/vite/headers.native.js +11 -5
  234. package/dist/esm/vite/headers.native.js.map +6 -1
  235. package/dist/esm/vite/loadEnv.native.js +7 -6
  236. package/dist/esm/vite/loadEnv.native.js.map +6 -1
  237. package/dist/esm/vite/makePluginWebOnly.native.js +9 -5
  238. package/dist/esm/vite/makePluginWebOnly.native.js.map +6 -1
  239. package/dist/esm/vite/one.native.js +142 -127
  240. package/dist/esm/vite/one.native.js.map +6 -1
  241. package/dist/esm/vite/removeReactNativeWebAnimatedPlugin.native.js +14 -11
  242. package/dist/esm/vite/removeReactNativeWebAnimatedPlugin.native.js.map +6 -1
  243. package/dist/esm/vite/replaceLoader.js +7 -1
  244. package/dist/esm/vite/replaceLoader.js.map +1 -1
  245. package/dist/esm/vite/replaceLoader.mjs +5 -1
  246. package/dist/esm/vite/replaceLoader.mjs.map +1 -1
  247. package/dist/esm/vite/replaceLoader.native.js +13 -10
  248. package/dist/esm/vite/replaceLoader.native.js.map +6 -1
  249. package/dist/esm/vite/resolveAPIRequest.native.js +44 -47
  250. package/dist/esm/vite/resolveAPIRequest.native.js.map +6 -1
  251. package/dist/esm/vite/server.native.js +5 -4
  252. package/dist/esm/vite/server.native.js.map +6 -1
  253. package/dist/esm/vite/types.native.js +1 -2
  254. package/dist/esm/vite/types.native.js.map +6 -1
  255. package/dist/esm/vite/virtualEntryPlugin.native.js +21 -16
  256. package/dist/esm/vite/virtualEntryPlugin.native.js.map +6 -1
  257. package/dist/esm/vite/vitePluginSsrCss.native.js +61 -50
  258. package/dist/esm/vite/vitePluginSsrCss.native.js.map +6 -1
  259. package/dist/esm/vite.native.js +19 -10
  260. package/dist/esm/vite.native.js.map +6 -1
  261. package/dist/esm/zero/getQueryKey.native.js +5 -3
  262. package/dist/esm/zero/getQueryKey.native.js.map +6 -1
  263. package/dist/esm/zero/isZeroQuery.native.js +4 -2
  264. package/dist/esm/zero/isZeroQuery.native.js.map +6 -1
  265. package/dist/esm/zero/resolveQuery.native.js +9 -8
  266. package/dist/esm/zero/resolveQuery.native.js.map +6 -1
  267. package/dist/esm/zero/subscribeToQuery.native.js +5 -3
  268. package/dist/esm/zero/subscribeToQuery.native.js.map +6 -1
  269. package/dist/esm/zero/types.native.js +1 -2
  270. package/dist/esm/zero/types.native.js.map +6 -1
  271. package/dist/esm/zero/useQuery.native.js +12 -12
  272. package/dist/esm/zero/useQuery.native.js.map +6 -1
  273. package/dist/esm/zero/useQueryZero.native.js +24 -20
  274. package/dist/esm/zero/useQueryZero.native.js.map +6 -1
  275. package/dist/esm/zero.native.js +9 -5
  276. package/dist/esm/zero.native.js.map +6 -1
  277. package/package.json +7 -7
  278. package/src/vite/replaceLoader.ts +7 -1
  279. package/types/vite/replaceLoader.d.ts.map +1 -1
@@ -5,83 +5,72 @@ import Path, { join, relative } from "node:path";
5
5
  import { nodeExternals } from "rollup-plugin-node-externals";
6
6
  import { mergeConfig, build as viteBuild } from "vite";
7
7
  import { fillOptions, getOptimizeDeps, rollupRemoveUnusedImportsPlugin, build as vxrnBuild } from "vxrn";
8
- import { getLoaderPath, getPreloadPath } from "../cleanUrl.native.js";
9
- import { getManifest } from "./getManifest.native.js";
10
- import { loadUserOneOptions } from "./one.native.js";
11
- import { replaceLoader } from "./replaceLoader.native.js";
12
- import { labelProcess } from "../cli/label-process.native.js";
13
- var {
14
- ensureDir,
15
- readFile,
16
- outputFile
17
- } = FSExtra;
18
- process.on("uncaughtException", function (err) {
8
+ import { getLoaderPath, getPreloadPath } from "../cleanUrl";
9
+ import { getManifest } from "./getManifest";
10
+ import { loadUserOneOptions } from "./one";
11
+ import { replaceLoader } from "./replaceLoader";
12
+ import { labelProcess } from "../cli/label-process";
13
+ var { ensureDir, readFile, outputFile } = FSExtra;
14
+ process.on("uncaughtException", function(err) {
19
15
  console.error(err?.message || err);
20
16
  });
21
17
  async function build(args) {
22
18
  var _userOptions_build_server, _userOptions_build, _userOptions_web, _options_server;
23
19
  labelProcess("build");
24
- var userOptions = await loadUserOneOptions("build"),
25
- _userOptions_build_server_outputFormat,
26
- serverOutputFormat = (_userOptions_build_server_outputFormat = (_userOptions_build = userOptions.build) === null || _userOptions_build === void 0 || (_userOptions_build_server = _userOptions_build.server) === null || _userOptions_build_server === void 0 ? void 0 : _userOptions_build_server.outputFormat) !== null && _userOptions_build_server_outputFormat !== void 0 ? _userOptions_build_server_outputFormat : "esm";
20
+ var userOptions = await loadUserOneOptions("build"), _userOptions_build_server_outputFormat, serverOutputFormat = (_userOptions_build_server_outputFormat = (_userOptions_build = userOptions.build) === null || _userOptions_build === void 0 || (_userOptions_build_server = _userOptions_build.server) === null || _userOptions_build_server === void 0 ? void 0 : _userOptions_build_server.outputFormat) !== null && _userOptions_build_server_outputFormat !== void 0 ? _userOptions_build_server_outputFormat : "esm";
27
21
  process.env.VXRN_REACT_19 = "1", process.env.ONE_SERVER_URL || console.warn("\u26A0\uFE0F No ONE_SERVER_URL environment set, set it in your .env to your target deploy URL");
28
22
  var vxrnOutput = await vxrnBuild({
29
- server: userOptions.server,
30
- build: {
31
- analyze: !0,
32
- server: {
33
- outputFormat: serverOutputFormat
34
- }
23
+ server: userOptions.server,
24
+ build: {
25
+ analyze: !0,
26
+ server: {
27
+ outputFormat: serverOutputFormat
35
28
  }
36
- }, args),
37
- options = await fillOptions(vxrnOutput.options),
38
- toAbsolute = function (p) {
39
- return Path.resolve(options.root, p);
40
- },
41
- manifest = getManifest(),
42
- {
43
- optimizeDeps
44
- } = getOptimizeDeps("build"),
45
- apiBuildConfig = mergeConfig(
29
+ }
30
+ }, args), options = await fillOptions(vxrnOutput.options), toAbsolute = function(p) {
31
+ return Path.resolve(options.root, p);
32
+ }, manifest = getManifest(), { optimizeDeps } = getOptimizeDeps("build"), apiBuildConfig = mergeConfig(
46
33
  // feels like this should build off the *server* build config not web
47
- vxrnOutput.webBuildConfig, {
34
+ vxrnOutput.webBuildConfig,
35
+ {
48
36
  configFile: !1,
49
37
  appType: "custom",
50
38
  optimizeDeps
51
- });
39
+ }
40
+ );
52
41
  if (manifest.apiRoutes.length) {
53
42
  var _userOptions_build_api, _userOptions_build1, _userOptions_build_api1, _userOptions_build2;
54
43
  console.info(`
55
44
  \u{1F528} build api routes
56
45
  `);
57
- var processEnvDefines = Object.fromEntries(Object.entries(process.env).map(function (param) {
58
- var [key, value] = param;
59
- return [`process.env.${key}`, JSON.stringify(value)];
60
- })),
61
- apiRouteExternalRegex = buildRegexExcludingDeps(optimizeDeps.include),
62
- apiEntryPoints = manifest.apiRoutes.reduce(function (entries, param) {
63
- var {
64
- page,
65
- file
66
- } = param;
67
- return entries[page.slice(1) + ".js"] = join("app", file), entries;
68
- }, {}),
69
- _userOptions_build_api_outputFormat,
70
- apiOutputFormat = (_userOptions_build_api_outputFormat = userOptions == null || (_userOptions_build1 = userOptions.build) === null || _userOptions_build1 === void 0 || (_userOptions_build_api = _userOptions_build1.api) === null || _userOptions_build_api === void 0 ? void 0 : _userOptions_build_api.outputFormat) !== null && _userOptions_build_api_outputFormat !== void 0 ? _userOptions_build_api_outputFormat : serverOutputFormat,
71
- treeshake = userOptions == null || (_userOptions_build2 = userOptions.build) === null || _userOptions_build2 === void 0 || (_userOptions_build_api1 = _userOptions_build2.api) === null || _userOptions_build_api1 === void 0 ? void 0 : _userOptions_build_api1.treeshake;
46
+ var processEnvDefines = Object.fromEntries(Object.entries(process.env).map(function(param) {
47
+ var [key, value] = param;
48
+ return [
49
+ `process.env.${key}`,
50
+ JSON.stringify(value)
51
+ ];
52
+ })), apiRouteExternalRegex = buildRegexExcludingDeps(optimizeDeps.include), apiEntryPoints = manifest.apiRoutes.reduce(function(entries, param) {
53
+ var { page, file } = param;
54
+ return entries[page.slice(1) + ".js"] = join("app", file), entries;
55
+ }, {}), _userOptions_build_api_outputFormat, apiOutputFormat = (_userOptions_build_api_outputFormat = userOptions == null || (_userOptions_build1 = userOptions.build) === null || _userOptions_build1 === void 0 || (_userOptions_build_api = _userOptions_build1.api) === null || _userOptions_build_api === void 0 ? void 0 : _userOptions_build_api.outputFormat) !== null && _userOptions_build_api_outputFormat !== void 0 ? _userOptions_build_api_outputFormat : serverOutputFormat, treeshake = userOptions == null || (_userOptions_build2 = userOptions.build) === null || _userOptions_build2 === void 0 || (_userOptions_build_api1 = _userOptions_build2.api) === null || _userOptions_build_api1 === void 0 ? void 0 : _userOptions_build_api1.treeshake;
72
56
  await viteBuild(mergeConfig(apiBuildConfig, {
73
57
  appType: "custom",
74
58
  configFile: !1,
75
- plugins: [nodeExternals({
76
- exclude: optimizeDeps.include
77
- })],
59
+ plugins: [
60
+ nodeExternals({
61
+ exclude: optimizeDeps.include
62
+ })
63
+ ],
78
64
  define: {
79
65
  ...processEnvDefines
80
66
  },
81
67
  ssr: {
82
68
  noExternal: !0,
83
69
  // we patched them to switch to react 19
84
- external: ["react", "react-dom"],
70
+ external: [
71
+ "react",
72
+ "react-dom"
73
+ ],
85
74
  optimizeDeps
86
75
  },
87
76
  build: {
@@ -95,8 +84,9 @@ async function build(args) {
95
84
  moduleSideEffects: !1
96
85
  },
97
86
  plugins: [
98
- // otherwise rollup is leaving commonjs-only top level imports...
99
- apiOutputFormat === "esm" ? rollupRemoveUnusedImportsPlugin : null].filter(Boolean),
87
+ // otherwise rollup is leaving commonjs-only top level imports...
88
+ apiOutputFormat === "esm" ? rollupRemoveUnusedImportsPlugin : null
89
+ ].filter(Boolean),
100
90
  // too many issues
101
91
  // treeshake: {
102
92
  // moduleSideEffects: false,
@@ -108,153 +98,148 @@ async function build(args) {
108
98
  output: {
109
99
  entryFileNames: "[name]",
110
100
  exports: "auto",
111
- ...(apiOutputFormat === "esm" ? {
101
+ ...apiOutputFormat === "esm" ? {
112
102
  format: "esm",
113
103
  esModule: !0
114
104
  } : {
115
105
  format: "cjs",
116
106
  // Preserve folder structure and use .cjs extension
117
- entryFileNames: function (chunkInfo) {
107
+ entryFileNames: function(chunkInfo) {
118
108
  var name = chunkInfo.name.replace(/\.js$/, ".cjs");
119
109
  return name;
120
110
  },
121
- chunkFileNames: function (chunkInfo) {
122
- var dir = Path.dirname(chunkInfo.name),
123
- name = Path.basename(chunkInfo.name, Path.extname(chunkInfo.name));
111
+ chunkFileNames: function(chunkInfo) {
112
+ var dir = Path.dirname(chunkInfo.name), name = Path.basename(chunkInfo.name, Path.extname(chunkInfo.name));
124
113
  return Path.join(dir, `${name}-[hash].cjs`);
125
114
  },
126
- assetFileNames: function (assetInfo) {
127
- var _assetInfo_name,
128
- name = (_assetInfo_name = assetInfo.name) !== null && _assetInfo_name !== void 0 ? _assetInfo_name : "",
129
- dir = Path.dirname(name),
130
- baseName = Path.basename(name, Path.extname(name)),
131
- ext = Path.extname(name);
115
+ assetFileNames: function(assetInfo) {
116
+ var _assetInfo_name, name = (_assetInfo_name = assetInfo.name) !== null && _assetInfo_name !== void 0 ? _assetInfo_name : "", dir = Path.dirname(name), baseName = Path.basename(name, Path.extname(name)), ext = Path.extname(name);
132
117
  return Path.join(dir, `${baseName}-[hash]${ext}`);
133
118
  }
134
- })
119
+ }
135
120
  }
136
121
  }
137
122
  }
138
123
  }));
139
124
  }
140
125
  globalThis.require = createRequire(join(import.meta.url, ".."));
141
- var assets = [],
142
- builtRoutes = [];
126
+ var assets = [], builtRoutes = [];
143
127
  console.info(`
144
128
  \u{1F528} build static routes
145
129
  `);
146
- var render = null,
147
- entryServer = vxrnOutput.serverEntry;
130
+ var render = null, entryServer = vxrnOutput.serverEntry;
148
131
  try {
149
- var _serverImport_default_default,
150
- serverImport = await import(entryServer);
132
+ var _serverImport_default_default, serverImport = await import(entryServer);
151
133
  render = serverImport.default.render || ((_serverImport_default_default = serverImport.default.default) === null || _serverImport_default_default === void 0 ? void 0 : _serverImport_default_default.render), typeof render != "function" && (console.error("\u274C Error: didn't find render function in entry", serverImport), process.exit(1));
152
134
  } catch (err) {
153
135
  console.error("\u274C Error importing the root entry:"), console.error(` This error happened in the built file: ${entryServer}`), console.error(err.stack), process.exit(1);
154
136
  }
155
- var staticDir = join("dist/static"),
156
- clientDir = join("dist/client");
137
+ var staticDir = join("dist/static"), clientDir = join("dist/client");
157
138
  await ensureDir(staticDir);
158
- var outputEntries = [...vxrnOutput.serverOutput.entries()],
159
- _iteratorNormalCompletion = !0,
160
- _didIteratorError = !1,
161
- _iteratorError = void 0;
139
+ var outputEntries = [
140
+ ...vxrnOutput.serverOutput.entries()
141
+ ], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
162
142
  try {
163
- for (var _loop = async function () {
164
- var [index, output] = _step.value,
165
- _vxrnOutput_buildArgs,
166
- _foundRoute_layouts,
167
- _exported_generateStaticParams;
168
- if (output.type === "asset") return assets.push(output), "continue";
169
- var id = output.facadeModuleId || "",
170
- file = Path.basename(id);
171
- if (!id || file[0] === "_" || file.includes("entry-server") || id.includes("+api") || !id.includes("/app/")) return "continue";
172
- var relativeId = relative(process.cwd(), id).replace("app/", "/"),
173
- onlyBuild = (_vxrnOutput_buildArgs = vxrnOutput.buildArgs) === null || _vxrnOutput_buildArgs === void 0 ? void 0 : _vxrnOutput_buildArgs.only;
174
- if (onlyBuild && !MicroMatch.contains(relativeId, onlyBuild)) return "continue";
175
- var clientManifestKey = Object.keys(vxrnOutput.clientManifest).find(function (key) {
176
- return id.endsWith(key);
177
- }) || "";
178
- if (!clientManifestKey) return "continue";
179
- var clientManifestEntry = vxrnOutput.clientManifest[clientManifestKey],
180
- findMatchingRoute = function (route) {
181
- return route.file && clientManifestKey.endsWith(route.file.slice(1));
182
- },
183
- foundRoute = manifest.pageRoutes.find(findMatchingRoute);
184
- if (!foundRoute) return clientManifestKey.startsWith("app") && (console.error(" No html route found!", {
143
+ for (var _loop = async function() {
144
+ var [index, output] = _step.value, _vxrnOutput_buildArgs, _foundRoute_layouts, _exported_generateStaticParams;
145
+ if (output.type === "asset")
146
+ return assets.push(output), "continue";
147
+ var id = output.facadeModuleId || "", file = Path.basename(id);
148
+ if (!id || file[0] === "_" || file.includes("entry-server") || id.includes("+api") || !id.includes("/app/"))
149
+ return "continue";
150
+ var relativeId = relative(process.cwd(), id).replace("app/", "/"), onlyBuild = (_vxrnOutput_buildArgs = vxrnOutput.buildArgs) === null || _vxrnOutput_buildArgs === void 0 ? void 0 : _vxrnOutput_buildArgs.only;
151
+ if (onlyBuild && !MicroMatch.contains(relativeId, onlyBuild))
152
+ return "continue";
153
+ var clientManifestKey = Object.keys(vxrnOutput.clientManifest).find(function(key) {
154
+ return id.endsWith(key);
155
+ }) || "";
156
+ if (!clientManifestKey)
157
+ return "continue";
158
+ var clientManifestEntry = vxrnOutput.clientManifest[clientManifestKey], findMatchingRoute = function(route) {
159
+ return route.file && clientManifestKey.endsWith(route.file.slice(1));
160
+ }, foundRoute = manifest.pageRoutes.find(findMatchingRoute);
161
+ if (!foundRoute)
162
+ return clientManifestKey.startsWith("app") && (console.error(" No html route found!", {
185
163
  id,
186
164
  clientManifestKey
187
165
  }), console.error(" In manifest", manifest), process.exit(1)), "continue";
188
- function collectImports(param) {
189
- var {
190
- imports = [],
191
- css
192
- } = param,
193
- {
194
- type = "js"
195
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
196
- return [...new Set([...(type === "js" ? imports : css || []), ...imports.flatMap(function (name) {
197
- var found = vxrnOutput.clientManifest[name];
198
- return found || console.warn("No found imports", name, vxrnOutput.clientManifest), collectImports(found, {
199
- type
200
- });
201
- })].flat().filter(function (x) {
166
+ function collectImports(param) {
167
+ var { imports = [], css } = param, { type = "js" } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
168
+ return [
169
+ ...new Set([
170
+ ...type === "js" ? imports : css || [],
171
+ ...imports.flatMap(function(name) {
172
+ var found = vxrnOutput.clientManifest[name];
173
+ return found || console.warn("No found imports", name, vxrnOutput.clientManifest), collectImports(found, {
174
+ type
175
+ });
176
+ })
177
+ ].flat().filter(function(x) {
202
178
  return x && (type === "css" || x.endsWith(".js"));
203
- }).map(function (x) {
179
+ }).map(function(x) {
204
180
  return type === "css" || x.startsWith("assets/") ? x : `assets/${x.slice(1)}`;
205
- }))];
206
- }
207
- clientManifestEntry || console.warn(`No client manifest entry found: ${clientManifestKey} in manifest ${JSON.stringify(vxrnOutput.clientManifest, null, 2)}`);
208
- var entryImports = collectImports(clientManifestEntry || {}),
209
- _foundRoute_layouts_flatMap,
210
- layoutEntries = (_foundRoute_layouts_flatMap = (_foundRoute_layouts = foundRoute.layouts) === null || _foundRoute_layouts === void 0 ? void 0 : _foundRoute_layouts.flatMap(function (layout) {
211
- var clientKey = `app${layout.contextKey.slice(1)}`;
212
- return vxrnOutput.clientManifest[clientKey];
213
- })) !== null && _foundRoute_layouts_flatMap !== void 0 ? _foundRoute_layouts_flatMap : [],
214
- layoutImports = layoutEntries.flatMap(function (entry) {
215
- return [entry.file, ...collectImports(entry)];
216
- }),
217
- preloadSetupFilePreloads = function () {
218
- if (userOptions.setupFile) {
219
- var needle = userOptions.setupFile.replace(/^\.\//, "");
220
- for (var file2 in vxrnOutput.clientManifest) if (file2 === needle) {
221
- var entry = vxrnOutput.clientManifest[file2];
222
- return [entry.file];
223
- }
181
+ }))
182
+ ];
183
+ }
184
+ clientManifestEntry || console.warn(`No client manifest entry found: ${clientManifestKey} in manifest ${JSON.stringify(vxrnOutput.clientManifest, null, 2)}`);
185
+ var entryImports = collectImports(clientManifestEntry || {}), _foundRoute_layouts_flatMap, layoutEntries = (_foundRoute_layouts_flatMap = (_foundRoute_layouts = foundRoute.layouts) === null || _foundRoute_layouts === void 0 ? void 0 : _foundRoute_layouts.flatMap(function(layout) {
186
+ var clientKey = `app${layout.contextKey.slice(1)}`;
187
+ return vxrnOutput.clientManifest[clientKey];
188
+ })) !== null && _foundRoute_layouts_flatMap !== void 0 ? _foundRoute_layouts_flatMap : [], layoutImports = layoutEntries.flatMap(function(entry) {
189
+ return [
190
+ entry.file,
191
+ ...collectImports(entry)
192
+ ];
193
+ }), preloadSetupFilePreloads = function() {
194
+ if (userOptions.setupFile) {
195
+ var needle = userOptions.setupFile.replace(/^\.\//, "");
196
+ for (var file2 in vxrnOutput.clientManifest)
197
+ if (file2 === needle) {
198
+ var entry = vxrnOutput.clientManifest[file2];
199
+ return [
200
+ entry.file
201
+ ];
224
202
  }
225
- return [];
226
- }(),
227
- preloads = [... /* @__PURE__ */new Set([...preloadSetupFilePreloads,
203
+ }
204
+ return [];
205
+ }(), preloads = [
206
+ .../* @__PURE__ */ new Set([
207
+ ...preloadSetupFilePreloads,
228
208
  // add the route entry js (like ./app/index.ts)
229
209
  clientManifestEntry.file,
230
210
  // add the virtual entry
231
- vxrnOutput.clientManifest["virtual:one-entry"].file, ...entryImports, ...layoutImports])].map(function (path2) {
232
- return `/${path2}`;
233
- }),
234
- allEntries = [clientManifestEntry, ...layoutEntries],
235
- allCSS = allEntries.flatMap(function (entry) {
236
- return collectImports(entry, {
237
- type: "css"
238
- });
239
- }).map(function (path2) {
240
- return `/${path2}`;
241
- });
242
- process.env.DEBUG && console.info("[one] building routes", {
243
- foundRoute,
244
- layoutEntries,
245
- allEntries,
246
- allCSS
211
+ vxrnOutput.clientManifest["virtual:one-entry"].file,
212
+ ...entryImports,
213
+ ...layoutImports
214
+ ])
215
+ ].map(function(path2) {
216
+ return `/${path2}`;
217
+ }), allEntries = [
218
+ clientManifestEntry,
219
+ ...layoutEntries
220
+ ], allCSS = allEntries.flatMap(function(entry) {
221
+ return collectImports(entry, {
222
+ type: "css"
247
223
  });
248
- var serverJsPath = toAbsolute(join("dist/server", output.fileName)),
249
- exported = void 0;
250
- try {
251
- exported = await import(serverJsPath);
252
- } catch (err) {
253
- throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${serverJsPath}`, {
254
- cause: err
255
- });
256
- }
257
- if (foundRoute.type !== "ssr" && !foundRoute.page.includes("+not-found") && !foundRoute.page.includes("_sitemap") && !exported.generateStaticParams && relativeId.includes("[")) throw new Error(`[one] Error: Missing generateStaticParams
224
+ }).map(function(path2) {
225
+ return `/${path2}`;
226
+ });
227
+ process.env.DEBUG && console.info("[one] building routes", {
228
+ foundRoute,
229
+ layoutEntries,
230
+ allEntries,
231
+ allCSS
232
+ });
233
+ var serverJsPath = toAbsolute(join("dist/server", output.fileName)), exported = void 0;
234
+ try {
235
+ exported = await import(serverJsPath);
236
+ } catch (err) {
237
+ throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${serverJsPath}`, {
238
+ cause: err
239
+ });
240
+ }
241
+ if (foundRoute.type !== "ssr" && !foundRoute.page.includes("+not-found") && !foundRoute.page.includes("_sitemap") && !exported.generateStaticParams && relativeId.includes("["))
242
+ throw new Error(`[one] Error: Missing generateStaticParams
258
243
 
259
244
  Route ${foundRoute.page} of type ${foundRoute.type} must export generateStaticParams so build can complete.
260
245
 
@@ -262,90 +247,78 @@ async function build(args) {
262
247
  https://onestack.dev/docs/routing-exports#generatestaticparams
263
248
 
264
249
  `);
265
- var _ref,
266
- paramsList = (_ref = await ((_exported_generateStaticParams = exported.generateStaticParams) === null || _exported_generateStaticParams === void 0 ? void 0 : _exported_generateStaticParams.call(exported))) !== null && _ref !== void 0 ? _ref : [{}];
267
- console.info(`
250
+ var _ref, paramsList = (_ref = await ((_exported_generateStaticParams = exported.generateStaticParams) === null || _exported_generateStaticParams === void 0 ? void 0 : _exported_generateStaticParams.call(exported))) !== null && _ref !== void 0 ? _ref : [
251
+ {}
252
+ ];
253
+ console.info(`
268
254
  [build] page ${relativeId} (with ${paramsList.length} routes)
269
255
  `), process.env.DEBUG && console.info("paramsList", JSON.stringify(paramsList, null, 2));
270
- var _iteratorNormalCompletion2 = !0,
271
- _didIteratorError2 = !1,
272
- _iteratorError2 = void 0;
273
- try {
274
- for (var _iterator2 = paramsList[Symbol.iterator](), _step1; !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
275
- var params = _step1.value,
276
- cleanId = relativeId.replace(/\+(spa|ssg|ssr)\.tsx?$/, ""),
277
- path = getPathnameFromFilePath(cleanId, params, foundRoute.type === "ssg"),
278
- htmlPath = `${path.endsWith("/") ? `${removeTrailingSlash(path)}/index` : path}.html`,
279
- clientJsPath = join("dist/client", clientManifestEntry.file),
280
- htmlOutPath = toAbsolute(join(staticDir, htmlPath)),
281
- loaderData = {};
282
- try {
283
- console.info(` \u21A6 route ${path}`);
284
- var cleanPath = path === "/" ? path : removeTrailingSlash(path),
285
- preloadPath = getPreloadPath(path);
286
- if (await FSExtra.writeFile(join(clientDir, preloadPath), preloads.map(function (preload) {
287
- return `import "${preload}"`;
288
- }).join(`
256
+ var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
257
+ try {
258
+ for (var _iterator2 = paramsList[Symbol.iterator](), _step1; !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
259
+ var params = _step1.value, cleanId = relativeId.replace(/\+(spa|ssg|ssr)\.tsx?$/, ""), path = getPathnameFromFilePath(cleanId, params, foundRoute.type === "ssg"), htmlPath = `${path.endsWith("/") ? `${removeTrailingSlash(path)}/index` : path}.html`, clientJsPath = join("dist/client", clientManifestEntry.file), htmlOutPath = toAbsolute(join(staticDir, htmlPath)), loaderData = {};
260
+ try {
261
+ console.info(` \u21A6 route ${path}`);
262
+ var cleanPath = path === "/" ? path : removeTrailingSlash(path), preloadPath = getPreloadPath(path);
263
+ if (await FSExtra.writeFile(join(clientDir, preloadPath), preloads.map(function(preload) {
264
+ return `import "${preload}"`;
265
+ }).join(`
289
266
  `)), builtRoutes.push({
290
- type: foundRoute.type,
291
- cleanPath,
292
- preloadPath,
293
- clientJsPath,
294
- serverJsPath,
295
- htmlPath,
296
- loaderData,
297
- params,
267
+ type: foundRoute.type,
268
+ cleanPath,
269
+ preloadPath,
270
+ clientJsPath,
271
+ serverJsPath,
272
+ htmlPath,
273
+ loaderData,
274
+ params,
275
+ path,
276
+ preloads
277
+ }), foundRoute.type !== "ssr") {
278
+ var _globalThis___vxrnresetState, _globalThis, loaderProps = {
298
279
  path,
299
- preloads
300
- }), foundRoute.type !== "ssr") {
301
- var _globalThis___vxrnresetState,
302
- _globalThis,
303
- loaderProps = {
304
- path,
305
- params
306
- };
307
- if (globalThis.__vxrnLoaderProps__ = loaderProps, (_globalThis___vxrnresetState = (_globalThis = globalThis).__vxrnresetState) === null || _globalThis___vxrnresetState === void 0 || _globalThis___vxrnresetState.call(_globalThis), exported.loader) {
308
- var _exported_loader, _ref1;
309
- loaderData = (_ref1 = await ((_exported_loader = exported.loader) === null || _exported_loader === void 0 ? void 0 : _exported_loader.call(exported, {
310
- path,
311
- params
312
- }))) !== null && _ref1 !== void 0 ? _ref1 : null;
313
- var code = await readFile(clientJsPath, "utf-8"),
314
- withLoader = replaceLoader({
315
- code,
316
- loaderData
317
- }),
318
- loaderPartialPath = join(clientDir, getLoaderPath(path));
319
- await outputFile(loaderPartialPath, withLoader);
320
- }
321
- if (foundRoute.type === "ssg") {
322
- var html = await render({
323
- path,
324
- preloads,
325
- loaderProps,
326
- loaderData,
327
- css: allCSS
328
- });
329
- await outputFile(htmlOutPath, html);
330
- continue;
331
- }
332
- foundRoute.type === "spa" && (await outputFile(htmlOutPath, `<html><head>
280
+ params
281
+ };
282
+ if (globalThis.__vxrnLoaderProps__ = loaderProps, (_globalThis___vxrnresetState = (_globalThis = globalThis).__vxrnresetState) === null || _globalThis___vxrnresetState === void 0 || _globalThis___vxrnresetState.call(_globalThis), exported.loader) {
283
+ var _exported_loader, _ref1;
284
+ loaderData = (_ref1 = await ((_exported_loader = exported.loader) === null || _exported_loader === void 0 ? void 0 : _exported_loader.call(exported, {
285
+ path,
286
+ params
287
+ }))) !== null && _ref1 !== void 0 ? _ref1 : null;
288
+ var code = await readFile(clientJsPath, "utf-8"), withLoader = replaceLoader({
289
+ code,
290
+ loaderData
291
+ }), loaderPartialPath = join(clientDir, getLoaderPath(path));
292
+ await outputFile(loaderPartialPath, withLoader);
293
+ }
294
+ if (foundRoute.type === "ssg") {
295
+ var html = await render({
296
+ path,
297
+ preloads,
298
+ loaderProps,
299
+ loaderData,
300
+ css: allCSS
301
+ });
302
+ await outputFile(htmlOutPath, html);
303
+ continue;
304
+ }
305
+ foundRoute.type === "spa" && await outputFile(htmlOutPath, `<html><head>
333
306
  <script>globalThis['global'] = globalThis</script>
334
307
  <script>globalThis['__vxrnIsSPA'] = true</script>
335
- ${preloads.map(function (preload) {
336
- return ` <script type="module" src="${preload}"></script>`;
337
- }).join(`
308
+ ${preloads.map(function(preload) {
309
+ return ` <script type="module" src="${preload}"></script>`;
310
+ }).join(`
338
311
  `)}
339
- ${allCSS.map(function (file2) {
340
- return ` <link rel="stylesheet" href=${file2} />`;
341
- }).join(`
312
+ ${allCSS.map(function(file2) {
313
+ return ` <link rel="stylesheet" href=${file2} />`;
314
+ }).join(`
342
315
  `)}
343
- </head></html>`));
344
- }
345
- } catch (err) {
346
- var errMsg = err instanceof Error ? `${err.message}
316
+ </head></html>`);
317
+ }
318
+ } catch (err) {
319
+ var errMsg = err instanceof Error ? `${err.message}
347
320
  ${err.stack}` : `${err}`;
348
- console.error(`Error building static page at ${path} with id ${relativeId}:
321
+ console.error(`Error building static page at ${path} with id ${relativeId}:
349
322
 
350
323
  ${errMsg}
351
324
 
@@ -355,50 +328,45 @@ ${JSON.stringify(loaderData || null, null, 2)}
355
328
  params:
356
329
 
357
330
  ${JSON.stringify(params || null, null, 2)}`), console.error(err), process.exit(1);
358
- }
359
331
  }
360
- } catch (err) {
361
- _didIteratorError2 = !0, _iteratorError2 = err;
332
+ }
333
+ } catch (err) {
334
+ _didIteratorError2 = !0, _iteratorError2 = err;
335
+ } finally {
336
+ try {
337
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
362
338
  } finally {
363
- try {
364
- !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
365
- } finally {
366
- if (_didIteratorError2) throw _iteratorError2;
367
- }
339
+ if (_didIteratorError2)
340
+ throw _iteratorError2;
368
341
  }
369
- }, _iterator = outputEntries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) await _loop();
342
+ }
343
+ }, _iterator = outputEntries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) await _loop();
370
344
  } catch (err) {
371
345
  _didIteratorError = !0, _iteratorError = err;
372
346
  } finally {
373
347
  try {
374
348
  !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
375
349
  } finally {
376
- if (_didIteratorError) throw _iteratorError;
350
+ if (_didIteratorError)
351
+ throw _iteratorError;
377
352
  }
378
353
  }
379
354
  await moveAllFiles(staticDir, clientDir), await FSExtra.rm(staticDir, {
380
355
  force: !0,
381
356
  recursive: !0
382
357
  });
383
- var routeMap = builtRoutes.reduce(function (acc, param) {
384
- var {
385
- cleanPath,
386
- htmlPath
387
- } = param;
388
- return acc[cleanPath] = htmlPath, acc;
389
- }, {}),
390
- buildInfoForWriting = {
391
- routeMap,
392
- builtRoutes
393
- },
394
- buildInfo = {
395
- ...buildInfoForWriting,
396
- ...vxrnOutput
397
- };
358
+ var routeMap = builtRoutes.reduce(function(acc, param) {
359
+ var { cleanPath, htmlPath } = param;
360
+ return acc[cleanPath] = htmlPath, acc;
361
+ }, {}), buildInfoForWriting = {
362
+ routeMap,
363
+ builtRoutes
364
+ }, buildInfo = {
365
+ ...buildInfoForWriting,
366
+ ...vxrnOutput
367
+ };
398
368
  await FSExtra.writeJSON(toAbsolute("dist/buildInfo.json"), buildInfoForWriting);
399
- var postBuildLogs = [],
400
- _userOptions_web_deploy,
401
- platform = (_userOptions_web_deploy = (_userOptions_web = userOptions.web) === null || _userOptions_web === void 0 ? void 0 : _userOptions_web.deploy) !== null && _userOptions_web_deploy !== void 0 ? _userOptions_web_deploy : (_options_server = options.server) === null || _options_server === void 0 ? void 0 : _options_server.platform;
369
+ var postBuildLogs = [], _userOptions_web_deploy, platform = (_userOptions_web_deploy = (_userOptions_web = userOptions.web) === null || _userOptions_web === void 0 ? void 0 : _userOptions_web.deploy) !== null && _userOptions_web_deploy !== void 0 ? _userOptions_web_deploy : (_options_server = options.server) === null || _options_server === void 0 ? void 0 : _options_server.platform;
402
370
  if (platform === "vercel" && (await FSExtra.writeFile(join(options.root, "dist", "index.js"), `import { serve } from 'one/serve'
403
371
  const handler = await serve()
404
372
  export const { GET, POST, PUT, PATCH, OPTIONS } = handler`), postBuildLogs.push(`wrote vercel entry to: ${join(".", "dist", "index.js")}`), postBuildLogs.push("point vercel outputDirectory to dist")), userOptions?.afterBuild) {
@@ -407,7 +375,7 @@ export const { GET, POST, PUT, PATCH, OPTIONS } = handler`), postBuildLogs.push(
407
375
  }
408
376
  process.env.VXRN_ANALYZE_BUNDLE && postBuildLogs.push(`client build report: ${toAbsolute("dist/report.html")}`), postBuildLogs.length && (console.info(`
409
377
 
410
- `), postBuildLogs.forEach(function (log) {
378
+ `), postBuildLogs.forEach(function(log) {
411
379
  console.info(` \xB7 ${log}`);
412
380
  })), console.info(`
413
381
 
@@ -429,22 +397,19 @@ async function moveAllFiles(src, dest) {
429
397
  }
430
398
  }
431
399
  function getPathnameFromFilePath(path) {
432
- var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
433
- strict = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1,
434
- dirname = Path.dirname(path).replace(/\([^\/]+\)/gi, ""),
435
- file = Path.basename(path),
436
- fileName = file.replace(/\.[a-z]+$/, ""),
437
- nameWithParams = function () {
438
- if (fileName === "index") return "/";
439
- if (fileName.startsWith("[...")) {
440
- var part = fileName.replace("[...", "").replace("]", "");
441
- return params[part] || console.warn(`couldn't resolve ${fileName} segment in path ${path}`), `/${params[part]}`;
442
- }
443
- return `/${fileName.split("/").map(function (part2) {
444
- if (part2[0] === "[") {
445
- var found = params[part2.slice(1, part2.length - 1)];
446
- if (!found) {
447
- if (strict) throw new Error(`[one] Params doesn't fit route:
400
+ var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, strict = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, dirname = Path.dirname(path).replace(/\([^\/]+\)/gi, ""), file = Path.basename(path), fileName = file.replace(/\.[a-z]+$/, ""), nameWithParams = function() {
401
+ if (fileName === "index")
402
+ return "/";
403
+ if (fileName.startsWith("[...")) {
404
+ var part = fileName.replace("[...", "").replace("]", "");
405
+ return params[part] || console.warn(`couldn't resolve ${fileName} segment in path ${path}`), `/${params[part]}`;
406
+ }
407
+ return `/${fileName.split("/").map(function(part2) {
408
+ if (part2[0] === "[") {
409
+ var found = params[part2.slice(1, part2.length - 1)];
410
+ if (!found) {
411
+ if (strict)
412
+ throw new Error(`[one] Params doesn't fit route:
448
413
 
449
414
  - path: ${path}
450
415
  - part: ${part2}
@@ -452,25 +417,25 @@ function getPathnameFromFilePath(path) {
452
417
  - params:
453
418
 
454
419
  ${JSON.stringify(params, null, 2)}`);
455
- return ":" + part2.replace("[", "").replace("]", "");
456
- }
457
- return found;
420
+ return ":" + part2.replace("[", "").replace("]", "");
458
421
  }
459
- return part2;
460
- }).join("/")}`;
461
- }();
422
+ return found;
423
+ }
424
+ return part2;
425
+ }).join("/")}`;
426
+ }();
462
427
  return `${dirname}${nameWithParams}`.replace(/\/\/+/gi, "/");
463
428
  }
464
429
  function escapeRegex(string) {
465
430
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
466
431
  }
467
432
  function buildRegexExcludingDeps(deps) {
468
- var sanitizedDeps = deps.map(function (dep) {
469
- return escapeRegex(dep);
470
- }),
471
- exclusionPattern = sanitizedDeps.join("|"),
472
- regexPattern = `node_modules/(?!(${exclusionPattern})).*`;
433
+ var sanitizedDeps = deps.map(function(dep) {
434
+ return escapeRegex(dep);
435
+ }), exclusionPattern = sanitizedDeps.join("|"), regexPattern = `node_modules/(?!(${exclusionPattern})).*`;
473
436
  return new RegExp(regexPattern);
474
437
  }
475
- export { build };
476
- //# sourceMappingURL=build.native.js.map
438
+ export {
439
+ build
440
+ };
441
+ //# sourceMappingURL=build.js.map