Skip to content

feat(ui): list every enabled plugin's inline scripts in preset.scripts - #421

Merged
vite-hub[bot] merged 6 commits into
mainfrom
feat/plugin-scripts
Nov 13, 2026
Merged

vite-hub[bot] merged 6 commits into
mainfrom
feat/plugin-scripts

Conversation

@onmax

@onmax onmax commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

A host with a strict Content Security Policy has no way to list the inline scripts comark-ui writes. Only mermaidScript and comark-outline's railScript were exported, so Drop renders a fake zoom block and a fake properties box at startup and pulls each <script> out with a regex, and it still misses the others: carousel, tabs, code, table, charts, sources, media, magic move, quiz, annotate, and X embeds.

This adds scripts: string[] to the preset: the exact text of every inline script the HTML components can write, for the plugins that are on, each once. A host hashes them, or adds its nonce to each <script> whose text is in the list and leaves a document's own scripts blocked. Turning a plugin off drops its script, and zoom: false drops zoom's from Mermaid.

Each package whose HTML renderer writes a script now exports its list as scripts from /html, and includes the scripts of the packages it draws with: carousel lists zoom's, annotate lists carousel's and zoom's, and charts lists annotate's for marks. The renderers write the same constant they export, so the two can't drift. The Vue, React, and Svelte presets return [], since their components run scripts from the bundle. mermaidScript and railScript stay as they are.

No visible change, so no screenshots. The renderers' HTML output is unchanged.

Validation:

  • New packages/ui/test/scripts.test.ts: it renders one document with a block of every plugin that has a script, collects each <script> text, and checks it equals preset.scripts (15 scripts). It also checks that turning plugins off drops theirs and that the Vue preset has none.
  • vp test run on the whole workspace passes apart from two remark-to-comark CLI tests that timed out under load. That package isn't touched here.
  • pnpm typecheck, vp lint and vp fmt on the changed files, pnpm run doctor for the 15 changed packages, and pnpm run lint:docs.

Each package whose HTML renderer writes a <script> exports the exact text as scripts from /html, with the scripts of the packages it draws with. comarkUi() collects them for the plugins that are on, so a host with a strict CSP can hash them or add its nonce without rendering a document first. The Vue, React, and Svelte presets return an empty list.
@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-13T17:11:43.237219Z
We couldn’t complete this review. Comment @codex review to try again.
22b72a7 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 13, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Completed 2026-11-13T22:16:05.785Z 4m 5s
View session Starting Not started —

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

Pushed 7779809 resolving the prepared main merge and restoring repository guidance, including preset.scripts documentation. Lint passed with warnings. Focused tests require workspace builds; the prerequisite build hit a sandbox SQLite access failure. Thread resolution was rejected because the PR head changed; the next pass must resolve the restored-guide finding. Awaiting hosted checks.

Session

Pushed acf26af, resolving the merge conflict while preserving both lazy-highlighter documentation and CSP script guidance. All 17 focused tests passed; lint passed with warnings. Dependencies refreshed successfully. Earlier review findings remain fixed, with no outstanding P0 or P1 findings. Awaiting hosted checks and automated review.

Session

Pushed acf26af, resolving the merge conflict while preserving both lazy-highlighter documentation and CSP script guidance. All 17 focused tests passed; lint passed with warnings. Dependencies refreshed successfully. Earlier review findings remain fixed, with no outstanding P0 or P1 findings. Awaiting hosted checks and automated review.

Session

Pushed acf26af, resolving the merge conflict while preserving both lazy-highlighter documentation and CSP script guidance. All 17 focused tests passed; lint passed with warnings. Dependencies refreshed successfully. Earlier review findings remain fixed, with no outstanding P0 or P1 findings. Awaiting hosted checks and automated review.

Session

Pushed acf26af, resolving the merge conflict while preserving both lazy-highlighter documentation and CSP script guidance. All 17 focused tests passed; lint passed with warnings. Dependencies refreshed successfully. Earlier review findings remain fixed, with no outstanding P0 or P1 findings. Awaiting hosted checks and automated review.

Session

Pushed acf26af, resolving the merge conflict while preserving both lazy-highlighter documentation and CSP script guidance. All 17 focused tests passed; lint passed with warnings. Dependencies refreshed successfully. Earlier review findings remain fixed, with no outstanding P0 or P1 findings. Awaiting hosted checks and automated review.

@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.

Important

preset.scripts does not always match the final rendered script text, so the documented CSP allowlists block valid component runtimes.

Reviewed changes — Reviewed the new inline-script exports, preset aggregation, renderer integration, documentation, and regression coverage across all 20 changed files.

  • Script exports: HTML packages share constants between their renderers and new scripts exports, including transitive carousel, annotate, and zoom runtimes.
  • Preset aggregation: Enabled HTML plugins contribute deduplicated script bodies; Mermaid follows its zoom setting, while framework presets return empty lists.
  • CSP integration: The guide and agent reference document hashing or selectively adding nonces, and the new tests compare a combined document against the preset list.
  • Validation: Focused tests passed (425 tests, one skipped), as did workspace typechecking and lint on the changed TypeScript files; isolated-render assertions and a controlled Chromium CSP comparison exposed the final-text mismatch described inline.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread packages/ui/src/index.ts Resolved

@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.

Important

One P1 regression remains: the new Unicode script separators break media runtime execution in responses without a declared charset, including the newly added CSP test.

Reviewed changes — Reviewed ab47d41, the fix added since the previous Pullfrog review.

  • Normalized inline scripts: Replaced CR/LF line endings with U+2028 across HTML runtimes to keep exported bodies invariant under native-parent indentation.
  • Added regression coverage: Expanded isolated and nested render assertions, script syntax checks, and a Chromium test using exported CSP hashes.
  • Validated execution: Passed 445 package/preset tests, workspace typechecking, and changed-file lint; reproduced 19 failures in the 20-test media browser suite and isolated the charset dependency with controlled Chromium responses.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread shared/html.ts Resolved

@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 — Reviewed 515413b, the UTF-8 hosting fix added since the previous Pullfrog review.

  • Documented UTF-8 hosting: Established the encoding requirement and explained why Unicode script separators need a declared charset.
  • Updated HTML fixtures: Declared charset=utf-8 in both media response paths and added an explicit browser encoding assertion to the strict-CSP test.
  • Verified runtime execution: All 20 media browser tests and 13 focused renderer/preset tests passed, including exported-hash execution and blocking an unrelated document script; the workspace build, typecheck, and changed-file lint also passed.

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

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

comark-badge

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

comark-cards

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

comark-carousel

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

comark-cast

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

comark-charts

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

comark-chat

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

comark-chips

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

comark-cjk

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

comark-code

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

comark-code-notes

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

comark-colors

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

comark-comments

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

comark-critic

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

comark-deflist

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

comark-details

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

comark-diagrams

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

comark-diff

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

comark-embed

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

comark-fields

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

comark-figure

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

comark-file-tree

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

comark-footnotes

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

comark-git-graph

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

comark-github

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

comark-icon

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

comark-include

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

comark-keys

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

comark-links

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

comark-linter

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

comark-magic-move

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

comark-mark

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

markdown-it-to-comark

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

marked-to-comark

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

comark-mathml

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

comark-media

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

comark-metrics

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

migrate-to-comark

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

comark-outline

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

comark-properties

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

comark-qr

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

comark-quiz

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

comark-reading-time

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

remark-to-comark

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

comark-sources

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

comark-steps

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

comark-table

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

comark-tabs

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

comark-tests

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

comark-time

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

comark-ui

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

comark-xref

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

comark-zoom

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

commit: 7779809

@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 P0 or P1 findings remain; one P2 documentation regression is noted inline.

Reviewed changes — Reviewed acf26af, the merge and reference-conflict resolution added since the previous incremental pass.

  • Merged reference guidance, retaining main's lazy-highlighter documentation alongside the existing CSP scripts guidance.
  • Removed repository instructions, leaving AGENTS.md empty without changing the PR's runtime implementation.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol(xhigh) | 𝕏

Comment thread AGENTS.md Resolved

@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 — Reviewed 7779809, the merge resolution and repository-guide restoration added since the previous Pullfrog review.

  • Restored repository guidance, recovering the architecture, verification, and release instructions while retaining the preset.scripts contract.
  • Preserved merge integration, keeping main's author-issues imports and reference guidance alongside the existing CSP script exports.
  • Verified guide restoration, checking the required sections, retained script guidance, and absence of conflict markers in the overlap files. Runtime tests were not rerun because the PR-specific delta changes documentation only.

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

@vite-hub
vite-hub Bot merged commit 92c3e4b into main Nov 13, 2026
6 checks passed
@vite-hub
vite-hub Bot deleted the feat/plugin-scripts branch November 13, 2026 23:02
@github-actions github-actions Bot mentioned this pull request Nov 13, 2026
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