Skip to content

Move the pathing editor's webview script into a bundle - #114

Merged
Frotty merged 3 commits into
refactor/objmod-css-assetfrom
refactor/wpm-webview-bundle
Sep 5, 2026
Merged

Move the pathing editor's webview script into a bundle#114
Frotty merged 3 commits into
refactor/objmod-css-assetfrom
refactor/wpm-webview-bundle

Conversation

@Frotty

@Frotty Frotty commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Stacked on #113. Establishes the pattern for getting inline webview JavaScript out of host template literals, using the smallest self-contained case.

  • src/webview/wpmEditorWebview.ts replaces the ~450-line <script> template literal in wpmPreview.ts; webpack bundles it to dist/webview/wpmEditorWebview.js.
  • The host hands over the grid and palette data through a nonce'd window.__WPM_INITIAL__ script and loads the bundle under the same nonce. The page CSP no longer allows 'unsafe-inline' scripts.
  • WpmEditorProvider takes the extension URI for localResourceRoots; the e2e harness passes the repo root like the object editor harness does.
  • The bundle is type-checked under tsconfig.webview.json (DOM casts added where the script relied on loose typing) and added to the packaging guard.
  • AGENTS.md documents the pattern and lists the remaining inline scripts to convert (model viewer, map preview, asset browser, map-data editors, sound player).

Validation

  • tsc (host and webview configs), npm run lint, npm test: clean.
  • npm run compile-web: bundle emitted.
  • npm run test:e2e pathing-editor specs (12): pass against the real bundle in Chromium.

The .wpm editor's ~450 lines of browser JavaScript lived in a template literal
inside wpmPreview.ts, unchecked by tsc or ESLint. It is now
src/webview/wpmEditorWebview.ts, bundled to dist/webview/wpmEditorWebview.js
and loaded under a nonce; the host hands over the grid and palette data through
window.__WPM_INITIAL__ and the page no longer allows arbitrary inline scripts.
This is the pattern for the remaining inline webview scripts (model viewer,
map preview, asset browser, map-data editors, sound player).
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T15:59:51.616292Z 5ad4623 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty
Frotty merged commit 24713e8 into refactor/objmod-css-asset Sep 5, 2026
1 check passed
@Frotty
Frotty deleted the refactor/wpm-webview-bundle branch September 5, 2026 16:24
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