From 1ec5e80a73a69316cdb5506b4945c5f988ed40f0 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 16 May 2026 19:00:48 +0200 Subject: [PATCH] plan(textarea-editor): use curl-based vendoring (subagent-executable) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original Task 1 instructed a human to click through prismjs.com's configurator UI — a step a subagent can't perform. Replace with direct curl from jsdelivr for both Prism components (core + clike + bash concatenated) and CodeJar, plus a sed-based ESM-export strip and a window-global shim. Updates the vendor README template accordingly. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../plans/2026-05-16-textarea-code-editor.md | 88 +++++++++++++------ 1 file changed, 62 insertions(+), 26 deletions(-) diff --git a/docs/superpowers/plans/2026-05-16-textarea-code-editor.md b/docs/superpowers/plans/2026-05-16-textarea-code-editor.md index 967cf18..dbaa644 100644 --- a/docs/superpowers/plans/2026-05-16-textarea-code-editor.md +++ b/docs/superpowers/plans/2026-05-16-textarea-code-editor.md @@ -51,40 +51,75 @@ - Create: `l4d2web/l4d2web/static/vendor/codejar.js` - Create: `l4d2web/l4d2web/static/vendor/README.md` -- [ ] **Step 1: Build the Prism custom bundle** +- [ ] **Step 1: Assemble the Prism bundle via curl** -Open `https://prismjs.com/download.html#themes=prism&languages=clike+bash` in a browser. Set theme = "Default". Tick languages: `clike` (Bash depends on it), `bash`. Leave all plugins unchecked. Click "Download JS" and "Download CSS". Save them as `l4d2web/l4d2web/static/vendor/prism.js` and `l4d2web/l4d2web/static/vendor/prism.css`. - -Verify the version string: - -```bash -head -1 l4d2web/l4d2web/static/vendor/prism.js | grep -oE 'v[0-9.]+' -``` - -Expected: a version like `v1.29.0`. Note it for the README. - -- [ ] **Step 2: Download CodeJar** +Prism ships per-component files at `cdn.jsdelivr.net/npm/prismjs@1.29.0/`. We concatenate three components — `core` (required), `clike` (bash depends on it), `bash` — into a single self-contained `prism.js`. Theme CSS is grabbed separately. ```bash mkdir -p l4d2web/l4d2web/static/vendor -curl -fsSL -o l4d2web/l4d2web/static/vendor/codejar.js \ - https://raw.githubusercontent.com/antonmedv/codejar/v4.0.0/codejar.js +VER=1.29.0 +BASE=https://cdn.jsdelivr.net/npm/prismjs@${VER} + +# Concatenate core + clike + bash into one file, in the required load order. +{ + echo "/* Prism v${VER} — core + clike + bash, assembled from ${BASE}/components/ */" + curl -fsSL "${BASE}/components/prism-core.min.js" + echo # newline separator between components + curl -fsSL "${BASE}/components/prism-clike.min.js" + echo + curl -fsSL "${BASE}/components/prism-bash.min.js" +} > l4d2web/l4d2web/static/vendor/prism.js + +# Theme CSS (the default "prism" theme). +curl -fsSL -o l4d2web/l4d2web/static/vendor/prism.css \ + "${BASE}/themes/prism.min.css" ``` -Inspect the first few lines to confirm it's a CodeJar source file with the expected `export function CodeJar(...)` signature. Then convert it to a script that exposes `CodeJar` on `window` (the UMD form CodeJar ships is ESM; we need a `