zudoku 0.87.0 → 0.88.0
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/dist/cli/cli.js +14 -1
- package/package.json +1 -1
- package/src/app/entry.server.tsx +6 -0
- package/src/vite/config.ts +30 -1
package/dist/cli/cli.js
CHANGED
|
@@ -8404,6 +8404,19 @@ var getAppClientEntryPath = () => path18.posix.join(getZudokuRootDir(), "src/app
|
|
|
8404
8404
|
var getAppServerEntryPath = () => path18.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
8405
8405
|
var hasLoggedCdnInfo = false;
|
|
8406
8406
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
8407
|
+
var getDepScanEntries = () => {
|
|
8408
|
+
const src = path18.posix.join(getZudokuRootDir(), "src");
|
|
8409
|
+
return [
|
|
8410
|
+
`${src}/{app,lib}/**/*.{ts,tsx}`,
|
|
8411
|
+
// Client-environment scan: `entry.server.tsx` imports
|
|
8412
|
+
// `virtual:zudoku-markdown-files`, which only the `ssr` environment
|
|
8413
|
+
// provides. Including it fails the scan and disables pre-bundling entirely.
|
|
8414
|
+
`!${getAppServerEntryPath()}`,
|
|
8415
|
+
// Not published, but present in the monorepo — keeps local dev scanning the
|
|
8416
|
+
// same file set an installed site does (and out of vitest's dependencies).
|
|
8417
|
+
`!${src}/**/*.test.*`
|
|
8418
|
+
];
|
|
8419
|
+
};
|
|
8407
8420
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
8408
8421
|
vars.flatMap((v) => [
|
|
8409
8422
|
[`process.env.${v}`, JSON.stringify(process.env[v])],
|
|
@@ -8551,7 +8564,7 @@ async function getViteConfig(dir, configEnv, options = {}) {
|
|
|
8551
8564
|
}
|
|
8552
8565
|
},
|
|
8553
8566
|
optimizeDeps: {
|
|
8554
|
-
entries:
|
|
8567
|
+
entries: getDepScanEntries(),
|
|
8555
8568
|
exclude: ["zudoku"],
|
|
8556
8569
|
include: [
|
|
8557
8570
|
"@mdx-js/react",
|
package/package.json
CHANGED
package/src/app/entry.server.tsx
CHANGED
|
@@ -186,6 +186,12 @@ export const handleRequest = async ({
|
|
|
186
186
|
|
|
187
187
|
try {
|
|
188
188
|
const reactStream = await renderToReadableStream(App, {
|
|
189
|
+
// The stream is only read after `allReady`, so nothing is streamed
|
|
190
|
+
// progressively anyway. Without this, React outlines completed Suspense
|
|
191
|
+
// boundaries larger than the default chunk size (12.8 kB) into a hidden
|
|
192
|
+
// segment swapped in by an inline script, leaving only the fallback
|
|
193
|
+
// visible to clients that don't run JS (AI crawlers, curl, reader mode).
|
|
194
|
+
progressiveChunkSize: Number.MAX_SAFE_INTEGER,
|
|
189
195
|
onError(error) {
|
|
190
196
|
status = 500;
|
|
191
197
|
logger.error(`SSR Error (${request.method} ${request.url}):`, error);
|
package/src/vite/config.ts
CHANGED
|
@@ -40,6 +40,35 @@ let hasLoggedCdnInfo = false;
|
|
|
40
40
|
const MEDIA_REGEX =
|
|
41
41
|
/\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Seeds Vite's dependency scanner with Zudoku's own source.
|
|
45
|
+
*
|
|
46
|
+
* `zudoku` is in `optimizeDeps.exclude`, so its source is served to the browser
|
|
47
|
+
* unbundled and its bare imports have to be pre-bundled by name. When Zudoku is
|
|
48
|
+
* installed normally its source lives inside `node_modules`, and Vite skips
|
|
49
|
+
* runtime dependency discovery for any importer under `node_modules` (it serves
|
|
50
|
+
* the raw file with a `?v=` query instead). This scan is therefore the only
|
|
51
|
+
* chance to find those dependencies — anything it misses reaches the browser as
|
|
52
|
+
* raw CommonJS and fails to parse as ESM.
|
|
53
|
+
*
|
|
54
|
+
* The scan aborts wholesale on a single unresolvable import, so the entries must
|
|
55
|
+
* not include modules that only resolve in another environment.
|
|
56
|
+
*/
|
|
57
|
+
export const getDepScanEntries = () => {
|
|
58
|
+
const src = path.posix.join(getZudokuRootDir(), "src");
|
|
59
|
+
|
|
60
|
+
return [
|
|
61
|
+
`${src}/{app,lib}/**/*.{ts,tsx}`,
|
|
62
|
+
// Client-environment scan: `entry.server.tsx` imports
|
|
63
|
+
// `virtual:zudoku-markdown-files`, which only the `ssr` environment
|
|
64
|
+
// provides. Including it fails the scan and disables pre-bundling entirely.
|
|
65
|
+
`!${getAppServerEntryPath()}`,
|
|
66
|
+
// Not published, but present in the monorepo — keeps local dev scanning the
|
|
67
|
+
// same file set an installed site does (and out of vitest's dependencies).
|
|
68
|
+
`!${src}/**/*.test.*`,
|
|
69
|
+
];
|
|
70
|
+
};
|
|
71
|
+
|
|
43
72
|
const defineEnvVars = (vars: string[]) =>
|
|
44
73
|
Object.fromEntries(
|
|
45
74
|
vars.flatMap((v) => [
|
|
@@ -229,7 +258,7 @@ export async function getViteConfig(
|
|
|
229
258
|
},
|
|
230
259
|
},
|
|
231
260
|
optimizeDeps: {
|
|
232
|
-
entries:
|
|
261
|
+
entries: getDepScanEntries(),
|
|
233
262
|
exclude: ["zudoku"],
|
|
234
263
|
include: [
|
|
235
264
|
"@mdx-js/react",
|