vite-plugin-react-server 0.3.10 → 0.3.12

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 (318) hide show
  1. package/dist/client.d.ts +1 -1
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +1 -1
  4. package/dist/index.d.ts +3 -6
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/package.json +16 -14
  9. package/dist/plugin/assertServerCondition.d.ts +5 -1
  10. package/dist/plugin/assertServerCondition.d.ts.map +1 -1
  11. package/dist/plugin/assertServerCondition.js +1 -3
  12. package/dist/plugin/checkFilesExist.d.ts +2 -2
  13. package/dist/plugin/checkFilesExist.d.ts.map +1 -1
  14. package/dist/plugin/checkFilesExist.js +43 -58
  15. package/dist/plugin/checkFilesExist.js.map +1 -1
  16. package/dist/plugin/collect-css-manifest.d.ts.map +1 -1
  17. package/dist/plugin/collect-css-manifest.js +5 -0
  18. package/dist/plugin/collect-css-manifest.js.map +1 -1
  19. package/dist/plugin/components.js +10 -15
  20. package/dist/plugin/config/createModuleIdGenerator.d.ts +11 -0
  21. package/dist/plugin/config/createModuleIdGenerator.d.ts.map +1 -0
  22. package/dist/plugin/config/createModuleIdGenerator.js +44 -0
  23. package/dist/plugin/config/createModuleIdGenerator.js.map +1 -0
  24. package/dist/plugin/config/defaults.d.ts +27 -24
  25. package/dist/plugin/config/defaults.d.ts.map +1 -1
  26. package/dist/plugin/config/defaults.js +26 -31
  27. package/dist/plugin/config/defaults.js.map +1 -1
  28. package/dist/plugin/config/getPaths.js +1 -1
  29. package/dist/plugin/config/resolveOptions.d.ts +1 -1
  30. package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
  31. package/dist/plugin/config/resolveOptions.js +223 -16
  32. package/dist/plugin/config/resolveOptions.js.map +1 -1
  33. package/dist/plugin/config/resolvePages.d.ts +2 -0
  34. package/dist/plugin/config/resolvePages.d.ts.map +1 -1
  35. package/dist/plugin/config/resolvePages.js.map +1 -1
  36. package/dist/plugin/config/resolveUserConfig.d.ts +2 -2
  37. package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
  38. package/dist/plugin/config/resolveUserConfig.js +149 -50
  39. package/dist/plugin/config/resolveUserConfig.js.map +1 -1
  40. package/dist/plugin/helpers/getBundleManifest.d.ts +25 -0
  41. package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -0
  42. package/dist/plugin/helpers/getBundleManifest.js +72 -0
  43. package/dist/plugin/helpers/getBundleManifest.js.map +1 -0
  44. package/dist/plugin/helpers/inputNormalizer.d.ts +14 -1
  45. package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
  46. package/dist/plugin/helpers/inputNormalizer.js +128 -16
  47. package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
  48. package/dist/plugin/helpers/tryManifest.d.ts +3 -1
  49. package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
  50. package/dist/plugin/helpers/tryManifest.js +1 -1
  51. package/dist/plugin/helpers/tryManifest.js.map +1 -1
  52. package/dist/plugin/loader/createBuildLoader.d.ts +6 -2
  53. package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -1
  54. package/dist/plugin/loader/createBuildLoader.js +37 -9
  55. package/dist/plugin/loader/createBuildLoader.js.map +1 -1
  56. package/dist/plugin/loader/createPageLoader.d.ts.map +1 -1
  57. package/dist/plugin/loader/createPageLoader.js +0 -7
  58. package/dist/plugin/loader/css-loader.d.ts +16 -0
  59. package/dist/plugin/loader/css-loader.d.ts.map +1 -0
  60. package/dist/plugin/loader/css-loader.js +70 -0
  61. package/dist/plugin/loader/css-loader.js.map +1 -0
  62. package/dist/plugin/loader/react-loader.d.ts +17 -0
  63. package/dist/plugin/loader/react-loader.d.ts.map +1 -0
  64. package/dist/plugin/loader/react-loader.js +647 -0
  65. package/dist/plugin/loader/react-loader.js.map +1 -0
  66. package/dist/plugin/loader/rsc/messageHandler.d.ts +2 -0
  67. package/dist/plugin/loader/rsc/messageHandler.d.ts.map +1 -0
  68. package/dist/plugin/loader/rsc/messageHandler.js +1 -0
  69. package/dist/plugin/loader/rsc/rsc-worker.development.d.ts +2 -0
  70. package/dist/plugin/loader/rsc/rsc-worker.development.d.ts.map +1 -0
  71. package/dist/plugin/loader/rsc/rsc-worker.development.js +1 -0
  72. package/dist/plugin/plugin.d.ts +0 -1
  73. package/dist/plugin/plugin.d.ts.map +1 -1
  74. package/dist/plugin/plugin.js +2 -1
  75. package/dist/plugin/preserver/plugin.d.ts.map +1 -1
  76. package/dist/plugin/preserver/plugin.js +3 -2
  77. package/dist/plugin/preserver/plugin.js.map +1 -1
  78. package/dist/plugin/react-client/index.d.ts +2 -1
  79. package/dist/plugin/react-client/index.d.ts.map +1 -1
  80. package/dist/plugin/react-client/index.js +19 -1
  81. package/dist/plugin/react-client/index.js.map +1 -0
  82. package/dist/plugin/react-client/plugin.d.ts +2 -2
  83. package/dist/plugin/react-client/plugin.d.ts.map +1 -1
  84. package/dist/plugin/react-client/plugin.js +283 -10
  85. package/dist/plugin/react-client/plugin.js.map +1 -1
  86. package/dist/plugin/react-server/createHandler.d.ts +2 -2
  87. package/dist/plugin/react-server/createHandler.d.ts.map +1 -1
  88. package/dist/plugin/react-server/createHandler.js +15 -9
  89. package/dist/plugin/react-server/createHandler.js.map +1 -1
  90. package/dist/plugin/react-server/createRscStream.d.ts +15 -3
  91. package/dist/plugin/react-server/createRscStream.d.ts.map +1 -1
  92. package/dist/plugin/react-server/createRscStream.js +53 -36
  93. package/dist/plugin/react-server/createRscStream.js.map +1 -1
  94. package/dist/plugin/react-server/createSsrHandler.d.ts +2 -2
  95. package/dist/plugin/react-server/createSsrHandler.d.ts.map +1 -1
  96. package/dist/plugin/react-server/createSsrHandler.js +5 -12
  97. package/dist/plugin/react-server/index.js +18 -9
  98. package/dist/plugin/react-server/index.js.map +1 -0
  99. package/dist/plugin/react-server/plugin.d.ts.map +1 -1
  100. package/dist/plugin/react-server/plugin.js +147 -137
  101. package/dist/plugin/react-server/plugin.js.map +1 -1
  102. package/dist/plugin/transformer/plugin.d.ts +2 -1
  103. package/dist/plugin/transformer/plugin.d.ts.map +1 -1
  104. package/dist/plugin/transformer/plugin.js +68 -75
  105. package/dist/plugin/transformer/plugin.js.map +1 -1
  106. package/dist/plugin/transformer/types.d.ts +4 -0
  107. package/dist/plugin/transformer/types.d.ts.map +1 -1
  108. package/dist/plugin/types.d.ts +56 -20
  109. package/dist/plugin/types.d.ts.map +1 -1
  110. package/dist/plugin/utils/logger.d.ts +9 -0
  111. package/dist/plugin/utils/logger.d.ts.map +1 -0
  112. package/dist/plugin/utils/logger.js +68 -0
  113. package/dist/plugin/utils/logger.js.map +1 -0
  114. package/dist/plugin/worker/createWorker.d.ts +1 -0
  115. package/dist/plugin/worker/createWorker.d.ts.map +1 -1
  116. package/dist/plugin/worker/createWorker.js +23 -36
  117. package/dist/plugin/worker/createWorker.js.map +1 -1
  118. package/dist/plugin/worker/html/html-worker.production.js +5 -1
  119. package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
  120. package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
  121. package/dist/plugin/worker/html/messageHandler.js +33 -28
  122. package/dist/plugin/worker/html/messageHandler.js.map +1 -1
  123. package/dist/plugin/worker/html/plugin.d.ts.map +1 -1
  124. package/dist/plugin/worker/html/plugin.js +10 -5
  125. package/dist/plugin/worker/html/renderPages.d.ts +7 -6
  126. package/dist/plugin/worker/html/renderPages.d.ts.map +1 -1
  127. package/dist/plugin/worker/html/renderPages.js +147 -93
  128. package/dist/plugin/worker/html/renderPages.js.map +1 -1
  129. package/dist/plugin/worker/loader.d.ts +1 -11
  130. package/dist/plugin/worker/loader.d.ts.map +1 -1
  131. package/dist/plugin/worker/loader.js +2 -2
  132. package/dist/plugin/worker/loader.js.map +1 -1
  133. package/dist/plugin/worker/plugin.d.ts +10 -1
  134. package/dist/plugin/worker/plugin.d.ts.map +1 -1
  135. package/dist/plugin/worker/plugin.js +10 -1
  136. package/dist/plugin/worker/rsc/index.d.ts +1 -3
  137. package/dist/plugin/worker/rsc/index.d.ts.map +1 -1
  138. package/dist/plugin/worker/rsc/index.js +1 -9
  139. package/dist/plugin/worker/rsc/index.js.map +1 -1
  140. package/dist/plugin/worker/rsc/messageHandler.d.ts +3 -0
  141. package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -0
  142. package/dist/plugin/worker/rsc/messageHandler.js +107 -0
  143. package/dist/plugin/worker/rsc/messageHandler.js.map +1 -0
  144. package/dist/plugin/worker/rsc/plugin.d.ts.map +1 -1
  145. package/dist/plugin/worker/rsc/plugin.js +74 -80
  146. package/dist/plugin/worker/rsc/rsc-worker.development.d.ts +32 -0
  147. package/dist/plugin/worker/rsc/rsc-worker.development.d.ts.map +1 -0
  148. package/dist/plugin/worker/rsc/rsc-worker.development.js +43 -0
  149. package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -0
  150. package/dist/plugin/worker/rsc/rsc-worker.js +4 -106
  151. package/dist/plugin/worker/rsc/rsc-worker.production.d.ts +2 -0
  152. package/dist/plugin/worker/rsc/rsc-worker.production.d.ts.map +1 -0
  153. package/dist/plugin/worker/rsc/rsc-worker.production.js +14 -0
  154. package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -0
  155. package/dist/plugin/worker/rsc/state.d.ts +11 -0
  156. package/dist/plugin/worker/rsc/state.d.ts.map +1 -0
  157. package/dist/plugin/worker/rsc/state.js +12 -0
  158. package/dist/plugin/worker/rsc/state.js.map +1 -0
  159. package/dist/plugin/worker/types.d.ts +62 -35
  160. package/dist/plugin/worker/types.d.ts.map +1 -1
  161. package/dist/server.d.ts +1 -3
  162. package/dist/server.d.ts.map +1 -1
  163. package/dist/server.js +1 -3
  164. package/dist/server.js.map +1 -1
  165. package/dist/tsconfig.tsbuildinfo +1 -1
  166. package/package.json +16 -14
  167. package/plugin/assertServerCondition.ts +2 -3
  168. package/plugin/checkFilesExist.ts +46 -66
  169. package/plugin/collect-css-manifest.ts +5 -1
  170. package/plugin/config/createModuleIdGenerator.ts +52 -0
  171. package/plugin/config/defaults.ts +27 -20
  172. package/plugin/config/resolveOptions.ts +311 -25
  173. package/plugin/config/resolvePages.ts +1 -1
  174. package/plugin/config/resolveUserConfig.ts +195 -61
  175. package/plugin/helpers/getBundleManifest.ts +113 -0
  176. package/plugin/helpers/inputNormalizer.ts +186 -25
  177. package/plugin/helpers/tryManifest.ts +3 -1
  178. package/plugin/loader/createBuildLoader.ts +50 -9
  179. package/plugin/loader/createPageLoader.ts +1 -7
  180. package/plugin/loader/css-loader.ts +96 -0
  181. package/plugin/loader/react-loader.ts +945 -0
  182. package/plugin/loader/rsc/messageHandler.tsx +1 -0
  183. package/plugin/loader/rsc/rsc-worker.development.ts +1 -0
  184. package/plugin/plugin.ts +2 -1
  185. package/plugin/preserver/plugin.ts +2 -1
  186. package/plugin/react-client/index.ts +12 -1
  187. package/plugin/react-client/plugin.ts +351 -11
  188. package/plugin/react-server/createHandler.ts +16 -18
  189. package/plugin/react-server/createRscStream.ts +75 -42
  190. package/plugin/react-server/createSsrHandler.ts +7 -26
  191. package/plugin/react-server/plugin.ts +192 -155
  192. package/plugin/transformer/plugin.ts +70 -104
  193. package/plugin/transformer/types.ts +4 -0
  194. package/plugin/types/global.d.ts +8 -0
  195. package/plugin/types.ts +120 -64
  196. package/plugin/utils/logger.ts +52 -0
  197. package/plugin/worker/createWorker.ts +43 -44
  198. package/plugin/worker/html/html-worker.production.tsx +7 -2
  199. package/plugin/worker/html/messageHandler.ts +42 -35
  200. package/plugin/worker/html/plugin.ts +15 -11
  201. package/plugin/worker/html/renderPages.ts +177 -123
  202. package/plugin/worker/loader.ts +4 -13
  203. package/plugin/worker/plugin.ts +10 -1
  204. package/plugin/worker/rsc/index.ts +4 -13
  205. package/plugin/worker/rsc/messageHandler.tsx +143 -0
  206. package/plugin/worker/rsc/plugin.ts +38 -37
  207. package/plugin/worker/rsc/rsc-worker.development.ts +107 -0
  208. package/plugin/worker/rsc/rsc-worker.production.ts +13 -0
  209. package/plugin/worker/rsc/rsc-worker.tsx +5 -128
  210. package/plugin/worker/rsc/state.ts +37 -0
  211. package/plugin/worker/types.ts +83 -38
  212. package/scripts/check-react-version.mjs +17 -7
  213. package/scripts/react+0.0.0-experimental-b3a95caf-20250113.patch +143 -4170
  214. package/scripts/react-dom+0.0.0-experimental-b3a95caf-20250113.patch +14271 -90079
  215. package/dist/node_modules/magic-string/dist/magic-string.es.js +0 -1283
  216. package/dist/node_modules/magic-string/dist/magic-string.es.js.map +0 -1
  217. package/dist/plugin/build/createClientBuildConfig.d.ts +0 -3
  218. package/dist/plugin/build/createClientBuildConfig.d.ts.map +0 -1
  219. package/dist/plugin/build/createClientBuildConfig.js +0 -14
  220. package/dist/plugin/build/createServerBuildConfig.d.ts +0 -12
  221. package/dist/plugin/build/createServerBuildConfig.d.ts.map +0 -1
  222. package/dist/plugin/build/createServerBuildConfig.js +0 -40
  223. package/dist/plugin/build/createSharedBuildConfig.d.ts +0 -5
  224. package/dist/plugin/build/createSharedBuildConfig.d.ts.map +0 -1
  225. package/dist/plugin/build/createSharedBuildConfig.js +0 -28
  226. package/dist/plugin/build/mergeInputs.d.ts +0 -9
  227. package/dist/plugin/build/mergeInputs.d.ts.map +0 -1
  228. package/dist/plugin/build/mergeInputs.js +0 -56
  229. package/dist/plugin/components.js.map +0 -1
  230. package/dist/plugin/config/moduleIdDefault.d.ts +0 -8
  231. package/dist/plugin/config/moduleIdDefault.d.ts.map +0 -1
  232. package/dist/plugin/config/moduleIdDefault.js +0 -23
  233. package/dist/plugin/config/moduleIdDefault.js.map +0 -1
  234. package/dist/plugin/helpers/createClientInputNormalizer.d.ts +0 -8
  235. package/dist/plugin/helpers/createClientInputNormalizer.d.ts.map +0 -1
  236. package/dist/plugin/helpers/createClientInputNormalizer.js +0 -35
  237. package/dist/plugin/helpers/createServerInputNormalizer.d.ts +0 -9
  238. package/dist/plugin/helpers/createServerInputNormalizer.d.ts.map +0 -1
  239. package/dist/plugin/helpers/createServerInputNormalizer.js +0 -37
  240. package/dist/plugin/helpers/createStaticInputNormalizer.d.ts +0 -7
  241. package/dist/plugin/helpers/createStaticInputNormalizer.d.ts.map +0 -1
  242. package/dist/plugin/helpers/createStaticInputNormalizer.js +0 -18
  243. package/dist/plugin/helpers/getModuleManifest.d.ts +0 -12
  244. package/dist/plugin/helpers/getModuleManifest.d.ts.map +0 -1
  245. package/dist/plugin/helpers/getModuleManifest.js +0 -24
  246. package/dist/plugin/helpers/getModuleManifest.js.map +0 -1
  247. package/dist/plugin/helpers/inputNormalizerWorker.d.ts +0 -11
  248. package/dist/plugin/helpers/inputNormalizerWorker.d.ts.map +0 -1
  249. package/dist/plugin/helpers/inputNormalizerWorker.js +0 -30
  250. package/dist/plugin/helpers/normalizedRelativePath.d.ts +0 -11
  251. package/dist/plugin/helpers/normalizedRelativePath.d.ts.map +0 -1
  252. package/dist/plugin/helpers/normalizedRelativePath.js +0 -36
  253. package/dist/plugin/helpers/resolveFilePath.d.ts +0 -13
  254. package/dist/plugin/helpers/resolveFilePath.d.ts.map +0 -1
  255. package/dist/plugin/helpers/resolveFilePath.js +0 -74
  256. package/dist/plugin/helpers/resolveWorkerModule.d.ts +0 -6
  257. package/dist/plugin/helpers/resolveWorkerModule.d.ts.map +0 -1
  258. package/dist/plugin/helpers/resolveWorkerModule.js +0 -24
  259. package/dist/plugin/helpers/validateModuleBase.d.ts +0 -3
  260. package/dist/plugin/helpers/validateModuleBase.d.ts.map +0 -1
  261. package/dist/plugin/helpers/validateModuleBase.js +0 -16
  262. package/dist/plugin/helpers/validateResolvedConfig.d.ts +0 -3
  263. package/dist/plugin/helpers/validateResolvedConfig.d.ts.map +0 -1
  264. package/dist/plugin/helpers/validateResolvedConfig.js +0 -17
  265. package/dist/plugin/react-server/createDevMiddleware.d.ts +0 -8
  266. package/dist/plugin/react-server/createDevMiddleware.d.ts.map +0 -1
  267. package/dist/plugin/react-server/createDevMiddleware.js +0 -68
  268. package/dist/plugin/react-server/createDevServer.d.ts +0 -4
  269. package/dist/plugin/react-server/createDevServer.d.ts.map +0 -1
  270. package/dist/plugin/react-server/createDevServer.js +0 -4
  271. package/dist/plugin/react-server/createReactNodeStreamer.d.ts +0 -10
  272. package/dist/plugin/react-server/createReactNodeStreamer.d.ts.map +0 -1
  273. package/dist/plugin/react-server/createReactNodeStreamer.js +0 -7
  274. package/dist/plugin/transformer/transformer-client-components.d.ts +0 -21
  275. package/dist/plugin/transformer/transformer-client-components.d.ts.map +0 -1
  276. package/dist/plugin/transformer/transformer-client-components.js +0 -61
  277. package/dist/plugin/transformer/transformer-client-components.js.map +0 -1
  278. package/dist/plugin/transformer/transformer-server-actions.d.ts +0 -29
  279. package/dist/plugin/transformer/transformer-server-actions.d.ts.map +0 -1
  280. package/dist/plugin/transformer/transformer-server-actions.js +0 -76
  281. package/dist/plugin/transformer/transformer-server-actions.js.map +0 -1
  282. package/dist/plugin/worker/rsc/createRscStream.d.ts +0 -5
  283. package/dist/plugin/worker/rsc/createRscStream.d.ts.map +0 -1
  284. package/dist/plugin/worker/rsc/createRscStream.js +0 -39
  285. package/dist/plugin/worker/rsc/createRscStream.js.map +0 -1
  286. package/dist/plugin/worker/rsc/development.d.ts +0 -5
  287. package/dist/plugin/worker/rsc/development.d.ts.map +0 -1
  288. package/dist/plugin/worker/rsc/development.js +0 -13
  289. package/dist/plugin/worker/rsc/development.js.map +0 -1
  290. package/dist/plugin/worker/rsc/plugin.js.map +0 -1
  291. package/dist/plugin/worker/rsc/production.d.ts +0 -5
  292. package/dist/plugin/worker/rsc/production.d.ts.map +0 -1
  293. package/dist/plugin/worker/rsc/production.js +0 -13
  294. package/dist/plugin/worker/rsc/production.js.map +0 -1
  295. package/plugin/build/createClientBuildConfig.ts +0 -21
  296. package/plugin/build/createServerBuildConfig.ts +0 -66
  297. package/plugin/build/createSharedBuildConfig.ts +0 -35
  298. package/plugin/build/mergeInputs.ts +0 -58
  299. package/plugin/config/moduleIdDefault.ts +0 -23
  300. package/plugin/helpers/createClientInputNormalizer.ts +0 -48
  301. package/plugin/helpers/createServerInputNormalizer.ts +0 -52
  302. package/plugin/helpers/createStaticInputNormalizer.ts +0 -26
  303. package/plugin/helpers/getModuleManifest.ts +0 -31
  304. package/plugin/helpers/inputNormalizerWorker.ts +0 -47
  305. package/plugin/helpers/normalizedRelativePath.ts +0 -59
  306. package/plugin/helpers/resolveFilePath.ts +0 -108
  307. package/plugin/helpers/resolveWorkerModule.ts +0 -41
  308. package/plugin/helpers/validateModuleBase.ts +0 -30
  309. package/plugin/helpers/validateResolvedConfig.ts +0 -21
  310. package/plugin/react-server/createDevMiddleware.ts +0 -91
  311. package/plugin/react-server/createDevServer.ts +0 -9
  312. package/plugin/react-server/createReactNodeStreamer.ts +0 -26
  313. package/plugin/transformer/transformer-client-components.ts +0 -94
  314. package/plugin/transformer/transformer-server-actions.ts +0 -110
  315. package/plugin/worker/rsc/createRscStream.ts +0 -42
  316. package/plugin/worker/rsc/development.ts +0 -6
  317. package/plugin/worker/rsc/production.ts +0 -6
  318. package/scripts/react-server-dom-esm+0.0.1.patch +0 -24775
package/dist/client.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { reactClientPlugin } from './plugin/react-client/plugin.js';
1
+ export { vitePluginReactClient } from './plugin/react-client/index.js';
2
2
  export type * from './plugin/types.js';
3
3
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,mBAAmB,mBAAmB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,mBAAmB,mBAAmB,CAAC"}
package/dist/client.js CHANGED
@@ -3,5 +3,5 @@
3
3
  * Copyright (c) Nico Brinkkemper
4
4
  * MIT License
5
5
  */
6
- export { reactClientPlugin } from './plugin/react-client/plugin.js';
6
+ export { vitePluginReactClient } from './plugin/react-client/index.js';
7
7
  //# sourceMappingURL=client.js.map
package/dist/index.d.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import type { StreamPluginOptions } from './plugin/types.js';
2
- export declare const viteReactServer: (options: StreamPluginOptions) => Promise<import("vite").Plugin<{
3
- meta: import("./server.js").ReactStreamPluginMeta;
4
- addCssFile: (path: string) => void;
5
- }> | (() => void)>;
6
- export declare const viteReactClient: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any> | (() => void)>;
7
- export declare const viteReactStream: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any> | (() => void)>;
2
+ export declare const viteReactServer: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any>[] | (() => void)>;
3
+ export declare const viteReactClient: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any>[] | (() => void)>;
4
+ export declare const viteReactStream: (options: StreamPluginOptions) => Promise<import("vite").Plugin<any>[] | (() => void)>;
8
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,eAAO,MAAM,eAAe,YAAmB,mBAAmB;;;kBAOjE,CAAA;AAED,eAAO,MAAM,eAAe,YAAmB,mBAAmB,uDAOjE,CAAA;AAED,eAAO,MAAM,eAAe,YAAa,mBAAmB,uDAM3D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAI7D,eAAO,MAAM,eAAe,YAAmB,mBAAmB,yDAOjE,CAAA;AAED,eAAO,MAAM,eAAe,YAAmB,mBAAmB,yDAOjE,CAAA;AAED,eAAO,MAAM,eAAe,YAAa,mBAAmB,yDAM3D,CAAA"}
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ const viteReactServer = async (options) => {
10
10
  };
11
11
  } else {
12
12
  const module = await import('./server.js');
13
- return module.reactServerPlugin(options);
13
+ return module.vitePluginReactServer(options);
14
14
  }
15
15
  };
16
16
  const viteReactClient = async (options) => {
@@ -19,7 +19,7 @@ const viteReactClient = async (options) => {
19
19
  };
20
20
  } else {
21
21
  const module = await import('./client.js');
22
- return module.reactClientPlugin(options);
22
+ return module.vitePluginReactClient(options);
23
23
  }
24
24
  };
25
25
  const viteReactStream = (options) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["\"use strict\";\n\nimport type { StreamPluginOptions } from './plugin/types.js';\n\nconst isServer = process.env['NODE_OPTIONS']?.match(/--conditions[= ]react-server/)\n\nexport const viteReactServer = async (options: StreamPluginOptions)=>{\n if(!isServer){\n return ()=>{}\n } else {\n const module = await import('./server.js')\n return module.reactServerPlugin(options)\n }\n}\n\nexport const viteReactClient = async (options: StreamPluginOptions)=>{\n if(isServer){\n return ()=>{}\n } else {\n const module = await import('./client.js')\n return module.reactClientPlugin(options)\n }\n}\n\nexport const viteReactStream = (options: StreamPluginOptions)=>{\n if(isServer){\n return viteReactClient(options)\n } else {\n return viteReactServer(options)\n }\n}"],"names":[],"mappings":";;;;;AAIA,MAAM,WAAW,OAAQ,CAAA,GAAA,CAAI,cAAc,CAAA,EAAG,MAAM,8BAA8B,CAAA;AAErE,MAAA,eAAA,GAAkB,OAAO,OAA+B,KAAA;AACnE,EAAA,IAAG,CAAC,QAAS,EAAA;AACX,IAAA,OAAO,MAAI;AAAA,KAAC;AAAA,GACP,MAAA;AACL,IAAM,MAAA,MAAA,GAAS,MAAM,OAAO,aAAa,CAAA;AACzC,IAAO,OAAA,MAAA,CAAO,kBAAkB,OAAO,CAAA;AAAA;AAE3C;AAEa,MAAA,eAAA,GAAkB,OAAO,OAA+B,KAAA;AACnE,EAAA,IAAG,QAAS,EAAA;AACR,IAAA,OAAO,MAAI;AAAA,KAAC;AAAA,GACT,MAAA;AACL,IAAM,MAAA,MAAA,GAAS,MAAM,OAAO,aAAa,CAAA;AACzC,IAAO,OAAA,MAAA,CAAO,kBAAkB,OAAO,CAAA;AAAA;AAE3C;AAEa,MAAA,eAAA,GAAkB,CAAC,OAA+B,KAAA;AAC7D,EAAA,IAAG,QAAS,EAAA;AACV,IAAA,OAAO,gBAAgB,OAAO,CAAA;AAAA,GACzB,MAAA;AACL,IAAA,OAAO,gBAAgB,OAAO,CAAA;AAAA;AAElC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../index.ts"],"sourcesContent":["\"use strict\";\n\nimport type { StreamPluginOptions } from './plugin/types.js';\n\nconst isServer = process.env['NODE_OPTIONS']?.match(/--conditions[= ]react-server/)\n\nexport const viteReactServer = async (options: StreamPluginOptions)=>{\n if(!isServer){\n return ()=>{}\n } else {\n const module = await import('./server.js')\n return module.vitePluginReactServer(options)\n }\n}\n\nexport const viteReactClient = async (options: StreamPluginOptions)=>{\n if(isServer){\n return ()=>{}\n } else {\n const module = await import('./client.js')\n return module.vitePluginReactClient(options)\n }\n}\n\nexport const viteReactStream = (options: StreamPluginOptions)=>{\n if(isServer){\n return viteReactClient(options)\n } else {\n return viteReactServer(options)\n }\n}"],"names":[],"mappings":";;;;;AAIA,MAAM,WAAW,OAAQ,CAAA,GAAA,CAAI,cAAc,CAAA,EAAG,MAAM,8BAA8B,CAAA;AAErE,MAAA,eAAA,GAAkB,OAAO,OAA+B,KAAA;AACnE,EAAA,IAAG,CAAC,QAAS,EAAA;AACX,IAAA,OAAO,MAAI;AAAA,KAAC;AAAA,GACP,MAAA;AACL,IAAM,MAAA,MAAA,GAAS,MAAM,OAAO,aAAa,CAAA;AACzC,IAAO,OAAA,MAAA,CAAO,sBAAsB,OAAO,CAAA;AAAA;AAE/C;AAEa,MAAA,eAAA,GAAkB,OAAO,OAA+B,KAAA;AACnE,EAAA,IAAG,QAAS,EAAA;AACR,IAAA,OAAO,MAAI;AAAA,KAAC;AAAA,GACT,MAAA;AACL,IAAM,MAAA,MAAA,GAAS,MAAM,OAAO,aAAa,CAAA;AACzC,IAAO,OAAA,MAAA,CAAO,sBAAsB,OAAO,CAAA;AAAA;AAE/C;AAEa,MAAA,eAAA,GAAkB,CAAC,OAA+B,KAAA;AAC7D,EAAA,IAAG,QAAS,EAAA;AACV,IAAA,OAAO,gBAAgB,OAAO,CAAA;AAAA,GACzB,MAAA;AACL,IAAA,OAAO,gBAAgB,OAAO,CAAA;AAAA;AAElC;;;;"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-react-server",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Vite plugin for React Server Components (RSC)",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin/index.js",
@@ -24,7 +24,8 @@
24
24
  "./loader": "./dist/plugin/worker/loader.js",
25
25
  "./package.json": "./package.json",
26
26
  "./patch": "./scripts/patch.mjs",
27
- "./check-react-version": "./scripts/check-react-version.mjs"
27
+ "./check-react-version": "./scripts/check-react-version.mjs",
28
+ "./css-loader": "./dist/plugin/loader/css-loader.js"
28
29
  },
29
30
  "typesVersions": {
30
31
  "*": {
@@ -61,14 +62,12 @@
61
62
  "test": "npm run build && npm run test:client && NODE_ENV=development npm run test:server",
62
63
  "test:coverage": "vitest run --coverage",
63
64
  "test:ui": "vitest --ui",
65
+ "experimental:clean-install": "npm install react-server-dom-esm react@experimental react-dom@experimental",
64
66
  "experimental:copy": "cp -r ./oss-experimental/* ./node_modules/",
65
- "experimental:patch": "npx patch-package react-server-dom-esm --exclude 'nothing' && npx patch-package react react-dom",
67
+ "experimental:patch": "npx patch-package react-server-dom-esm react react-dom --exclude 'nothing'",
66
68
  "experimental:move-patches": "mv patches/* ./scripts/",
67
- "experimental:setup": "rm -rf patches/* && npm install react-server-dom-esm react@canary react-dom@canary && npm run experimental:copy && npm run experimental:patch && npm run experimental:move-patches && node scripts/check-react-version.mjs",
68
- "experimental:check": "node scripts/check-react-version.mjs",
69
- "postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package",
70
- "start": "cd template; NODE_OPTIONS='--conditions react-server' npx vite",
71
- "template:build": "cd template && NODE_OPTIONS='--conditions react-server' npx vite build"
69
+ "experimental:setup": "rm -rf patches/* && npm run experimental:clean-install && npm run experimental:copy && npm run experimental:patch && npm run experimental:move-patches && node scripts/check-react-version.mjs",
70
+ "postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package"
72
71
  },
73
72
  "keywords": [
74
73
  "vite",
@@ -80,7 +79,7 @@
80
79
  "author": "Nico Brinkkemper",
81
80
  "license": "MIT",
82
81
  "engines": {
83
- "node": "^23.6.0"
82
+ "node": "^23.7.0"
84
83
  },
85
84
  "repository": {
86
85
  "type": "git",
@@ -107,13 +106,12 @@
107
106
  }
108
107
  },
109
108
  "devDependencies": {
110
- "@types/node": "^20.17.16",
111
109
  "@types/react": "^19.0.8",
112
110
  "@types/react-dom": "^19.0.3",
113
111
  "acorn-loose": "^8.3.0",
114
112
  "patch-package": "^8.0.0",
115
- "react": "^19.1.0-canary-8759c5c8-20250207",
116
- "react-dom": "^19.1.0-canary-8759c5c8-20250207",
113
+ "react": "^0.0.0-experimental-e670e72f-20250214",
114
+ "react-dom": "^0.0.0-experimental-e670e72f-20250214",
117
115
  "react-server-dom-esm": "^0.0.1",
118
116
  "rollup": "^4.34.0",
119
117
  "source-map": "^0.7.4",
@@ -122,9 +120,13 @@
122
120
  "typescript": "^5.7.3",
123
121
  "vite": "^6.0.11",
124
122
  "vitest": "^3.0.4",
125
- "webpack-sources": "^3.2.0"
123
+ "webpack-sources": "^3.2.3"
126
124
  },
127
125
  "bin": {
128
- "vite-plugin-react-server-patch": "./scripts/check-react-version.mjs"
126
+ "check-react-version": "./scripts/check-react-version.mjs",
127
+ "patch": "./bin/patch.mjs"
128
+ },
129
+ "dependencies": {
130
+ "tsx": "^4.19.2"
129
131
  }
130
132
  }
@@ -1,2 +1,6 @@
1
- export {};
1
+ export declare function assertServerCondition<P extends typeof process>(p: P): asserts p is P & {
2
+ env: {
3
+ NODE_OPTIONS: string;
4
+ };
5
+ };
2
6
  //# sourceMappingURL=assertServerCondition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertServerCondition.d.ts","sourceRoot":"","sources":["../../plugin/assertServerCondition.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"assertServerCondition.d.ts","sourceRoot":"","sources":["../../plugin/assertServerCondition.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAWtH"}
@@ -1,4 +1,4 @@
1
- function assertServerCondition(p) {
1
+ export function assertServerCondition(p) {
2
2
  const nodeOptions = p.env['NODE_OPTIONS'];
3
3
  if (!nodeOptions?.match(/--conditions[= ]react-server/)) {
4
4
  if (!nodeOptions?.match(/--conditions/)) {
@@ -11,5 +11,3 @@ function assertServerCondition(p) {
11
11
  return undefined;
12
12
  }
13
13
  ;
14
- assertServerCondition(process);
15
- export {};
@@ -1,3 +1,3 @@
1
- import type { CheckFilesExistReturn, StreamPluginOptions } from "./types.js";
2
- export declare function checkFilesExist(pages: string[], options: Pick<StreamPluginOptions, "Page" | "props">, root: string): Promise<CheckFilesExistReturn>;
1
+ import type { CheckFilesExistReturn, ResolvedUserOptions } from "./types.js";
2
+ export declare function checkFilesExist(pages: string[], options: ResolvedUserOptions, root: string): Promise<CheckFilesExistReturn>;
3
3
  //# sourceMappingURL=checkFilesExist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkFilesExist.d.ts","sourceRoot":"","sources":["../../plugin/checkFilesExist.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAG7E,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,EACpD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,CAwEhC"}
1
+ {"version":3,"file":"checkFilesExist.d.ts","sourceRoot":"","sources":["../../plugin/checkFilesExist.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAW7E,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,CA4ChC"}
@@ -4,74 +4,59 @@
4
4
  * MIT License
5
5
  */
6
6
  import { existsSync } from 'node:fs';
7
- import { resolve, relative } from 'node:path';
8
- import { DEFAULT_CONFIG } from './config/defaults.js';
7
+ import { join } from 'node:path';
8
+ import 'vite';
9
+ import { createInputNormalizer } from './helpers/inputNormalizer.js';
9
10
 
11
+ const resolveFileOption = (pageOrProps) => {
12
+ if (typeof pageOrProps === "string") {
13
+ return () => pageOrProps;
14
+ }
15
+ return pageOrProps;
16
+ };
10
17
  async function checkFilesExist(pages, options, root) {
18
+ if (!root || root === "") {
19
+ throw new Error("Root not found");
20
+ }
11
21
  const errors = [];
12
22
  const pageSet = /* @__PURE__ */ new Set();
13
- const pageMap = /* @__PURE__ */ new Map();
14
- const toKey = (path) => {
15
- return relative(root, resolve(root, path)).replace(/\\/g, "/").replace(DEFAULT_CONFIG.FILE_REGEX, "").replace(/^\.\//, "");
16
- };
17
- if (typeof options.Page === "string") {
18
- const pagePath = options.Page;
19
- const fullPagePath = resolve(root, pagePath);
20
- const key = toKey(pagePath);
21
- pageMap.set(key, pagePath);
22
- if (!pageSet.has(key)) {
23
- if (!existsSync(fullPagePath)) {
24
- errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
25
- }
26
- pageSet.add(pagePath.replace(/^\//, ""));
27
- }
28
- } else if (typeof options.Page === "function" && pages) {
29
- for (const page of pages) {
30
- const pagePath = options.Page(page);
31
- const fullPagePath = resolve(root, pagePath);
32
- const key = toKey(pagePath);
33
- pageMap.set(key, pagePath);
34
- if (pageSet.has(key)) {
35
- continue;
36
- }
37
- if (!existsSync(fullPagePath)) {
38
- errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
39
- }
40
- pageSet.add(pagePath);
41
- }
42
- }
43
23
  const propsSet = /* @__PURE__ */ new Set();
24
+ const pageMap = /* @__PURE__ */ new Map();
44
25
  const propsMap = /* @__PURE__ */ new Map();
45
- if (typeof options.props === "string") {
46
- const propsPath = options.props;
47
- const fullPropsPath = resolve(root, propsPath);
48
- const key = toKey(propsPath);
49
- propsMap.set(key, propsPath);
50
- if (!propsSet.has(key)) {
51
- if (!existsSync(fullPropsPath)) {
52
- errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);
26
+ const urlMap = /* @__PURE__ */ new Map();
27
+ const normalizer = createInputNormalizer({
28
+ root,
29
+ preserveModulesRoot: options.build.preserveModulesRoot === true ? options.moduleBase : undefined,
30
+ removeExtension: true
31
+ });
32
+ const pageFn = resolveFileOption(options.Page);
33
+ const propsFn = resolveFileOption(options.props);
34
+ for (const page of pages) {
35
+ const pagePath = pageFn(page);
36
+ const propsPath = propsFn(page);
37
+ const [pageKey, pageValue] = normalizer(pagePath);
38
+ const [propsKey, propsValue] = normalizer(propsPath);
39
+ try {
40
+ if (!existsSync(join(root, pageValue))) {
41
+ errors.push(
42
+ `Page file not found: ${pagePath}, ${join(root, pagePath)}`
43
+ );
53
44
  }
54
- propsSet.add(propsPath);
55
- }
56
- } else if (typeof options.props === "function" && pages) {
57
- for (const page of pages) {
58
- const propsPath = options.props(page);
59
- const fullPropsPath = resolve(root, propsPath);
60
- const key = toKey(propsPath);
61
- propsMap.set(key, propsPath);
62
- if (propsSet.has(key)) {
63
- continue;
64
- }
65
- if (!existsSync(fullPropsPath)) {
66
- errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);
45
+ if (!existsSync(join(root, propsValue))) {
46
+ errors.push(
47
+ `Props file not found: ${propsPath}, ${join(root, propsPath)}`
48
+ );
67
49
  }
68
- propsSet.add(propsPath);
50
+ } catch (error) {
51
+ errors.push(`Error checking files: ${error}`);
69
52
  }
53
+ urlMap.set(page, { props: propsPath, page: pagePath });
54
+ pageSet.add(pagePath);
55
+ propsSet.add(propsPath);
56
+ pageMap.set(pageKey, pageValue);
57
+ propsMap.set(propsKey, propsValue);
70
58
  }
71
- if (errors.length) {
72
- console.warn("React Stream Plugin Validation:\n" + errors.join("\n"));
73
- }
74
- return { pageMap, pageSet, propsMap, propsSet };
59
+ return { pageMap, pageSet, propsMap, propsSet, urlMap, errors };
75
60
  }
76
61
 
77
62
  export { checkFilesExist };
@@ -1 +1 @@
1
- {"version":3,"file":"checkFilesExist.js","sources":["../../plugin/checkFilesExist.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve, relative } from \"node:path\";\nimport type { CheckFilesExistReturn, StreamPluginOptions } from \"./types.js\";\nimport { DEFAULT_CONFIG } from \"./config/defaults.js\";\n\nexport async function checkFilesExist(\n pages: string[],\n options: Pick<StreamPluginOptions, \"Page\" | \"props\">,\n root: string\n): Promise<CheckFilesExistReturn> {\n const errors: string[] = [];\n const pageSet = new Set<string>();\n const pageMap = new Map<string, string>();\n \n const toKey = (path: string) => {\n return relative(root, resolve(root, path))\n .replace(/\\\\/g, '/')\n .replace(DEFAULT_CONFIG.FILE_REGEX, '')\n .replace(/^\\.\\//, '');\n }\n // Check if files exist when string paths are provided\n if (typeof options.Page === \"string\") {\n const pagePath = options.Page;\n const fullPagePath = resolve(root, pagePath);\n const key = toKey(pagePath);\n pageMap.set(key, pagePath);\n if (!pageSet.has(key)) {\n if (!existsSync(fullPagePath)) {\n errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);\n }\n pageSet.add(pagePath.replace(/^\\//, ''));\n }\n } else if (typeof options.Page === \"function\" && pages) {\n for (const page of pages) {\n const pagePath = options.Page(page);\n const fullPagePath = resolve(root, pagePath);\n const key = toKey(pagePath);\n pageMap.set(key, pagePath);\n if (pageSet.has(key)) {\n continue;\n }\n if (!existsSync(fullPagePath)) {\n errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);\n }\n pageSet.add(pagePath);\n }\n }\n\n const propsSet = new Set<string>();\n const propsMap = new Map<string, string>();\n if (typeof options.props === \"string\") {\n const propsPath = options.props;\n const fullPropsPath = resolve(root, propsPath);\n const key = toKey(propsPath);\n propsMap.set(key, propsPath);\n if (!propsSet.has(key)) {\n if (!existsSync(fullPropsPath)) {\n errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);\n }\n propsSet.add(propsPath);\n }\n } else if (typeof options.props === \"function\" && pages) {\n for (const page of pages) {\n const propsPath = options.props(page);\n const fullPropsPath = resolve(root, propsPath);\n const key = toKey(propsPath);\n propsMap.set(key, propsPath);\n if (propsSet.has(key)) {\n continue;\n }\n if (!existsSync(fullPropsPath)) {\n errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);\n }\n propsSet.add(propsPath);\n }\n }\n\n if (errors.length) {\n console.warn(\"React Stream Plugin Validation:\\n\" + errors.join(\"\\n\"));\n }\n return { pageMap, pageSet, propsMap, propsSet };\n}\n"],"names":[],"mappings":";;;;;;;;;AAKsB,eAAA,eAAA,CACpB,KACA,EAAA,OAAA,EACA,IACgC,EAAA;AAChC,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAM,MAAA,OAAA,uBAAc,GAAY,EAAA;AAChC,EAAM,MAAA,OAAA,uBAAc,GAAoB,EAAA;AAExC,EAAM,MAAA,KAAA,GAAQ,CAAC,IAAiB,KAAA;AAC9B,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,CAAI,KAAK,SAAS,CAAA;AAC3B,MAAI,IAAA,QAAA,CAAS,GAAI,CAAA,GAAG,CAAG,EAAA;AACrB,QAAA;AAAA;AAEF,MAAI,IAAA,CAAC,UAAW,CAAA,aAAa,CAAG,EAAA;AAC9B,QAAA,MAAA,CAAO,IAAK,CAAA,CAAA,sBAAA,EAAyB,SAAS,CAAA,EAAA,EAAK,aAAa,CAAE,CAAA,CAAA;AAAA;AAEpE,MAAA,QAAA,CAAS,IAAI,SAAS,CAAA;AAAA;AACxB;AAGF,EAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,IAAA,OAAA,CAAQ,IAAK,CAAA,mCAAA,GAAsC,MAAO,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA;AAEtE,EAAA,OAAO,EAAE,OAAA,EAAS,OAAS,EAAA,QAAA,EAAU,QAAS,EAAA;AAChD;;;;"}
1
+ {"version":3,"file":"checkFilesExist.js","sources":["../../plugin/checkFilesExist.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { CheckFilesExistReturn, ResolvedUserOptions } from \"./types.js\";\nimport { normalizePath } from \"vite\";\nimport { createInputNormalizer } from \"./helpers/inputNormalizer.js\";\n\nconst resolveFileOption = (pageOrProps: string | ((url: string) => string)) => {\n if (typeof pageOrProps === \"string\") {\n return () => pageOrProps;\n }\n return pageOrProps;\n};\n\nexport async function checkFilesExist(\n pages: string[],\n options: ResolvedUserOptions,\n root: string\n): Promise<CheckFilesExistReturn> {\n if (!root || root === \"\") {\n throw new Error(\"Root not found\");\n }\n const errors: string[] = [];\n const pageSet = new Set<string>();\n const propsSet = new Set<string>();\n const pageMap = new Map<string, string>();\n const propsMap = new Map<string, string>();\n const urlMap = new Map<string, { props: string; page: string }>();\n const normalizer = createInputNormalizer({\n root,\n preserveModulesRoot: options.build.preserveModulesRoot === true ? options.moduleBase : undefined,\n removeExtension: true,\n });\n const pageFn = resolveFileOption(options.Page);\n const propsFn = resolveFileOption(options.props);\n for (const page of pages) {\n const pagePath = pageFn(page);\n const propsPath = propsFn(page);\n const [pageKey, pageValue] = normalizer(pagePath);\n const [propsKey, propsValue] = normalizer(propsPath);\n try {\n if (!existsSync(join(root, pageValue))) {\n errors.push(\n `Page file not found: ${pagePath}, ${join(root, pagePath)}`\n );\n }\n if (!existsSync(join(root, propsValue))) {\n errors.push(\n `Props file not found: ${propsPath}, ${join(root, propsPath)}`\n );\n }\n } catch (error) {\n errors.push(`Error checking files: ${error}`);\n }\n urlMap.set(page, { props: propsPath, page: pagePath });\n pageSet.add(pagePath);\n propsSet.add(propsPath);\n pageMap.set(pageKey, pageValue);\n propsMap.set(propsKey, propsValue);\n }\n\n return { pageMap, pageSet, propsMap, propsSet, urlMap, errors };\n}\n"],"names":[],"mappings":";;;;;;;;;;AAMA,MAAM,iBAAA,GAAoB,CAAC,WAAoD,KAAA;AAC7E,EAAI,IAAA,OAAO,gBAAgB,QAAU,EAAA;AACnC,IAAA,OAAO,MAAM,WAAA;AAAA;AAEf,EAAO,OAAA,WAAA;AACT,CAAA;AAEsB,eAAA,eAAA,CACpB,KACA,EAAA,OAAA,EACA,IACgC,EAAA;AAChC,EAAI,IAAA,CAAC,IAAQ,IAAA,IAAA,KAAS,EAAI,EAAA;AACxB,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA;AAAA;AAElC,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAM,MAAA,OAAA,uBAAc,GAAY,EAAA;AAChC,EAAM,MAAA,QAAA,uBAAe,GAAY,EAAA;AACjC,EAAM,MAAA,OAAA,uBAAc,GAAoB,EAAA;AACxC,EAAM,MAAA,QAAA,uBAAe,GAAoB,EAAA;AACzC,EAAM,MAAA,MAAA,uBAAa,GAA6C,EAAA;AAChE,EAAA,MAAM,aAAa,qBAAsB,CAAA;AAAA,IACvC,IAAA;AAAA,IACA,qBAAqB,OAAQ,CAAA,KAAA,CAAM,mBAAwB,KAAA,IAAA,GAAO,QAAQ,UAAa,GAA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AQ,OAAA,CAAA,GAAA,CAAI,SAAS,SAAS,CAAA;AAC9B,IAAS,QAAA,CAAA,GAAA,CAAI,UAAU,UAAU,CAAA;AAAA;AAGnC,EAAA,OAAO,EAAE,OAAS,EAAA,OAAA,EAAS,QAAU,EAAA,QAAA,EAAU,QAAQ,MAAO,EAAA;AAChE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"collect-css-manifest.d.ts","sourceRoot":"","sources":["../../plugin/collect-css-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAElD,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,gCAqB/B;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,uBA6C/B"}
1
+ {"version":3,"file":"collect-css-manifest.d.ts","sourceRoot":"","sources":["../../plugin/collect-css-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAElD,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,gCAqB/B;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,uBAiD/B"}
@@ -35,6 +35,11 @@ function collectManifestCss(manifest, root, pagePath, onCss) {
35
35
  onCss?.(id);
36
36
  return;
37
37
  }
38
+ if (id.endsWith(".css.js")) {
39
+ cssFiles.set(id.slice(0, -3), id.slice(0, -3));
40
+ onCss?.(id.slice(0, -3));
41
+ return;
42
+ }
38
43
  const entry = manifest[id];
39
44
  if (!entry) return;
40
45
  if (entry.css) {
@@ -1 +1 @@
1
- {"version":3,"file":"collect-css-manifest.js","sources":["../../plugin/collect-css-manifest.ts"],"sourcesContent":["import type { Manifest, ModuleGraph } from 'vite';\n\nexport async function collectModuleGraphCss(\n moduleGraph: ModuleGraph,\n pagePath: string,\n onCss?: (path: string) => void\n) {\n if (!pagePath) return new Map<string, string>();\n\n const cssFiles = new Map<string, string>();\n const pageModule = await moduleGraph.getModuleByUrl(pagePath, true);\n if (!pageModule) {\n return new Map<string, string>();\n }\n const seen = new Set<string>();\n const walkModule = (mod: any) => {\n if (!mod?.id || seen.has(mod.id)) return;\n seen.add(mod.id);\n if (mod?.id?.endsWith(\".css\")) {\n cssFiles.set(mod?.url, mod?.id);\n onCss?.(mod?.url);\n }\n mod?.importedModules?.forEach((imp: any) => walkModule(imp));\n };\n walkModule(pageModule);\n return cssFiles;\n}\n\nexport function collectManifestCss(\n manifest: Manifest,\n root: string,\n pagePath: string,\n onCss?: (path: string) => void\n) {\n const relativePagePath = pagePath.startsWith(root + \"/\")\n ? pagePath.slice(root.length + 1)\n : pagePath;\n if (!relativePagePath) return new Map<string, string>();\n const cssFiles = new Map<string, string>();\n const seen = new Set<string>();\n\n const walkManifestEntry = (id: string) => {\n if (seen.has(id)) return;\n seen.add(id);\n if (id.endsWith(\".css\")) {\n cssFiles.set(id, id);\n onCss?.(id);\n return;\n }\n // Get the manifest entry\n const entry = manifest[id];\n if (!entry) return;\n\n // Add direct CSS\n if (entry.css) {\n entry.css.forEach((css: string) => {\n cssFiles.set(entry.file, css);\n onCss?.(css);\n });\n }\n\n // Walk imports recursively\n if (entry.imports) {\n entry.imports.forEach((imp: string) => walkManifestEntry(imp));\n }\n\n // Also check dynamicImports\n if (entry.dynamicImports) {\n entry.dynamicImports.forEach((imp: string) => walkManifestEntry(imp));\n }\n };\n\n if (manifest[relativePagePath]) {\n walkManifestEntry(relativePagePath);\n }\n\n return cssFiles;\n}\n"],"names":[],"mappings":";;;;;AAEsB,eAAA,qBAAA,CACpB,WACA,EAAA,QAAA,EACA,KACA,EAAA;AACA,EAAA,IAAI,CAAC,QAAA,EAAiB,uBAAA,IAAI,GAAoB,EAAA;AAE9C,EAAM,MAAA,QAAA,uBAAe,GAAoB,EAAA;AACzC,EAAA,MAAM,UAAa,GAAA,MAAM,WAAY,CAAA,cAAA,CAAe,UAAU,IAAI,CAAA;AAClE,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAA,2BAAW,GAAoB,EAAA;AAAA;AAEjC,EAAM,MAAA,IAAA,uBAAW,GAAY,EAAA;AAC7B,EAAM,MAAA,UAAA,GAAa,CAAC,GAAa,KAAA;AAC/B,IAAA,IAAI,CAAC,GAAK,EAAA,EAAA,IAAM,KAAK,GAAI,CAAA,GAAA,CAAI,EAAE,CAAG,EAAA;AAClC,IAAK,IAAA,CAAA,GAAA,CAAI,IAAI,EAAE,CAAA;AACf,IAAA,IAAI,GAAK,EAAA,EAAA,EAAI,QAAS,CAAA,MAAM,CAAG,EAAA;AAC7B,MAAA,QAAA,CAAS,GAAI,CAAA,GAAA,EAAK,GAAK,EAAA,GAAA,EAAK,EAAE,CAAA;AACd;AAElB,IAAA,GAAA,EAAK,iBAAiB,OAAQ,CAAA,CAAC,GAAa,KAAA,UAAA,CAAW,GAAG,CAAC,CAAA;AAAA,GAC7D;AACA,EAAA,UAAA,CAAW,UAAU,CAAA;AACrB,EAAO,OAAA,QAAA;AACT;AAEO,SAAS,kBACd,CAAA,QAAA,EACA,IACA,EAAA,QAAA,EACA,KACA,EAAA;AACA,EAAM,MAAA,gBAAA,GAAmB,QAAS,CAAA,UAAA,CAAW,IAAO,GAAA,GAAG,CACnD,GAAA,QAAA,CAAS,KAAM,CAAA,IAAA,CAAK,MAAS,GAA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,QAAA;AACT;;;;"}
1
+ {"version":3,"file":"collect-css-manifest.js","sources":["../../plugin/collect-css-manifest.ts"],"sourcesContent":["import type { Manifest, ModuleGraph } from 'vite';\n\nexport async function collectModuleGraphCss(\n moduleGraph: ModuleGraph,\n pagePath: string,\n onCss?: (path: string) => void\n) {\n if (!pagePath) return new Map<string, string>();\n\n const cssFiles = new Map<string, string>();\n const pageModule = await moduleGraph.getModuleByUrl(pagePath, true);\n if (!pageModule) {\n return new Map<string, string>();\n }\n const seen = new Set<string>();\n const walkModule = (mod: any) => {\n if (!mod?.id || seen.has(mod.id)) return;\n seen.add(mod.id);\n if (mod?.id?.endsWith(\".css\")) {\n cssFiles.set(mod?.url, mod?.id);\n onCss?.(mod?.url);\n }\n mod?.importedModules?.forEach((imp: any) => walkModule(imp));\n };\n walkModule(pageModule);\n return cssFiles;\n}\n\nexport function collectManifestCss(\n manifest: Manifest,\n root: string,\n pagePath: string,\n onCss?: (path: string) => void\n) {\n const relativePagePath = pagePath.startsWith(root + \"/\")\n ? pagePath.slice(root.length + 1)\n : pagePath;\n if (!relativePagePath) return new Map<string, string>();\n const cssFiles = new Map<string, string>();\n const seen = new Set<string>();\n\n const walkManifestEntry = (id: string) => {\n if (seen.has(id)) return;\n seen.add(id);\n if (id.endsWith(\".css\")) {\n cssFiles.set(id, id);\n onCss?.(id);\n return;\n }\n if (id.endsWith(\".css.js\")) {\n cssFiles.set(id.slice(0, -3), id.slice(0, -3));\n onCss?.(id.slice(0, -3));\n return;\n }\n // Get the manifest entry\n const entry = manifest[id];\n if (!entry) return;\n\n // Add direct CSS\n if (entry.css) {\n entry.css.forEach((css: string) => {\n cssFiles.set(entry.file, css);\n onCss?.(css);\n });\n }\n\n // Walk imports recursively\n if (entry.imports) {\n entry.imports.forEach((imp: string) => walkManifestEntry(imp));\n }\n\n // Also check dynamicImports\n if (entry.dynamicImports) {\n entry.dynamicImports.forEach((imp: string) => walkManifestEntry(imp));\n }\n };\n\n if (manifest[relativePagePath]) {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,MAAA,KAAA,CAAM,eAAe,OAAQ,CAAA,CAAC,GAAgB,KAAA,iBAAA,CAAkB,GAAG,CAAC,CAAA;AAAA;AACtE,GACF;AAEA,EAAI,IAAA,QAAA,CAAS,gBAAgB,CAAG,EAAA;AAC9B,IAAA,iBAAA,CAAkB,gBAAgB,CAAA;AAAA;AAEpC,EAAO,OAAA,QAAA;AACT;;;;"}
@@ -1,18 +1,13 @@
1
+ import { createElement } from 'react';
1
2
  /**
2
- * vite-plugin-react-server
3
- * Copyright (c) Nico Brinkkemper
4
- * MIT License
3
+ * A component that emits <link> tags for CSS files during streaming.
4
+ * The high precedence ensures they bubble up to the document head.
5
5
  */
6
- import { createElement } from 'react';
7
-
8
- function CssCollector({ url, moduleBasePath }) {
9
- return createElement("link", {
10
- key: url,
11
- rel: "stylesheet",
12
- href: url,
13
- precedence: "high"
14
- });
6
+ export function CssCollector({ url, moduleBasePath }) {
7
+ return createElement('link', {
8
+ key: url,
9
+ rel: 'stylesheet',
10
+ href: url,
11
+ precedence: 'high'
12
+ });
15
13
  }
16
-
17
- export { CssCollector };
18
- //# sourceMappingURL=components.js.map
@@ -0,0 +1,11 @@
1
+ export declare const createModuleIdGenerator: ({ inputRoot, client, server, moduleBase, isProduction, preserveModulesRoot, imports, removeExtension }: {
2
+ isProduction: boolean;
3
+ inputRoot: string;
4
+ client: string;
5
+ server: string;
6
+ moduleBase: string;
7
+ preserveModulesRoot: boolean;
8
+ removeExtension: ((path: string) => boolean) | string | RegExp;
9
+ imports: Record<string, string>;
10
+ }) => (moduleIdPath: string, ssr?: boolean) => string;
11
+ //# sourceMappingURL=createModuleIdGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createModuleIdGenerator.d.ts","sourceRoot":"","sources":["../../../plugin/config/createModuleIdGenerator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,2GASjC;IACD,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,oBAMuB,MAAM,0BAyB7B,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * vite-plugin-react-server
3
+ * Copyright (c) Nico Brinkkemper
4
+ * MIT License
5
+ */
6
+ import { createInputNormalizer } from '../helpers/inputNormalizer.js';
7
+
8
+ const createModuleIdGenerator = ({
9
+ inputRoot,
10
+ client,
11
+ server,
12
+ moduleBase,
13
+ isProduction,
14
+ preserveModulesRoot,
15
+ imports,
16
+ removeExtension
17
+ }) => {
18
+ const normalizer = createInputNormalizer({
19
+ root: inputRoot,
20
+ removeExtension,
21
+ preserveModulesRoot: preserveModulesRoot === true ? moduleBase : undefined
22
+ });
23
+ return (moduleIdPath, ssr = isProduction) => {
24
+ const [moduleId, modulePath] = normalizer(moduleIdPath);
25
+ const key = preserveModulesRoot ? `${moduleBase}/${moduleId}` : moduleId;
26
+ const hasImports = key in imports;
27
+ if (hasImports) {
28
+ const mappedImport = imports[key];
29
+ const noRoot = mappedImport.startsWith(inputRoot) ? mappedImport.slice(inputRoot.length + 1) : mappedImport;
30
+ const noModuleBase = preserveModulesRoot ? noRoot.startsWith(moduleBase) ? noRoot.slice(moduleBase.length) : noRoot : noRoot;
31
+ return noModuleBase;
32
+ } else if (ssr && isProduction) {
33
+ const availableImports = Object.keys(imports).length > 0 ? Object.keys(imports).join(", ") : "none";
34
+ throw new Error(
35
+ `${availableImports === "none" ? "No imports." : `Module ID ${key}, ${modulePath} is not in imports. Available imports: ${availableImports}`}`
36
+ );
37
+ } else {
38
+ return moduleId;
39
+ }
40
+ };
41
+ };
42
+
43
+ export { createModuleIdGenerator };
44
+ //# sourceMappingURL=createModuleIdGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createModuleIdGenerator.js","sources":["../../../plugin/config/createModuleIdGenerator.ts"],"sourcesContent":["import { createInputNormalizer } from \"../helpers/inputNormalizer.js\";\n\nexport const createModuleIdGenerator = ({\n inputRoot,\n client,\n server,\n moduleBase,\n isProduction,\n preserveModulesRoot,\n imports,\n removeExtension\n}: {\n isProduction: boolean;\n inputRoot: string;\n client: string;\n server: string;\n moduleBase: string;\n preserveModulesRoot: boolean;\n removeExtension: ((path: string) => boolean) | string | RegExp;\n imports: Record<string, string>;\n}) => {\n const normalizer = createInputNormalizer({\n root: inputRoot,\n removeExtension: removeExtension,\n preserveModulesRoot: preserveModulesRoot === true ? moduleBase : undefined,\n });\n return (moduleIdPath: string, ssr = isProduction) => {\n const [moduleId, modulePath] = normalizer(moduleIdPath);\n const key = preserveModulesRoot ? `${moduleBase}/${moduleId}` : moduleId;\n const hasImports = key in imports;\n\n if (hasImports) {\n // Return the actual file path from the manifest\n const mappedImport = imports[key];\n const noRoot = mappedImport.startsWith(inputRoot) ? mappedImport.slice(inputRoot.length +1) : mappedImport;\n const noModuleBase = preserveModulesRoot ? noRoot.startsWith(moduleBase) ? noRoot.slice(moduleBase.length) : noRoot : noRoot;\n return noModuleBase;\n } else if (ssr && isProduction) {\n // Only throw in production SSR builds\n const availableImports =\n Object.keys(imports).length > 0\n ? Object.keys(imports).join(\", \")\n : \"none\";\n throw new Error(\n `${availableImports === \"none\" ? \"No imports.\" : `Module ID ${key}, ${modulePath} is not in imports. Available imports: ${availableImports}`}`\n );\n } else {\n // For development or non-SSR builds, use the module ID\n return moduleId;\n }\n };\n};\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,0BAA0B,CAAC;AAAA,EACtC,SAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,mBA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AG,CAAK,EAAA,EAAA,UAAU,CAA0C,uCAAA,EAAA,gBAAgB,CAAE,CAAA,CAAA;AAAA,OAC9I;AAAA,KACK,MAAA;AAEL,MAAO,OAAA,QAAA;AAAA;AACT,GACF;AACF;;;;"}
@@ -5,14 +5,14 @@ export declare const DEFAULT_CONFIG: {
5
5
  readonly MODULE_BASE: "src";
6
6
  readonly MODULE_BASE_PATH: "/src";
7
7
  readonly MODULE_BASE_URL: "/src";
8
- readonly PAGE: "/src/page/page.tsx";
9
- readonly PROPS: "/src/page/props.ts";
10
- readonly CLIENT_ENTRY: "/src/client.tsx";
11
- readonly SERVER_ENTRY: "/src/server.tsx";
12
- readonly PAGE_EXPORT: "Page";
13
- readonly PROPS_EXPORT: "props";
14
- readonly HTML_WORKER_PATH: "worker/html/html-worker.js";
15
- readonly RSC_WORKER_PATH: "worker/rsc/rsc-worker.js";
8
+ readonly PAGE: "src/page/page.tsx";
9
+ readonly PROPS: "src/page/props.ts";
10
+ readonly CLIENT_ENTRY: "src/client.tsx";
11
+ readonly SERVER_ENTRY: "src/server.tsx";
12
+ readonly PAGE_EXPORT_NAME: "Page";
13
+ readonly PROPS_EXPORT_NAME: "props";
14
+ readonly HTML_WORKER_PATH: "worker/html/html-worker.production.js" | "worker/html/html-worker.development.js";
15
+ readonly RSC_WORKER_PATH: "worker/rsc/rsc-worker.production.js" | "worker/rsc/rsc-worker.development.js";
16
16
  readonly LOADER_PATH: "worker/loader.js";
17
17
  readonly RSC_EXTENSION: ".rsc";
18
18
  readonly HTML: ({ children }: {
@@ -20,8 +20,6 @@ export declare const DEFAULT_CONFIG: {
20
20
  }) => any;
21
21
  readonly COLLECT_CSS: true;
22
22
  readonly COLLECT_ASSETS: true;
23
- readonly PAGE_PATTERN: "/src/page/**/*.page.tsx";
24
- readonly PROPS_PATTERN: "/src/page/**/*.props.ts";
25
23
  readonly DEV_PORT: 5173;
26
24
  readonly PREVIEW_PORT: 4173;
27
25
  readonly DEV_HOST: "localhost";
@@ -29,23 +27,28 @@ export declare const DEFAULT_CONFIG: {
29
27
  readonly ENV_PREFIX: "VITE_";
30
28
  readonly BUILD: {
31
29
  readonly pages: () => string[];
32
- readonly client: "dist/client";
33
- readonly server: "dist/server";
34
- readonly static: "dist/static";
30
+ readonly client: "client";
31
+ readonly server: "server";
32
+ readonly static: "static";
33
+ readonly api: "api";
34
+ readonly outDir: "dist";
35
+ readonly assetsDir: "assets";
36
+ readonly hash: "hash";
37
+ readonly preserveModulesRoot: true;
35
38
  };
36
39
  readonly MODULE_BASE_EXCEPTIONS: string[];
37
40
  readonly AUTO_DISCOVER: {
38
- readonly pagePattern: RegExp;
39
- readonly propsPattern: RegExp;
40
- readonly clientComponents: RegExp;
41
- readonly serverFunctions: RegExp;
41
+ readonly modulePattern: (n: string) => boolean;
42
+ readonly pagePattern: (n: string) => boolean;
43
+ readonly propsPattern: (n: string) => boolean;
44
+ readonly clientComponents: (n: string) => boolean;
45
+ readonly serverFunctions: (n: string) => boolean;
46
+ readonly cssPattern: (n: string) => boolean;
47
+ readonly cssModulePattern: (n: string) => boolean;
48
+ readonly vendorPattern: (n: string) => boolean;
49
+ readonly htmlPattern: (n: string) => boolean;
50
+ readonly jsonPattern: (n: string) => boolean;
42
51
  };
43
- readonly MODULE_ID: ({ projectRoot, output: _, isProduction, }: {
44
- isProduction: boolean;
45
- projectRoot: string;
46
- output: {
47
- dir: string;
48
- };
49
- }) => (moduleId: string) => string;
52
+ readonly MODULE_ID: (id: string) => string;
50
53
  };
51
54
  //# sourceMappingURL=defaults.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../plugin/config/defaults.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;kCAiBJ;QAAE,QAAQ,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;qCAgBR,MAAM,EAAE;;;;;;;;;;;;;;CAQ9B,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../plugin/config/defaults.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;kCAiBJ;QAAE,QAAQ,EAAE,GAAG,CAAA;KAAE;;;;;;;;;;;;;;;;;;;qCAmBR,MAAM,EAAE;;oCAEjB,MAAM;kCACR,MAAM;mCACL,MAAM;uCACF,MAAM;sCACP,MAAM;iCACX,MAAM;uCACA,MAAM;oCACT,MAAM;kCACR,MAAM;kCACN,MAAM;;6BAET,MAAM;CACd,CAAC"}