vite-plugin-react-server 1.1.17 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/package.json +5 -4
- package/dist/plugin/components/css-collector-elements.d.ts.map +1 -1
- package/dist/plugin/components/html.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js +7 -12
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +2 -2
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +1 -1
- package/dist/plugin/config/createModuleID.d.ts.map +1 -1
- package/dist/plugin/config/defaults.d.ts +1 -1
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +18 -4
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/extMap.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getPaths.d.ts.map +1 -1
- package/dist/plugin/config/mimeTypes.d.ts.map +1 -1
- package/dist/plugin/config/mimeTypes.js +67 -0
- package/dist/plugin/config/mimeTypes.js.map +1 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +5 -5
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +39 -22
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/env/plugin.d.ts.map +1 -1
- package/dist/plugin/env/plugin.js +35 -2
- package/dist/plugin/env.js +37 -3
- package/dist/plugin/env.js.map +1 -1
- package/dist/plugin/error/toError.js +4 -4
- package/dist/plugin/error/toError.js.map +1 -1
- package/dist/plugin/helpers/cleanObject.js +2 -2
- package/dist/plugin/helpers/cleanObject.js.map +1 -1
- package/dist/plugin/helpers/collectManifestCss.js +2 -2
- package/dist/plugin/helpers/collectManifestCss.js.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +3 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +1 -1
- package/dist/plugin/helpers/createCssProps.d.ts +1 -1
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -1
- package/dist/plugin/helpers/createCssProps.js +12 -1
- package/dist/plugin/helpers/createCssProps.js.map +1 -1
- package/dist/plugin/helpers/createEventHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createEventHandler.js +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +1 -1
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.js +2 -2
- package/dist/plugin/helpers/getRouteFiles.js.map +1 -1
- package/dist/plugin/helpers/handleServerAction.d.ts +34 -0
- package/dist/plugin/helpers/handleServerAction.d.ts.map +1 -0
- package/dist/plugin/helpers/handleServerAction.js +48 -0
- package/dist/plugin/helpers/handleServerAction.js.map +1 -0
- package/dist/plugin/helpers/inputNormalizer.js +1 -1
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +1 -1
- package/dist/plugin/helpers/requestInfo.js.map +1 -1
- package/dist/plugin/helpers/resolvePage.d.ts.map +1 -1
- package/dist/plugin/helpers/resolveProps.d.ts.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/sourceMap.d.ts.map +1 -1
- package/dist/plugin/helpers/stashReturnValue.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.d.ts +3 -1
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +14 -8
- package/dist/plugin/helpers/tryManifest.js.map +1 -1
- package/dist/plugin/loader/handleExports.d.ts +16 -10
- package/dist/plugin/loader/handleExports.d.ts.map +1 -1
- package/dist/plugin/loader/handleExports.js +32 -16
- package/dist/plugin/loader/handleExports.js.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.js +22 -12
- package/dist/plugin/loader/transformModuleIfNeeded.js.map +1 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts +21 -0
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js +398 -73
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js.map +1 -1
- package/dist/plugin/loader/types.d.ts +9 -3
- package/dist/plugin/loader/types.d.ts.map +1 -1
- package/dist/plugin/metrics/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts.map +1 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js +12 -73
- package/dist/plugin/react-client/configureWorkerRequestHandler.js.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts +12 -0
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts.map +1 -0
- package/dist/plugin/react-client/handleWorkerServerAction.js +47 -0
- package/dist/plugin/react-client/handleWorkerServerAction.js.map +1 -0
- package/dist/plugin/react-server/configureReactServer.d.ts.map +1 -1
- package/dist/plugin/react-server/configureReactServer.js +0 -12
- package/dist/plugin/react-server/configureReactServer.js.map +1 -1
- package/dist/plugin/react-server/handleServerAction.d.ts +1 -1
- package/dist/plugin/react-server/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/react-server/handleServerAction.js +42 -6
- package/dist/plugin/react-server/handleServerAction.js.map +1 -1
- package/dist/plugin/react-server/plugin.js +2 -2
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js.map +1 -1
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +15 -16
- package/dist/plugin/react-static/plugin.js.map +1 -1
- package/dist/plugin/react-static/renderPages.js +1 -1
- package/dist/plugin/react-static/renderPages.js.map +1 -1
- package/dist/plugin/source-map/createMappingsSerializer.d.ts.map +1 -1
- package/dist/plugin/source-map/createMappingsSerializer.js +128 -157
- package/dist/plugin/source-map/createMappingsSerializer.js.map +1 -0
- package/dist/plugin/transformer/plugin.server.d.ts +24 -0
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.server.js +18 -15
- package/dist/plugin/transformer/plugin.server.js.map +1 -1
- package/dist/plugin/types.d.ts +7 -7
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/utils/createCallServer.d.ts.map +1 -1
- package/dist/plugin/utils/envUrls.node.d.ts.map +1 -1
- package/dist/plugin/utils/urls.d.ts.map +1 -1
- package/dist/plugin/vendor/types.d.ts +2 -0
- package/dist/plugin/vendor/types.d.ts.map +1 -0
- package/dist/plugin/vendor/types.js +2 -0
- package/dist/plugin/worker/createWorker.js +1 -1
- package/dist/plugin/worker/createWorker.js.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +0 -1
- package/dist/plugin/worker/rsc/handleRender.js.map +1 -1
- package/dist/plugin/worker/rsc/handlers.js.map +1 -1
- package/dist/plugin/worker/rsc/state.d.ts +1 -1
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/state.js +31 -17
- package/dist/plugin/worker/rsc/state.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
- package/plugin/config/autoDiscover/resolveAutoDiscover.ts +6 -14
- package/plugin/config/defaults.tsx +5 -2
- package/plugin/config/mimeTypes.ts +75 -1
- package/plugin/config/resolveOptions.ts +9 -10
- package/plugin/config/resolveUserConfig.ts +46 -21
- package/plugin/env/plugin.ts +39 -3
- package/plugin/helpers/collectManifestCss.ts +2 -2
- package/plugin/helpers/collectViteModuleGraphCss.ts +3 -0
- package/plugin/helpers/createCssProps.tsx +20 -3
- package/plugin/helpers/handleServerAction.ts +79 -0
- package/plugin/helpers/requestInfo.ts +1 -1
- package/plugin/helpers/tryManifest.ts +20 -10
- package/plugin/loader/handleExports.ts +50 -40
- package/plugin/loader/transformModuleIfNeeded.ts +50 -18
- package/plugin/loader/transformModuleWithPreservedFunctions.ts +496 -126
- package/plugin/loader/types.ts +12 -4
- package/plugin/react-client/configureWorkerRequestHandler.ts +12 -92
- package/plugin/react-client/handleWorkerServerAction.ts +74 -0
- package/plugin/react-server/configureReactServer.ts +1 -13
- package/plugin/react-server/handleServerAction.ts +49 -12
- package/plugin/react-server/plugin.ts +2 -2
- package/plugin/react-static/configurePreviewServer.ts +1 -2
- package/plugin/react-static/plugin.ts +30 -29
- package/plugin/transformer/plugin.server.ts +22 -15
- package/plugin/types.ts +12 -11
- package/plugin/vendor/types.ts +1 -0
- package/plugin/worker/rsc/handleRender.ts +0 -2
- package/plugin/worker/rsc/handlers.ts +3 -3
- package/plugin/worker/rsc/state.ts +53 -28
package/README.md
CHANGED
|
@@ -130,7 +130,11 @@ const Shell: React.FC<{
|
|
|
130
130
|
const rootElement = document.getElementById("root");
|
|
131
131
|
if (!rootElement) throw new Error("Root element not found");
|
|
132
132
|
|
|
133
|
-
const intitalData = createReactFetcher(
|
|
133
|
+
const intitalData = createReactFetcher({
|
|
134
|
+
url: window.location.pathname,
|
|
135
|
+
moduleBaseURL: import.meta.env.BASE_URL,
|
|
136
|
+
publicOrigin: import.meta.env.PUBLIC_ORIGIN,
|
|
137
|
+
});
|
|
134
138
|
|
|
135
139
|
createRoot(rootElement).render(<Shell data={intitalData} />);
|
|
136
140
|
```
|
|
@@ -200,9 +204,9 @@ We can also make a static build for these pages, which will render them to index
|
|
|
200
204
|
Page: "src/page.tsx",
|
|
201
205
|
props: "src/props.ts"
|
|
202
206
|
// define the routes we want to render
|
|
203
|
-
build:
|
|
207
|
+
build: {
|
|
204
208
|
pages: ['/', '/404']
|
|
205
|
-
|
|
209
|
+
}
|
|
206
210
|
};
|
|
207
211
|
```
|
|
208
212
|
|
|
@@ -388,13 +392,13 @@ publicOrigin: "https://github.com",
|
|
|
388
392
|
### Page and props Mapping
|
|
389
393
|
|
|
390
394
|
```ts
|
|
391
|
-
Page: (id) => join(
|
|
395
|
+
Page: (id) => join('src', id, "page.tsx");
|
|
392
396
|
```
|
|
393
397
|
|
|
394
398
|
Defines how pages are mapped to file paths.
|
|
395
399
|
|
|
396
400
|
```ts
|
|
397
|
-
props: (id) => join(
|
|
401
|
+
props: (id) => join('src', id, "props.ts");
|
|
398
402
|
```
|
|
399
403
|
|
|
400
404
|
Defines how to load the initial props of the page file.
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-react-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.19",
|
|
4
4
|
"description": "Vite plugin for React Server Components (RSC)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin/index.js",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"test:client": "vitest run test/client",
|
|
91
91
|
"test:build": "npm run setup:test-fixtures && npm test test/server/build.test.ts",
|
|
92
92
|
"test:unit": "NODE_OPTIONS='--conditions react-server' vitest run test/unit",
|
|
93
|
-
"test:
|
|
93
|
+
"test:tee": "rm -f build.log && npm run test:build 2>&1 | tee build.log",
|
|
94
94
|
"test:rsc-worker": "npm run build && vitest run test/client/rsc-worker.test.ts",
|
|
95
95
|
"test:large-html": "npm run build && NODE_OPTIONS='--conditions react-server' vitest run test/server/large-html.test.ts --reporter=verbose",
|
|
96
96
|
"test:metrics": "npm run build && NODE_OPTIONS='--conditions react-server' vitest run test/server/metrics.test.ts --reporter=verbose",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"test:server-action-integration": "npm run build && NODE_OPTIONS='--conditions react-server' vitest run test/server/server-action-integration.test.ts --reporter=verbose",
|
|
106
106
|
"test:server-action-integration-client": "npm run build && vitest run test/client/server-action-integration.test.ts --reporter=verbose",
|
|
107
107
|
"test": "npm run build && npm run test:server && npm run test:client && npm run test:unit",
|
|
108
|
-
"test-base-url": "BASE_URL='/test/' && npm run build && npm run test:server && npm run test:client
|
|
109
|
-
"test:coverage": "npm run setup:test-fixtures && vitest run --coverage",
|
|
108
|
+
"test-base-url": "BASE_URL='/test/' && npm run build && npm run test:server && npm run test:client",
|
|
109
|
+
"test:coverage": "npm run setup:test-fixtures && NODE_OPTIONS='--conditions react-server' vitest run --coverage",
|
|
110
110
|
"test:ui": "npm run setup:test-fixtures && vitest --ui",
|
|
111
111
|
"experimental:clean-install": "npm install react-server-dom-esm react@experimental react-dom@experimental react-server-dom-esm --save-peer",
|
|
112
112
|
"experimental:copy": "cp -r ./oss-experimental/* ./node_modules/",
|
|
@@ -157,6 +157,7 @@
|
|
|
157
157
|
"devDependencies": {
|
|
158
158
|
"@types/react": "^19.0.8",
|
|
159
159
|
"@types/react-dom": "^19.0.3",
|
|
160
|
+
"@vitest/coverage-v8": "^3.0.4",
|
|
160
161
|
"acorn-loose": "^8.3.0",
|
|
161
162
|
"happy-dom": "^17.1.8",
|
|
162
163
|
"patch-package": "^8.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-collector-elements.d.ts","sourceRoot":"","sources":["../../../plugin/components/css-collector-elements.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"css-collector-elements.d.ts","sourceRoot":"","sources":["../../../plugin/components/css-collector-elements.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,eAAO,MAAM,oBAAoB,GAAI,eAElC;IACD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,UAAU,EAAE,CAAC;CAClD,+BAiCA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../plugin/components/html.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../plugin/components/html.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,eAAO,MAAM,IAAI,GAAI,6DAOlB,SAAS,sBAeX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGlobAutoDiscover.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/createGlobAutoDiscover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createGlobAutoDiscover.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/createGlobAutoDiscover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,IACZ,0BAGrC;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,IAAI,CACf,mBAAmB,EACnB,YAAY,GAAG,aAAa,GAAG,YAAY,CAC5C,CAAC;CACH,qCAcF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customWorkerFiles.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/customWorkerFiles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"customWorkerFiles.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/customWorkerFiles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,0BAG/B;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,GAAG,gBAAgB,CAAC,CAAC;CAC5E,2BAUA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageAndPropFiles.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/pageAndPropFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"pageAndPropFiles.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/pageAndPropFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,oBAG5B;IACD,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,2BAsBA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAutoDiscover.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/resolveAutoDiscover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AAexB,KAAK,wBAAwB,CAC3B,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,SAAS,SAAS,YAAY,GAAG,YAAY,IAC3C;IACF,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,EAAE,cAAc,GAAG,cAAc,CAAC;CAC5C,CAAC;AAEF,KAAK,yBAAyB,GAC1B;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB,CAAC,EAAE,KAAK,CAAC;CAC7B,CAAC;AAEN,wBAAsB,mBAAmB,CACvC,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,SAAS,SAAS,YAAY,GAAG,YAAY,EAC7C,EACA,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,GACV,EAAE,wBAAwB,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC,
|
|
1
|
+
{"version":3,"file":"resolveAutoDiscover.d.ts","sourceRoot":"","sources":["../../../../plugin/config/autoDiscover/resolveAutoDiscover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AAexB,KAAK,wBAAwB,CAC3B,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,SAAS,SAAS,YAAY,GAAG,YAAY,IAC3C;IACF,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,EAAE,cAAc,GAAG,cAAc,CAAC;CAC5C,CAAC;AAEF,KAAK,yBAAyB,GAC1B;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB,CAAC,EAAE,KAAK,CAAC;CAC7B,CAAC;AAEN,wBAAsB,mBAAmB,CACvC,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,SAAS,SAAS,YAAY,GAAG,YAAY,EAC7C,EACA,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,GACV,EAAE,wBAAwB,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAoI7E"}
|
|
@@ -59,9 +59,10 @@ async function resolveAutoDiscover({
|
|
|
59
59
|
if (staticManifestResult.type === "success") {
|
|
60
60
|
staticManifest = staticManifestResult.manifest;
|
|
61
61
|
} else if (configEnv.command === "build") {
|
|
62
|
-
|
|
62
|
+
if (staticManifestResult.type === "error") {
|
|
63
|
+
console.error(staticManifestResult.error);
|
|
64
|
+
}
|
|
63
65
|
console.warn("Continuing without static manifest");
|
|
64
|
-
staticManifest = {};
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
const customWorkerInputs = customWorkerFiles({
|
|
@@ -92,25 +93,19 @@ async function resolveAutoDiscover({
|
|
|
92
93
|
...configInputRecord,
|
|
93
94
|
...clientInputs,
|
|
94
95
|
...clientEntry,
|
|
95
|
-
...cssInputs
|
|
96
|
-
...jsonInputs
|
|
96
|
+
...cssInputs
|
|
97
97
|
};
|
|
98
98
|
const inputs = condition === "react-client" ? {
|
|
99
99
|
...indexHtmlInputs,
|
|
100
|
-
...agnosticInputs
|
|
101
|
-
...!(configEnv.command === "build" || configEnv.isSsrBuild) ? {
|
|
102
|
-
// when we are not building, we likely still want the files for the client server, so we include them in the inputs
|
|
103
|
-
...pageAndPropInputs,
|
|
104
|
-
...serverActions,
|
|
105
|
-
...serverEntry
|
|
106
|
-
} : {}
|
|
100
|
+
...agnosticInputs
|
|
107
101
|
} : {
|
|
108
102
|
...configInputRecord,
|
|
109
103
|
...customWorkerInputs,
|
|
110
104
|
...pageAndPropInputs,
|
|
111
105
|
...agnosticInputs,
|
|
112
106
|
...serverActions,
|
|
113
|
-
...serverEntry
|
|
107
|
+
...serverEntry,
|
|
108
|
+
...jsonInputs
|
|
114
109
|
};
|
|
115
110
|
return {
|
|
116
111
|
type: "success",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAutoDiscover.js","sources":["../../../../plugin/config/autoDiscover/resolveAutoDiscover.ts"],"sourcesContent":["import type { ConfigEnv, UserConfig } from \"vite\";\nimport type {\n ResolvedUserOptions,\n AutoDiscoveredFiles,\n PagePropOpt,\n InlineCssOpt,\n} from \"../../types.js\";\nimport { join } from \"path\";\nimport { resolveBuildPages } from \"./resolveBuildPages.js\";\nimport { resolvePages } from \"../resolvePages.js\";\nimport { tryManifest } from \"../../helpers/tryManifest.js\";\nimport type { Manifest } from \"vite\";\nimport { createGlobAutoDiscover } from \"./createGlobAutoDiscover.js\";\nimport { customWorkerFiles } from \"./customWorkerFiles.js\";\nimport { pageAndPropFiles } from \"./pageAndPropFiles.js\";\n\nconst clientFiles = createGlobAutoDiscover(\"**/*.client.*\");\nconst serverFiles = createGlobAutoDiscover(\"**/*.server.*\");\nconst cssFiles = createGlobAutoDiscover(\"**/*.css\");\nconst jsonFiles = createGlobAutoDiscover(\"**/*.json\");\n\ntype ResolveAutoDiscoverProps<\n T extends PagePropOpt = PagePropOpt,\n InlineCSS extends InlineCssOpt = InlineCssOpt\n> = {\n config: UserConfig;\n configEnv: ConfigEnv;\n userOptions: ResolvedUserOptions<T, InlineCSS>;\n condition: \"react-server\" | \"react-client\";\n};\n\ntype ResolveAutoDiscoverReturn =\n | {\n type: \"success\";\n id: string;\n autoDiscoveredFiles: AutoDiscoveredFiles;\n error?: never;\n }\n | {\n type: \"error\";\n error: Error;\n id: string;\n autoDiscoveredFiles?: never;\n };\n\nexport async function resolveAutoDiscover<\n T extends PagePropOpt = PagePropOpt,\n InlineCSS extends InlineCssOpt = InlineCssOpt\n>({\n config,\n configEnv,\n userOptions,\n condition,\n}: ResolveAutoDiscoverProps<T, InlineCSS>): Promise<ResolveAutoDiscoverReturn> {\n const ssr = configEnv.isSsrBuild || condition === \"react-server\";\n const envDir =\n condition === \"react-server\"\n ? userOptions.build.server\n : ssr\n ? userOptions.build.client\n : userOptions.build.static;\n const envId = `${envDir}${ssr ? \"-ssr\" : \"\"}`;\n const configInputRecord = {} as Record<string, string>;\n if (typeof config.build?.rollupOptions?.input === \"string\") {\n configInputRecord[\n userOptions.normalizer(config.build?.rollupOptions?.input)[0]\n ] = config.build?.rollupOptions?.input;\n } else if (typeof config.build?.rollupOptions?.input === \"object\") {\n for (const [, value] of Object.entries(\n config.build?.rollupOptions?.input\n )) {\n configInputRecord[userOptions.normalizer(value)[0]] = value;\n }\n }\n\n const serverEntry =\n typeof userOptions.serverEntry === \"string\"\n ? Object.fromEntries([userOptions.normalizer(userOptions.serverEntry)])\n : null;\n\n const indexHtmlInputs = { index: \"index.html\" };\n\n const clientEntry =\n typeof userOptions.clientEntry === \"string\"\n ? Object.fromEntries([userOptions.normalizer(userOptions.clientEntry)])\n : {};\n\n const { type, error, pages } = await resolvePages(userOptions.build.pages);\n\n if (type === \"error\") {\n return {\n type: \"error\",\n error,\n id: envId,\n };\n }\n\n const files = await resolveBuildPages({\n pages,\n userOptions,\n });\n\n // Load static manifest for client build\n let staticManifest: Manifest = {};\n if (ssr && configEnv.command === \"build\") {\n const staticManifestResult = await tryManifest({\n root: userOptions.projectRoot,\n ssrManifest: false,\n outDir: join(userOptions.build.outDir, userOptions.build.static),\n });\n if (staticManifestResult.type === \"success\") {\n staticManifest = staticManifestResult.manifest;\n } else if (configEnv.command === \"build\") {\n // in dev mode
|
|
1
|
+
{"version":3,"file":"resolveAutoDiscover.js","sources":["../../../../plugin/config/autoDiscover/resolveAutoDiscover.ts"],"sourcesContent":["import type { ConfigEnv, UserConfig } from \"vite\";\nimport type {\n ResolvedUserOptions,\n AutoDiscoveredFiles,\n PagePropOpt,\n InlineCssOpt,\n} from \"../../types.js\";\nimport { join } from \"path\";\nimport { resolveBuildPages } from \"./resolveBuildPages.js\";\nimport { resolvePages } from \"../resolvePages.js\";\nimport { tryManifest } from \"../../helpers/tryManifest.js\";\nimport type { Manifest } from \"vite\";\nimport { createGlobAutoDiscover } from \"./createGlobAutoDiscover.js\";\nimport { customWorkerFiles } from \"./customWorkerFiles.js\";\nimport { pageAndPropFiles } from \"./pageAndPropFiles.js\";\n\nconst clientFiles = createGlobAutoDiscover(\"**/*.client.*\");\nconst serverFiles = createGlobAutoDiscover(\"**/*.server.*\");\nconst cssFiles = createGlobAutoDiscover(\"**/*.css\");\nconst jsonFiles = createGlobAutoDiscover(\"**/*.json\");\n\ntype ResolveAutoDiscoverProps<\n T extends PagePropOpt = PagePropOpt,\n InlineCSS extends InlineCssOpt = InlineCssOpt\n> = {\n config: UserConfig;\n configEnv: ConfigEnv;\n userOptions: ResolvedUserOptions<T, InlineCSS>;\n condition: \"react-server\" | \"react-client\";\n};\n\ntype ResolveAutoDiscoverReturn =\n | {\n type: \"success\";\n id: string;\n autoDiscoveredFiles: AutoDiscoveredFiles;\n error?: never;\n }\n | {\n type: \"error\";\n error: Error;\n id: string;\n autoDiscoveredFiles?: never;\n };\n\nexport async function resolveAutoDiscover<\n T extends PagePropOpt = PagePropOpt,\n InlineCSS extends InlineCssOpt = InlineCssOpt\n>({\n config,\n configEnv,\n userOptions,\n condition,\n}: ResolveAutoDiscoverProps<T, InlineCSS>): Promise<ResolveAutoDiscoverReturn> {\n const ssr = configEnv.isSsrBuild || condition === \"react-server\";\n const envDir =\n condition === \"react-server\"\n ? userOptions.build.server\n : ssr\n ? userOptions.build.client\n : userOptions.build.static;\n const envId = `${envDir}${ssr ? \"-ssr\" : \"\"}`;\n const configInputRecord = {} as Record<string, string>;\n if (typeof config.build?.rollupOptions?.input === \"string\") {\n configInputRecord[\n userOptions.normalizer(config.build?.rollupOptions?.input)[0]\n ] = config.build?.rollupOptions?.input;\n } else if (typeof config.build?.rollupOptions?.input === \"object\") {\n for (const [, value] of Object.entries(\n config.build?.rollupOptions?.input\n )) {\n configInputRecord[userOptions.normalizer(value)[0]] = value;\n }\n }\n\n const serverEntry =\n typeof userOptions.serverEntry === \"string\"\n ? Object.fromEntries([userOptions.normalizer(userOptions.serverEntry)])\n : null;\n\n const indexHtmlInputs = { index: \"index.html\" };\n\n const clientEntry =\n typeof userOptions.clientEntry === \"string\"\n ? Object.fromEntries([userOptions.normalizer(userOptions.clientEntry)])\n : {};\n\n const { type, error, pages } = await resolvePages(userOptions.build.pages);\n\n if (type === \"error\") {\n return {\n type: \"error\",\n error,\n id: envId,\n };\n }\n\n const files = await resolveBuildPages({\n pages,\n userOptions,\n });\n\n // Load static manifest for client build\n let staticManifest: Manifest = {};\n if (ssr && configEnv.command === \"build\") {\n const staticManifestResult = await tryManifest({\n root: userOptions.projectRoot,\n ssrManifest: false,\n outDir: join(userOptions.build.outDir, userOptions.build.static),\n });\n if (staticManifestResult.type === \"success\") {\n staticManifest = staticManifestResult.manifest;\n } else if (configEnv.command === \"build\") {\n // in dev mode the static manifest is not needed\n // without ssr, WE ARE BUILDING the static manifest, so only warn in the case of a build\n if (staticManifestResult.type === \"error\") {\n console.error(staticManifestResult.error);\n }\n console.warn(\"Continuing without static manifest\");\n // this can still work, but, it won't be able to look up any client-side assets\n }\n }\n\n const customWorkerInputs = customWorkerFiles({\n inputs: {},\n userOptions,\n });\n const clientInputs = await clientFiles({\n inputs: {},\n userOptions,\n });\n const serverActions = await serverFiles({\n inputs: {},\n userOptions,\n });\n\n const pageAndPropInputs = pageAndPropFiles({\n files,\n inputs: {},\n });\n\n const cssInputs = await cssFiles({\n inputs: {},\n userOptions,\n });\n\n const jsonInputs = await jsonFiles({\n inputs: {},\n userOptions,\n });\n const agnosticInputs = {\n ...configInputRecord,\n ...clientInputs,\n ...clientEntry,\n ...cssInputs,\n };\n // Add inputs based on condition\n const inputs =\n condition === \"react-client\"\n ? {\n ...indexHtmlInputs,\n ...agnosticInputs,\n }\n : {\n ...configInputRecord,\n ...customWorkerInputs,\n ...pageAndPropInputs,\n ...agnosticInputs,\n ...serverActions,\n ...serverEntry,\n ...jsonInputs,\n };\n return {\n type: \"success\",\n id: envId,\n autoDiscoveredFiles: {\n ...files,\n workerPaths: customWorkerInputs,\n serverEntry,\n clientEntry,\n staticManifest,\n inputs,\n serverActions,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I,EAAA,KAAA;AAAA,IACJ,mBAAqB,EAAA;AAAA,MACnB,GAAG,KAAA;AAAA,MACH,WAAa,EAAA,kBAAA;AAAA,MACb,WAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;;;;"}
|
|
@@ -30,7 +30,7 @@ async function resolveBuildPages({
|
|
|
30
30
|
}
|
|
31
31
|
const [pageKey, pageValue] = userOptions.normalizer(pageResult.Page);
|
|
32
32
|
if (!userOptions.props) {
|
|
33
|
-
urlMap.set(page, { props:
|
|
33
|
+
urlMap.set(page, { props: void 0, page: pageValue });
|
|
34
34
|
pageMap.set(pageKey, pageValue);
|
|
35
35
|
const routes = routeMap.get(pageValue) || [];
|
|
36
36
|
routes.push(page);
|
|
@@ -67,7 +67,7 @@ async function resolveBuildPages({
|
|
|
67
67
|
propsRoutes.push(page);
|
|
68
68
|
routeMap.set(propsValue, propsRoutes);
|
|
69
69
|
} else {
|
|
70
|
-
urlMap.set(page, { props:
|
|
70
|
+
urlMap.set(page, { props: void 0, page: pageValue });
|
|
71
71
|
const routes = routeMap.get(pageValue) || [];
|
|
72
72
|
routes.push(page);
|
|
73
73
|
routeMap.set(pageValue, routes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveBuildPages.js","sources":["../../../../plugin/config/autoDiscover/resolveBuildPages.ts"],"sourcesContent":["import { access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { ResolvedBuildPages, ResolvedUserOptions } from \"../../types.js\";\nimport { resolveUrlOption } from \"../resolveUrlOption.js\";\n\nlet stashedBuildPages: ResolvedBuildPages | null = null;\nlet stashedPages: string[] | null = null;\n\nexport async function resolveBuildPages({\n pages,\n userOptions,\n}: {\n pages: string[];\n userOptions: Pick<ResolvedUserOptions, \"Page\" | \"props\" | \"build\" | \"moduleBase\" | \"projectRoot\" | \"normalizer\" | \"moduleBasePath\">;\n}): Promise<ResolvedBuildPages> {\n // Check if pages array has changed\n const pagesChanged =\n !stashedPages ||\n stashedPages.length !== pages.length ||\n !stashedPages.every((page, i) => page === pages[i]);\n\n if (stashedBuildPages && !pagesChanged) {\n return stashedBuildPages; // Return directly without Promise.resolve\n }\n const errors: Error[] = [];\n const pageMap = new Map<string, string>();\n const propsMap = new Map<string, string>();\n const urlMap = new Map<string, { props: string | undefined; page: string }>();\n const routeMap = new Map<string, string[]>();\n\n for (const page of pages) {\n const pageResult = await resolveUrlOption(userOptions, \"Page\", page);\n if(pageResult.type === \"error\") {\n errors.push(pageResult.error);\n continue;\n }\n const [pageKey, pageValue] = userOptions.normalizer(pageResult.Page);\n if(!userOptions.props) {\n urlMap.set(page, { props: undefined, page: pageValue });\n pageMap.set(pageKey, pageValue);\n // Add to routeMap\n const routes = routeMap.get(pageValue) || [];\n routes.push(page);\n routeMap.set(pageValue, routes);\n continue;\n }\n try {\n await access(join(userOptions.projectRoot, pageValue));\n } catch {\n errors.push(new Error(`Page file not found: ${pageValue}`));\n }\n const propsResult = await resolveUrlOption(userOptions, \"props\", page);\n if(propsResult.type === \"error\") {\n errors.push(propsResult.error);\n continue;\n }\n\n // If propsPath is defined, check if it exists\n if (propsResult.props) {\n const [propsKey, propsValue] = userOptions.normalizer(propsResult.props);\n if (propsValue !== pageValue) {\n try {\n await access(join(userOptions.projectRoot, propsValue));\n } catch {\n errors.push(\n new Error(`Props file not found: ${propsValue}`)\n );\n }\n }\n urlMap.set(page, { props: propsValue, page: pageValue });\n propsMap.set(propsKey, propsValue);\n \n // Add to routeMap for both page and props files\n const pageRoutes = routeMap.get(pageValue) || [];\n pageRoutes.push(page);\n routeMap.set(pageValue, pageRoutes);\n \n const propsRoutes = routeMap.get(propsValue) || [];\n propsRoutes.push(page);\n routeMap.set(propsValue, propsRoutes);\n } else {\n // If no props path, use the page path for both\n urlMap.set(page, { props: undefined, page: pageValue });\n \n // Add to routeMap for page file only\n const routes = routeMap.get(pageValue) || [];\n routes.push(page);\n routeMap.set(pageValue, routes);\n }\n\n pageMap.set(pageKey, pageValue);\n }\n\n stashedBuildPages = { pageMap, propsMap, urlMap, routeMap, errors };\n stashedPages = [...pages];\n return stashedBuildPages;\n}\n"],"names":[],"mappings":";;;;;;;;;AAKA,IAAI,iBAA+C,GAAA,IAAA;AACnD,IAAI,YAAgC,GAAA,IAAA;AAEpC,eAAsB,iBAAkB,CAAA;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAGgC,EAAA;AAE9B,EAAA,MAAM,eACJ,CAAC,YAAA,IACD,YAAa,CAAA,MAAA,KAAW,MAAM,MAC9B,IAAA,CAAC,YAAa,CAAA,KAAA,CAAM,CAAC,IAAM,EAAA,CAAA,KAAM,IAAS,KAAA,KAAA,CAAM,CAAC,CAAC,CAAA;AAEpD,EAAI,IAAA,iBAAA,IAAqB,CAAC,YAAc,EAAA;AACtC,IAAO,OAAA,iBAAA;AAAA;AAET,EAAA,MAAM,SAAkB,EAAC;AACzB,EAAM,MAAA,OAAA,uBAAc,GAAoB,EAAA;AACxC,EAAM,MAAA,QAAA,uBAAe,GAAoB,EAAA;AACzC,EAAM,MAAA,MAAA,uBAAa,GAAyD,EAAA;AAC5E,EAAM,MAAA,QAAA,uBAAe,GAAsB,EAAA;AAE3C,EAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,IAAA,MAAM,UAAa,GAAA,MAAM,gBAAiB,CAAA,WAAA,EAAa,QAAQ,IAAI,CAAA;AACnE,IAAG,IAAA,UAAA,CAAW,SAAS,OAAS,EAAA;AAC9B,MAAO,MAAA,CAAA,IAAA,CAAK,WAAW,KAAK,CAAA;AAC5B,MAAA;AAAA;AAEF,IAAA,MAAM,CAAC,OAAS,EAAA,SAAS,IAAI,WAAY,CAAA,UAAA,CAAW,WAAW,IAAI,CAAA;AACnE,IAAG,IAAA,CAAC,YAAY,KAAO,EAAA;AACrB,MAAA,MAAA,CAAO,IAAI,IAAM,EAAA,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"resolveBuildPages.js","sources":["../../../../plugin/config/autoDiscover/resolveBuildPages.ts"],"sourcesContent":["import { access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { ResolvedBuildPages, ResolvedUserOptions } from \"../../types.js\";\nimport { resolveUrlOption } from \"../resolveUrlOption.js\";\n\nlet stashedBuildPages: ResolvedBuildPages | null = null;\nlet stashedPages: string[] | null = null;\n\nexport async function resolveBuildPages({\n pages,\n userOptions,\n}: {\n pages: string[];\n userOptions: Pick<ResolvedUserOptions, \"Page\" | \"props\" | \"build\" | \"moduleBase\" | \"projectRoot\" | \"normalizer\" | \"moduleBasePath\">;\n}): Promise<ResolvedBuildPages> {\n // Check if pages array has changed\n const pagesChanged =\n !stashedPages ||\n stashedPages.length !== pages.length ||\n !stashedPages.every((page, i) => page === pages[i]);\n\n if (stashedBuildPages && !pagesChanged) {\n return stashedBuildPages; // Return directly without Promise.resolve\n }\n const errors: Error[] = [];\n const pageMap = new Map<string, string>();\n const propsMap = new Map<string, string>();\n const urlMap = new Map<string, { props: string | undefined; page: string }>();\n const routeMap = new Map<string, string[]>();\n\n for (const page of pages) {\n const pageResult = await resolveUrlOption(userOptions, \"Page\", page);\n if(pageResult.type === \"error\") {\n errors.push(pageResult.error);\n continue;\n }\n const [pageKey, pageValue] = userOptions.normalizer(pageResult.Page);\n if(!userOptions.props) {\n urlMap.set(page, { props: undefined, page: pageValue });\n pageMap.set(pageKey, pageValue);\n // Add to routeMap\n const routes = routeMap.get(pageValue) || [];\n routes.push(page);\n routeMap.set(pageValue, routes);\n continue;\n }\n try {\n await access(join(userOptions.projectRoot, pageValue));\n } catch {\n errors.push(new Error(`Page file not found: ${pageValue}`));\n }\n const propsResult = await resolveUrlOption(userOptions, \"props\", page);\n if(propsResult.type === \"error\") {\n errors.push(propsResult.error);\n continue;\n }\n\n // If propsPath is defined, check if it exists\n if (propsResult.props) {\n const [propsKey, propsValue] = userOptions.normalizer(propsResult.props);\n if (propsValue !== pageValue) {\n try {\n await access(join(userOptions.projectRoot, propsValue));\n } catch {\n errors.push(\n new Error(`Props file not found: ${propsValue}`)\n );\n }\n }\n urlMap.set(page, { props: propsValue, page: pageValue });\n propsMap.set(propsKey, propsValue);\n \n // Add to routeMap for both page and props files\n const pageRoutes = routeMap.get(pageValue) || [];\n pageRoutes.push(page);\n routeMap.set(pageValue, pageRoutes);\n \n const propsRoutes = routeMap.get(propsValue) || [];\n propsRoutes.push(page);\n routeMap.set(propsValue, propsRoutes);\n } else {\n // If no props path, use the page path for both\n urlMap.set(page, { props: undefined, page: pageValue });\n \n // Add to routeMap for page file only\n const routes = routeMap.get(pageValue) || [];\n routes.push(page);\n routeMap.set(pageValue, routes);\n }\n\n pageMap.set(pageKey, pageValue);\n }\n\n stashedBuildPages = { pageMap, propsMap, urlMap, routeMap, errors };\n stashedPages = [...pages];\n return stashedBuildPages;\n}\n"],"names":[],"mappings":";;;;;;;;;AAKA,IAAI,iBAA+C,GAAA,IAAA;AACnD,IAAI,YAAgC,GAAA,IAAA;AAEpC,eAAsB,iBAAkB,CAAA;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAGgC,EAAA;AAE9B,EAAA,MAAM,eACJ,CAAC,YAAA,IACD,YAAa,CAAA,MAAA,KAAW,MAAM,MAC9B,IAAA,CAAC,YAAa,CAAA,KAAA,CAAM,CAAC,IAAM,EAAA,CAAA,KAAM,IAAS,KAAA,KAAA,CAAM,CAAC,CAAC,CAAA;AAEpD,EAAI,IAAA,iBAAA,IAAqB,CAAC,YAAc,EAAA;AACtC,IAAO,OAAA,iBAAA;AAAA;AAET,EAAA,MAAM,SAAkB,EAAC;AACzB,EAAM,MAAA,OAAA,uBAAc,GAAoB,EAAA;AACxC,EAAM,MAAA,QAAA,uBAAe,GAAoB,EAAA;AACzC,EAAM,MAAA,MAAA,uBAAa,GAAyD,EAAA;AAC5E,EAAM,MAAA,QAAA,uBAAe,GAAsB,EAAA;AAE3C,EAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,IAAA,M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;AACxB,EAAO,OAAA,iBAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createModuleID.d.ts","sourceRoot":"","sources":["../../../plugin/config/createModuleID.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"createModuleID.d.ts","sourceRoot":"","sources":["../../../plugin/config/createModuleID.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,qBAAqB,GAAI,SAAS;IAC7C,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC9C,cAAc,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IACtD,YAAY,EAAE,IAAI,CAChB,mBAAmB,CAAC,cAAc,CAAC,EACjC,iBAAiB,GACjB,aAAa,GACb,cAAc,GACd,eAAe,GACf,eAAe,GACf,cAAc,CACjB,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC;CAClE,MAYS,IAAI,MAAM,WAqBnB,CAAC"}
|
|
@@ -114,7 +114,7 @@ export declare const DEFAULT_CONFIG: {
|
|
|
114
114
|
*/
|
|
115
115
|
readonly clientDirective: RegExp;
|
|
116
116
|
readonly isServerFunctionCode: (code: string, moduleId?: string) => boolean;
|
|
117
|
-
readonly isClientComponentCode: (code: string) => boolean;
|
|
117
|
+
readonly isClientComponentCode: (code: string, moduleId?: string) => boolean;
|
|
118
118
|
readonly jsExtension: ".js";
|
|
119
119
|
readonly cssExtension: ".css";
|
|
120
120
|
readonly jsonExtension: ".json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../plugin/config/defaults.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA8CD,MAAM,EAAE;+BACV,MAAM,EAAE;;qCAEA,MAAM,EAAE;;QAUpC;;WAEG;oCACgB,MAAM;QACzB;;WAEG;kCACc,MAAM;QACvB;;WAEG;mCACe,MAAM;QACxB;;WAEG;uCACmB,MAAM;QAC5B;;WAEG;sCACkB,MAAM;QAC3B;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;+BACW,MAAM;QACpB;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;8CAG0B,MAAM,aAAa,MAAM;+CAIxB,MAAM;;;;;;;
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../plugin/config/defaults.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA8CD,MAAM,EAAE;+BACV,MAAM,EAAE;;qCAEA,MAAM,EAAE;;QAUpC;;WAEG;oCACgB,MAAM;QACzB;;WAEG;kCACc,MAAM;QACvB;;WAEG;mCACe,MAAM;QACxB;;WAEG;uCACmB,MAAM;QAC5B;;WAEG;sCACkB,MAAM;QAC3B;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;+BACW,MAAM;QACpB;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;8CAG0B,MAAM,aAAa,MAAM;+CAIxB,MAAM,aAAa,MAAM;;;;;;;6BAWzC,MAAM;;CAEd,CAAC"}
|
|
@@ -3,24 +3,34 @@
|
|
|
3
3
|
* Copyright (c) Nico Brinkkemper
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
+
import { CssCollector } from '../components/css-collector.js';
|
|
6
7
|
import { Html } from '../components/html.js';
|
|
7
8
|
|
|
8
9
|
const DEFAULT_CONFIG = {
|
|
9
10
|
CLIENT_ASSETS_DIR: "assets",
|
|
11
|
+
RSC_DIR: "rsc",
|
|
10
12
|
MODULE_BASE: "src",
|
|
11
13
|
MODULE_BASE_PATH: "/",
|
|
12
14
|
MODULE_BASE_URL: "/",
|
|
13
15
|
PUBLIC_ORIGIN: "",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
PAGE: "page.tsx",
|
|
17
|
+
PROPS: "props.ts",
|
|
18
|
+
CLIENT_ENTRY: void 0,
|
|
19
|
+
SERVER_ENTRY: void 0,
|
|
16
20
|
PAGE_EXPORT_NAME: "Page",
|
|
17
21
|
PROPS_EXPORT_NAME: "props",
|
|
18
22
|
HTML_WORKER_PATH: `worker/html/html-worker.${process.env["NODE_ENV"] === "production" ? "production" : "development"}.js`,
|
|
19
23
|
RSC_WORKER_PATH: `worker/rsc/rsc-worker.${process.env["NODE_ENV"] === "production" ? "production" : "development"}.js`,
|
|
20
24
|
LOADER_PATH: "worker/loader.js",
|
|
25
|
+
RSC_EXTENSION: ".rsc",
|
|
26
|
+
CSS_COLLECTOR: CssCollector,
|
|
21
27
|
HTML: Html,
|
|
22
28
|
ON_METRICS: () => {
|
|
23
29
|
},
|
|
30
|
+
DEV_PORT: 5173,
|
|
31
|
+
PREVIEW_PORT: 4173,
|
|
32
|
+
DEV_HOST: "localhost",
|
|
33
|
+
PREVIEW_HOST: "localhost",
|
|
24
34
|
ENV_PREFIX: "VITE_",
|
|
25
35
|
BUILD: {
|
|
26
36
|
pages: [],
|
|
@@ -29,6 +39,7 @@ const DEFAULT_CONFIG = {
|
|
|
29
39
|
static: "static",
|
|
30
40
|
api: "api",
|
|
31
41
|
outDir: "dist",
|
|
42
|
+
assetsDir: "assets",
|
|
32
43
|
hash: "hash",
|
|
33
44
|
rscOutputPath: "index.rsc",
|
|
34
45
|
htmlOutputPath: "index.html",
|
|
@@ -36,6 +47,7 @@ const DEFAULT_CONFIG = {
|
|
|
36
47
|
},
|
|
37
48
|
CSS: {
|
|
38
49
|
inlineCss: false,
|
|
50
|
+
purgeCss: false,
|
|
39
51
|
inlineThreshold: 4096,
|
|
40
52
|
// 4KB
|
|
41
53
|
inlinePatterns: [],
|
|
@@ -43,6 +55,7 @@ const DEFAULT_CONFIG = {
|
|
|
43
55
|
linkPatterns: []
|
|
44
56
|
// Always link node_modules CSS
|
|
45
57
|
},
|
|
58
|
+
MODULE_BASE_EXCEPTIONS: [],
|
|
46
59
|
AUTO_DISCOVER: {
|
|
47
60
|
// All REGEX tricks used here are based on the following:
|
|
48
61
|
// $ = endsWith
|
|
@@ -115,19 +128,20 @@ const DEFAULT_CONFIG = {
|
|
|
115
128
|
/**
|
|
116
129
|
* /^"use server"[\s;]*\n?/m
|
|
117
130
|
*/
|
|
118
|
-
serverDirective:
|
|
131
|
+
serverDirective: /"use server"[\s;]*\n?/m,
|
|
119
132
|
/**
|
|
120
133
|
* /^"use client"[\s;]*\n?/m
|
|
121
134
|
*/
|
|
122
135
|
clientDirective: /^"use client"[\s;]*\n?/m,
|
|
123
136
|
isServerFunctionCode: (code, moduleId) => code.match(DEFAULT_CONFIG.AUTO_DISCOVER.serverDirective) !== null || moduleId && DEFAULT_CONFIG.AUTO_DISCOVER.serverFunctions(moduleId) || false,
|
|
124
|
-
isClientComponentCode: (code) => code.match(DEFAULT_CONFIG.AUTO_DISCOVER.clientDirective) !== null,
|
|
137
|
+
isClientComponentCode: (code, moduleId) => code.match(DEFAULT_CONFIG.AUTO_DISCOVER.clientDirective) !== null || moduleId && DEFAULT_CONFIG.AUTO_DISCOVER.clientComponents(moduleId) || false,
|
|
125
138
|
jsExtension: ".js",
|
|
126
139
|
cssExtension: ".css",
|
|
127
140
|
jsonExtension: ".json",
|
|
128
141
|
htmlExtension: ".html",
|
|
129
142
|
rscExtension: ".rsc"
|
|
130
143
|
},
|
|
144
|
+
MODULE_ID: (id) => id,
|
|
131
145
|
VERBOSE: false
|
|
132
146
|
};
|
|
133
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sources":["../../../plugin/config/defaults.tsx"],"sourcesContent":["import { CssCollector } from \"../components/css-collector.js\";\nimport { Html } from \"../components/html.js\";\nexport const DEFAULT_CONFIG = {\n CLIENT_ASSETS_DIR: \"assets\",\n RSC_DIR: \"rsc\",\n MODULE_BASE: \"src\",\n MODULE_BASE_PATH: \"/\",\n MODULE_BASE_URL: \"/\",\n PUBLIC_ORIGIN: \"\",\n PAGE: \"page.tsx\",\n PROPS: \"props.ts\",\n CLIENT_ENTRY: undefined,\n SERVER_ENTRY: undefined,\n PAGE_EXPORT_NAME: \"Page\",\n PROPS_EXPORT_NAME: \"props\",\n HTML_WORKER_PATH: `worker/html/html-worker.${\n process.env[\"NODE_ENV\"] === \"production\" ? \"production\" : \"development\"\n }.js`,\n RSC_WORKER_PATH: `worker/rsc/rsc-worker.${\n process.env[\"NODE_ENV\"] === \"production\" ? \"production\" : \"development\"\n }.js`,\n LOADER_PATH: \"worker/loader.js\",\n RSC_EXTENSION: \".rsc\",\n CSS_COLLECTOR: CssCollector,\n HTML: Html,\n ON_METRICS: ()=>{},\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 rscOutputPath: \"index.rsc\",\n htmlOutputPath: \"index.html\",\n preserveModulesRoot: true,\n },\n CSS: {\n inlineCss: false,\n purgeCss: false,\n inlineThreshold: 4096, // 4KB\n inlinePatterns: [] as RegExp[], // Always inline CSS modules\n linkPatterns: [] as RegExp[], // Always link node_modules CSS\n },\n MODULE_BASE_EXCEPTIONS: [] as string[],\n AUTO_DISCOVER: {\n // All REGEX tricks used here are based on the following:\n // $ = endsWith\n // ^ = startsWith\n // . = includes\n // \\ = escape\n // ? = optional\n // () = group\n // | = or\n /**\n * /\\.(m|c)?(j|t)sx?$/ and .lowerCase()\n */\n modulePattern: (n: string) => /\\.(m|c)?(j|t)sx?$/.test(n.toLowerCase()),\n /**\n * /\\.?page(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n pagePattern: (n: string) => /\\.?page(\\.(m|c)?(j|t)sx?)$/.test(n.toLowerCase()),\n /**\n * /\\.?props(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n propsPattern: (n: string) => /\\.?props(\\.(m|c)?(j|t)sx?)$/.test(n.toLowerCase()), \n /**\n * /(\\.|\\/)?client(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n clientComponents: (n: string) => /(\\.|\\/)?client(\\.(m|c)?(j|t)sx?)?$/.test(n.toLowerCase()),\n /**\n * /(\\.|\\/)?server(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n serverFunctions: (n: string) => /(\\.|\\/)?server(\\.(m|c)?(j|t)sx?)?$/.test(n.toLowerCase()),\n /**\n * /\\.css$/\n */\n cssPattern: /\\.css$/,\n /**\n * /\\.css\\.js$/\n */\n cssModulePattern: /\\.css\\.js$/,\n /**\n * /^\\/@\\//\n */\n virtualPattern: /^\\/@\\//,\n /**\n * /^\\/node_modules\\//\n */\n vendorPattern: /^\\/node_modules\\//,\n /**\n * /\\.html$/\n */\n htmlPattern: /\\.html$/,\n /**\n * /\\.json$/\n */\n jsonPattern: /\\.json$/,\n /**\n * /\\.node(\\.js)?$/\n */\n nodeOnly: /\\.node(\\.js)?$/,\n /**\n * /\\.node(\\.js)?$/\n */\n dotFiles: (n: string) => n.split('/').some(p => p.startsWith('.')), \n /**\n * /\\.rsc$/\n */\n rscPattern: /\\.rsc$/, \n /**\n * /\\.(m|c)?(j|t)sx?$/\n */\n moduleExtension: /\\.(m|c)?(j|t)sx?$/,\n /**\n * /^\"use server\"[\\s;]*\\n?/m\n */\n serverDirective:
|
|
1
|
+
{"version":3,"file":"defaults.js","sources":["../../../plugin/config/defaults.tsx"],"sourcesContent":["import { CssCollector } from \"../components/css-collector.js\";\nimport { Html } from \"../components/html.js\";\nexport const DEFAULT_CONFIG = {\n CLIENT_ASSETS_DIR: \"assets\",\n RSC_DIR: \"rsc\",\n MODULE_BASE: \"src\",\n MODULE_BASE_PATH: \"/\",\n MODULE_BASE_URL: \"/\",\n PUBLIC_ORIGIN: \"\",\n PAGE: \"page.tsx\",\n PROPS: \"props.ts\",\n CLIENT_ENTRY: undefined,\n SERVER_ENTRY: undefined,\n PAGE_EXPORT_NAME: \"Page\",\n PROPS_EXPORT_NAME: \"props\",\n HTML_WORKER_PATH: `worker/html/html-worker.${\n process.env[\"NODE_ENV\"] === \"production\" ? \"production\" : \"development\"\n }.js`,\n RSC_WORKER_PATH: `worker/rsc/rsc-worker.${\n process.env[\"NODE_ENV\"] === \"production\" ? \"production\" : \"development\"\n }.js`,\n LOADER_PATH: \"worker/loader.js\",\n RSC_EXTENSION: \".rsc\",\n CSS_COLLECTOR: CssCollector,\n HTML: Html,\n ON_METRICS: ()=>{},\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 rscOutputPath: \"index.rsc\",\n htmlOutputPath: \"index.html\",\n preserveModulesRoot: true,\n },\n CSS: {\n inlineCss: false,\n purgeCss: false,\n inlineThreshold: 4096, // 4KB\n inlinePatterns: [] as RegExp[], // Always inline CSS modules\n linkPatterns: [] as RegExp[], // Always link node_modules CSS\n },\n MODULE_BASE_EXCEPTIONS: [] as string[],\n AUTO_DISCOVER: {\n // All REGEX tricks used here are based on the following:\n // $ = endsWith\n // ^ = startsWith\n // . = includes\n // \\ = escape\n // ? = optional\n // () = group\n // | = or\n /**\n * /\\.(m|c)?(j|t)sx?$/ and .lowerCase()\n */\n modulePattern: (n: string) => /\\.(m|c)?(j|t)sx?$/.test(n.toLowerCase()),\n /**\n * /\\.?page(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n pagePattern: (n: string) => /\\.?page(\\.(m|c)?(j|t)sx?)$/.test(n.toLowerCase()),\n /**\n * /\\.?props(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n propsPattern: (n: string) => /\\.?props(\\.(m|c)?(j|t)sx?)$/.test(n.toLowerCase()), \n /**\n * /(\\.|\\/)?client(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n clientComponents: (n: string) => /(\\.|\\/)?client(\\.(m|c)?(j|t)sx?)?$/.test(n.toLowerCase()),\n /**\n * /(\\.|\\/)?server(\\.(m|c)?(j|t)sx?)$/ and .lowerCase()\n */\n serverFunctions: (n: string) => /(\\.|\\/)?server(\\.(m|c)?(j|t)sx?)?$/.test(n.toLowerCase()),\n /**\n * /\\.css$/\n */\n cssPattern: /\\.css$/,\n /**\n * /\\.css\\.js$/\n */\n cssModulePattern: /\\.css\\.js$/,\n /**\n * /^\\/@\\//\n */\n virtualPattern: /^\\/@\\//,\n /**\n * /^\\/node_modules\\//\n */\n vendorPattern: /^\\/node_modules\\//,\n /**\n * /\\.html$/\n */\n htmlPattern: /\\.html$/,\n /**\n * /\\.json$/\n */\n jsonPattern: /\\.json$/,\n /**\n * /\\.node(\\.js)?$/\n */\n nodeOnly: /\\.node(\\.js)?$/,\n /**\n * /\\.node(\\.js)?$/\n */\n dotFiles: (n: string) => n.split('/').some(p => p.startsWith('.')), \n /**\n * /\\.rsc$/\n */\n rscPattern: /\\.rsc$/, \n /**\n * /\\.(m|c)?(j|t)sx?$/\n */\n moduleExtension: /\\.(m|c)?(j|t)sx?$/,\n /**\n * /^\"use server\"[\\s;]*\\n?/m\n */\n serverDirective: /\"use server\"[\\s;]*\\n?/m,\n /**\n * /^\"use client\"[\\s;]*\\n?/m\n */\n clientDirective: /^\"use client\"[\\s;]*\\n?/m,\n\n isServerFunctionCode: (code: string, moduleId?: string) => \n code.match(DEFAULT_CONFIG.AUTO_DISCOVER.serverDirective) !== null || \n (moduleId && DEFAULT_CONFIG.AUTO_DISCOVER.serverFunctions(moduleId)) || \n false,\n isClientComponentCode: (code: string, moduleId?: string) => \n code.match(DEFAULT_CONFIG.AUTO_DISCOVER.clientDirective) !== null || \n (moduleId && DEFAULT_CONFIG.AUTO_DISCOVER.clientComponents(moduleId)) || \n false,\n jsExtension: \".js\",\n cssExtension: \".css\",\n jsonExtension: \".json\",\n htmlExtension: \".html\",\n rscExtension: \".rsc\",\n \n },\n MODULE_ID: (id: string) => id,\n VERBOSE: false,\n} as const;"],"names":[],"mappings":";;;;;;;;AAEO,MAAM,cAAiB,GAAA;AAAA,EAC5B,iBAAmB,EAAA,QAAA;AAAA,EACnB,OAAS,EAAA,KAAA;AAAA,EACT,WAAa,EAAA,KAAA;AAAA,EACb,gBAAkB,EAAA,GAAA;AAAA,EAClB,eAAiB,EAAA,GAAA;AAAA,EACjB,aAAe,EAAA,EAAA;AAAA,EACf,IAAM,EAAA,UAAA;AAAA,EACN,KAAO,EAAA,UAAA;AAAA,EACP,YAAc,EAAA,MAAA;AAAA,EACd,YAAc,EAAA,MAAA;AAAA,EACd,gBAAkB,EAAA,MAAA;AAAA,EAClB,iBAAmB,EAAA,OAAA;AAAA,EACnB,gBAAA,EAAkB,2BAChB,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,YAAA,GAAe,eAAe,aAC5D,CAAA,GAAA,CAAA;AAAA,EACA,eAAA,EAAiB,yBACf,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,YAAA,GAAe,eAAe,aAC5D,CAAA,GAAA,CAAA;AAAA,EACA,WAAa,EAAA,kBAAA;AAAA,EACb,aAAe,EAAA,MAAA;AAAA,EACf,aAAe,EA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AA;AAAA,IACF,WAAa,EAAA,KAAA;AAAA,IACb,YAAc,EAAA,MAAA;AAAA,IACd,aAAe,EAAA,OAAA;AAAA,IACf,aAAe,EAAA,OAAA;AAAA,IACf,YAAc,EAAA;AAAA,GAEhB;AAAA,EACA,SAAA,EAAW,CAAC,EAAe,KAAA,EAAA;AAAA,EAC3B,OAAS,EAAA;AACX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extMap.d.ts","sourceRoot":"","sources":["../../../plugin/config/extMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"extMap.d.ts","sourceRoot":"","sources":["../../../plugin/config/extMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,eAAO,MAAM,MAAM,GACjB,8FAOG,IAAI,CACL,mBAAmB,CAAC,cAAc,CAAC,EACjC,iBAAiB,GACjB,aAAa,GACb,cAAc,GACd,eAAe,GACf,eAAe,GACf,cAAc,CAQjB,MAqBO,IAAI,MAAM,WAYnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCondition.d.ts","sourceRoot":"","sources":["../../../plugin/config/getCondition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"getCondition.d.ts","sourceRoot":"","sources":["../../../plugin/config/getCondition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,MAAM,GAAG,QAAQ,EAC3D,SAAQ,MAA2B,KAClC,GAAG,MAAM,QAAQ,GAAG,GAAG,MAAM,QAI/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPaths.d.ts","sourceRoot":"","sources":["../../../plugin/config/getPaths.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"getPaths.d.ts","sourceRoot":"","sources":["../../../plugin/config/getPaths.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,OAAM,MAAsB,KAAG,MAE1D,CAAA;AAED,eAAO,MAAM,OAAO,QAAO,YAAY,GAAG,aAAa,GAAG,MAMzD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mimeTypes.d.ts","sourceRoot":"","sources":["../../../plugin/config/mimeTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mimeTypes.d.ts","sourceRoot":"","sources":["../../../plugin/config/mimeTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0F3C,CAAC"}
|
|
@@ -4,19 +4,86 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
6
|
const MIME_TYPES = {
|
|
7
|
+
// HTML and Web
|
|
7
8
|
".html": "text/html",
|
|
9
|
+
".htm": "text/html",
|
|
10
|
+
".xhtml": "application/xhtml+xml",
|
|
11
|
+
".xml": "application/xml",
|
|
8
12
|
".css": "text/css",
|
|
9
13
|
".js": "application/javascript",
|
|
14
|
+
".mjs": "application/javascript",
|
|
15
|
+
".cjs": "application/javascript",
|
|
16
|
+
".jsx": "application/javascript",
|
|
17
|
+
".ts": "application/javascript",
|
|
18
|
+
".tsx": "application/javascript",
|
|
10
19
|
".json": "application/json",
|
|
20
|
+
".map": "application/json",
|
|
21
|
+
".wasm": "application/wasm",
|
|
22
|
+
".webmanifest": "application/manifest+json",
|
|
23
|
+
// Images
|
|
11
24
|
".png": "image/png",
|
|
12
25
|
".jpg": "image/jpeg",
|
|
13
26
|
".jpeg": "image/jpeg",
|
|
14
27
|
".gif": "image/gif",
|
|
15
28
|
".svg": "image/svg+xml",
|
|
16
29
|
".ico": "image/x-icon",
|
|
30
|
+
".webp": "image/webp",
|
|
31
|
+
".avif": "image/avif",
|
|
32
|
+
".bmp": "image/bmp",
|
|
33
|
+
".tiff": "image/tiff",
|
|
34
|
+
".tif": "image/tiff",
|
|
35
|
+
".heic": "image/heic",
|
|
36
|
+
".heif": "image/heif",
|
|
37
|
+
".apng": "image/apng",
|
|
38
|
+
// Fonts
|
|
17
39
|
".woff": "font/woff",
|
|
18
40
|
".woff2": "font/woff2",
|
|
19
41
|
".ttf": "font/ttf",
|
|
42
|
+
".otf": "font/otf",
|
|
43
|
+
".eot": "application/vnd.ms-fontobject",
|
|
44
|
+
".sfnt": "font/sfnt",
|
|
45
|
+
// Video
|
|
46
|
+
".mp4": "video/mp4",
|
|
47
|
+
".webm": "video/webm",
|
|
48
|
+
".m4v": "video/x-m4v",
|
|
49
|
+
".m4s": "video/iso.segment",
|
|
50
|
+
".m3u8": "application/vnd.apple.mpegurl",
|
|
51
|
+
".mpd": "application/dash+xml",
|
|
52
|
+
".mov": "video/quicktime",
|
|
53
|
+
".avi": "video/x-msvideo",
|
|
54
|
+
".wmv": "video/x-ms-wmv",
|
|
55
|
+
".flv": "video/x-flv",
|
|
56
|
+
".mkv": "video/x-matroska",
|
|
57
|
+
".3gp": "video/3gpp",
|
|
58
|
+
".m2ts": "video/mp2t",
|
|
59
|
+
// Audio
|
|
60
|
+
".mp3": "audio/mpeg",
|
|
61
|
+
".wav": "audio/wav",
|
|
62
|
+
".ogg": "audio/ogg",
|
|
63
|
+
".m4a": "audio/mp4",
|
|
64
|
+
".aac": "audio/aac",
|
|
65
|
+
".flac": "audio/flac",
|
|
66
|
+
// Documents
|
|
67
|
+
".pdf": "application/pdf",
|
|
68
|
+
".doc": "application/msword",
|
|
69
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
70
|
+
".xls": "application/vnd.ms-excel",
|
|
71
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
72
|
+
".ppt": "application/vnd.ms-powerpoint",
|
|
73
|
+
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
74
|
+
// Archives
|
|
75
|
+
".zip": "application/zip",
|
|
76
|
+
".rar": "application/x-rar-compressed",
|
|
77
|
+
".7z": "application/x-7z-compressed",
|
|
78
|
+
".tar": "application/x-tar",
|
|
79
|
+
".gz": "application/gzip",
|
|
80
|
+
// Data
|
|
81
|
+
".csv": "text/csv",
|
|
82
|
+
".txt": "text/plain",
|
|
83
|
+
".md": "text/markdown",
|
|
84
|
+
".yaml": "application/yaml",
|
|
85
|
+
".yml": "application/yaml",
|
|
86
|
+
// React specific
|
|
20
87
|
".rsc": "text/x-component"
|
|
21
88
|
};
|
|
22
89
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mimeTypes.js","sources":["../../../plugin/config/mimeTypes.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"mimeTypes.js","sources":["../../../plugin/config/mimeTypes.ts"],"sourcesContent":["export const MIME_TYPES: Record<string, string> = {\n // HTML and Web\n '.html': 'text/html',\n '.htm': 'text/html',\n '.xhtml': 'application/xhtml+xml',\n '.xml': 'application/xml',\n '.css': 'text/css',\n '.js': 'application/javascript',\n '.mjs': 'application/javascript',\n '.cjs': 'application/javascript',\n '.jsx': 'application/javascript',\n '.ts': 'application/javascript',\n '.tsx': 'application/javascript',\n '.json': 'application/json',\n '.map': 'application/json',\n '.wasm': 'application/wasm',\n '.webmanifest': 'application/manifest+json',\n\n // Images\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.webp': 'image/webp',\n '.avif': 'image/avif',\n '.bmp': 'image/bmp',\n '.tiff': 'image/tiff',\n '.tif': 'image/tiff',\n '.heic': 'image/heic',\n '.heif': 'image/heif',\n '.apng': 'image/apng',\n\n // Fonts\n '.woff': 'font/woff',\n '.woff2': 'font/woff2',\n '.ttf': 'font/ttf',\n '.otf': 'font/otf',\n '.eot': 'application/vnd.ms-fontobject',\n '.sfnt': 'font/sfnt',\n\n // Video\n '.mp4': 'video/mp4',\n '.webm': 'video/webm',\n '.m4v': 'video/x-m4v',\n '.m4s': 'video/iso.segment',\n '.m3u8': 'application/vnd.apple.mpegurl',\n '.mpd': 'application/dash+xml',\n '.mov': 'video/quicktime',\n '.avi': 'video/x-msvideo',\n '.wmv': 'video/x-ms-wmv',\n '.flv': 'video/x-flv',\n '.mkv': 'video/x-matroska',\n '.3gp': 'video/3gpp',\n '.m2ts': 'video/mp2t',\n\n // Audio\n '.mp3': 'audio/mpeg',\n '.wav': 'audio/wav',\n '.ogg': 'audio/ogg',\n '.m4a': 'audio/mp4',\n '.aac': 'audio/aac',\n '.flac': 'audio/flac',\n\n // Documents\n '.pdf': 'application/pdf',\n '.doc': 'application/msword',\n '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n '.xls': 'application/vnd.ms-excel',\n '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n '.ppt': 'application/vnd.ms-powerpoint',\n '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n\n // Archives\n '.zip': 'application/zip',\n '.rar': 'application/x-rar-compressed',\n '.7z': 'application/x-7z-compressed',\n '.tar': 'application/x-tar',\n '.gz': 'application/gzip',\n\n // Data\n '.csv': 'text/csv',\n '.txt': 'text/plain',\n '.md': 'text/markdown',\n '.yaml': 'application/yaml',\n '.yml': 'application/yaml',\n\n // React specific\n '.rsc': 'text/x-component'\n };"],"names":[],"mappings":";;;;;AAAO,MAAM,UAAqC,GAAA;AAAA;AAAA,EAE9C,OAAS,EAAA,WAAA;AAAA,EACT,MAAQ,EAAA,WAAA;AAAA,EACR,QAAU,EAAA,uBAAA;AAAA,EACV,MAAQ,EAAA,iBAAA;AAAA,EACR,MAAQ,EAAA,UAAA;AAAA,EACR,KAAO,EAAA,wBAAA;AAAA,EACP,M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,EAAA,YAAA;AAAA,EACR,OAAS,EAAA,YAAA;AAAA;AAAA,EAGT,MAAQ,EAAA,YAAA;AAAA,EACR,MAAQ,EAAA,WAAA;AAAA,EACR,MAAQ,EAAA,WAAA;AAAA,EACR,MAAQ,EAAA,WAAA;AAAA,EACR,MAAQ,EAAA,WAAA;AAAA,EACR,OAAS,EAAA,YAAA;AAAA;AAAA,EAGT,MAAQ,EAAA,iBAAA;AAAA,EACR,MAAQ,EAAA,oBAAA;AAAA,EACR,OAAS,EAAA,yEAAA;AAAA,EACT,MAAQ,EAAA,0BAAA;AAAA,EACR,OAAS,EAAA,mEAAA;AAAA,EACT,MAAQ,EAAA,+BAAA;AAAA,EACR,OAAS,EAAA,2EAAA;AAAA;AAAA,EAGT,MAAQ,EAAA,iBAAA;AAAA,EACR,MAAQ,EAAA,8BAAA;AAAA,EACR,KAAO,EAAA,6BAAA;AAAA,EACP,MAAQ,EAAA,mBAAA;AAAA,EACR,KAAO,EAAA,kBAAA;AAAA;AAAA,EAGP,MAAQ,EAAA,UAAA;AAAA,EACR,MAAQ,EAAA,YAAA;AAAA,EACR,KAAO,EAAA,eAAA;AAAA,EACP,OAAS,EAAA,kBAAA;AAAA,EACT,MAAQ,EAAA,kBAAA;AAAA;AAAA,EAGR,MAAQ,EAAA;AACV;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveAutoDiscoverMatcher.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveAutoDiscoverMatcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"resolveAutoDiscoverMatcher.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveAutoDiscoverMatcher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,SAAS,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,EAClE,UAAU,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,YADC,MAAM,KAAK,OAkB3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveEnv.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveEnv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;AAIpD,KAAK,SAAS,GAAG;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACpC,CAAC;AAgBF;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAM,GAAG,MAAM,EAA8B,cAiHxD;AAED,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,WAAW,CAAC,cAsB7D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,cAM9C;AAED,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"resolveEnv.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveEnv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,MAAM,CAAC;AAIpD,KAAK,SAAS,GAAG;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACpC,CAAC;AAgBF;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAM,GAAG,MAAM,EAA8B,cAiHxD;AAED,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,WAAW,CAAC,cAsB7D;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,cAM9C;AAED,eAAO,MAAM,UAAU,GACrB,uBAAiB,EACjB,WAAU,MAAM,GAAG,MAAM,EAA8B,QAgBtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACb,MAAM,aAAa,CAAC;AA+CrB,eAAO,MAAM,cAAc,GACzB,CAAC,SAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"resolveOptions.d.ts","sourceRoot":"","sources":["../../../plugin/config/resolveOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACb,MAAM,aAAa,CAAC;AA+CrB,eAAO,MAAM,cAAc,GACzB,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,SAAS,SAAS,YAAY,GAAG,YAAY,EAE7C,SAAS,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,KAExC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAydhC,CAAC"}
|
|
@@ -29,7 +29,7 @@ const resolveOptions = (options) => {
|
|
|
29
29
|
const projectRoot = options.projectRoot ?? process.cwd();
|
|
30
30
|
const preserveModulesRoot = options.build?.preserveModulesRoot ?? DEFAULT_CONFIG.BUILD.preserveModulesRoot;
|
|
31
31
|
const isProd = process.env["NODE_ENV"] === "production" || process.env["VITE_PROD"] === "true" || process.env["VITE_PROD"] === "1";
|
|
32
|
-
const prodModuleBase = isProd && preserveModulesRoot ? moduleBase :
|
|
32
|
+
const prodModuleBase = isProd && preserveModulesRoot ? moduleBase : void 0;
|
|
33
33
|
const {
|
|
34
34
|
pageExportName = DEFAULT_CONFIG.PAGE_EXPORT_NAME,
|
|
35
35
|
propsExportName = DEFAULT_CONFIG.PROPS_EXPORT_NAME
|
|
@@ -115,12 +115,12 @@ const resolveOptions = (options) => {
|
|
|
115
115
|
DEFAULT_CONFIG.AUTO_DISCOVER.dotFiles
|
|
116
116
|
);
|
|
117
117
|
const isServerFunctionCode = resolveAutoDiscoverMatcher(
|
|
118
|
-
options.autoDiscover?.
|
|
119
|
-
options.autoDiscover?.serverDirective ? (code, moduleId) => code.match(options.autoDiscover?.serverDirective) != null || moduleId && serverFunctions(moduleId) || false :
|
|
118
|
+
options.autoDiscover?.isServerFunctionCode,
|
|
119
|
+
options.autoDiscover?.serverDirective ? (code, moduleId) => code.match(options.autoDiscover?.serverDirective) != null || moduleId && serverFunctions(moduleId) || false : DEFAULT_CONFIG.AUTO_DISCOVER.isServerFunctionCode
|
|
120
120
|
);
|
|
121
121
|
const isClientComponentCode = resolveAutoDiscoverMatcher(
|
|
122
|
-
options.autoDiscover?.
|
|
123
|
-
options.autoDiscover?.clientDirective ? (code) => code.match(options.autoDiscover?.clientDirective) != null : DEFAULT_CONFIG.AUTO_DISCOVER.
|
|
122
|
+
options.autoDiscover?.isClientComponentCode,
|
|
123
|
+
options.autoDiscover?.clientDirective ? (code, moduleId) => code.match(options.autoDiscover?.clientDirective) != null || moduleId && clientComponents(moduleId) || false : DEFAULT_CONFIG.AUTO_DISCOVER.isClientComponentCode
|
|
124
124
|
);
|
|
125
125
|
const hashOption = typeof options.build?.hash === "string" ? options.build.hash : DEFAULT_CONFIG.BUILD.hash;
|
|
126
126
|
const hashString = hashOption === "" ? "" : `-[${hashOption}]`;
|