Repository navigation
fix(pages): the self-hosted Mermaid bundle ships the notices of all 74 packages it contains (#274) - #276
Merged
Conversation
…s, with the licence texts (#274) The docs site redistributes Mermaid's standalone bundle (engine#272) and shipped only Mermaid's licence. The bundle contains the code of 73 more packages, so each of their notices has to ship with it. scripts/third-party-notices.mjs reads the packages from the bundle's source maps, following a sibling package's own maps and failing on any source it cannot attribute, and takes each package's licence and NOTICE files from the package installed at that exact version or from third-party/licenses/. A first approach walked the installed dependency tree; it found 110 packages and still missed langium and chevrotain, which Mermaid's parser bundles at its own build time and which are not installed at all, so it was replaced before commit. scripts/vendor-licence-texts.mjs fills third-party/licenses/ with npm pack; it holds the 25 packages the bundle names at a version npm does not install here. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… Mermaid bundle (#274) mermaid.min.js.LICENSE.txt now carries Mermaid's licence and the licence and NOTICE files of every package the bundle's source maps name, among them chevrotain under Apache-2.0. scripts/mermaid-notices.mjs holds the rules for Mermaid 11's maps: its own sources, @mermaid-js/parser's bundled files, and vscode-uri's webpack sources (vscode-uri 3.1.0 and path-browserify 1.0.1, the only releases langium 4.2.0's and vscode-uri's ranges allow). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…TRIBUTING (#274) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#274) adaptive-learner vendors Mermaid 11.17.2 for its docs site without any notice (adaptive-learner#3813). scripts/write-mermaid-notices.mjs runs the same rules on a scratch install of that version and can fetch the missing texts first (vendorLicenceTexts, now importable; missingNoticeTexts lists them without throwing). fastdom 1.0.12, new in Mermaid 11.17.2, ships its MIT licence only as a README section: the vendoring step takes that section as LICENSE.from-README with a line naming its origin, and a copy installed without a licence file no longer hides a vendored one. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
#274) chevrotain-allstar ships its licence with CRLF line ends. Git normalises them on commit, so a notices file pinned by hash in a repository (adaptive-learner#3813) no longer matched its own checkout. renderNotices writes LF throughout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since #273 the Pages site serves Mermaid's standalone bundle (
docs/assets/mermaid.min.js, mermaid 11.16.1) and ships only Mermaid's own licence next to it. The bundle contains the code of 73 other packages, and the site redistributes all of it, so each package's notice has to ship too. One of them is chevrotain, under Apache-2.0, which asks for a copy of the licence itself.What the bundle contains (measured)
The packages come from the bundle's source maps, not from the dependency tree. Measured on 2026-10-21:
mermaid.min.js.maphas 1125 sources:@mermaid-js/parser's own bundle (../../parser/dist/…).webpack://LIB/…because vscode-uri is itself a webpack bundle.A first approach walked the installed dependency tree. It found 110 packages, many of them never bundled (type packages, for one), and still missed langium and chevrotain. It was replaced before commit.
Change
scripts/third-party-notices.mjsprovides three functions:bundledPackageswalks a source map and follows a sibling package's own maps. It fails on any source it cannot attribute, and lists them all.noticeTextstakes each package's licence and NOTICE files from the package installed at that exact version, else fromthird-party/licenses/. It fails on a package with neither and prints the command that fetches the missing texts.renderNoticeswrites the file.scripts/mermaid-notices.mjsholds the rules for Mermaid 11's maps:@mermaid-js/parser's bundled files.~3.1.0and 3.1.0 is the only 3.1.x release; and path-browserify 1.0.1, because vscode-uri 3.1.0 asks for^1.0.1and 1.0.1 is the only 1.x release.scripts/vendor-licence-texts.mjsfetches texts withnpm pack, without installing anything.third-party/licenses/holds the 25 vendored packages (364 KB). It is not part of the npm package.docs-site/assets/mermaid.min.js.LICENSE.txtnow has 74 sections (164 KB). Mermaid's licence comes first, then the others sorted by name.For a bundle vendored elsewhere
scripts/write-mermaid-notices.mjsruns the same rules on a scratch install of any Mermaid version and fetches the missing texts on request. For adaptive-learner (#3813, Mermaid 11.17.2):The installed 11.17.2 bundle is byte-identical to the one adaptive-learner pins (sha256
581ed7d7…). The result has 75 sections, one for each package the maps name.fastdom 1.0.12, new in Mermaid 11.17.2, ships its MIT licence only as a README section, with no licence file in the tarball or the repository. The vendoring step takes that section as
LICENSE.from-READMEwith a line naming its origin. A copy installed without a licence file no longer hides the vendored one.Verification
src/third-party-notices.test.ts: 15 tests on small maps and package trees. They cover pnpm paths (scoped names, peer suffix), a sibling map, aliases, fail-closed on unattributable sources and missing texts, exact-version selection, the vendored fallback, and the notice-file rule (license-update.mjsis a script, not a licence; cytoscape ships one).src/docs-site.test.ts: the shipped file starts with the notice header, contains Mermaid's licence verbatim and a section for every package the maps name, and carrieschevrotain@11.1.2 (Apache-2.0)with the Apache text.make release-check: passed, 77 files, 2074 tests.npm run lint,npm run typecheck,npm run docs:api:check,npm run docs:pagesandnpm run docs:pages:checkare green.make prose-checkis OK.Notes
Closes #274
🤖 Generated with Claude Code