Skip to content

Update maidr w/ npm auto-update - #2205

Open
jooyoungseo wants to merge 1 commit into
cdnjs:masterfrom
jooyoungseo:update-maidr-locale-packs
Open

jooyoungseo wants to merge 1 commit into
cdnjs:masterfrom
jooyoungseo:update-maidr-locale-packs

Conversation

@jooyoungseo

Copy link
Copy Markdown
Contributor

Adds maidr's eight locale packs to its file map (#2181 added the library).

Why

Since v4.8.0, maidr ships every language but English as a separate locale pack, dist/locale-<code>.js, rather than building every dictionary into maidr.js (xability/maidr#1252). When a reader picks a language, or the browser reports one, maidr.js loads the pack from beside its own URL, the same way it already loads maidr-math.css.

On a page served from cdnjs, that resolves to, for example, https://cdnjs.cloudflare.com/ajax/libs/maidr/4.10.0/locale-ko.js. That URL is a 404 today, so the page stays in English. The file map lists only maidr.js, maidr.css and maidr-math.css, so 4.8.0 through 4.10.0 on cdnjs each have 6 files and no packs.

Files added

file size (4.11.0)
locale-ko.js 97 KB
locale-ja.js 102 KB
locale-zh.js 84 KB
locale-es.js 94 KB
locale-de.js 94 KB
locale-fr.js 97 KB
locale-it.js 93 KB
locale-hi.js 152 KB

The list is still explicit rather than a glob, as in #2181 (per #186):

  • The locale-<code>.mjs twins are ES modules for bundlers. maidr.js never requests them.
  • The runtime loader asks for exactly locale-<code>.js, and nothing else in dist/ is loaded relative to maidr.js. I checked the 4.11.0 bundle: its only relative loads are maidr-math.css and these packs.

All eight are in the published tarball of every release since 4.8.0, e.g. https://cdn.jsdelivr.net/npm/maidr@4.11.0/dist/.

Checks

  • Only the files array changes; every other field is byte-identical.
  • The file validates against schema_human.json from cdnjs/tools.
  • LF endings and the trailing newline are kept.
  • The same map is kept in the maidr repository as cdnjs/maidr.json, with a test that fails if a pack is missing from it. This PR brings the live config in line with it.

Versions already on cdnjs keep their current files; releases processed after this change will include the packs.

🤖 Generated with Claude Code

Mirror the eight locale packs maidr.js loads from beside itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jooyoungseo added a commit to xability/maidr-skill that referenced this pull request Sep 28, 2026
Since maidr.js 4.8.0 only English is in the bundle; ko, ja, zh, es, de,
fr, it and hi are dist/locale-<code>.js packs that maidr.js fetches from
beside its own URL, or from window.maidrLocaleBaseUrl when set (Dc() in
the vendored 4.11.0 bundle; maidr docs/LOCALIZATION.md). The skill's
offline paths never reached them:

- inline bundle: no URL, so "[maidr] Cannot locate the locale pack" and
  English. javascript.md, python.md's one-file recipe and the template
  comment now put a jsDelivr maidrLocaleBaseUrl declaration before the
  bundle (a maidr@X.Y.Z pin, so update-bundle.sh and the pin check cover
  it), and say to paste the reader's pack too for an offline file.
- vendored ./maidr.js: ./locale-ko.js 404s. New
  scripts/fetch_locale_packs.py puts the packs beside it (from jsDelivr,
  or --from a local dist), checking each is the pack for its code. The
  packs are not vendored into assets/.
- cdnjs: mirrors no packs (4.8.0-4.10.0; cdnjs/packages#2205). Documented
  in SKILL.md, javascript.md and to_artifact.py. The template loader sets
  no base URL: it would override packs beside whichever copy loads.

check_maidr_html.py warns when maidr.js is inline or relative and the
page has no declaration, no locale-*.js script or pasted pack, and no
packs beside the local file. Its loader detection, and to_artifact.py's
LOADER, now require the bundle's own URL, so the declaration is not
taken for a loader (to_artifact would have replaced it with a second
maidr.js tag). troubleshooting.md covers both console warnings.

Checked in Chromium with locale ko-KR: the inline page fetches
maidr@4.11.0/dist/locale-ko.js (200) and announces "Quarter는 Q1, ...";
a vendored page with locale-ko.js beside it does so with the network
blocked; en-US requests no pack.

Closes #9


Claude-Session: https://claude.ai/code/session_01NozAnjR3Ymjh9RQM8oXkAR

Co-authored-by: Claude <noreply@anthropic.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