workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

Fix: Correctly escape newlines in `constructType` function

Open harugon opened this issue 1 year ago • 2 comments

What this PR solves / how to test

Fixes #5699

This PR fixes the issue with constructType function handling multiline strings improperly. It ensures that newlines in strings are correctly escaped, preventing invalid JavaScript code generation.

Author has addressed the following

  • Tests
    • [x] Included
    • [ ] Not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • [ ] I don't know
    • [ ] Required / Maybe required
    • [x] Not required because: This change affects type generation only
  • Changeset (Changeset guidelines)
    • [x] Included
    • [ ] Not necessary because:
  • Public documentation
    • [ ] TODO (before merge)
    • [ ] Cloudflare docs PR(s):
    • [x] Not necessary because: Internal functionality change only

harugon avatar Jun 02 '24 05:06 harugon

🦋 Changeset detected

Latest commit: 8836004c306c9c694f4ad1c64ee513ba08d3ec53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jun 02 '24 05:06 changeset-bot[bot]

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-wrangler-5955

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5955/npm-package-wrangler-5955

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-wrangler-5955 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-create-cloudflare-5955 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-cloudflare-kv-asset-handler-5955
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-miniflare-5955
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-cloudflare-pages-shared-5955
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/9935839257/npm-package-cloudflare-vitest-pool-workers-5955

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240701.0
workerd 1.20240701.0 1.20240701.0
workerd --version 1.20240701.0 2024-07-01

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

github-actions[bot] avatar Jun 17 '24 13:06 github-actions[bot]

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them. Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately. Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

gitguardian[bot] avatar Jul 15 '24 02:07 gitguardian[bot]

After running the tests, I noticed that the original backslash escaping tests were not correct either. So this fix actually fixes that too.

petebacondarwin avatar Jul 15 '24 08:07 petebacondarwin

Congratulations @harugon, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/clympp2n806930clbeoft1eoa

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

holopin-bot[bot] avatar Jul 15 '24 08:07 holopin-bot[bot]