one 1.1.479 → 1.1.481

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.
Files changed (224) hide show
  1. package/dist/cjs/Root.cjs +1 -1
  2. package/dist/cjs/Root.js +1 -1
  3. package/dist/cjs/Root.js.map +1 -1
  4. package/dist/cjs/Root.native.js +1 -1
  5. package/dist/cjs/Root.native.js.map +2 -2
  6. package/dist/cjs/cli/build.cjs +28 -8
  7. package/dist/cjs/cli/build.js +29 -10
  8. package/dist/cjs/cli/build.js.map +1 -1
  9. package/dist/cjs/cli/build.native.js +60 -24
  10. package/dist/cjs/cli/build.native.js.map +2 -2
  11. package/dist/cjs/createApp.cjs +3 -1
  12. package/dist/cjs/createApp.js +3 -1
  13. package/dist/cjs/createApp.js.map +1 -1
  14. package/dist/cjs/createApp.native.js +1 -0
  15. package/dist/cjs/createApp.native.js.map +2 -2
  16. package/dist/cjs/createHandleRequest.cjs +6 -2
  17. package/dist/cjs/createHandleRequest.js +2 -2
  18. package/dist/cjs/createHandleRequest.js.map +1 -1
  19. package/dist/cjs/createHandleRequest.native.js +4 -2
  20. package/dist/cjs/createHandleRequest.native.js.map +2 -2
  21. package/dist/cjs/router/useViteRoutes.cjs +6 -6
  22. package/dist/cjs/router/useViteRoutes.js +6 -6
  23. package/dist/cjs/router/useViteRoutes.js.map +1 -1
  24. package/dist/cjs/router/useViteRoutes.native.js +6 -6
  25. package/dist/cjs/router/useViteRoutes.native.js.map +2 -2
  26. package/dist/cjs/server/getServerManifest.cjs +20 -8
  27. package/dist/cjs/server/getServerManifest.js +15 -14
  28. package/dist/cjs/server/getServerManifest.js.map +1 -1
  29. package/dist/cjs/server/getServerManifest.native.js +19 -4
  30. package/dist/cjs/server/getServerManifest.native.js.map +2 -2
  31. package/dist/cjs/server/oneServe.cjs +14 -2
  32. package/dist/cjs/server/oneServe.js +15 -2
  33. package/dist/cjs/server/oneServe.js.map +1 -1
  34. package/dist/cjs/server/oneServe.native.js +24 -12
  35. package/dist/cjs/server/oneServe.native.js.map +2 -2
  36. package/dist/cjs/typed-routes/generateRouteTypes.cjs +3 -3
  37. package/dist/cjs/typed-routes/generateRouteTypes.js +2 -2
  38. package/dist/cjs/typed-routes/generateRouteTypes.js.map +1 -1
  39. package/dist/cjs/typed-routes/generateRouteTypes.native.js +3 -3
  40. package/dist/cjs/typed-routes/generateRouteTypes.native.js.map +2 -2
  41. package/dist/cjs/utils/getRouterRootFromOneOptions.cjs +28 -0
  42. package/dist/cjs/utils/getRouterRootFromOneOptions.js +23 -0
  43. package/dist/cjs/utils/getRouterRootFromOneOptions.js.map +6 -0
  44. package/dist/cjs/utils/getRouterRootFromOneOptions.native.js +29 -0
  45. package/dist/cjs/utils/getRouterRootFromOneOptions.native.js.map +6 -0
  46. package/dist/cjs/vercel/build/buildVercelOutputDirectory.cjs +1 -1
  47. package/dist/cjs/vercel/build/buildVercelOutputDirectory.js +5 -0
  48. package/dist/cjs/vercel/build/buildVercelOutputDirectory.js.map +1 -1
  49. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js +1 -1
  50. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +2 -2
  51. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.cjs +11 -3
  52. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.js +11 -3
  53. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.js.map +1 -1
  54. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.native.js +11 -3
  55. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -1
  56. package/dist/cjs/vite/getManifest.cjs +4 -2
  57. package/dist/cjs/vite/getManifest.js +2 -2
  58. package/dist/cjs/vite/getManifest.js.map +1 -1
  59. package/dist/cjs/vite/getManifest.native.js +2 -2
  60. package/dist/cjs/vite/getManifest.native.js.map +2 -2
  61. package/dist/cjs/vite/one.cjs +5 -3
  62. package/dist/cjs/vite/one.js +3 -3
  63. package/dist/cjs/vite/one.js.map +1 -1
  64. package/dist/cjs/vite/one.native.js +3 -3
  65. package/dist/cjs/vite/one.native.js.map +2 -2
  66. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +10 -6
  67. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +8 -7
  68. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  69. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +9 -6
  70. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +2 -2
  71. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +6 -4
  72. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +4 -4
  73. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  74. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +4 -4
  75. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +2 -2
  76. package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +4 -2
  77. package/dist/cjs/vite/plugins/virtualEntryPlugin.js +4 -2
  78. package/dist/cjs/vite/plugins/virtualEntryPlugin.js.map +1 -1
  79. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +4 -2
  80. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  81. package/dist/cjs/vite/types.native.js.map +1 -1
  82. package/dist/esm/Root.js +1 -1
  83. package/dist/esm/Root.js.map +1 -1
  84. package/dist/esm/Root.mjs +1 -1
  85. package/dist/esm/Root.mjs.map +1 -1
  86. package/dist/esm/Root.native.js +1 -1
  87. package/dist/esm/Root.native.js.map +1 -1
  88. package/dist/esm/cli/build.js +29 -9
  89. package/dist/esm/cli/build.js.map +1 -1
  90. package/dist/esm/cli/build.mjs +28 -8
  91. package/dist/esm/cli/build.mjs.map +1 -1
  92. package/dist/esm/cli/build.native.js +60 -24
  93. package/dist/esm/cli/build.native.js.map +1 -1
  94. package/dist/esm/createApp.js +3 -1
  95. package/dist/esm/createApp.js.map +1 -1
  96. package/dist/esm/createApp.mjs +3 -1
  97. package/dist/esm/createApp.mjs.map +1 -1
  98. package/dist/esm/createApp.native.js +1 -0
  99. package/dist/esm/createApp.native.js.map +1 -1
  100. package/dist/esm/createHandleRequest.js +2 -2
  101. package/dist/esm/createHandleRequest.js.map +1 -1
  102. package/dist/esm/createHandleRequest.mjs +6 -2
  103. package/dist/esm/createHandleRequest.mjs.map +1 -1
  104. package/dist/esm/createHandleRequest.native.js +7 -2
  105. package/dist/esm/createHandleRequest.native.js.map +1 -1
  106. package/dist/esm/router/useViteRoutes.js +6 -6
  107. package/dist/esm/router/useViteRoutes.js.map +1 -1
  108. package/dist/esm/router/useViteRoutes.mjs +6 -6
  109. package/dist/esm/router/useViteRoutes.mjs.map +1 -1
  110. package/dist/esm/router/useViteRoutes.native.js +6 -6
  111. package/dist/esm/router/useViteRoutes.native.js.map +1 -1
  112. package/dist/esm/server/getServerManifest.js +15 -14
  113. package/dist/esm/server/getServerManifest.js.map +1 -1
  114. package/dist/esm/server/getServerManifest.mjs +20 -8
  115. package/dist/esm/server/getServerManifest.mjs.map +1 -1
  116. package/dist/esm/server/getServerManifest.native.js +21 -4
  117. package/dist/esm/server/getServerManifest.native.js.map +1 -1
  118. package/dist/esm/server/oneServe.js +16 -3
  119. package/dist/esm/server/oneServe.js.map +1 -1
  120. package/dist/esm/server/oneServe.mjs +15 -3
  121. package/dist/esm/server/oneServe.mjs.map +1 -1
  122. package/dist/esm/server/oneServe.native.js +25 -13
  123. package/dist/esm/server/oneServe.native.js.map +1 -1
  124. package/dist/esm/typed-routes/generateRouteTypes.js +2 -2
  125. package/dist/esm/typed-routes/generateRouteTypes.js.map +1 -1
  126. package/dist/esm/typed-routes/generateRouteTypes.mjs +3 -3
  127. package/dist/esm/typed-routes/generateRouteTypes.mjs.map +1 -1
  128. package/dist/esm/typed-routes/generateRouteTypes.native.js +3 -3
  129. package/dist/esm/typed-routes/generateRouteTypes.native.js.map +1 -1
  130. package/dist/esm/utils/getRouterRootFromOneOptions.js +7 -0
  131. package/dist/esm/utils/getRouterRootFromOneOptions.js.map +6 -0
  132. package/dist/esm/utils/getRouterRootFromOneOptions.mjs +5 -0
  133. package/dist/esm/utils/getRouterRootFromOneOptions.mjs.map +1 -0
  134. package/dist/esm/utils/getRouterRootFromOneOptions.native.js +6 -0
  135. package/dist/esm/utils/getRouterRootFromOneOptions.native.js.map +1 -0
  136. package/dist/esm/vercel/build/buildVercelOutputDirectory.js +5 -0
  137. package/dist/esm/vercel/build/buildVercelOutputDirectory.js.map +1 -1
  138. package/dist/esm/vercel/build/buildVercelOutputDirectory.mjs +1 -1
  139. package/dist/esm/vercel/build/buildVercelOutputDirectory.mjs.map +1 -1
  140. package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js +1 -1
  141. package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
  142. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.js +11 -3
  143. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.js.map +1 -1
  144. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.mjs +11 -3
  145. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.mjs.map +1 -1
  146. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.native.js +11 -3
  147. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -1
  148. package/dist/esm/vite/getManifest.js +2 -2
  149. package/dist/esm/vite/getManifest.js.map +1 -1
  150. package/dist/esm/vite/getManifest.mjs +4 -2
  151. package/dist/esm/vite/getManifest.mjs.map +1 -1
  152. package/dist/esm/vite/getManifest.native.js +5 -2
  153. package/dist/esm/vite/getManifest.native.js.map +1 -1
  154. package/dist/esm/vite/one.js +3 -2
  155. package/dist/esm/vite/one.js.map +1 -1
  156. package/dist/esm/vite/one.mjs +5 -3
  157. package/dist/esm/vite/one.mjs.map +1 -1
  158. package/dist/esm/vite/one.native.js +5 -3
  159. package/dist/esm/vite/one.native.js.map +1 -1
  160. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +8 -6
  161. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  162. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +9 -5
  163. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
  164. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +9 -5
  165. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  166. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +4 -3
  167. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  168. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +5 -3
  169. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
  170. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +5 -3
  171. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  172. package/dist/esm/vite/plugins/virtualEntryPlugin.js +4 -2
  173. package/dist/esm/vite/plugins/virtualEntryPlugin.js.map +1 -1
  174. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +4 -2
  175. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
  176. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +4 -2
  177. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  178. package/package.json +10 -10
  179. package/src/Root.tsx +2 -1
  180. package/src/cli/build.ts +35 -10
  181. package/src/createApp.native.tsx +8 -6
  182. package/src/createApp.tsx +5 -1
  183. package/src/createHandleRequest.ts +2 -2
  184. package/src/router/useViteRoutes.tsx +6 -4
  185. package/src/server/getServerManifest.ts +12 -4
  186. package/src/server/oneServe.ts +30 -1
  187. package/src/typed-routes/generateRouteTypes.ts +3 -3
  188. package/src/utils/getRouterRootFromOneOptions.ts +5 -0
  189. package/src/vercel/build/buildVercelOutputDirectory.ts +9 -0
  190. package/src/vercel/build/generate/createSsrServerlessFunction.ts +11 -3
  191. package/src/vite/getManifest.ts +2 -2
  192. package/src/vite/one.ts +4 -1
  193. package/src/vite/plugins/fileSystemRouterPlugin.tsx +8 -6
  194. package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +6 -3
  195. package/src/vite/plugins/virtualEntryPlugin.ts +4 -2
  196. package/src/vite/types.ts +7 -0
  197. package/types/Root.d.ts +1 -0
  198. package/types/Root.d.ts.map +1 -1
  199. package/types/cli/build.d.ts.map +1 -1
  200. package/types/createApp.d.ts +1 -0
  201. package/types/createApp.d.ts.map +1 -1
  202. package/types/createApp.native.d.ts +1 -5
  203. package/types/createApp.native.d.ts.map +1 -1
  204. package/types/createHandleRequest.d.ts +3 -1
  205. package/types/createHandleRequest.d.ts.map +1 -1
  206. package/types/router/useViteRoutes.d.ts +3 -3
  207. package/types/router/useViteRoutes.d.ts.map +1 -1
  208. package/types/server/getServerManifest.d.ts.map +1 -1
  209. package/types/server/oneServe.d.ts.map +1 -1
  210. package/types/typed-routes/generateRouteTypes.d.ts +1 -1
  211. package/types/typed-routes/generateRouteTypes.d.ts.map +1 -1
  212. package/types/utils/getRouterRootFromOneOptions.d.ts +3 -0
  213. package/types/utils/getRouterRootFromOneOptions.d.ts.map +1 -0
  214. package/types/vercel/build/buildVercelOutputDirectory.d.ts.map +1 -1
  215. package/types/vercel/build/generate/createSsrServerlessFunction.d.ts.map +1 -1
  216. package/types/vite/getManifest.d.ts +3 -1
  217. package/types/vite/getManifest.d.ts.map +1 -1
  218. package/types/vite/one.d.ts.map +1 -1
  219. package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
  220. package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
  221. package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
  222. package/types/vite/types.d.ts +7 -0
  223. package/types/vite/types.d.ts.map +1 -1
  224. package/vendor/react-dom/package.json +1 -1
@@ -1,17 +1,18 @@
1
1
  import { join } from "node:path";
2
2
  import { debounce } from "perfect-debounce";
3
3
  import { generateRouteTypes } from "../../typed-routes/generateRouteTypes";
4
+ import { getRouterRootFromOneOptions } from "../../utils/getRouterRootFromOneOptions";
4
5
  function generateFileSystemRouteTypesPlugin(options) {
5
6
  return {
6
7
  name: "one-generate-fs-route-types",
7
8
  enforce: "post",
8
9
  apply: "serve",
9
10
  configureServer(server) {
10
- const appDir = join(process.cwd(), "app"), outFile = join(process.cwd(), "routes.d.ts"), fileWatcherChangeListener = debounce(async (type, path) => {
11
- (type === "add" || type === "delete") && path.startsWith(appDir) && generateRouteTypes(outFile);
11
+ const appDir = join(process.cwd(), getRouterRootFromOneOptions(options)), outFile = join(process.cwd(), "routes.d.ts"), routerRoot = getRouterRootFromOneOptions(options), fileWatcherChangeListener = debounce(async (type, path) => {
12
+ (type === "add" || type === "delete") && path.startsWith(appDir) && generateRouteTypes(outFile, routerRoot);
12
13
  }, 100);
13
14
  return server.watcher.addListener("all", fileWatcherChangeListener), () => {
14
- generateRouteTypes(outFile);
15
+ generateRouteTypes(outFile, routerRoot);
15
16
  };
16
17
  }
17
18
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],
4
- "mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAGzB,SAAS,0BAA0B;AAE5B,SAAS,mCAAmC,SAAoC;AACrF,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IAEP,gBAAgB,QAAQ;AACtB,YAAM,SAAS,KAAK,QAAQ,IAAI,GAAG,KAAK,GAClC,UAAU,KAAK,QAAQ,IAAI,GAAG,aAAa,GAG3C,4BAA4B,SAAS,OAAO,MAAc,SAAiB;AAC/E,SAAI,SAAS,SAAS,SAAS,aACzB,KAAK,WAAW,MAAM,KAExB,mBAAmB,OAAO;AAAA,MAGhC,GAAG,GAAG;AAEN,oBAAO,QAAQ,YAAY,OAAO,yBAAyB,GAEpD,MAAM;AAGX,2BAAmB,OAAO;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAGzB,SAAS,0BAA0B;AACnC,SAAS,mCAAmC;AAErC,SAAS,mCAAmC,SAAoC;AACrF,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,IAEP,gBAAgB,QAAQ;AACtB,YAAM,SAAS,KAAK,QAAQ,IAAI,GAAG,4BAA4B,OAAO,CAAC,GACjE,UAAU,KAAK,QAAQ,IAAI,GAAG,aAAa,GAE3C,aAAa,4BAA4B,OAAO,GAGhD,4BAA4B,SAAS,OAAO,MAAc,SAAiB;AAC/E,SAAI,SAAS,SAAS,SAAS,aACzB,KAAK,WAAW,MAAM,KAExB,mBAAmB,SAAS,UAAU;AAAA,MAG5C,GAAG,GAAG;AAEN,oBAAO,QAAQ,YAAY,OAAO,yBAAyB,GAEpD,MAAM;AAGX,2BAAmB,SAAS,UAAU;AAAA,MACxC;AAAA,IACF;AAAA,EACF;AACF;",
5
5
  "names": []
6
6
  }
@@ -1,19 +1,21 @@
1
1
  import { join } from "node:path";
2
2
  import { debounce } from "perfect-debounce";
3
3
  import { generateRouteTypes } from "../../typed-routes/generateRouteTypes.mjs";
4
+ import { getRouterRootFromOneOptions } from "../../utils/getRouterRootFromOneOptions.mjs";
4
5
  function generateFileSystemRouteTypesPlugin(options) {
5
6
  return {
6
7
  name: "one-generate-fs-route-types",
7
8
  enforce: "post",
8
9
  apply: "serve",
9
10
  configureServer(server) {
10
- const appDir = join(process.cwd(), "app"),
11
+ const appDir = join(process.cwd(), getRouterRootFromOneOptions(options)),
11
12
  outFile = join(process.cwd(), "routes.d.ts"),
13
+ routerRoot = getRouterRootFromOneOptions(options),
12
14
  fileWatcherChangeListener = debounce(async (type, path) => {
13
- (type === "add" || type === "delete") && path.startsWith(appDir) && generateRouteTypes(outFile);
15
+ (type === "add" || type === "delete") && path.startsWith(appDir) && generateRouteTypes(outFile, routerRoot);
14
16
  }, 100);
15
17
  return server.watcher.addListener("all", fileWatcherChangeListener), () => {
16
- generateRouteTypes(outFile);
18
+ generateRouteTypes(outFile, routerRoot);
17
19
  };
18
20
  }
19
21
  };
@@ -1 +1 @@
1
- {"version":3,"names":["join","debounce","generateRouteTypes","generateFileSystemRouteTypesPlugin","options","name","enforce","apply","configureServer","server","appDir","process","cwd","outFile","fileWatcherChangeListener","type","path","startsWith","watcher","addListener"],"sources":["../../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,QAAY;AACrB,SAASC,QAAA,QAAgB;AAGzB,SAASC,kBAAA,QAA0B;AAE5B,SAASC,mCAAmCC,OAAA,EAAoC;EACrF,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,KAAA,EAAO;IAEPC,gBAAgBC,MAAA,EAAQ;MACtB,MAAMC,MAAA,GAASV,IAAA,CAAKW,OAAA,CAAQC,GAAA,CAAI,GAAG,KAAK;QAClCC,OAAA,GAAUb,IAAA,CAAKW,OAAA,CAAQC,GAAA,CAAI,GAAG,aAAa;QAG3CE,yBAAA,GAA4Bb,QAAA,CAAS,OAAOc,IAAA,EAAcC,IAAA,KAAiB;UAC/E,CAAID,IAAA,KAAS,SAASA,IAAA,KAAS,aACzBC,IAAA,CAAKC,UAAA,CAAWP,MAAM,KAExBR,kBAAA,CAAmBW,OAAO;QAGhC,GAAG,GAAG;MAEN,OAAAJ,MAAA,CAAOS,OAAA,CAAQC,WAAA,CAAY,OAAOL,yBAAyB,GAEpD,MAAM;QAGXZ,kBAAA,CAAmBW,OAAO;MAC5B;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["join","debounce","generateRouteTypes","getRouterRootFromOneOptions","generateFileSystemRouteTypesPlugin","options","name","enforce","apply","configureServer","server","appDir","process","cwd","outFile","routerRoot","fileWatcherChangeListener","type","path","startsWith","watcher","addListener"],"sources":["../../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,QAAY;AACrB,SAASC,QAAA,QAAgB;AAGzB,SAASC,kBAAA,QAA0B;AACnC,SAASC,2BAAA,QAAmC;AAErC,SAASC,mCAAmCC,OAAA,EAAoC;EACrF,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,KAAA,EAAO;IAEPC,gBAAgBC,MAAA,EAAQ;MACtB,MAAMC,MAAA,GAASX,IAAA,CAAKY,OAAA,CAAQC,GAAA,CAAI,GAAGV,2BAAA,CAA4BE,OAAO,CAAC;QACjES,OAAA,GAAUd,IAAA,CAAKY,OAAA,CAAQC,GAAA,CAAI,GAAG,aAAa;QAE3CE,UAAA,GAAaZ,2BAAA,CAA4BE,OAAO;QAGhDW,yBAAA,GAA4Bf,QAAA,CAAS,OAAOgB,IAAA,EAAcC,IAAA,KAAiB;UAC/E,CAAID,IAAA,KAAS,SAASA,IAAA,KAAS,aACzBC,IAAA,CAAKC,UAAA,CAAWR,MAAM,KAExBT,kBAAA,CAAmBY,OAAA,EAASC,UAAU;QAG5C,GAAG,GAAG;MAEN,OAAAL,MAAA,CAAOU,OAAA,CAAQC,WAAA,CAAY,OAAOL,yBAAyB,GAEpD,MAAM;QAGXd,kBAAA,CAAmBY,OAAA,EAASC,UAAU;MACxC;IACF;EACF;AACF","ignoreList":[]}
@@ -1,19 +1,21 @@
1
1
  import { join } from "node:path";
2
2
  import { debounce } from "perfect-debounce";
3
3
  import { generateRouteTypes } from "../../typed-routes/generateRouteTypes.native.js";
4
+ import { getRouterRootFromOneOptions } from "../../utils/getRouterRootFromOneOptions.native.js";
4
5
  function generateFileSystemRouteTypesPlugin(options) {
5
6
  return {
6
7
  name: "one-generate-fs-route-types",
7
8
  enforce: "post",
8
9
  apply: "serve",
9
10
  configureServer(server) {
10
- var appDir = join(process.cwd(), "app"),
11
+ var appDir = join(process.cwd(), getRouterRootFromOneOptions(options)),
11
12
  outFile = join(process.cwd(), "routes.d.ts"),
13
+ routerRoot = getRouterRootFromOneOptions(options),
12
14
  fileWatcherChangeListener = debounce(async function (type, path) {
13
- (type === "add" || type === "delete") && path.startsWith(appDir) && generateRouteTypes(outFile);
15
+ (type === "add" || type === "delete") && path.startsWith(appDir) && generateRouteTypes(outFile, routerRoot);
14
16
  }, 100);
15
17
  return server.watcher.addListener("all", fileWatcherChangeListener), function () {
16
- generateRouteTypes(outFile);
18
+ generateRouteTypes(outFile, routerRoot);
17
19
  };
18
20
  }
19
21
  };
@@ -1 +1 @@
1
- {"version":3,"names":["join","debounce","generateRouteTypes","generateFileSystemRouteTypesPlugin","options","name","enforce","apply","configureServer","server","appDir","process","cwd","outFile","fileWatcherChangeListener","type","path","startsWith","watcher","addListener"],"sources":["../../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,QAAY;AACrB,SAASC,QAAA,QAAgB;AAGzB,SAASC,kBAAA,QAA0B;AAE5B,SAASC,mCAAmCC,OAAA,EAAoC;EACrF,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,KAAA,EAAO;IAEPC,gBAAgBC,MAAA,EAAQ;MACtB,IAAAC,MAAM,GAAAV,IAAS,CAAAW,OAAK,CAAAC,GAAQ,IAAI,KAAG;QAAKC,OAClC,GAAAb,IAAU,CAAAW,OAAK,CAAAC,GAAQ,IAAI,aAAG;QAAaE,yBAG3C,GAAAb,QAA4B,iBAA8Bc,IAAA,EAAAC,IAAiB;UAC/E,CAAID,IAAA,KAAS,SAASA,IAAA,KAAS,aACzBC,IAAA,CAAKC,UAAA,CAAWP,MAAM,KAExBR,kBAAA,CAAmBW,OAAO;QAGhC,GAAG,GAAG;MAEN,OAAAJ,MAAA,CAAOS,OAAA,CAAQC,WAAA,CAAY,OAAOL,yBAAyB,GAEpD,YAAM;QAGXZ,kBAAA,CAAmBW,OAAO;MAC5B;IACF;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["join","debounce","generateRouteTypes","getRouterRootFromOneOptions","generateFileSystemRouteTypesPlugin","options","name","enforce","apply","configureServer","server","appDir","process","cwd","outFile","routerRoot","fileWatcherChangeListener","type","path","startsWith","watcher","addListener"],"sources":["../../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAA,QAAY;AACrB,SAASC,QAAA,QAAgB;AAGzB,SAASC,kBAAA,QAA0B;AACnC,SAASC,2BAAA,QAAmC;AAErC,SAASC,mCAAmCC,OAAA,EAAoC;EACrF,OAAO;IACLC,IAAA,EAAM;IACNC,OAAA,EAAS;IACTC,KAAA,EAAO;IAEPC,gBAAgBC,MAAA,EAAQ;MACtB,IAAAC,MAAM,GAAAX,IAAS,CAAAY,OAAK,CAAAC,GAAQ,IAAIV,2BAAG,CAAAE,OAA4B,EAAO;QAACS,OACjE,GAAAd,IAAU,CAAAY,OAAK,CAAAC,GAAQ,IAAI,aAAG;QAAaE,UAE3C,GAAAZ,2BAAa,CAAAE,OAA4B;QAAOW,yBAGhD,GAAAf,QAA4B,iBAA8BgB,IAAA,EAAAC,IAAiB;UAC/E,CAAID,IAAA,KAAS,SAASA,IAAA,KAAS,aACzBC,IAAA,CAAKC,UAAA,CAAWR,MAAM,KAExBT,kBAAA,CAAmBY,OAAA,EAASC,UAAU;QAG5C,GAAG,GAAG;MAEN,OAAAL,MAAA,CAAOU,OAAA,CAAQC,WAAA,CAAY,OAAOL,yBAAyB,GAEpD,YAAM;QAGXd,kBAAA,CAAmBY,OAAA,EAASC,UAAU;MACxC;IACF;EACF;AACF","ignoreList":[]}
@@ -31,7 +31,8 @@ import { createApp } from 'one'
31
31
  // globbing ${appDirGlob}
32
32
  export default createApp({
33
33
  routes: import.meta.glob('${appDirGlob}', { exhaustive: true }),
34
- flags: ${JSON.stringify(options.flags)}
34
+ routerRoot: ${JSON.stringify(options.root)},
35
+ flags: ${JSON.stringify(options.flags)},
35
36
  })
36
37
  `;
37
38
  if (id === resolvedVirtualEntryIdNative)
@@ -43,7 +44,8 @@ import { createApp } from 'one'
43
44
  // globbing ${appDirGlob}
44
45
  export default createApp({
45
46
  routes: import.meta.glob(['${appDirGlob}', '!${appDirApiGlob}'], { exhaustive: true }),
46
- flags: ${JSON.stringify(options.flags)}
47
+ routerRoot: ${JSON.stringify(options.root)},
48
+ flags: ${JSON.stringify(options.flags)},
47
49
  })
48
50
  `;
49
51
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/vite/plugins/virtualEntryPlugin.ts"],
4
- "mappings": "AACA,SAAS,2BAA2B;AAEpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAMpB,SAAS,mBAAmB,SAAqD;AACtF,QAAM,aAAa,IAAI,QAAQ,IAAI,aAC7B,gBAAgB,IAAI,QAAQ,IAAI;AAEtC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,UAAU,IAAI;AACZ,UAAI,OAAO;AACT,eAAO;AAET,UAAI,OAAO;AACT,eAAO;AAAA,IAEX;AAAA,IAEA,KAAK,IAAI;AACP,UAAI,OAAO;AAIT,eAAO;AAAA,EAHa,oBAAoB,KAAK,WAAW,IACpD,KACA,kBAEC;AAAA;AAAA;AAAA;AAAA,cAIC,UAAU;AAAA;AAAA,8BAEM,UAAU;AAAA,WAC7B,KAAK,UAAU,QAAQ,KAAK,CAAC;AAAA;AAAA;AAKlC,UAAI,OAAO;AAIT,eAAO;AAAA,EAHa,oBAAoB,KAAK,WAAW,IACpD,KACA,kBAEC;AAAA;AAAA;AAAA;AAAA,cAIC,UAAU;AAAA;AAAA,+BAEO,UAAU,QAAQ,aAAa;AAAA,WACnD,KAAK,UAAU,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,IAIpC;AAAA,EACF;AACF;",
4
+ "mappings": "AACA,SAAS,2BAA2B;AAEpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAMpB,SAAS,mBAAmB,SAAqD;AACtF,QAAM,aAAa,IAAI,QAAQ,IAAI,aAC7B,gBAAgB,IAAI,QAAQ,IAAI;AAEtC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,UAAU,IAAI;AACZ,UAAI,OAAO;AACT,eAAO;AAET,UAAI,OAAO;AACT,eAAO;AAAA,IAEX;AAAA,IAEA,KAAK,IAAI;AACP,UAAI,OAAO;AAIT,eAAO;AAAA,EAHa,oBAAoB,KAAK,WAAW,IACpD,KACA,kBAEC;AAAA;AAAA;AAAA;AAAA,cAIC,UAAU;AAAA;AAAA,8BAEM,UAAU;AAAA,gBACxB,KAAK,UAAU,QAAQ,IAAI,CAAC;AAAA,WACjC,KAAK,UAAU,QAAQ,KAAK,CAAC;AAAA;AAAA;AAKlC,UAAI,OAAO;AAIT,eAAO;AAAA,EAHa,oBAAoB,KAAK,WAAW,IACpD,KACA,kBAEC;AAAA;AAAA;AAAA;AAAA,cAIC,UAAU;AAAA;AAAA,+BAEO,UAAU,QAAQ,aAAa;AAAA,gBAC9C,KAAK,UAAU,QAAQ,IAAI,CAAC;AAAA,WACjC,KAAK,UAAU,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,IAIpC;AAAA,EACF;AACF;",
5
5
  "names": []
6
6
  }
@@ -24,7 +24,8 @@ import { createApp } from 'one'
24
24
  // globbing ${appDirGlob}
25
25
  export default createApp({
26
26
  routes: import.meta.glob('${appDirGlob}', { exhaustive: true }),
27
- flags: ${JSON.stringify(options.flags)}
27
+ routerRoot: ${JSON.stringify(options.root)},
28
+ flags: ${JSON.stringify(options.flags)},
28
29
  })
29
30
  `;
30
31
  if (id === resolvedVirtualEntryIdNative) return `
@@ -35,7 +36,8 @@ import { createApp } from 'one'
35
36
  // globbing ${appDirGlob}
36
37
  export default createApp({
37
38
  routes: import.meta.glob(['${appDirGlob}', '!${appDirApiGlob}'], { exhaustive: true }),
38
- flags: ${JSON.stringify(options.flags)}
39
+ routerRoot: ${JSON.stringify(options.root)},
40
+ flags: ${JSON.stringify(options.flags)},
39
41
  })
40
42
  `;
41
43
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isNativeEnvironment","resolvedVirtualEntryId","resolvedVirtualEntryIdNative","virtualEntryId","virtualEntryIdNative","USE_ONE_SETUP_FILE","createVirtualEntry","options","appDirGlob","root","appDirApiGlob","name","enforce","resolveId","id","load","environment","JSON","stringify","flags"],"sources":["../../../../src/vite/plugins/virtualEntryPlugin.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,mBAAA,QAA2B;AAEpC,SACEC,sBAAA,EACAC,4BAAA,EACAC,cAAA,EACAC,oBAAA,QACK;AAEP,MAAMC,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAMpB,SAASC,mBAAmBC,OAAA,EAAqD;EACtF,MAAMC,UAAA,GAAa,IAAID,OAAA,CAAQE,IAAI;IAC7BC,aAAA,GAAgB,IAAIH,OAAA,CAAQE,IAAI;EAEtC,OAAO;IACLE,IAAA,EAAM;IACNC,OAAA,EAAS;IAETC,UAAUC,EAAA,EAAI;MACZ,IAAIA,EAAA,KAAOX,cAAA,EACT,OAAOF,sBAAA;MAET,IAAIa,EAAA,KAAOV,oBAAA,EACT,OAAOF,4BAAA;IAEX;IAEAa,KAAKD,EAAA,EAAI;MACP,IAAIA,EAAA,KAAOb,sBAAA,EAIT,OAAO;AAAA,EAHaD,mBAAA,CAAoB,KAAKgB,WAAW,IACpD,KACAX,kBAEC;AAAA;AAAA;AAAA;AAAA,cAICG,UAAU;AAAA;AAAA,8BAEMA,UAAU;AAAA,WAC7BS,IAAA,CAAKC,SAAA,CAAUX,OAAA,CAAQY,KAAK,CAAC;AAAA;AAAA;MAKlC,IAAIL,EAAA,KAAOZ,4BAAA,EAIT,OAAO;AAAA,EAHaF,mBAAA,CAAoB,KAAKgB,WAAW,IACpD,KACAX,kBAEC;AAAA;AAAA;AAAA;AAAA,cAICG,UAAU;AAAA;AAAA,+BAEOA,UAAU,QAAQE,aAAa;AAAA,WACnDO,IAAA,CAAKC,SAAA,CAAUX,OAAA,CAAQY,KAAK,CAAC;AAAA;AAAA;IAIpC;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["isNativeEnvironment","resolvedVirtualEntryId","resolvedVirtualEntryIdNative","virtualEntryId","virtualEntryIdNative","USE_ONE_SETUP_FILE","createVirtualEntry","options","appDirGlob","root","appDirApiGlob","name","enforce","resolveId","id","load","environment","JSON","stringify","flags"],"sources":["../../../../src/vite/plugins/virtualEntryPlugin.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,mBAAA,QAA2B;AAEpC,SACEC,sBAAA,EACAC,4BAAA,EACAC,cAAA,EACAC,oBAAA,QACK;AAEP,MAAMC,kBAAA,GAAqB;AAAA;AAAA;AAAA;AAAA;AAMpB,SAASC,mBAAmBC,OAAA,EAAqD;EACtF,MAAMC,UAAA,GAAa,IAAID,OAAA,CAAQE,IAAI;IAC7BC,aAAA,GAAgB,IAAIH,OAAA,CAAQE,IAAI;EAEtC,OAAO;IACLE,IAAA,EAAM;IACNC,OAAA,EAAS;IAETC,UAAUC,EAAA,EAAI;MACZ,IAAIA,EAAA,KAAOX,cAAA,EACT,OAAOF,sBAAA;MAET,IAAIa,EAAA,KAAOV,oBAAA,EACT,OAAOF,4BAAA;IAEX;IAEAa,KAAKD,EAAA,EAAI;MACP,IAAIA,EAAA,KAAOb,sBAAA,EAIT,OAAO;AAAA,EAHaD,mBAAA,CAAoB,KAAKgB,WAAW,IACpD,KACAX,kBAEC;AAAA;AAAA;AAAA;AAAA,cAICG,UAAU;AAAA;AAAA,8BAEMA,UAAU;AAAA,gBACxBS,IAAA,CAAKC,SAAA,CAAUX,OAAA,CAAQE,IAAI,CAAC;AAAA,WACjCQ,IAAA,CAAKC,SAAA,CAAUX,OAAA,CAAQY,KAAK,CAAC;AAAA;AAAA;MAKlC,IAAIL,EAAA,KAAOZ,4BAAA,EAIT,OAAO;AAAA,EAHaF,mBAAA,CAAoB,KAAKgB,WAAW,IACpD,KACAX,kBAEC;AAAA;AAAA;AAAA;AAAA,cAICG,UAAU;AAAA;AAAA,+BAEOA,UAAU,QAAQE,aAAa;AAAA,gBAC9CO,IAAA,CAAKC,SAAA,CAAUX,OAAA,CAAQE,IAAI,CAAC;AAAA,WACjCQ,IAAA,CAAKC,SAAA,CAAUX,OAAA,CAAQY,KAAK,CAAC;AAAA;AAAA;IAIpC;EACF;AACF","ignoreList":[]}
@@ -27,7 +27,8 @@ import { createApp } from 'one'
27
27
  // globbing ${appDirGlob}
28
28
  export default createApp({
29
29
  routes: import.meta.glob('${appDirGlob}', { exhaustive: true }),
30
- flags: ${JSON.stringify(options.flags)}
30
+ routerRoot: ${JSON.stringify(options.root)},
31
+ flags: ${JSON.stringify(options.flags)},
31
32
  })
32
33
  `;
33
34
  }
@@ -42,7 +43,8 @@ import { createApp } from 'one'
42
43
  // globbing ${appDirGlob}
43
44
  export default createApp({
44
45
  routes: import.meta.glob(['${appDirGlob}', '!${appDirApiGlob}'], { exhaustive: true }),
45
- flags: ${JSON.stringify(options.flags)}
46
+ routerRoot: ${JSON.stringify(options.root)},
47
+ flags: ${JSON.stringify(options.flags)},
46
48
  })
47
49
  `;
48
50
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isNativeEnvironment","resolvedVirtualEntryId","resolvedVirtualEntryIdNative","virtualEntryId","virtualEntryIdNative","USE_ONE_SETUP_FILE","createVirtualEntry","options","appDirGlob","root","appDirApiGlob","name","enforce","resolveId","id","load","prependCode","environment","JSON","stringify","flags","prependCode1"],"sources":["../../../../src/vite/plugins/virtualEntryPlugin.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,mBAAA,QAA2B;AAEpC,SAAAC,sBAAA,EAAAC,4BAAA,EAAAC,cAAA,EAAAC,oBAAA;AAAA,IACEC,kBAAA;AAAA;AACA;AACA;AACA;AAGF,SAAMC,kBAAqBA,CAAAC,OAAA;EAAA,IAAAC,UAAA,OAAAD,OAAA,CAAAE,IAAA;IAAAC,aAAA,OAAAH,OAAA,CAAAE,IAAA;EAAA;IAAAE,IAAA;IAAAC,OAAA;IAMpBC,SAASA,CAAAC,EAAA;MACd,IAAMA,EAAA,KAAAX,cAAiB,EAGvB,OAAOF,sBAAA;MACL,IAAMa,EAAA,KAAAV,oBAAA,EACN,OAASF,4BAAA;IAET;IACEa,KAAAD,EAAI;MACF,IAAAA,EAAA,KAAOb,sBAAA;QAET,IAAIe,WAAO,GAAAhB,mBAAA,MAAAiB,WAAA,UACT;QAEJZ,kBAAA,CAEK;QACH,OAAI;AAIF,EAAAW,WAAA;AAAO;AACF;AAAA;AAAA,cAAAR,UAAA;AAAA;AAIW,8BAAAA,UAAA;AAAA,WAAAU,IAAA,CAAAC,SAAA,CAAAZ,OAEM,CAAAa,KAAA,CAAU;AAAA;AACA;MAAA;MAKlC,IAAIN,EAAA,KAAOZ,4BAAA;QAIT,IAAAmB,YAAO,GAAArB,mBAAA,MAAAiB,WAAA,UAHa;QAIfZ,kBAAA;QAAA;AAAA,EAAAgB,YAIC;AAAU;AAAA;AAEsC;AACtB,cAAAb,UAAA;AAAA;AAAA,+BAIpCA,UAAA,QAAAE,aAAA;AAAA,WACFQ,IAAA,CAAAC,SAAA,CAAAZ,OAAA,CAAAa,KAAA;AACF","ignoreList":[]}
1
+ {"version":3,"names":["isNativeEnvironment","resolvedVirtualEntryId","resolvedVirtualEntryIdNative","virtualEntryId","virtualEntryIdNative","USE_ONE_SETUP_FILE","createVirtualEntry","options","appDirGlob","root","appDirApiGlob","name","enforce","resolveId","id","load","prependCode","environment","JSON","stringify","flags","prependCode1"],"sources":["../../../../src/vite/plugins/virtualEntryPlugin.ts"],"sourcesContent":[null],"mappings":"AACA,SAASA,mBAAA,QAA2B;AAEpC,SAAAC,sBAAA,EAAAC,4BAAA,EAAAC,cAAA,EAAAC,oBAAA;AAAA,IACEC,kBAAA;AAAA;AACA;AACA;AACA;AAGF,SAAMC,kBAAqBA,CAAAC,OAAA;EAAA,IAAAC,UAAA,OAAAD,OAAA,CAAAE,IAAA;IAAAC,aAAA,OAAAH,OAAA,CAAAE,IAAA;EAAA;IAAAE,IAAA;IAAAC,OAAA;IAMpBC,SAASA,CAAAC,EAAA;MACd,IAAMA,EAAA,KAAAX,cAAiB,EAGvB,OAAOF,sBAAA;MACL,IAAMa,EAAA,KAAAV,oBAAA,EACN,OAASF,4BAAA;IAET;IACEa,KAAAD,EAAI;MACF,IAAAA,EAAA,KAAOb,sBAAA;QAET,IAAIe,WAAO,GAAAhB,mBAAA,MAAAiB,WAAA,UACT;QAEJZ,kBAAA,CAEK;QACH,OAAI;AAIF,EAAAW,WAAA;AAAO;AACF;AAAA;AAAA,cAAAR,UAAA;AAAA;AAIW,8BAAAA,UAAA;AAAA,gBAAAU,IAAA,CAAAC,SAEM,CAAAZ,OAAA,CAAAE,IAAU;AAAA,WAAAS,IAAA,CACxBC,SAAK,CAAAZ,OAAU,CAAAa,KAAQ;AAAK;AACJ;MAAA;MAKlC,IAAIN,EAAA,KAAOZ,4BAAA;QAIT,IAAAmB,YAAO,GAAArB,mBAAA,MAAAiB,WAAA,UAHa;QAIfZ,kBAAA;QAAA;AAAA,EAAAgB,YAIC;AAAU;AAAA;AAEsC;AAClB,cACjCb,UAAK;AAAwB;AAAA,+BAAAA,UAAA,QAAAE,aAAA;AAAA,gBAIpCQ,IAAA,CAAAC,SAAA,CAAAZ,OAAA,CAAAE,IAAA;AAAA,WACFS,IAAA,CAAAC,SAAA,CAAAZ,OAAA,CAAAa,KAAA;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "one",
3
- "version": "1.1.479",
3
+ "version": "1.1.481",
4
4
  "license": "BSD-3-Clause",
5
5
  "sideEffects": [
6
6
  "setup.mjs",
@@ -95,15 +95,15 @@
95
95
  "@react-navigation/routers": "~7",
96
96
  "@swc/core": "^1.10.4",
97
97
  "@ungap/structured-clone": "^1.2.0",
98
- "@vxrn/compiler": "1.1.479",
99
- "@vxrn/resolve": "1.1.479",
100
- "@vxrn/tslib-lite": "1.1.479",
101
- "@vxrn/universal-color-scheme": "1.1.479",
102
- "@vxrn/use-isomorphic-layout-effect": "1.1.479",
98
+ "@vxrn/compiler": "1.1.481",
99
+ "@vxrn/resolve": "1.1.481",
100
+ "@vxrn/tslib-lite": "1.1.481",
101
+ "@vxrn/universal-color-scheme": "1.1.481",
102
+ "@vxrn/use-isomorphic-layout-effect": "1.1.481",
103
103
  "babel-dead-code-elimination": "^1.0.9",
104
104
  "citty": "^0.1.6",
105
105
  "core-js": "^3.38.1",
106
- "create-vxrn": "1.1.479",
106
+ "create-vxrn": "1.1.481",
107
107
  "escape-string-regexp": "^5.0.0",
108
108
  "expo-linking": "~6.3.1",
109
109
  "expo-modules-core": "2.1.2",
@@ -116,9 +116,9 @@
116
116
  "nanoid": "^3.3.7",
117
117
  "perfect-debounce": "^1.0.0",
118
118
  "picocolors": "^1.0.0",
119
- "react": "^18.3.1 || ^19.0.0",
119
+ "react": "^18.3.1 || ~19.0.0",
120
120
  "react-compiler-runtime": "^19.0.0-beta-201e55d-20241215",
121
- "react-dom": "^18.3.1 || ^19.0.0",
121
+ "react-dom": "^18.3.1 || ~19.0.0",
122
122
  "react-native-css-interop": "^0.1.22",
123
123
  "react-native-gesture-handler": "^2.18.1",
124
124
  "react-native-reanimated": "~3.16.5",
@@ -129,7 +129,7 @@
129
129
  "vite": "^6.1.0",
130
130
  "vite-plugin-barrel": "^0.4.1",
131
131
  "vite-tsconfig-paths": "^5.0.1",
132
- "vxrn": "1.1.479",
132
+ "vxrn": "1.1.481",
133
133
  "ws": "^8.18.0",
134
134
  "xxhashjs": "^0.2.2"
135
135
  },
package/src/Root.tsx CHANGED
@@ -35,6 +35,7 @@ type RootProps = Omit<InnerProps, 'context'> & {
35
35
  path: string
36
36
  isClient?: boolean
37
37
  routes: GlobbedRouteImports
38
+ routerRoot: string
38
39
  routeOptions?: One.RouteOptions
39
40
  flags?: One.Flags
40
41
  }
@@ -68,7 +69,7 @@ export function Root(props: RootProps) {
68
69
  const { path, routes, routeOptions, isClient, navigationContainerProps, onRenderId } =
69
70
  props
70
71
 
71
- const context = useViteRoutes(routes, routeOptions, globalThis['__vxrnVersion'])
72
+ const context = useViteRoutes(routes, props.routerRoot, routeOptions, globalThis['__vxrnVersion'])
72
73
  const location =
73
74
  typeof window !== 'undefined' && window.location
74
75
  ? new URL(path || window.location.href || '/', window.location.href)
package/src/cli/build.ts CHANGED
@@ -21,6 +21,7 @@ import { loadUserOneOptions } from '../vite/loadConfig'
21
21
  import { runWithAsyncLocalContext } from '../vite/one-server-only'
22
22
  import type { One, RouteInfo } from '../vite/types'
23
23
  import { buildVercelOutputDirectory } from '../vercel/build/buildVercelOutputDirectory'
24
+ import { getRouterRootFromOneOptions } from '../utils/getRouterRootFromOneOptions'
24
25
 
25
26
  import { buildPage } from './buildPage'
26
27
  import { checkNodeVersion } from './checkNodeVersion'
@@ -49,7 +50,10 @@ export async function build(args: {
49
50
  }
50
51
 
51
52
  const { oneOptions } = await loadUserOneOptions('build')
52
- const manifest = getManifest()!
53
+ const routerRoot = getRouterRootFromOneOptions(oneOptions)
54
+ const routerRootRegexp = new RegExp(`^${routerRoot}`)
55
+
56
+ const manifest = getManifest({ routerRoot })!
53
57
 
54
58
  const serverOutputFormat =
55
59
  oneOptions.build?.server === false ? 'esm' : (oneOptions.build?.server?.outputFormat ?? 'esm')
@@ -97,7 +101,7 @@ export async function build(args: {
97
101
 
98
102
  async function buildCustomRoutes(subFolder: string, routes: RouteInfo<string>[]) {
99
103
  const input = routes.reduce((entries, { page, file }) => {
100
- entries[page.slice(1) + '.js'] = join('app', file)
104
+ entries[page.slice(1) + '.js'] = join(routerRoot, file)
101
105
  return entries
102
106
  }, {}) as Record<string, string>
103
107
 
@@ -208,7 +212,7 @@ export async function build(args: {
208
212
 
209
213
  for (const middleware of manifest.middlewareRoutes) {
210
214
  const absoluteRoot = resolve(process.cwd(), options.root)
211
- const fullPath = join(absoluteRoot, 'app', middleware.file)
215
+ const fullPath = join(absoluteRoot, routerRoot, middleware.file)
212
216
  const outChunks = middlewareBuildInfo.output.filter((x) => x.type === 'chunk')
213
217
  const chunk = outChunks.find((x) => x.facadeModuleId === fullPath)
214
218
  if (!chunk) throw new Error(`internal err finding middleware`)
@@ -252,13 +256,11 @@ export async function build(args: {
252
256
  }
253
257
 
254
258
  // temp we should use manifest but lets just filter out non-app dir stuff
255
- if (!id.includes('/app/')) {
259
+ if (!id.includes(`/${routerRoot}/`)) {
256
260
  continue
257
261
  }
258
262
 
259
- const relativeId = relative(process.cwd(), id)
260
- // TODO hardcoded app
261
- .replace('app/', '/')
263
+ const relativeId = relative(process.cwd(), id).replace(`${routerRoot}/`, '/')
262
264
 
263
265
  const onlyBuild = vxrnOutput.buildArgs?.only
264
266
  if (onlyBuild) {
@@ -281,7 +283,7 @@ export async function build(args: {
281
283
  const clientManifestEntry = vxrnOutput.clientManifest[clientManifestKey]
282
284
 
283
285
  const foundRoute = manifest.pageRoutes.find((route: RouteInfo<string>) => {
284
- return route.file && clientManifestKey.replace(/^app/, '') === route.file.slice(1)
286
+ return route.file && clientManifestKey.replace(routerRootRegexp, '') === route.file.slice(1)
285
287
  })
286
288
 
287
289
  if (!foundRoute) {
@@ -329,8 +331,7 @@ export async function build(args: {
329
331
  // TODO isn't this getting all layouts not just the ones for this route?
330
332
  const layoutEntries =
331
333
  foundRoute.layouts?.flatMap((layout) => {
332
- // TODO hardcoded app/
333
- const clientKey = `app${layout.contextKey.slice(1)}`
334
+ const clientKey = `${routerRoot}${layout.contextKey.slice(1)}`
334
335
  return vxrnOutput.clientManifest[clientKey]
335
336
  }) ?? []
336
337
 
@@ -456,6 +457,7 @@ export async function build(args: {
456
457
  // write out the static paths (pathname => html) for the server
457
458
  const routeMap: Record<string, string> = {}
458
459
  const routeToBuildInfo: Record<string, Omit<One.RouteBuildInfo, 'loaderData'>> = {}
460
+ const pathToRoute: Record<string, string> = {}
459
461
  const preloads: Record<string, boolean> = {}
460
462
  const loaders: Record<string, boolean> = {}
461
463
 
@@ -470,6 +472,9 @@ export async function build(args: {
470
472
  } = route
471
473
 
472
474
  routeToBuildInfo[route.routeFile] = rest
475
+ for (let p of getCleanPaths([route.path, route.cleanPath])) {
476
+ pathToRoute[p] = route.routeFile
477
+ }
473
478
  preloads[route.preloadPath] = true
474
479
  loaders[route.loaderPath] = true
475
480
  }
@@ -497,6 +502,7 @@ export async function build(args: {
497
502
  const buildInfoForWriting: One.BuildInfo = {
498
503
  oneOptions,
499
504
  routeToBuildInfo,
505
+ pathToRoute,
500
506
  manifest: {
501
507
  pageRoutes: manifest.pageRoutes.map(createBuildManifestRoute),
502
508
  apiRoutes: manifest.apiRoutes.map(createBuildManifestRoute),
@@ -569,6 +575,25 @@ export async function build(args: {
569
575
  console.info(`\n\n 💛 build complete\n\n`)
570
576
  }
571
577
 
578
+ const TRAILING_INDEX_REGEX = /\/index(\.(web))?/
579
+ function getCleanPaths(possiblePaths: Array<string>) {
580
+ return Array.from(
581
+ new Set(
582
+ Array.from(new Set(possiblePaths)).flatMap((p) => {
583
+ const paths = [p]
584
+
585
+ if (p.match(TRAILING_INDEX_REGEX)) {
586
+ const pathWithTrailingIndexRemoved = p.replace(TRAILING_INDEX_REGEX, '')
587
+ paths.push(pathWithTrailingIndexRemoved)
588
+ paths.push(pathWithTrailingIndexRemoved + '/')
589
+ }
590
+
591
+ return paths
592
+ })
593
+ )
594
+ )
595
+ }
596
+
572
597
  async function moveAllFiles(src: string, dest: string) {
573
598
  try {
574
599
  await FSExtra.copy(src, dest, { overwrite: true, errorOnExist: false })
@@ -3,11 +3,7 @@ import type { One } from './vite/types'
3
3
  import './polyfills-mobile'
4
4
  import { Root } from './Root'
5
5
  import './setup'
6
-
7
- export type CreateAppProps = {
8
- routes: Record<string, () => Promise<unknown>>
9
- flags?: One.Flags
10
- }
6
+ import type { CreateAppProps } from './createApp'
11
7
 
12
8
  // TODO temporary
13
9
  LogBox.ignoreLogs([/Sending .* with no listeners registered/])
@@ -15,7 +11,13 @@ LogBox.ignoreLogs([/Sending .* with no listeners registered/])
15
11
  export function createApp(options: CreateAppProps): void {
16
12
  const App = () => {
17
13
  let contents = (
18
- <Root isClient flags={options.flags} routes={options.routes} path="/" />
14
+ <Root
15
+ isClient
16
+ flags={options.flags}
17
+ routes={options.routes}
18
+ routerRoot={options.routerRoot}
19
+ path="/"
20
+ />
19
21
  )
20
22
 
21
23
  return contents
package/src/createApp.tsx CHANGED
@@ -17,6 +17,7 @@ import { cloneElement } from 'react'
17
17
 
18
18
  export type CreateAppProps = {
19
19
  routes: Record<string, () => Promise<unknown>>
20
+ routerRoot: string
20
21
  flags?: One.Flags
21
22
  }
22
23
 
@@ -45,6 +46,7 @@ export function createApp(options: CreateAppProps) {
45
46
  renderId = id
46
47
  }}
47
48
  routes={options.routes}
49
+ routerRoot={options.routerRoot}
48
50
  {...props}
49
51
  />
50
52
  )
@@ -116,7 +118,8 @@ export function createApp(options: CreateAppProps) {
116
118
  }
117
119
 
118
120
  // run their root layout before calling resolveClientLoader so they can register hook
119
- const rootLayoutImport = options.routes['/app/_layout.tsx']?.()
121
+ const rootLayoutImport =
122
+ options.routes[`/${options.routerRoot}/_layout.tsx`]?.()
120
123
 
121
124
  return rootLayoutImport
122
125
  .then(() => {
@@ -128,6 +131,7 @@ export function createApp(options: CreateAppProps) {
128
131
  isClient
129
132
  flags={options.flags}
130
133
  routes={options.routes}
134
+ routerRoot={options.routerRoot}
131
135
  path={window.location.href}
132
136
  />
133
137
  )
@@ -211,8 +211,8 @@ export function compileManifest(manifest: { pageRoutes: RouteInfo[]; apiRoutes:
211
211
  }
212
212
 
213
213
  // in dev mode we do it more simply:
214
- export function createHandleRequest(handlers: RequestHandlers) {
215
- const manifest = getManifest()
214
+ export function createHandleRequest(handlers: RequestHandlers, { routerRoot }: { routerRoot: string }) {
215
+ const manifest = getManifest({ routerRoot })
216
216
  if (!manifest) {
217
217
  throw new Error(`No routes manifest`)
218
218
  }
@@ -9,6 +9,7 @@ let context
9
9
  // for some reason putting it in state doesnt even re-render
10
10
  export function useViteRoutes(
11
11
  routes: GlobbedRouteImports,
12
+ routerRoot: string,
12
13
  options?: One.RouteOptions,
13
14
  version?: number
14
15
  ) {
@@ -19,21 +20,22 @@ export function useViteRoutes(
19
20
  }
20
21
 
21
22
  if (!context) {
22
- loadRoutes(routes, options)
23
+ loadRoutes(routes, routerRoot, options)
23
24
  }
24
25
 
25
26
  return context
26
27
  }
27
28
 
28
- export function loadRoutes(paths: GlobbedRouteImports, options?: One.RouteOptions) {
29
+ export function loadRoutes(paths: GlobbedRouteImports, routerRoot: string, options?: One.RouteOptions) {
29
30
  if (context) return context
30
31
  globalThis['__importMetaGlobbed'] = paths
31
- context = globbedRoutesToRouteContext(paths, options)
32
+ context = globbedRoutesToRouteContext(paths, routerRoot, options)
32
33
  return context
33
34
  }
34
35
 
35
36
  export function globbedRoutesToRouteContext(
36
37
  paths: GlobbedRouteImports,
38
+ routerRoot: string,
37
39
  options?: One.RouteOptions
38
40
  ): One.RouteContext {
39
41
  // make it look like webpack context
@@ -48,7 +50,7 @@ export function globbedRoutesToRouteContext(
48
50
  return
49
51
  }
50
52
  const loadRouteFunction = paths[path]
51
- const pathWithoutRelative = path.replace('/app/', './')
53
+ const pathWithoutRelative = path.replace(`/${routerRoot}/`, './')
52
54
 
53
55
  const originalPath = pathWithoutRelative.slice(1).replace(/\.[jt]sx?$/, '')
54
56
  if (options?.routeModes?.[originalPath] === 'spa') {
@@ -139,6 +139,7 @@ function getRouteEntry(normalizedRoute: string, node: RouteNode): OneRouterServe
139
139
  type: node.type,
140
140
  namedRegex: result.namedRegex,
141
141
  urlPath: result.urlPath,
142
+ urlCleanPath: result.urlCleanPath,
142
143
  routeKeys: result.routeKeys,
143
144
  layouts: node.layouts,
144
145
  middlewares: node.middlewares,
@@ -190,7 +191,7 @@ function getPathMeta(route: string) {
190
191
  const getSafeRouteKey = buildGetSafeRouteKey()
191
192
  const routeKeys: Record<string, string> = {}
192
193
 
193
- let urlPath = ''
194
+ const urlPathParts: Array<{ content: string; type?: 'group' }> = []
194
195
 
195
196
  const routeSegments = segments
196
197
  .map((segment, index) => {
@@ -221,7 +222,7 @@ function getPathMeta(route: string) {
221
222
  cleanedKey = getSafeRouteKey()
222
223
  }
223
224
 
224
- urlPath += repeat ? '/*' : `/:${name}${optional ? '?' : ''}`
225
+ urlPathParts.push({ content: repeat ? '/*' : `/:${name}${optional ? '?' : ''}` })
225
226
  routeKeys[cleanedKey] = name
226
227
 
227
228
  return repeat
@@ -237,7 +238,7 @@ function getPathMeta(route: string) {
237
238
  .map((group) => group.trim())
238
239
  .filter(Boolean)
239
240
 
240
- urlPath += `/:${groupName}?`
241
+ urlPathParts.push({ content: `/:${groupName}?`, type: 'group' })
241
242
 
242
243
  if (groupName.length > 1) {
243
244
  const optionalSegment = `\\((?:${groupName.map(escapeStringRegexp).join('|')})\\)`
@@ -250,15 +251,22 @@ function getPathMeta(route: string) {
250
251
  return `(?:/${escapeStringRegexp(segment)})?`
251
252
  }
252
253
 
253
- urlPath += `/${segment}`
254
+ urlPathParts.push({ content: `/${segment}` })
254
255
 
255
256
  return `/${escapeStringRegexp(segment)}`
256
257
  })
257
258
  .join('')
258
259
 
260
+ const urlPath = urlPathParts.map((p) => p.content).join('')
261
+ const urlCleanPath = urlPathParts
262
+ .filter((p) => p.type !== 'group')
263
+ .map((p) => p.content)
264
+ .join('')
265
+
259
266
  return {
260
267
  namedRegex: `^${routeSegments}(?:/)?$`,
261
268
  urlPath: urlPath === '' ? '/' : urlPath,
269
+ urlCleanPath: urlCleanPath === '' ? '/' : urlCleanPath,
262
270
  routeKeys,
263
271
  }
264
272
  }
@@ -2,7 +2,7 @@ import { default as FSExtra } from 'fs-extra'
2
2
  import type { Hono, MiddlewareHandler } from 'hono'
3
3
  import type { BlankEnv } from 'hono/types'
4
4
  import { extname, join } from 'node:path'
5
- import { getServerEntry } from 'vxrn/serve'
5
+ import { getServerEntry, serveStatic } from 'vxrn/serve'
6
6
  import { LOADER_JS_POSTFIX_UNCACHED, PRELOAD_JS_POSTFIX } from '../constants'
7
7
  import { compileManifest, getURLfromRequestURL, type RequestHandlers } from '../createHandleRequest'
8
8
  import type { RenderAppProps } from '../types'
@@ -135,6 +135,23 @@ url: ${url}`)
135
135
 
136
136
  function createHonoHandler(route: RouteInfoCompiled): MiddlewareHandler<BlankEnv, never, {}> {
137
137
  return async (context, next) => {
138
+ if (route.page.endsWith('/+not-found')) {
139
+ let didCallNext = false
140
+
141
+ const response = await serveStatic({
142
+ root: './dist/client',
143
+ onFound: (_path, c) => {
144
+ c.header('Cache-Control', `public, immutable, max-age=31536000`)
145
+ },
146
+ })(context, async () => {
147
+ didCallNext = true
148
+ })
149
+
150
+ if (response && !didCallNext) {
151
+ return response
152
+ }
153
+ }
154
+
138
155
  try {
139
156
  const request = context.req.raw
140
157
 
@@ -220,10 +237,22 @@ url: ${url}`)
220
237
  app.post(route.urlPath, createHonoHandler(route))
221
238
  app.delete(route.urlPath, createHonoHandler(route))
222
239
  app.patch(route.urlPath, createHonoHandler(route))
240
+
241
+ if (route.urlPath !== route.urlCleanPath) {
242
+ app.get(route.urlCleanPath, createHonoHandler(route))
243
+ app.put(route.urlCleanPath, createHonoHandler(route))
244
+ app.post(route.urlCleanPath, createHonoHandler(route))
245
+ app.delete(route.urlCleanPath, createHonoHandler(route))
246
+ app.patch(route.urlCleanPath, createHonoHandler(route))
247
+ }
223
248
  }
224
249
 
225
250
  for (const route of compiledManifest.pageRoutes) {
226
251
  app.get(route.urlPath, createHonoHandler(route))
252
+
253
+ if (route.urlPath !== route.urlCleanPath) {
254
+ app.get(route.urlCleanPath, createHonoHandler(route))
255
+ }
227
256
  }
228
257
 
229
258
  const { preloads } = buildInfo
@@ -5,13 +5,13 @@ import { globbedRoutesToRouteContext } from '../router/useViteRoutes'
5
5
  import { globDir } from '../utils/globDir'
6
6
  import { getTypedRoutesDeclarationFile } from './getTypedRoutesDeclarationFile'
7
7
 
8
- export async function generateRouteTypes(outFile: string) {
9
- const routePaths = globDir('app')
8
+ export async function generateRouteTypes(outFile: string, routerRoot: string) {
9
+ const routePaths = globDir(routerRoot)
10
10
  const routes = routePaths.reduce((acc, cur) => {
11
11
  acc[cur] = {}
12
12
  return acc
13
13
  }, {})
14
- const context = globbedRoutesToRouteContext(routes)
14
+ const context = globbedRoutesToRouteContext(routes, routerRoot)
15
15
  const declarations = getTypedRoutesDeclarationFile(context)
16
16
  await FSExtra.ensureDir(dirname(outFile))
17
17
  await writeFile(outFile, declarations)
@@ -0,0 +1,5 @@
1
+ import type { One } from '../vite/types'
2
+
3
+ export function getRouterRootFromOneOptions(options: One.PluginOptions) {
4
+ return options?.router?.root || process.env.ONE_ROUTER_ROOT || 'app'
5
+ }