-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Correctly escape newlines in
constructType
function (#5955)
* Fix: Escape newlines in multi-line strings for `wrangler types` generation * Add test for handling multiline strings in `constructType` function * Add changeset for newline escape fix in constructType function * fix: Simplify `constructType` function by using JSON.stringify for value escaping * Update packages/wrangler/src/type-generation.ts Remove unnecessary quotation marks around JSON.stringify output Co-authored-by: Somhairle MacLeòid <[email protected]> * fix changeset formatting * fix type-gen escaping tests --------- Co-authored-by: Somhairle MacLeòid <[email protected]> Co-authored-by: Peter Bacon Darwin <[email protected]>
- Loading branch information
1 parent
fa1016c
commit db11a0f
Showing
3 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
fix: correctly escape newlines in `constructType` function for multiline strings | ||
|
||
This fix ensures that multiline strings are correctly handled by the `constructType` function. Newlines are now properly escaped to prevent invalid JavaScript code generation when using the `wrangler types` command. This improves robustness and prevents errors related to multiline string handling in environment variables and other configuration settings. |
This file contains 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
This file contains 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