Repository navigation
Move the OJS runtime and its Observable forks from quarto-dev/quarto - #15046
Conversation
Copy the OJS runtime and its five vendored Observable forks verbatim from packages/ojs in quarto-dev/quarto at 42177e13, which includes the rollup tooling upgrade from quarto-dev/quarto#1180. The only omission is quarto-ojs-runtime/assets/quarto.css, which is older than this repo's src/resources/formats/html/ojs/quarto-ojs.css. Part of quarto-dev#15043. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Add an npm workspace root in packages/ojs that links the runtime and the forks, with a package-lock.json. npm run build writes both bundles straight into src/resources/formats/html/ojs. - Remove the forks' devDependencies and yarn.lock files. They were for each fork's own build and tests, which don't run here, and their old rollup plugins fail npm's peer dependency checks. - Point the compiler fork's module field at its ES module source, so the runtime's rollup build bundles it directly. This removes the need for a rollup 1 build of its UMD dist and for @rollup/plugin-commonjs (the bundles are byte-identical without it). - Drop the build year from the banner so the build is reproducible, and bump quarto-ojs-runtime to 0.0.19. - Replace notes.md, whose git subtree commands no longer apply, with a README. Part of quarto-dev#15043. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Rebuild quarto-ojs-runtime{,.min}.js from packages/ojs. Besides the
build tooling, this ships everything since the last bump in 2024-02:
acorn 8.17, the debugger removal, inspector 5.0.1, Inputs 0.10.6 and
mime 4.
Add a workflow that rebuilds the bundles when packages/ojs or the
bundles change, and fails if they differ from the committed ones.
Closes quarto-dev#15043.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v1 |
There was a problem hiding this comment.
| - uses: actions/checkout@v1 | |
| - uses: actions/checkout@v7 |
There was a problem hiding this comment.
wait do we even need this? this is just vendored?
There was a problem hiding this comment.
No, GitHub only runs workflows from the root .github/workflows, so this one never runs here. Same for the other CI files this PR adds under the forks:
packages/ojs/external-asg017-unofficial-observablehq-compiler/.circleci/config.yml
packages/ojs/external-asg017-unofficial-observablehq-compiler/.github/workflows/main.yml
packages/ojs/external-d3-d3-require/.github/eslint.json
packages/ojs/external-d3-d3-require/.github/workflows/node.js.yml
packages/ojs/external-observablehq-parser/.github/eslint.json
packages/ojs/external-observablehq-parser/.github/workflows/nodejs.yml
packages/ojs/external-observablehq-runtime/.github/workflows/nodejs.yml
packages/ojs/external-observablehq-stdlib/.github/workflows/nodejs.yml
The forks' devDependencies are already removed, so the test/build scripts these workflows call can't run anyway. I would remove the nested .github/ and .circleci/ directories before merging, so they don't end up in main and attract bump suggestions like the one on this file.
There was a problem hiding this comment.
🤖 Removed all eight files listed (the nested .github/ and .circleci/ dirs in the forks) in 730faee, and noted the removal under "Changes from the copies in quarto-dev/quarto" in the README.
cderv
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me from the quarto-cli side.
What I checked in addition to your testing:
- The rebuild also reproduces the bundles on Windows. The unminified one comes out with CRLF line endings there, but
.gitattributesnormalizes it, sogit diffstays empty and the CI check holds for Windows contributors. - Only the bundle ships. Nothing under
packages/is picked up byprepare-dist, anddeno lint/fmtdon't see it. - For self-contained output we inline
quarto-ojs-runtime.jsinto a<script type="module">without any escaping. The new bundle still has no</scriptin it, so that path is fine. - The 14 smoke-all documents with
{ojs}cells also pass with the new bundle.
A few small changes suggested inline, none blocking.
Remove the forks' nested CI configs, note the escodegen and escape-html licenses, and record the source commit in the README. Mention .mjs in the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OJS runtime and its Observable forks now live in packages/ojs/,
but nothing in the repo explained how {ojs} cells reach that runtime or
what a runtime change must include to be complete. Add that
documentation so maintainers can work on the render path and the update
process without reverse-engineering it.
- llm-docs/ojs-architecture.md: the render path through ojsCompile(),
linking or inlining the runtime for self-contained output, the Lua
filter for inline ${...}, ojs_define per engine, resource extraction,
and which files are generated versus hand-edited.
- dev-docs/update-ojs-runtime.md: the maintainer procedure for a runtime
change, npm dependency bump, or fork change, including what to commit
together and what to verify beyond the bundle CI check (self-contained
render, Shiny inputs, FileAttachment MIME types after a mime upgrade).
dev-docs/upgrade-dependencies.md links to it.
- .claude/rules/formats/ojs.md: a path-scoped rule pointing to both docs
when editing OJS sources.
- vendored-html-dependencies.md excludes ojs/, since the vendored
dependency updater does not manage it.
See #15046
Closes #15043.
This moves the OJS runtime and its vendored Observable forks from quarto-dev/quarto's
packages/ojs/intopackages/ojs/here, next topackages/quarto-types. It adds an npm build that regenerates the committed bundles, and a CI check that the committed bundles match the sources. quarto-dev/quarto#1180 deletes the copy there once this lands.Commits
Each commit is reviewable separately:
packages/ojsfrom quarto-dev/quarto. A verbatim copy from quarto-dev/quarto@42177e13, the commit before Problem creating PDFs - 'No TeX installation was detected' (Windows 10) #1180's deletion, so Problem creating PDFs - 'No TeX installation was detected' (Windows 10) #1180's rollup tooling upgrade comes along. The only file left out isquarto-ojs-runtime/assets/quarto.css, because this repo'squarto-ojs.cssis newer.packages/ojs/package.jsonis an npm workspace root that links the runtime and the five forks. It has a committedpackage-lock.json.npm run buildwritesquarto-ojs-runtime{,.min}.jsstraight intosrc/resources/formats/html/ojs/.devDependenciesandyarn.lockfiles are removed. They were only for each fork's own build and tests, which never ran in quarto-dev/quarto's CI either. Their old rollup plugins fail npm's peer dependency checks (rollup-plugin-terser7 needs rollup 2, but the forks use rollup 3), and they would keep the dev-only Snyk advisories.package.jsongets"module": "src/index.js". Itsmainwas a UMDdist/that had to be built first with rollup 1. Now the runtime's rollup bundles the compiler from its ES module source. This also makes@rollup/plugin-commonjsunnecessary: with it removed, the output is byte-identical.new Date().getFullYear(), so a rebuild gives the same bytes in any year. The banner used to read "Copyright 2024 undefined"; now it reads// quarto-ojs-runtime v0.0.19 Copyright Posit Software, PBC. The runtime's version is bumped to 0.0.19.notes.mdis replaced with aREADME.md. The old notes'git subtree pullcommands won't work on plain copies..github/workflows/test-ojs-runtime.yml, which runs whenpackages/ojs/**or the bundles change. It runsnpm ci && npm run build, then fails ifgit diffshows the bundles changed.Bundle changes
Compared with #1180's bundle, the new one differs only in how the compiler is included. The compiler's code is inlined as ES modules instead of as an embedded UMD blob, which also renumbers some identifiers (
hasOwnProperty$2→$3, and so on). The bundled library versions are the same: acorn 7.4.1 for the compiler's@observablehq/parser4.2, and acorn 8.17.0 for the parser fork.Compared with the bundle on
main, which was last rebuilt in 2024-02, this also ships everything listed in #15043: acorn 8.8.1 → 8.17, thedebuggerremoval, inspector 5.0.1, Inputs 0.10.6, and mime 4 (FileAttachment(…).mimeTypeistext/javascriptfor.js).@observablehq/inputsstays on 0.10, as the README notes.Testing
npm ci && npm run buildinpackages/ojson Node 24 / npm 11: clean install, 0 vulnerabilities, no peer warnings. Rebuilding from a freshnpm cireproduces the committed bundles exactly.tests/docs/playwright/ojs/*.qmdwith the dev build and ran the 7 OJS spec files (9 tests) in Chromium, Firefox and WebKit: 27/27 pass. The rendered pages load the v0.0.19 bundle.Notes for reviewers
git subtree/filter-repo), because PRs here are squash-merged. The source commit is recorded in commit 1 and in the README..github/and.circleci/directories came along with the copy. They're inactive outside the repo root. I kept them so the forks stay close to upstream.deno lint/fmtonly includesrc/, so they don't check the vendored JS.🤖 Generated with Claude Code