Skip to content

perf(ui): load the Mermaid wrapper and typeset styles on first use in comark-ui/vue/lazy - #445

Merged
vite-hub[bot] merged 1 commit into
mainfrom
perf/ui-lazy-mermaid-typeset
Nov 17, 2026
Merged

vite-hub[bot] merged 1 commit into
mainfrom
perf/ui-lazy-mermaid-typeset

Conversation

@onmax

@onmax onmax commented Nov 17, 2026

Copy link
Copy Markdown
Owner

comark-ui/vue/lazy still imports the Mermaid wrapper and the typeset styles up front. A page that switches to it from a build-time map of blocks grows: vitehub.dev's DocsMarkdown chunk gained 19,323 bytes when @vite-hub/docs tried it.

Both came from vue-blocks.ts, which vue-lazy.ts imported statically. The wrapper pulls in client.ts (its bar and styles) and the typeset component pulls in typeset-css.ts, about 12 kB of CSS as a string.

This PR splits them into vue-mermaid.ts and vue-typeset.ts and loads them with the same lazy() helper as every other block. comark-ui/vue imports them as before. A server render is unchanged: Vue's server renderer waits for both, and the existing test that compares the lazy and eager server renders still passes. In the browser, the typeset <style> now arrives with the first document's chunk instead of with the entry.

What the entry loads before any document renders (Vite, minified ESM, vue and comark-* external, gzip -9):

main this PR
raw 24,954 B 2,650 B
gzip 8,144 B 840 B

The lazy-entry test in packages/ui/test/ui.test.ts now also fails when client.ts, typeset-css.ts, or the two new modules end up in the entry's static imports. It fails on main with typeset-css.ts and client.ts and passes here. The built dist/vue-lazy.mjs imports only vue.

I haven't rebuilt vitehub.dev against a preview of this yet; that check goes with vite-hub/vitehub's switch to comark-ui/vue/lazy.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T07:00:11.120264Z
We couldn’t complete this review. Comment @codex review to try again.
4b6046a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vite-hub

vite-hub Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Waiting 2026-11-17T07:14:12.485Z 6m 21s
View session Last seen running 2026-11-17T07:10:18.238Z 0s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

PR #445 is ready. Verified the expected HEAD, complete diff, and Pullfrog review; no actionable findings remain and all supplied checks passed. Local prerequisite build and all 23 focused tests passed. Repository lint passed with warnings. Confirmed the built lazy entry statically imports only Vue. No source changes or repair commit were needed.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@445

comark-badge

pnpm add https://pkg.pr.new/comark-badge@445

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@445

comark-cards

pnpm add https://pkg.pr.new/comark-cards@445

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@445

comark-cast

pnpm add https://pkg.pr.new/comark-cast@445

comark-charts

pnpm add https://pkg.pr.new/comark-charts@445

comark-chat

pnpm add https://pkg.pr.new/comark-chat@445

comark-chips

pnpm add https://pkg.pr.new/comark-chips@445

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@445

comark-code

pnpm add https://pkg.pr.new/comark-code@445

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@445

comark-colors

pnpm add https://pkg.pr.new/comark-colors@445

comark-comments

pnpm add https://pkg.pr.new/comark-comments@445

comark-critic

pnpm add https://pkg.pr.new/comark-critic@445

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@445

comark-details

pnpm add https://pkg.pr.new/comark-details@445

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@445

comark-diff

pnpm add https://pkg.pr.new/comark-diff@445

comark-embed

pnpm add https://pkg.pr.new/comark-embed@445

comark-fields

pnpm add https://pkg.pr.new/comark-fields@445

comark-figure

pnpm add https://pkg.pr.new/comark-figure@445

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@445

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@445

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@445

comark-github

pnpm add https://pkg.pr.new/comark-github@445

comark-icon

pnpm add https://pkg.pr.new/comark-icon@445

comark-include

pnpm add https://pkg.pr.new/comark-include@445

comark-keys

pnpm add https://pkg.pr.new/comark-keys@445

comark-links

pnpm add https://pkg.pr.new/comark-links@445

comark-linter

pnpm add https://pkg.pr.new/comark-linter@445

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@445

comark-mark

pnpm add https://pkg.pr.new/comark-mark@445

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@445

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@445

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@445

comark-media

pnpm add https://pkg.pr.new/comark-media@445

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@445

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@445

comark-outline

pnpm add https://pkg.pr.new/comark-outline@445

comark-properties

pnpm add https://pkg.pr.new/comark-properties@445

comark-qr

pnpm add https://pkg.pr.new/comark-qr@445

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@445

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@445

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@445

comark-sources

pnpm add https://pkg.pr.new/comark-sources@445

comark-steps

pnpm add https://pkg.pr.new/comark-steps@445

comark-table

pnpm add https://pkg.pr.new/comark-table@445

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@445

comark-tests

pnpm add https://pkg.pr.new/comark-tests@445

comark-time

pnpm add https://pkg.pr.new/comark-time@445

comark-ui

pnpm add https://pkg.pr.new/comark-ui@445

comark-xref

pnpm add https://pkg.pr.new/comark-xref@445

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@445

commit: 4b6046a

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes in the lazy Vue entry, extracted renderer modules, eager Vue integration, and bundle regression test.

  • Deferred renderer loading: Mermaid’s wrapper and the scoped typeset styles now load through the existing async component helper instead of the lazy entry’s static imports.
  • Rendering compatibility: The eager Vue entry retains synchronous access to both components, and server rendering still includes the Mermaid SVG, toolbar, and document-local typeset styles. Verified through the public comark-ui/vue/lazy export as well as the existing SSR parity test.
  • Bundle regression coverage: The static-import test now guards against eagerly loading the wrapper, toolbar runtime, and typeset CSS. The workspace build and all 23 focused UI and lazy-navigation tests passed.

Pullfrog  | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

@vite-hub
vite-hub Bot merged commit 50cb8e9 into main Nov 17, 2026
7 checks passed
@vite-hub
vite-hub Bot deleted the perf/ui-lazy-mermaid-typeset branch November 17, 2026 07:29
@github-actions github-actions Bot mentioned this pull request Nov 17, 2026
@github-actions github-actions Bot mentioned this pull request Nov 17, 2026
onmax added a commit to vite-hub/vitehub that referenced this pull request Nov 27, 2026
…and typeset styles on first use

comark-ui 0.12.2's comark-ui/vue/lazy imported the Mermaid wrapper and the
typeset CSS statically, so every docs page loaded them. onmax/comark-ui#445
moved both behind defineAsyncComponent; 0.14.3 is the first npm release with it.
Raise the markdown-ui catalog and the docs peer minimum to ^0.14.3.
vite-hub Bot added a commit to vite-hub/vitehub that referenced this pull request Nov 27, 2026
* perf(docs): load comark blocks through comark-ui/vue/lazy

* fix(docs): type and test the Comark lazy block map

* perf(docs): require comark-ui 0.14.3, whose lazy entry loads Mermaid and typeset styles on first use

comark-ui 0.12.2's comark-ui/vue/lazy imported the Mermaid wrapper and the
typeset CSS statically, so every docs page loaded them. onmax/comark-ui#445
moved both behind defineAsyncComponent; 0.14.3 is the first npm release with it.
Raise the markdown-ui catalog and the docs peer minimum to ^0.14.3.

* fix(content): run comark-ui's typeset after the app's Markdown plugins

comark-ui 0.14.3 puts the typeset-styles node first in the tree instead of last,
so an app plugin such as comark's headings({ remove: true }) no longer found the
title. Content now runs typeset after the app's plugins, as comark-ui's own preset
runs it last, and the consumer probe and Get started example show the new order.

* chore(content): keep index.ts within its comment baseline

* fix(docs, content): keep comark-ui's motion layer off, as before 0.14

comark-ui 0.14 turns motion on by default, which adds a motion-runtime node to
every document and loads comark-motion on the page. The docs site and Content
documents had neither, so their presets turn it off. A docs site opts in with
comarkUi: { motion: true }.

---------

Co-authored-by: vite-hub[bot] <320448255+vite-hub[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant