Move the pathing editor's webview script into a bundle - #114
Merged
Conversation
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).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Frotty
added a commit
that referenced
this pull request
Sep 5, 2026
Frotty
added a commit
that referenced
this pull request
Sep 5, 2026
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.
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.tsreplaces the ~450-line<script>template literal inwpmPreview.ts; webpack bundles it todist/webview/wpmEditorWebview.js.window.__WPM_INITIAL__script and loads the bundle under the same nonce. The page CSP no longer allows'unsafe-inline'scripts.WpmEditorProvidertakes the extension URI forlocalResourceRoots; the e2e harness passes the repo root like the object editor harness does.tsconfig.webview.json(DOM casts added where the script relied on loose typing) and added to the packaging guard.Validation
tsc(host and webview configs),npm run lint,npm test: clean.npm run compile-web: bundle emitted.npm run test:e2epathing-editor specs (12): pass against the real bundle in Chromium.