fix: resolve escaped </script> in generated framework files#195
Open
angeloashmore wants to merge 1 commit into
Open
fix: resolve escaped </script> in generated framework files#195angeloashmore wants to merge 1 commit into
angeloashmore wants to merge 1 commit into
Conversation
The bundler escapes `</script>` to `<\/script>` in string literals, and dedent reads the raw template strings, so the backslash leaked into generated Nuxt and SvelteKit files. Point dedent at the resolved string segments instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Resolves: #193
Description
prismic gen setupandprismic initgenerated Nuxt and SvelteKit files whose closing<script>tag was written as<\/script>(with a stray backslash), producing invalid SFC syntax.The bundler escapes
</script>to<\/script>in string literals, and ourdedentwrapper reads the raw template strings, so the backslash leaked into the output. This pointsdedentat the resolved string segments instead, where the escape is already gone.Checklist
Preview
How to QA
prismic gen setup.</script>.🤖 Generated with Claude Code
Note
Low Risk
Localized change to the shared
dedenthelper plus a new test; behavior for non-</script>templates should match prior dedenting while fixing escape leakage.Overview
Fixes invalid closing tags like
<\/script>in files emitted byprismic gen setupandprismic init(Nuxt/SvelteKit simulator pages and similar).dedentis no longer a thin re-export ofdedent.withOptions. It now builds template output from resolved string segments and setsrawto those same segments so bundler escapes on literals (e.g.</script>→<\/script>) are not written into generated source.Adds a
gen setupintegration test that treats the fixture as SvelteKit and assertssrc/routes/slice-simulator/+page.sveltecontains a literal</script>closing tag.Reviewed by Cursor Bugbot for commit 6f16cfe. Bugbot is set up for automated code reviews on this repo. Configure here.