Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency wrangler to v3.28.0 #542

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 8, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
wrangler (source) 3.27.0 -> 3.28.0 age adoption passing confidence

Release Notes

cloudflare/workers-sdk (wrangler)

v3.28.0

Compare Source

Minor Changes
  • #​4499 cf9c029b Thanks @​penalosa! - feat: Support runtime-agnostic polyfills

    Previously, Wrangler treated any imports of node:* modules as build-time errors (unless one of the two Node.js compatibility modes was enabled). This is sometimes overly aggressive, since those imports are often not hit at runtime (for instance, it was impossible to write a library that worked across Node.JS and Workers, using Node packages only when running in Node). Here's an example of a function that would cause Wrangler to fail to build:

    export function randomBytes(length: number) {
    	if (navigator.userAgent !== "Cloudflare-Workers") {
    		return new Uint8Array(require("node:crypto").randomBytes(length));
    	} else {
    		return crypto.getRandomValues(new Uint8Array(length));
    	}
    }

    This function should work in both Workers and Node, since it gates Node-specific functionality behind a user agent check, and falls back to the built-in Workers crypto API. Instead, Wrangler detected the node:crypto import and failed with the following error:

    ✘ [ERROR] Could not resolve "node:crypto"
    
        src/randomBytes.ts:5:36:
          5 │ ... return new Uint8Array(require('node:crypto').randomBytes(length));
            ╵                                   ~~~~~~~~~~~~~
    
      The package "node:crypto" wasn't found on the file system but is built into node.
      Add "node_compat = true" to your wrangler.toml file to enable Node.js compatibility.
    

    This change turns that Wrangler build failure into a warning, which users can choose to ignore if they know the import of node:* APIs is safe (because it will never trigger at runtime, for instance):

    ▲ [WARNING] The package "node:crypto" wasn't found on the file system but is built into node.
    
      Your Worker may throw errors at runtime unless you enable the "nodejs_compat"
      compatibility flag. Refer to
      https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details.
      Imported from:
       - src/randomBytes.ts
    

    However, in a lot of cases, it's possible to know at build time whether the import is safe. This change also injects navigator.userAgent into esbuild's bundle settings as a predefined constant, which means that esbuild can tree-shake away imports of node:* APIs that are guaranteed not to be hit at runtime, supressing the warning entirely.

  • #​4926 a14bd1d9 Thanks @​dario-piotrowicz! - feature: add a cf field to the getBindingsProxy result

    Add a new cf field to the getBindingsProxy result that people can use to mock the production
    cf (IncomingRequestCfProperties) object.

    Example:

    const { cf } = await getBindingsProxy();
    
    console.log(`country = ${cf.country}; colo = ${cf.colo}`);
Patch Changes
  • #​4931 321c7ed7 Thanks @​dario-piotrowicz! - fix: make the entrypoint optional for the types command

    Currently running wrangler types against a wrangler.toml file without a defined entrypoint (main value)
    causes the command to error with the following message:

    ✘ [ERROR] Missing entry-point: The entry-point should be specified via the command line (e.g. `wrangler types path/to/script`) or the `main` config field.
    

    However developers could want to generate types without the entrypoint being defined (for example when using getBindingsProxy), so these changes
    make the entrypoint optional for the types command, assuming modules syntax if none is specified.

  • #​4867 d637bd59 Thanks @​RamIdeas! - fix: inflight requests to UserWorker which failed across reloads are now retried

    Previously, when running wrangler dev, requests inflight during a UserWorker reload (due to config or source file changes) would fail.

    Now, if those inflight requests are GET or HEAD requests, they will be reproxied against the new UserWorker. This adds to the guarantee that requests made during local development reach the latest worker.

  • #​4938 75bd08ae Thanks @​rozenmd! - fix: print wrangler banner at the start of every d1 command

    This PR adds a wrangler banner to the start of every D1 command (except when invoked in JSON-mode)

    For example:


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

@renovate renovate bot added auto-merge Renovate auto-merges dependencies Updates one or more dependencies labels Feb 8, 2024
@renovate renovate bot enabled auto-merge (squash) February 8, 2024 22:51
@renovate renovate bot force-pushed the renovate/wrangler-3.x branch from be56a8e to ccf7e16 Compare February 9, 2024 00:53
@renovate renovate bot merged commit cd9ca20 into main Feb 9, 2024
5 checks passed
@renovate renovate bot deleted the renovate/wrangler-3.x branch February 9, 2024 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Renovate auto-merges dependencies Updates one or more dependencies
Development

Successfully merging this pull request may close these issues.

0 participants