diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index c0f372ec..e47f76b0 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -284,7 +284,7 @@ export default defineConfig({ ? false : { resolveDependencies: (_filename, dependencies) => dependencies.filter((dependency) => - !/(?:vendor-code-highlight|vendor-(?:mermaid|D3|tiptap|prosemirror|floating|codemirror|x6|infographic|zod)|vendor~(?:wasm|emacs-lisp)-|vendor-radix(?!-slot)|ui-primitives|ui-button-tooltip|i18n-ja-)/.test(dependency), + !/(?:vendor-code-highlight|vendor-(?:mermaid|D3|tiptap|prosemirror|floating|codemirror|x6|infographic|zod|streamdown)|vendor~(?:wasm|emacs-lisp)-|vendor-radix(?!-slot)|ui-primitives|ui-button-tooltip|i18n-ja-)/.test(dependency), ), }, rolldownOptions: { diff --git a/scripts/verify-web-performance.mjs b/scripts/verify-web-performance.mjs index 6fef67a2..a570544e 100644 --- a/scripts/verify-web-performance.mjs +++ b/scripts/verify-web-performance.mjs @@ -27,7 +27,7 @@ assert.deepEqual( ); assert.doesNotMatch(serviceWorker, /edgeever-offline-shell/, "PWA must not retain a versioned offline HTML shell"); const modulePreloads = indexHtml.match(/]+>/g)?.join("\n") ?? ""; -const initialOptionalPattern = /vendor-code-highlight|vendor-D3|beautiful-mermaid|vendor-(?:mermaid|tiptap|prosemirror|floating|codemirror|x6|infographic)|vendor~(?:wasm|emacs-lisp)-|ui-primitives|mermaid\.core|[^"']*Diagram(?:EditorPane)?-/; +const initialOptionalPattern = /vendor-code-highlight|vendor-D3|beautiful-mermaid|vendor-(?:mermaid|tiptap|prosemirror|floating|codemirror|x6|infographic|streamdown)|vendor~(?:wasm|emacs-lisp)-|ui-primitives|mermaid\.core|[^"']*Diagram(?:EditorPane)?-/; assert.doesNotMatch(modulePreloads, initialOptionalPattern, "Optional editor and diagram chunks must remain out of the initial HTML modulepreload list"); assert.doesNotMatch(modulePreloads, /ui-button-tooltip/, "Button tooltips must load only when a titled button is rendered"); assert.doesNotMatch(modulePreloads, /vendor-radix(?!-slot)/, "Radix overlays must remain out of the initial HTML modulepreload list"); @@ -40,9 +40,10 @@ assert.ok(initialModulePreloadBytes <= INITIAL_MODULE_PRELOAD_BUDGET, `Initial m const DEFAULT_CHUNK_WARNING_BYTES = 500 * 1024; // Shiki, loaded with the infographic conversation, keeps the Oniguruma wasm // engine and the Emacs Lisp grammar above 500 KiB. AntV Infographic stays one -// atomic deferred chunk so its registries initialize in order. All of these -// stay off the initial modulepreload list. -const allowedLargeChunkPattern = /^(?:vendor-(?:code-highlight|beautiful-mermaid|mermaid-(?:layout|render)|codemirror|x6|infographic)|vendor~(?:wasm|emacs-lisp)-|.*Diagram-).*\.js$/; +// atomic deferred chunk so its registries initialize in order. Streamdown +// keeps the unified/micromark parser graph atomic for the same reason; it +// loads with the note editor. All of these stay off the initial modulepreload list. +const allowedLargeChunkPattern = /^(?:vendor-(?:code-highlight|beautiful-mermaid|mermaid-(?:layout|render)|codemirror|x6|infographic|streamdown)|vendor~(?:wasm|emacs-lisp)-|.*Diagram-).*\.js$/; const largeChunks = readdirSync(join(distDirectory, "assets")) .filter((name) => name.endsWith(".js")) .map((name) => ({ name, size: statSync(join(distDirectory, "assets", name)).size }))