fix(web): allow the deferred Streamdown chunk in the performance budget
The companion markdown parser stays one atomic chunk so its initializer order holds. It loads with the note editor and stays off the initial modulepreload list.
This commit is contained in:
1 parent
4ff9ed65e2
commit
99a83f3d64
2 files changed
+6
-5
No files matched your search
@@ -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: {
|
||||
|
||||
@@ -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(/<link rel="modulepreload"[^>]+>/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 }))
|
||||
|
||||
Reference in new issue
Block a user