vite-plugin-react-server 0.3.11 → 0.3.14

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 (221) hide show
  1. package/dist/package.json +15 -11
  2. package/dist/plugin/checkFilesExist.d.ts +2 -2
  3. package/dist/plugin/checkFilesExist.d.ts.map +1 -1
  4. package/dist/plugin/checkFilesExist.js +39 -57
  5. package/dist/plugin/checkFilesExist.js.map +1 -1
  6. package/dist/plugin/collect-css-manifest.d.ts +1 -1
  7. package/dist/plugin/collect-css-manifest.d.ts.map +1 -1
  8. package/dist/plugin/collect-css-manifest.js +8 -3
  9. package/dist/plugin/collect-css-manifest.js.map +1 -1
  10. package/dist/plugin/components.js +10 -15
  11. package/dist/plugin/config/createModuleIdGenerator.js +1 -1
  12. package/dist/plugin/config/createModuleIdGenerator.js.map +1 -1
  13. package/dist/plugin/config/defaults.d.ts +5 -14
  14. package/dist/plugin/config/defaults.d.ts.map +1 -1
  15. package/dist/plugin/config/defaults.js +12 -12
  16. package/dist/plugin/config/defaults.js.map +1 -1
  17. package/dist/plugin/config/getPaths.js +1 -1
  18. package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
  19. package/dist/plugin/config/resolveOptions.js +73 -52
  20. package/dist/plugin/config/resolveOptions.js.map +1 -1
  21. package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
  22. package/dist/plugin/config/resolveUserConfig.js +53 -65
  23. package/dist/plugin/config/resolveUserConfig.js.map +1 -1
  24. package/dist/plugin/helpers/getBundleManifest.d.ts +6 -1
  25. package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
  26. package/dist/plugin/helpers/getBundleManifest.js +48 -19
  27. package/dist/plugin/helpers/getBundleManifest.js.map +1 -1
  28. package/dist/plugin/helpers/inputNormalizer.d.ts +1 -2
  29. package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
  30. package/dist/plugin/helpers/inputNormalizer.js +52 -46
  31. package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
  32. package/dist/plugin/helpers/tryManifest.d.ts +1 -1
  33. package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
  34. package/dist/plugin/helpers/tryManifest.js.map +1 -1
  35. package/dist/plugin/loader/createBuildLoader.d.ts +1 -1
  36. package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -1
  37. package/dist/plugin/loader/createBuildLoader.js +29 -26
  38. package/dist/plugin/loader/createBuildLoader.js.map +1 -1
  39. package/dist/plugin/loader/css-loader.d.ts +16 -0
  40. package/dist/plugin/loader/css-loader.d.ts.map +1 -0
  41. package/dist/plugin/loader/css-loader.js +70 -0
  42. package/dist/plugin/loader/css-loader.js.map +1 -0
  43. package/dist/plugin/loader/react-loader.d.ts +17 -0
  44. package/dist/plugin/loader/react-loader.d.ts.map +1 -0
  45. package/dist/plugin/loader/react-loader.js +647 -0
  46. package/dist/plugin/loader/react-loader.js.map +1 -0
  47. package/dist/plugin/loader/rsc/messageHandler.d.ts +2 -0
  48. package/dist/plugin/loader/rsc/messageHandler.d.ts.map +1 -0
  49. package/dist/plugin/loader/rsc/messageHandler.js +1 -0
  50. package/dist/plugin/loader/rsc/rsc-worker.development.d.ts +2 -0
  51. package/dist/plugin/loader/rsc/rsc-worker.development.d.ts.map +1 -0
  52. package/dist/plugin/loader/rsc/rsc-worker.development.js +1 -0
  53. package/dist/plugin/react-client/index.js +2 -2
  54. package/dist/plugin/react-client/index.js.map +1 -1
  55. package/dist/plugin/react-client/plugin.d.ts.map +1 -1
  56. package/dist/plugin/react-client/plugin.js +202 -25
  57. package/dist/plugin/react-client/plugin.js.map +1 -1
  58. package/dist/plugin/react-server/createHandler.d.ts.map +1 -1
  59. package/dist/plugin/react-server/createHandler.js +13 -7
  60. package/dist/plugin/react-server/createHandler.js.map +1 -1
  61. package/dist/plugin/react-server/createRscStream.d.ts +15 -3
  62. package/dist/plugin/react-server/createRscStream.d.ts.map +1 -1
  63. package/dist/plugin/react-server/createRscStream.js +52 -49
  64. package/dist/plugin/react-server/createRscStream.js.map +1 -1
  65. package/dist/plugin/react-server/plugin.d.ts.map +1 -1
  66. package/dist/plugin/react-server/plugin.js +76 -27
  67. package/dist/plugin/react-server/plugin.js.map +1 -1
  68. package/dist/plugin/transformer/plugin.d.ts.map +1 -1
  69. package/dist/plugin/transformer/plugin.js +65 -52
  70. package/dist/plugin/transformer/plugin.js.map +1 -1
  71. package/dist/plugin/types.d.ts +6 -1
  72. package/dist/plugin/types.d.ts.map +1 -1
  73. package/dist/plugin/utils/logger.d.ts +9 -0
  74. package/dist/plugin/utils/logger.d.ts.map +1 -0
  75. package/dist/plugin/utils/logger.js +68 -0
  76. package/dist/plugin/utils/logger.js.map +1 -0
  77. package/dist/plugin/worker/createWorker.d.ts +1 -0
  78. package/dist/plugin/worker/createWorker.d.ts.map +1 -1
  79. package/dist/plugin/worker/createWorker.js +23 -36
  80. package/dist/plugin/worker/createWorker.js.map +1 -1
  81. package/dist/plugin/worker/html/html-worker.production.js +5 -1
  82. package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
  83. package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
  84. package/dist/plugin/worker/html/messageHandler.js +10 -19
  85. package/dist/plugin/worker/html/messageHandler.js.map +1 -1
  86. package/dist/plugin/worker/html/renderPages.d.ts +3 -3
  87. package/dist/plugin/worker/html/renderPages.d.ts.map +1 -1
  88. package/dist/plugin/worker/html/renderPages.js +148 -131
  89. package/dist/plugin/worker/html/renderPages.js.map +1 -1
  90. package/dist/plugin/worker/rsc/index.d.ts +1 -3
  91. package/dist/plugin/worker/rsc/index.d.ts.map +1 -1
  92. package/dist/plugin/worker/rsc/index.js +1 -9
  93. package/dist/plugin/worker/rsc/index.js.map +1 -1
  94. package/dist/plugin/worker/rsc/messageHandler.d.ts +3 -0
  95. package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -0
  96. package/dist/plugin/worker/rsc/messageHandler.js +107 -0
  97. package/dist/plugin/worker/rsc/messageHandler.js.map +1 -0
  98. package/dist/plugin/worker/rsc/plugin.d.ts.map +1 -1
  99. package/dist/plugin/worker/rsc/plugin.js +74 -80
  100. package/dist/plugin/worker/rsc/rsc-worker.development.d.ts +32 -0
  101. package/dist/plugin/worker/rsc/rsc-worker.development.d.ts.map +1 -0
  102. package/dist/plugin/worker/rsc/rsc-worker.development.js +43 -0
  103. package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -0
  104. package/dist/plugin/worker/rsc/rsc-worker.js +4 -106
  105. package/dist/plugin/worker/rsc/rsc-worker.production.d.ts +2 -0
  106. package/dist/plugin/worker/rsc/rsc-worker.production.d.ts.map +1 -0
  107. package/dist/plugin/worker/rsc/rsc-worker.production.js +14 -0
  108. package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -0
  109. package/dist/plugin/worker/rsc/state.d.ts +11 -0
  110. package/dist/plugin/worker/rsc/state.d.ts.map +1 -0
  111. package/dist/plugin/worker/rsc/state.js +12 -0
  112. package/dist/plugin/worker/rsc/state.js.map +1 -0
  113. package/dist/plugin/worker/types.d.ts +60 -46
  114. package/dist/plugin/worker/types.d.ts.map +1 -1
  115. package/dist/tsconfig.tsbuildinfo +1 -1
  116. package/package.json +15 -11
  117. package/plugin/checkFilesExist.ts +42 -62
  118. package/plugin/collect-css-manifest.ts +9 -4
  119. package/plugin/config/createModuleIdGenerator.ts +1 -1
  120. package/plugin/config/defaults.ts +13 -15
  121. package/plugin/config/resolveOptions.ts +134 -76
  122. package/plugin/config/resolveUserConfig.ts +75 -76
  123. package/plugin/helpers/getBundleManifest.ts +69 -31
  124. package/plugin/helpers/inputNormalizer.ts +82 -70
  125. package/plugin/helpers/tryManifest.ts +1 -1
  126. package/plugin/loader/createBuildLoader.ts +38 -41
  127. package/plugin/loader/css-loader.ts +96 -0
  128. package/plugin/loader/react-loader.ts +945 -0
  129. package/plugin/loader/rsc/messageHandler.tsx +1 -0
  130. package/plugin/loader/rsc/rsc-worker.development.ts +1 -0
  131. package/plugin/react-client/index.ts +1 -1
  132. package/plugin/react-client/plugin.ts +266 -41
  133. package/plugin/react-server/createHandler.ts +12 -8
  134. package/plugin/react-server/createRscStream.ts +75 -54
  135. package/plugin/react-server/plugin.ts +86 -35
  136. package/plugin/transformer/plugin.ts +67 -76
  137. package/plugin/types/global.d.ts +8 -0
  138. package/plugin/types.ts +3 -1
  139. package/plugin/utils/logger.ts +52 -0
  140. package/plugin/worker/createWorker.ts +43 -44
  141. package/plugin/worker/html/html-worker.production.tsx +7 -2
  142. package/plugin/worker/html/messageHandler.ts +13 -21
  143. package/plugin/worker/html/renderPages.ts +166 -181
  144. package/plugin/worker/rsc/index.ts +4 -13
  145. package/plugin/worker/rsc/messageHandler.tsx +143 -0
  146. package/plugin/worker/rsc/plugin.ts +38 -37
  147. package/plugin/worker/rsc/rsc-worker.development.ts +107 -0
  148. package/plugin/worker/rsc/rsc-worker.production.ts +13 -0
  149. package/plugin/worker/rsc/rsc-worker.tsx +5 -128
  150. package/plugin/worker/rsc/state.ts +37 -0
  151. package/plugin/worker/types.ts +79 -55
  152. package/scripts/check-react-version.mjs +17 -7
  153. package/scripts/react+0.0.0-experimental-b3a95caf-20250113.patch +143 -4170
  154. package/scripts/react-dom+0.0.0-experimental-b3a95caf-20250113.patch +14271 -90079
  155. package/dist/plugin/components.js.map +0 -1
  156. package/dist/plugin/helpers/createClientInputNormalizer.d.ts +0 -8
  157. package/dist/plugin/helpers/createClientInputNormalizer.d.ts.map +0 -1
  158. package/dist/plugin/helpers/createClientInputNormalizer.js +0 -35
  159. package/dist/plugin/helpers/createServerInputNormalizer.d.ts +0 -9
  160. package/dist/plugin/helpers/createServerInputNormalizer.d.ts.map +0 -1
  161. package/dist/plugin/helpers/createServerInputNormalizer.js +0 -37
  162. package/dist/plugin/helpers/createStaticInputNormalizer.d.ts +0 -7
  163. package/dist/plugin/helpers/createStaticInputNormalizer.d.ts.map +0 -1
  164. package/dist/plugin/helpers/createStaticInputNormalizer.js +0 -18
  165. package/dist/plugin/helpers/getModuleManifest.d.ts +0 -17
  166. package/dist/plugin/helpers/getModuleManifest.d.ts.map +0 -1
  167. package/dist/plugin/helpers/getModuleManifest.js +0 -23
  168. package/dist/plugin/helpers/inputNormalizerWorker.d.ts +0 -12
  169. package/dist/plugin/helpers/inputNormalizerWorker.d.ts.map +0 -1
  170. package/dist/plugin/helpers/inputNormalizerWorker.js +0 -33
  171. package/dist/plugin/helpers/normalizedRelativePath.d.ts +0 -11
  172. package/dist/plugin/helpers/normalizedRelativePath.d.ts.map +0 -1
  173. package/dist/plugin/helpers/normalizedRelativePath.js +0 -36
  174. package/dist/plugin/helpers/resolveFilePath.d.ts +0 -13
  175. package/dist/plugin/helpers/resolveFilePath.d.ts.map +0 -1
  176. package/dist/plugin/helpers/resolveFilePath.js +0 -74
  177. package/dist/plugin/helpers/resolveWorkerModule.d.ts +0 -6
  178. package/dist/plugin/helpers/resolveWorkerModule.d.ts.map +0 -1
  179. package/dist/plugin/helpers/resolveWorkerModule.js +0 -24
  180. package/dist/plugin/helpers/validateModuleBase.d.ts +0 -3
  181. package/dist/plugin/helpers/validateModuleBase.d.ts.map +0 -1
  182. package/dist/plugin/helpers/validateModuleBase.js +0 -16
  183. package/dist/plugin/helpers/validateResolvedConfig.d.ts +0 -3
  184. package/dist/plugin/helpers/validateResolvedConfig.d.ts.map +0 -1
  185. package/dist/plugin/helpers/validateResolvedConfig.js +0 -17
  186. package/dist/plugin/transformer/transformer-client-components.d.ts +0 -30
  187. package/dist/plugin/transformer/transformer-client-components.d.ts.map +0 -1
  188. package/dist/plugin/transformer/transformer-client-components.js +0 -122
  189. package/dist/plugin/transformer/transformer-client-components.js.map +0 -1
  190. package/dist/plugin/transformer/transformer-server-actions.d.ts +0 -29
  191. package/dist/plugin/transformer/transformer-server-actions.d.ts.map +0 -1
  192. package/dist/plugin/transformer/transformer-server-actions.js +0 -90
  193. package/dist/plugin/worker/rsc/createRscStream.d.ts +0 -5
  194. package/dist/plugin/worker/rsc/createRscStream.d.ts.map +0 -1
  195. package/dist/plugin/worker/rsc/createRscStream.js +0 -39
  196. package/dist/plugin/worker/rsc/createRscStream.js.map +0 -1
  197. package/dist/plugin/worker/rsc/development.d.ts +0 -5
  198. package/dist/plugin/worker/rsc/development.d.ts.map +0 -1
  199. package/dist/plugin/worker/rsc/development.js +0 -13
  200. package/dist/plugin/worker/rsc/development.js.map +0 -1
  201. package/dist/plugin/worker/rsc/plugin.js.map +0 -1
  202. package/dist/plugin/worker/rsc/production.d.ts +0 -5
  203. package/dist/plugin/worker/rsc/production.d.ts.map +0 -1
  204. package/dist/plugin/worker/rsc/production.js +0 -13
  205. package/dist/plugin/worker/rsc/production.js.map +0 -1
  206. package/plugin/helpers/createClientInputNormalizer.ts +0 -48
  207. package/plugin/helpers/createServerInputNormalizer.ts +0 -52
  208. package/plugin/helpers/createStaticInputNormalizer.ts +0 -26
  209. package/plugin/helpers/getModuleManifest.ts +0 -36
  210. package/plugin/helpers/inputNormalizerWorker.ts +0 -52
  211. package/plugin/helpers/normalizedRelativePath.ts +0 -59
  212. package/plugin/helpers/resolveFilePath.ts +0 -108
  213. package/plugin/helpers/resolveWorkerModule.ts +0 -41
  214. package/plugin/helpers/validateModuleBase.ts +0 -30
  215. package/plugin/helpers/validateResolvedConfig.ts +0 -21
  216. package/plugin/transformer/transformer-client-components.ts +0 -168
  217. package/plugin/transformer/transformer-server-actions.ts +0 -125
  218. package/plugin/worker/rsc/createRscStream.ts +0 -42
  219. package/plugin/worker/rsc/development.ts +0 -6
  220. package/plugin/worker/rsc/production.ts +0 -6
  221. package/scripts/react-server-dom-esm+0.0.1.patch +0 -24775
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-react-server",
3
- "version": "0.3.11",
3
+ "version": "0.3.14",
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,11 +62,11 @@
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
+ "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",
69
70
  "postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package"
70
71
  },
71
72
  "keywords": [
@@ -78,7 +79,7 @@
78
79
  "author": "Nico Brinkkemper",
79
80
  "license": "MIT",
80
81
  "engines": {
81
- "node": "^23.6.0"
82
+ "node": "^23.7.0"
82
83
  },
83
84
  "repository": {
84
85
  "type": "git",
@@ -105,13 +106,12 @@
105
106
  }
106
107
  },
107
108
  "devDependencies": {
108
- "@types/node": "^20.17.16",
109
109
  "@types/react": "^19.0.8",
110
110
  "@types/react-dom": "^19.0.3",
111
111
  "acorn-loose": "^8.3.0",
112
112
  "patch-package": "^8.0.0",
113
- "react": "^19.1.0-canary-8759c5c8-20250207",
114
- "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",
115
115
  "react-server-dom-esm": "^0.0.1",
116
116
  "rollup": "^4.34.0",
117
117
  "source-map": "^0.7.4",
@@ -120,9 +120,13 @@
120
120
  "typescript": "^5.7.3",
121
121
  "vite": "^6.0.11",
122
122
  "vitest": "^3.0.4",
123
- "webpack-sources": "^3.2.0"
123
+ "webpack-sources": "^3.2.3"
124
124
  },
125
125
  "bin": {
126
- "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"
127
131
  }
128
132
  }
@@ -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"}
@@ -5,76 +5,58 @@
5
5
  */
6
6
  import { existsSync } from 'node:fs';
7
7
  import { join } from 'node:path';
8
- import { normalizePath } from 'vite';
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) {
11
18
  if (!root || root === "") {
12
19
  throw new Error("Root not found");
13
20
  }
14
21
  const errors = [];
15
22
  const pageSet = /* @__PURE__ */ new Set();
16
- const pageMap = /* @__PURE__ */ new Map();
17
- const toKey = (path) => {
18
- return normalizePath(path);
19
- };
20
- if (typeof options.Page === "string") {
21
- const pagePath = options.Page;
22
- const fullPagePath = join(root, pagePath);
23
- const key = toKey(pagePath);
24
- pageMap.set(key, pagePath);
25
- if (!pageSet.has(key)) {
26
- if (!existsSync(fullPagePath)) {
27
- errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
28
- }
29
- pageSet.add(pagePath.replace(/^\//, ""));
30
- }
31
- } else if (typeof options.Page === "function" && pages) {
32
- for (const page of pages) {
33
- const pagePath = options.Page(page);
34
- const fullPagePath = join(root, pagePath);
35
- const key = toKey(pagePath);
36
- pageMap.set(key, pagePath);
37
- if (pageSet.has(key)) {
38
- continue;
39
- }
40
- if (!existsSync(fullPagePath)) {
41
- errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
42
- }
43
- pageSet.add(pagePath);
44
- }
45
- }
46
23
  const propsSet = /* @__PURE__ */ new Set();
24
+ const pageMap = /* @__PURE__ */ new Map();
47
25
  const propsMap = /* @__PURE__ */ new Map();
48
- if (typeof options.props === "string") {
49
- const propsPath = options.props;
50
- const fullPropsPath = join(root, propsPath);
51
- const key = toKey(propsPath);
52
- propsMap.set(key, propsPath);
53
- if (!propsSet.has(key)) {
54
- if (!existsSync(fullPropsPath)) {
55
- 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
+ );
56
44
  }
57
- propsSet.add(propsPath);
58
- }
59
- } else if (typeof options.props === "function" && pages) {
60
- for (const page of pages) {
61
- const propsPath = options.props(page);
62
- const fullPropsPath = join(root, propsPath);
63
- const key = toKey(propsPath);
64
- propsMap.set(key, propsPath);
65
- if (propsSet.has(key)) {
66
- continue;
67
- }
68
- if (!existsSync(fullPropsPath)) {
69
- 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
+ );
70
49
  }
71
- propsSet.add(propsPath);
50
+ } catch (error) {
51
+ errors.push(`Error checking files: ${error}`);
72
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);
73
58
  }
74
- if (errors.length) {
75
- console.warn("React Stream Plugin Validation:\n" + errors.join("\n"));
76
- }
77
- return { pageMap, pageSet, propsMap, propsSet };
59
+ return { pageMap, pageSet, propsMap, propsSet, urlMap, errors };
78
60
  }
79
61
 
80
62
  export { checkFilesExist };
@@ -1 +1 @@
1
- {"version":3,"file":"checkFilesExist.js","sources":["../../plugin/checkFilesExist.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { CheckFilesExistReturn, StreamPluginOptions } from \"./types.js\";\nimport { normalizePath } from \"vite\";\n\nexport async function checkFilesExist(\n pages: string[],\n options: Pick<StreamPluginOptions, \"Page\" | \"props\">,\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 pageMap = new Map<string, string>();\n \n const toKey = (path: string) => {\n return normalizePath(path)\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 = join(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 = join(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 = join(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 = join(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,EAAG,IAAA,CAAC,IAAQ,IAAA,IAAA,KAAS,EAAI,EAAA;AACvB,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA;AAAA;AAElC,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,IAAA,OAAO,cAAc,IAAI,CAAA;AAAA,GAC3B;AAEA,EAAI,IAAA,OAAO,OAAQ,CAAA,IAAA,KAAS,QAAU,EAAA;AACpC,IAAA,MAAM,WAAW,OAAQ,CAAA,IAAA;AACzB,IAAM,MAAA,YAAA,GAAe,IAAK,CAAA,IAAA,EAAM,QAAQ,CAAA;AACxC,IAAM,MAAA,GAAA,GAAM,MAAM,QAAQ,CAAA;AAC1B,IAAQ,OAAA,CAAA,GAAA,CAAI,KAAK,QAAQ,CAAA;AACzB,IAAA,IAAI,CAAC,OAAA,CAAQ,GAAI,CAAA,GAAG,CAAG,EAAA;AACrB,MAAI,IAAA,CAAC,UAAW,CAAA,YAAY,CAAG,EAAA;AAC7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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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A,UACL,wBAAwB,QAAQ,CAAA,EAAA,EAAK,IAAK,CAAA,IAAA,EAAM,QAAQ,CAAC,CAAA;AAAA,SAC3D;AAAA;AAEF,MAAA,IAAI,CAAC,UAAW,CAAA,IAAA,CAAK,IAAM,EAAA,UAAU,CAAC,CAAG,EAAA;AACvC,QAAO,MAAA,CAAA,IAAA;AAAA,UACL,yBAAyB,SAAS,CAAA,EAAA,EAAK,IAAK,CAAA,IAAA,EAAM,SAAS,CAAC,CAAA;AAAA,SAC9D;AAAA;AACF,aACO,KAAO,EAAA;AACd,MAAO,MAAA,CAAA,IAAA,CAAK,CAAyB,sBAAA,EAAA,KAAK,CAAE,CAAA,CAAA;AAAA;AAE9C,IAAA,MAAA,CAAO,IAAI,IAAM,EAAA,EAAE,OAAO,SAAW,EAAA,IAAA,EAAM,UAAU,CAAA;AACrD,IAAA,OAAA,CAAQ,IAAI,QAAQ,CAAA;AACpB,IAAA,QAAA,CAAS,IAAI,SAAS,CAAA;AACtB,IAAQ,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,4 +1,4 @@
1
1
  import type { Manifest, ModuleGraph } from 'vite';
2
2
  export declare function collectModuleGraphCss(moduleGraph: ModuleGraph, pagePath: string, onCss?: (path: string) => void): Promise<Map<string, string>>;
3
- export declare function collectManifestCss(manifest: Manifest, root: string, pagePath: string, onCss?: (path: string) => void): Map<string, string>;
3
+ export declare function collectManifestCss(manifest: Manifest, root: string, pagePath: string, onCss?: (path: string, parentUrl: string) => void, parentUrl?: string): Map<string, string>;
4
4
  //# sourceMappingURL=collect-css-manifest.d.ts.map
@@ -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,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,EACjD,SAAS,CAAC,EAAE,MAAM,uBAiDnB"}
@@ -22,7 +22,7 @@ async function collectModuleGraphCss(moduleGraph, pagePath, onCss) {
22
22
  walkModule(pageModule);
23
23
  return cssFiles;
24
24
  }
25
- function collectManifestCss(manifest, root, pagePath, onCss) {
25
+ function collectManifestCss(manifest, root, pagePath, onCss, parentUrl) {
26
26
  const relativePagePath = pagePath.startsWith(root + "/") ? pagePath.slice(root.length + 1) : pagePath;
27
27
  if (!relativePagePath) return /* @__PURE__ */ new Map();
28
28
  const cssFiles = /* @__PURE__ */ new Map();
@@ -32,7 +32,12 @@ function collectManifestCss(manifest, root, pagePath, onCss) {
32
32
  seen.add(id);
33
33
  if (id.endsWith(".css")) {
34
34
  cssFiles.set(id, id);
35
- onCss?.(id);
35
+ onCss?.(id, parentUrl ?? pagePath);
36
+ return;
37
+ }
38
+ if (id.endsWith(".css.js")) {
39
+ cssFiles.set(id.slice(0, -3), id.slice(0, -3));
40
+ onCss?.(id.slice(0, -3), parentUrl ?? pagePath);
36
41
  return;
37
42
  }
38
43
  const entry = manifest[id];
@@ -40,7 +45,7 @@ function collectManifestCss(manifest, root, pagePath, onCss) {
40
45
  if (entry.css) {
41
46
  entry.css.forEach((css) => {
42
47
  cssFiles.set(entry.file, css);
43
- onCss?.(css);
48
+ onCss?.(css, parentUrl ?? pagePath);
44
49
  });
45
50
  }
46
51
  if (entry.imports) {
@@ -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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,CAAM,QAAQ,OAAQ,CAAA,CAAC,GAAgB,KAAA,iBAAA,CAAkB,GAAG,CAAC,CAAA;AAAA;AAI/D,IAAA,IAAI,MAAM,cAAgB,EAAA;AACxB,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;AAGpC,EAAO,OAAA,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, parentUrl: string) => void,\n parentUrl?: string\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, parentUrl ?? pagePath);\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), parentUrl ?? pagePath);\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, parentUrl ?? pagePath);\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 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,EAA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AAA;AACzB,IAAA,IAAI,CAAC,KAAO,EAAA;AAGZ,IAAA,IAAI,MAAM,GAAK,EAAA;AACb,MAAM,KAAA,CAAA,GAAA,CAAI,OAAQ,CAAA,CAAC,GAAgB,KAAA;AACjC,QAAS,QAAA,CAAA,GAAA,CAAI,KAAM,CAAA,IAAA,EAAM,GAAG,CAAA;AAC5B,QAAQ,KAAA,GAAA,GAAA,EAAK,aAAa,QAAQ,CAAA;AAAA,OACnC,CAAA;AAAA;AAIH,IAAA,IAAI,MAAM,OAAS,EAAA;AACjB,MAAA,KAAA,CAAM,QAAQ,OAAQ,CAAA,CAAC,GAAgB,KAAA,iBAAA,CAAkB,GAAG,CAAC,CAAA;AAAA;AAI/D,IAAA,IAAI,MAAM,cAAgB,EAAA;AACxB,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
@@ -32,7 +32,7 @@ const createModuleIdGenerator = ({
32
32
  } else if (ssr && isProduction) {
33
33
  const availableImports = Object.keys(imports).length > 0 ? Object.keys(imports).join(", ") : "none";
34
34
  throw new Error(
35
- `Module ID ${key}, ${modulePath} is not in imports and is not SSR. Available imports: ${availableImports}`
35
+ `${availableImports === "none" ? "No imports." : `Module ID ${key}, ${modulePath} is not in imports. Available imports: ${availableImports}`}`
36
36
  );
37
37
  } else {
38
38
  return moduleId;
@@ -1 +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 `Module ID ${key}, ${modulePath} is not in imports and is not SSR. Available imports: ${availableImports}`\n );\n } else {\n // For development or non-SSR builds, use the module ID\n return moduleId;\n }\n };\n};\n"],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AA,CAAK,IAAI,CAC9B,GAAA,MAAA;AACN,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAa,UAAA,EAAA,GAAG,CAAK,EAAA,EAAA,UAAU,yDAAyD,gBAAgB,CAAA;AAAA,OAC1G;AAAA,KACK,MAAA;AAEL,MAAO,OAAA,QAAA;AAAA;AACT,GACF;AACF;;;;"}
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":[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AAK,IAAI,CAC9B,GAAA,MAAA;AACN,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,EAAG,gBAAqB,KAAA,MAAA,GAAS,aAAgB,GAAA,CAAA,UAAA,EAAa,GAAG,CAAK,EAAA,EAAA,UAAU,CAA0C,uCAAA,EAAA,gBAAgB,CAAE,CAAA,CAAA;AAAA,OAC9I;AAAA,KACK,MAAA;AAEL,MAAO,OAAA,QAAA;AAAA;AACT,GACF;AACF;;;;"}
@@ -9,10 +9,10 @@ export declare const DEFAULT_CONFIG: {
9
9
  readonly PROPS: "src/page/props.ts";
10
10
  readonly CLIENT_ENTRY: "src/client.tsx";
11
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";
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 }: {
@@ -49,15 +49,6 @@ export declare const DEFAULT_CONFIG: {
49
49
  readonly htmlPattern: (n: string) => boolean;
50
50
  readonly jsonPattern: (n: string) => boolean;
51
51
  };
52
- readonly MODULE_ID: ({ inputRoot, client, server, moduleBase, isProduction, preserveModulesRoot, imports, removeExtension }: {
53
- isProduction: boolean;
54
- inputRoot: string;
55
- client: string;
56
- server: string;
57
- moduleBase: string;
58
- preserveModulesRoot: boolean;
59
- removeExtension: ((path: string) => boolean) | string | RegExp;
60
- imports: Record<string, string>;
61
- }) => (moduleIdPath: string, ssr?: boolean) => string;
52
+ readonly MODULE_ID: (id: string) => string;
62
53
  };
63
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;;;;;;;;;;;;;;;;;;;qCAmBR,MAAM,EAAE;;oCAEjB,MAAM;kCACR,MAAM;mCACL,MAAM;uCACF,MAAM;sCACP,MAAM;iCACX,MAAM;uCACA,MAAM;oCACT,MAAM;kCACR,MAAM;kCACN,MAAM;;;;;;;;;;;;CAGjB,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"}
@@ -12,10 +12,10 @@ const DEFAULT_CONFIG = {
12
12
  PROPS: "src/page/props.ts",
13
13
  CLIENT_ENTRY: "src/client.tsx",
14
14
  SERVER_ENTRY: "src/server.tsx",
15
- PAGE_EXPORT: "Page",
16
- PROPS_EXPORT: "props",
17
- HTML_WORKER_PATH: "worker/html/html-worker.js",
18
- RSC_WORKER_PATH: "worker/rsc/rsc-worker.js",
15
+ PAGE_EXPORT_NAME: "Page",
16
+ PROPS_EXPORT_NAME: "props",
17
+ HTML_WORKER_PATH: `worker/html/html-worker.${process.env["NODE_ENV"] === "development" ? "development" : "production"}.js`,
18
+ RSC_WORKER_PATH: `worker/rsc/rsc-worker.${process.env["NODE_ENV"] === "development" ? "development" : "production"}.js`,
19
19
  LOADER_PATH: "worker/loader.js",
20
20
  HTML: ({ children }) => children,
21
21
  COLLECT_CSS: true,
@@ -32,15 +32,15 @@ const DEFAULT_CONFIG = {
32
32
  },
33
33
  AUTO_DISCOVER: {
34
34
  modulePattern: (n) => DEFAULT_CONFIG.FILE_REGEX.test(n),
35
- pagePattern: (n) => n.toLowerCase().endsWith("page"),
36
- propsPattern: (n) => n.toLowerCase().endsWith("props"),
37
- clientComponents: (n) => n.toLowerCase().endsWith("client"),
38
- serverFunctions: (n) => n.toLowerCase().endsWith("server"),
39
- cssPattern: (n) => n.toLowerCase().endsWith("css"),
40
- cssModulePattern: (n) => n.toLowerCase().endsWith("css.js"),
35
+ pagePattern: (n) => n.toLowerCase().endsWith("/page") || n.toLowerCase() === "page",
36
+ propsPattern: (n) => n.toLowerCase().endsWith("/props") || n.toLowerCase() === "props",
37
+ clientComponents: (n) => n.toLowerCase().endsWith(".client") || n.toLowerCase() === "client",
38
+ serverFunctions: (n) => n.toLowerCase().endsWith(".server") || n.toLowerCase() === "server",
39
+ cssPattern: (n) => n.toLowerCase().endsWith(".css"),
40
+ cssModulePattern: (n) => n.toLowerCase().endsWith(".css.js"),
41
41
  vendorPattern: (n) => n.toLowerCase().startsWith("node_modules") || n.toLowerCase().startsWith("_virtual"),
42
- htmlPattern: (n) => n.toLowerCase().endsWith("html"),
43
- jsonPattern: (n) => n.toLowerCase().endsWith("json")
42
+ htmlPattern: (n) => n.toLowerCase().endsWith(".html"),
43
+ jsonPattern: (n) => n.toLowerCase().endsWith(".json")
44
44
  }};
45
45
 
46
46
  export { DEFAULT_CONFIG };
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sources":["../../../plugin/config/defaults.ts"],"sourcesContent":["import { createModuleIdGenerator } from \"./createModuleIdGenerator.js\";\n\nexport const DEFAULT_CONFIG = {\n FILE_REGEX: /\\.(m|c)?(j|t)sx?$/,\n CLIENT_ASSETS_DIR: \"assets\",\n RSC_DIR: \"rsc\",\n MODULE_BASE: \"src\",\n MODULE_BASE_PATH: \"/src\",\n MODULE_BASE_URL: \"/src\",\n PAGE: \"src/page/page.tsx\",\n PROPS: \"src/page/props.ts\",\n CLIENT_ENTRY: \"src/client.tsx\",\n SERVER_ENTRY: \"src/server.tsx\",\n PAGE_EXPORT: \"Page\",\n PROPS_EXPORT: \"props\",\n HTML_WORKER_PATH: 'worker/html/html-worker.js',\n RSC_WORKER_PATH: 'worker/rsc/rsc-worker.js',\n LOADER_PATH: 'worker/loader.js',\n RSC_EXTENSION: \".rsc\",\n HTML: ({ children }: { children: any }) => children,\n COLLECT_CSS: true,\n COLLECT_ASSETS: true,\n DEV_PORT: 5173,\n PREVIEW_PORT: 4173,\n DEV_HOST: \"localhost\",\n PREVIEW_HOST: \"localhost\",\n ENV_PREFIX: \"VITE_\",\n BUILD: {\n pages: () => [\"/\"],\n client: \"client\",\n server: \"server\",\n static: \"static\",\n api: \"api\",\n outDir: \"dist\",\n assetsDir: \"assets\",\n hash: \"hash\",\n preserveModulesRoot: true,\n },\n MODULE_BASE_EXCEPTIONS: [] as string[],\n AUTO_DISCOVER: {\n modulePattern: (n: string) => DEFAULT_CONFIG.FILE_REGEX.test(n),\n pagePattern: (n: string) => n.toLowerCase().endsWith('page'),\n propsPattern: (n: string) => n.toLowerCase().endsWith('props'),\n clientComponents: (n: string) => n.toLowerCase().endsWith('client'),\n serverFunctions: (n: string) => n.toLowerCase().endsWith('server'),\n cssPattern: (n: string) => n.toLowerCase().endsWith('css'),\n cssModulePattern: (n: string) => n.toLowerCase().endsWith('css.js'),\n vendorPattern: (n: string) => n.toLowerCase().startsWith('node_modules') || n.toLowerCase().startsWith('_virtual'),\n htmlPattern: (n: string) => n.toLowerCase().endsWith('html'),\n jsonPattern: (n: string) => n.toLowerCase().endsWith('json'),\n },\n MODULE_ID: createModuleIdGenerator\n} as const; "],"names":[],"mappings":";;;;;AAEO,MAAM,cAAiB,GAAA;AAAA,EAC5B,UAAY,EAAA,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CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,KAAK,CAAA;AAAA,IACzD,kBAAkB,CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,QAAQ,CAAA;AAAA,IAClE,aAAe,EAAA,CAAC,CAAc,KAAA,CAAA,CAAE,WAAY,EAAA,CAAE,UAAW,CAAA,cAAc,CAAK,IAAA,CAAA,CAAE,WAAY,EAAA,CAAE,WAAW,UAAU,CAAA;AAAA,IACjH,aAAa,CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,MAAM,CAAA;AAAA,IAC3D,aAAa,CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,MAAM;AAAA,GAG/D;;;;"}
1
+ {"version":3,"file":"defaults.js","sources":["../../../plugin/config/defaults.ts"],"sourcesContent":["export const DEFAULT_CONFIG = {\n FILE_REGEX: /\\.(m|c)?(j|t)sx?$/,\n CLIENT_ASSETS_DIR: \"assets\",\n RSC_DIR: \"rsc\",\n MODULE_BASE: \"src\",\n MODULE_BASE_PATH: \"/src\",\n MODULE_BASE_URL: \"/src\",\n PAGE: \"src/page/page.tsx\",\n PROPS: \"src/page/props.ts\",\n CLIENT_ENTRY: \"src/client.tsx\",\n SERVER_ENTRY: \"src/server.tsx\",\n PAGE_EXPORT_NAME: \"Page\",\n PROPS_EXPORT_NAME: \"props\",\n HTML_WORKER_PATH: `worker/html/html-worker.${process.env['NODE_ENV'] === 'development' ? 'development' : 'production'}.js`,\n RSC_WORKER_PATH: `worker/rsc/rsc-worker.${process.env['NODE_ENV'] === 'development' ? 'development' : 'production'}.js`,\n LOADER_PATH: 'worker/loader.js',\n RSC_EXTENSION: \".rsc\",\n HTML: ({ children }: { children: any }) => children,\n COLLECT_CSS: true,\n COLLECT_ASSETS: true,\n DEV_PORT: 5173,\n PREVIEW_PORT: 4173,\n DEV_HOST: \"localhost\",\n PREVIEW_HOST: \"localhost\",\n ENV_PREFIX: \"VITE_\",\n BUILD: {\n pages: () => [\"/\"],\n client: \"client\",\n server: \"server\",\n static: \"static\",\n api: \"api\",\n outDir: \"dist\",\n assetsDir: \"assets\",\n hash: \"hash\",\n preserveModulesRoot: true,\n },\n MODULE_BASE_EXCEPTIONS: [] as string[],\n AUTO_DISCOVER: {\n modulePattern: (n: string) => DEFAULT_CONFIG.FILE_REGEX.test(n),\n pagePattern: (n: string) => n.toLowerCase().endsWith('/page') || n.toLowerCase() === 'page',\n propsPattern: (n: string) => n.toLowerCase().endsWith('/props') || n.toLowerCase() === 'props',\n clientComponents: (n: string) => n.toLowerCase().endsWith('.client') || n.toLowerCase() === 'client',\n serverFunctions: (n: string) => n.toLowerCase().endsWith('.server') || n.toLowerCase() === 'server',\n cssPattern: (n: string) => n.toLowerCase().endsWith('.css'),\n cssModulePattern: (n: string) => n.toLowerCase().endsWith('.css.js'),\n vendorPattern: (n: string) => n.toLowerCase().startsWith('node_modules') || n.toLowerCase().startsWith('_virtual'),\n htmlPattern: (n: string) => n.toLowerCase().endsWith('.html'),\n jsonPattern: (n: string) => n.toLowerCase().endsWith('.json'),\n },\n MODULE_ID: (id: string) => id,\n} as const; "],"names":[],"mappings":";;;;;AAAO,MAAM,cAAiB,GAAA;AAAA,EAC5B,UAAY,EAAA,mBAAA;AAAA,EACZ,iBAAmB,EAAA,QAAA;AAAA,EAEnB,WAAa,EAAA,KAAA;AAAA,EAEb,eAAiB,EAAA,MAAA;AAAA,EACjB,IAAM,EAAA,mBAAA;AAAA,EACN,KAAO,EAAA,mBAAA;AAAA,EACP,YAAc,EAAA,gBAAA;AAAA,EACd,YAAc,EAAA,gBAAA;AAAA,EACd,gBAAkB,EAAA,MAAA;AAAA,EAClB,iBAAmB,EAAA,OAAA;AAAA,EACnB,gBAAA,EAAkB,2BAA2B,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,aAAA,GAAgB,gBAAgB,YAAY,CAAA,GAAA,CAAA;AAAA,EACrH,eAAA,EAAiB,yBAAyB,OAA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EAAE,WAAY,EAAA,CAAE,SAAS,MAAM,CAAA;AAAA,IAC1D,kBAAkB,CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,SAAS,CAAA;AAAA,IACnE,aAAe,EAAA,CAAC,CAAc,KAAA,CAAA,CAAE,WAAY,EAAA,CAAE,UAAW,CAAA,cAAc,CAAK,IAAA,CAAA,CAAE,WAAY,EAAA,CAAE,WAAW,UAAU,CAAA;AAAA,IACjH,aAAa,CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,OAAO,CAAA;AAAA,IAC5D,aAAa,CAAC,CAAA,KAAc,EAAE,WAAY,EAAA,CAAE,SAAS,OAAO;AAAA,GAGhE;;;;"}
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) Nico Brinkkemper
4
4
  * MIT License
5
5
  */
6
- import { join, dirname } from 'node:path';
6
+ import { dirname, join } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
8
 
9
9
  const getNodePath = (root = process.cwd()) => {
@@ -1 +1 @@
1
- {"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA0B5E,eAAO,MAAM,cAAc,YAChB,mBAAmB,aAClB,OAAO,KAEf;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CA8QhC,CAAC"}
1
+ {"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAoD5E,eAAO,MAAM,cAAc,YAChB,mBAAmB,aAClB,OAAO,KAEf;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CA8ShC,CAAC"}