Load power-strip.js as ES module (import.meta.url path detection) (v0.4.5)#110
Merged
Conversation
Switch every power-strip.js injection to `<script type="module" async>` (the auto-injected one in PowerStrip.ts, the three internal pages, and the manual theme test). Module scripts run with `document.currentScript === null`, so the old path-detection (currentScript, with a last-<script> fallback) no longer works. Replace it with `import.meta.url`, which is the module's own URL and the reliable way to locate ourselves. Verified in a real browser that the element still upgrades and basePath resolves to "/users" with no errors. power-strip.js is safe as a module: it uses addEventListener (no inline handlers) and its only global contract is customElements.define, which is unaffected by module scoping. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
startup-api | 5a62db4 | Jul 01 2026, 02:47 AM |
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.
Load power-strip.js as an ES module
Switches every
power-strip.jsinjection to<script type="module" async>— the auto-injected tag (PowerStrip.ts), the internal pages (profile / accounts / admin), and the manual theme test.Path detection
Module scripts execute with
document.currentScript === null, so the previous detection (currentScript + a last-<script>fallback) breaks. Replaced withimport.meta.url, the module's own URL — the reliable way for the script to locate itself and derivebasePath.Verified
wrangler dev): the custom element upgrades,basePathresolves to/users, and there are no console errors.power-strip.jsis module-safe: it usesaddEventListener(no inline handlers), and its only global contract iscustomElements.define.powerstrip.spec.tsassertions updated to the new tag;tsc+eslintclean; suite 129/129.Bumps to 0.4.5.
🤖 Generated with Claude Code