From 02e9edd4ed90ba2909ef0734c0d49ceba1eda364 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 16 May 2026 19:10:39 +0200 Subject: [PATCH] vendor(editor): add CodeJar attribution header + source-form rationale Brings codejar.js to parity with prism.js, which already carries a self-documenting header. The README also now records *why* the unminified source form was chosen: CSP rules out runtime sourcemap loading from a CDN, so debuggability lives in the vendored bytes. SHA256 column updated to match the new file content. Addresses Minor #1 + #2 from the Task 1 code review. Co-Authored-By: Claude Opus 4.7 (1M context) --- l4d2web/l4d2web/static/vendor/README.md | 10 ++++++++-- l4d2web/l4d2web/static/vendor/codejar.js | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/l4d2web/l4d2web/static/vendor/README.md b/l4d2web/l4d2web/static/vendor/README.md index d1e4790..4abfe5a 100644 --- a/l4d2web/l4d2web/static/vendor/README.md +++ b/l4d2web/l4d2web/static/vendor/README.md @@ -8,7 +8,12 @@ verbatim from the upstream releases below. The strict CSP |---|---|---|---| | `prism.js` | jsdelivr concat: prism-core.min.js + prism-clike.min.js + prism-bash.min.js | v1.29.0 | `636b6ce9db1eddd5b60992bb34e3fbc1c3364bce7c312f798f20a16011d7681c` | | `prism.css` | https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css | v1.29.0 | `928e23e6b9fcef82c5f1d1f05b6f7fc5a6e187c60195e59fbf16fc9d071ee057` | -| `codejar.js` | https://cdn.jsdelivr.net/npm/codejar@4.0.0/dist/codejar.js + ESM-strip + browser-global shim | v4.0.0 | `c13c2df70a0712acb6440ff5a19ec0afe46d3e811fcb6c4fecd1fde73ae94486` | +| `codejar.js` | https://cdn.jsdelivr.net/npm/codejar@4.0.0/dist/codejar.js + ESM-strip + attribution header + browser-global shim | v4.0.0 | `1d05dc0fdc6941c3ea0c865612843d098e271155b9258b4cbbc4095b07318d3b` | + +CodeJar ships in source form (not minified) — chosen here over the +minified variant because the strict CSP rules out runtime sourcemap +loading from a CDN, and readable vendor source meaningfully helps +debugging when something goes wrong in the editor widget. ## Regenerating @@ -17,6 +22,7 @@ verbatim from the upstream releases below. The strict CSP an updated `VER`, then re-download the theme CSS. - **CodeJar:** Re-download from jsdelivr per the same plan's Task 1 Step 2 (`dist/codejar.js`, not the bare `codejar.js` which does not - exist in v4.x), strip ESM exports, re-append the `window.CodeJar` shim. + exist in v4.x), strip ESM exports, prepend the in-file attribution + header, re-append the `window.CodeJar` shim. Bump the version + SHA columns in this table after any update. diff --git a/l4d2web/l4d2web/static/vendor/codejar.js b/l4d2web/l4d2web/static/vendor/codejar.js index 82611f7..7480f62 100644 --- a/l4d2web/l4d2web/static/vendor/codejar.js +++ b/l4d2web/l4d2web/static/vendor/codejar.js @@ -1,3 +1,6 @@ +/* CodeJar v4.0.0 — https://cdn.jsdelivr.net/npm/codejar@4.0.0/dist/codejar.js + * Local edits: leading `export` keyword stripped from `function CodeJar`; + * `window.CodeJar = CodeJar;` shim appended at EOF for non-module