Skip to content

Releases: cloudflare/workers-sdk

[email protected]

05 May 19:02
f2b6cd9
Compare
Choose a tag to compare

Patch Changes

  • #902 daed3c3 Thanks @petebacondarwin! - fix: show error if a string option is used without a value

    Fixes #883

  • #901 b246066 Thanks @threepointone! - chore: minify bundle, don't ship sourcemaps

    We haven't found much use for sourcemaps in production, and we should probably minify the bundle anyway. This will also remove an dev only warnings react used to log.

  • #904 641cdad Thanks @GregBrimble! - feat: Adds 'assets:' loader for Pages Functions.

    This lets users and Plugin authors include a folder of static assets in Pages Functions.

    export { onRequest } from "assets:../folder/of/static/assets";

    More information in our docs.

  • #905 c57ff0e Thanks @JacobMGEvans! - chore: removed Sentry and related reporting code. Automated reporting of Wrangler errors will be reimplemented after further planning.

[email protected]

04 May 18:58
62680f6
Compare
Choose a tag to compare

Patch Changes

  • #897 d0801b7 Thanks @threepointone! - polish: tweak the message when .dev.vars is used

    This tweaks the mssage when a .dev.vars file is used so that it doesn't imply that the user has to copy the values from it into their wrangler.toml.

  • #880 aad1418 Thanks @GregBrimble! - fix: Stop unnecessarily amalgamating duplicate headers in Pages Functions

    Previously, set-cookie multiple headers would be combined because of unexpected behavior in the spec.

  • #892 b08676a Thanks @GregBrimble! - fix: Adds the leading slash to Pages deployment manifests that the API expects, and fixes manifest generation on Windows machines.

  • #852 6283ad5 Thanks @JacobMGEvans! - feat: non-TTY check for required variables
    Added a check in non-TTY environments for account_id, CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN. If account_id exists in wrangler.toml
    then CLOUDFLARE_ACCOUNT_ID is not needed in non-TTY scope. The CLOUDFLARE_API_TOKEN is necessary in non-TTY scope and will always error if missing.

    resolves #827

  • #893 5bf17ca Thanks @petebacondarwin! - fix: remove bold font from additional lines of warnings and errors

    Previously, when a warning or error was logged, the entire message
    was formatted in bold font. This change makes only the first line of
    the message bold, and the rest is formatted with a normal font.

  • #894 57c1354 Thanks @threepointone! - polish: s/DO NOT USE THIS/ Ignored

    Followup to #888, this replaces some more scary capitals with a more chill word.

  • #893 5bf17ca Thanks @petebacondarwin! - fix: add bold to the Deprecated warning title

  • #882 1ad7570 Thanks @petebacondarwin! - feat: add support for reading build time env variables from a .env file

    This change will automatically load up a .env file, if found, and apply its
    values to the current environment. An example would be to provide a specific
    CLOUDFLARE_ACCOUNT_ID value.

    Related to #190

  • #887 2bb4d30 Thanks @threepointone! - polish: accept Enter as a valid key in confirm dialogs

    Instead of logging "Unrecognised input" when hitting return/enter in a confirm dialog, we should accept it as a confirmation. This patch also makes the default choice "y" bold in the dialog.

  • #891 bae5ba4 Thanks @GregBrimble! - feat: Adds interactive prompts for the 'wrangler pages publish' and related commands.

    Additionally, those commands now read from node_modules/.cache/wrangler/pages.json to persist users' account IDs and project names.

  • #888 b77aa38 Thanks @threepointone! - polish: s/DEPRECATION/Deprecation

    This removes the scary uppercase from DEPRECATION warnings. It also moves the service environment usage warning into diagnostics instead of logging it directly.

  • #879 f694313 Thanks @petebacondarwin! - feat: read vars overrides from a local file for wrangler dev

    The vars bindings can be specified in the wrangler.toml configuration file.
    But "secret" vars are usually only provided at the server -
    either by creating them in the Dashboard UI, or using the wrangler secret command.

    It is useful during development, to provide these types of variable locally.
    When running wrangler dev we will look for a file called .dev.vars, situated
    next to the wrangler.toml file (or in the current working directory if there is no
    wrangler.toml). Any values in this file, formatted like a dotenv file, will add to
    or override vars bindings provided in the wrangler.toml.

    Related to #190

[email protected]

04 May 18:58
62680f6
Compare
Choose a tag to compare

[email protected]

03 May 23:01
21af9ad
Compare
Choose a tag to compare

Patch Changes

  • #843 da12cc5 Thanks @threepointone! - fix: site.entry-point is no longer a hard deprecation

    To make migration of v1 projects easier, Sites projects should still work, including the entry-point field (which currently errors out). This enables site.entry-point as a valid entry point, with a deprecation warning.

  • #848 0a79d75 Thanks @petebacondarwin! - polish: improve consistency of warnings and errors

    Related to #377

  • #877 97f945f Thanks @caass! - Treat the "name" parameter in wrangler init as a path.

    This means that running wrangler init . will create a worker in the current directory,
    and the worker's name will be the name of the current directory.

    You can also run wrangler init path/to/my-worker and a worker will be created at
    [CWD]/path/to/my-worker with the name my-worker,

  • #851 277b254 Thanks @threepointone! - polish: do not log the error object when refreshing a token fails

    We handle the error anyway (by doing a fresh login) which has its own logging and messaging. In the future we should add a DEBUG mode that logs all requests/errors/warnings, but that's for later.

  • #869 f1423bf Thanks @threepointone! - feat: experimental --node-compat / config.node_compat

    This adds an experimental node.js compatibility mode. It can be enabled by adding node_compat = true in wrangler.toml, or by passing --node-compat as a command line arg for dev/publish commands. This is currently powered by @esbuild-plugins/node-globals-polyfill (which in itself is powered by rollup-plugin-node-polyfills).

    We'd previously added this, and then removed it because the quality of the polyfills isn't great. We're reintroducing it regardless so we can start getting feedback on its usage, and it sets up a foundation for replacing it with our own, hopefully better maintained polyfills.

    Of particular note, this means that what we promised in https://blog.cloudflare.com/announcing-stripe-support-in-workers/ now actually works.

    This patch also addresses some dependency issues, specifically leftover entries in package-lock.json.

  • #790 331c659 Thanks @sidharthachatterjee! - feature: Adds 'wrangler pages publish' (alias 'wrangler pages deployment create') command.

  • #866 8b227fc Thanks @caass! - Add a runtime check for wrangler dev local mode to avoid erroring in environments with no AsyncLocalStorage class

    Certain runtime APIs are only available to workers during the "request context",
    which is any code that returns after receiving a request and before returning
    a response.

    Miniflare emulates this behavior by using an AsyncLocalStorage and
    checking at runtime
    to see if you're using those APIs during the request context.

    In certain environments AsyncLocalStorage is unavailable, such as in a
    webcontainer.
    This function figures out if we're able to run those "request context" checks
    and returns a set of options
    that indicate to miniflare whether to run the checks or not.

  • #829 f08aac5 Thanks @JacobMGEvans! - feat: Add validation to the name field in configuration.
    The validation will warn users that the field can only be "type string,
    alphanumeric, underscores, and lowercase with dashes only" using the same RegEx as the backend

    resolves #795 #775

  • #868 6ecb1c1 Thanks @threepointone! - feat: implement service environments + durable objects

    Now that the APIs for getting migrations tags of services works as expected, this lands support for publishing durable objects to service environments, including migrations. It also removes the error we used to throw when attempting to use service envs + durable objects.

    Fixes #739

[email protected]

03 May 23:01
21af9ad
Compare
Choose a tag to compare

[email protected]

25 Apr 11:09
61b752c
Compare
Choose a tag to compare

Patch Changes

  • #838 9c025c4 Thanks @threepointone! - fix: remove timeout on custom builds, and make sure logs are visible

    This removes the timeout we have for custom builds. We shouldn't be applying this timeout anyway, since it doesn't block wrangler, just the user themselves. Further, in #759, we changed the custom build's process stdout/stderr config to "pipe" to pass tests, however that meant we wouldn't see logs in the terminal anymore. This patch removes the timeout, and brings back proper logging for custom builds.

  • #349 9d04a68 Thanks @GregBrimble! - chore: rename --script-path to --outfile for wrangler pages functions build command.
  • #836 28e3b17 Thanks @threepointone! - fix: toggle workers.dev subdomains only when required

    This fix -

    • passes the correct query param to check whether a workers.dev subdomain has already been published/enabled
    • thus enabling it only when it's not been enabled
    • it also disables it only when it's explicitly knows it's already been enabled

    The effect of this is that publishes are much faster.

  • #794 ee3475f Thanks @JacobMGEvans! - fix: Error messaging from failed login would dump a JSON.parse error in some situations. Added a fallback if .json fails to parse
    it will attempt .text() then throw result. If both attempts to parse fail it will throw an UnknownError with a message showing where
    it originated.

    resolves #539

  • #824 62af4b6 Thanks @threepointone! - feat: publish --dry-run

    It can be useful to do a dry run of publishing. Developers want peace of mind that a project will compile before actually publishing to live servers. Combined with --outdir, this is also useful for testing the output of publish. Further, it gives developers a chance to upload our generated sourcemap to a service like sentry etc, so that errors from the worker can be mapped against actual source code, but before the service actually goes live.

  • #839 f2d6de6 Thanks @threepointone! - fix: persist dev experimental storage state in feature specific dirs

    With --experimental-enable-local-persistence in dev, we were clobbering a single folder with data from kv/do/cache. This patch gives individual folders for them. It also enables persistence even when this is not true, but that stays only for the length of a session, and cleans itself up when the dev session ends.

    Fixes #830

  • #796 3e0db3b Thanks @GregBrimble! - fix: Makes Response Headers object mutable after a call to next() in Pages Functions
  • #814 51fea7c Thanks @threepointone! - fix: disallow setting account_id in named service environments

    Much like #641, we don't want to allow setting account_id with named service environments. This is so that we use the same account_id for multiple environments, and have them group together in the dashboard.

  • #823 4a00910 Thanks @threepointone! - fix: don't log an error when wrangler dev is cancelled early

    We currently log an AbortError with a stack if we exit wrangler dev's startup process before it's done. This fix skips logging that error (since it's not an exception).

    Test plan:

    cd packages/wrangler
    npm run build
    cd ../../examples/workers-chat-demo
    npx wrangler dev
    # hit [x] as soon as the hotkey shortcut bar shows
    
  • #815 025c722 Thanks @threepointone! - fix: ensure that bundle is generated to es2020 target

    The default tsconfig generated by tsc uses target: "es5", which we don't support. This fix ensures that we output es2020 modules, even if tsconfig asks otherwise.

  • #349 9d04a68 Thanks @GregBrimble! - feature: Adds a --plugin option to wrangler pages functions build which compiles a Pages Plugin. More information about Pages Plugins can be found here. This wrangler build is required for both the development of, and inclusion of, plugins.
  • #822 4302172 Thanks @GregBrimble! - chore: Add help messages for wrangler pages project and wrangler pages deployment
  • #837 206b9a5 Thanks @threepointone! - polish: replace 🦺 with ⚠️

    I got some feedback that the construction worker jacket (?) icon for deprecations is confusing, especially because it's an uncommon icon and not very big in the terminal. This patch replaces it with a more familiar warning symbol.

  • #824 62af4b6 Thanks @threepointone! - feat: publish --outdir <path>

    It can be useful to introspect built assets. A leading usecase is to upload the sourcemap that we generate to services like sentry etc, so that errors from the worker can be mapped against actual source code. We introduce a --outdir cli arg to specify a path to generate built assets at, which doesn't get cleaned up after publishing. We are not adding this to wrangler.toml just yet, but could in the future if it looks appropriate there.

  • #811 8c2c7b7 Thanks @JacobMGEvans! - feat: Added minify as a configuration option and a cli arg, which will minify code for dev and publish

    resolves #785

[email protected]

16 Apr 01:10
1e4fb70
Compare
Choose a tag to compare

Patch Changes

  • #782 34552d9 Thanks @GregBrimble! - feature: Add 'pages create project [name]' command.

    This command will create a Pages project with a given name, and optionally set its --production-branch=[production].

  • #772 a852e32 Thanks @JacobMGEvans! - fix: We want to prevent any user created code from sending Events to Sentry,
    which can be captured by uncaughtExceptionMonitor listener.
    Miniflare code can run user code on the same process as Wrangler,
    so we want to return null if @miniflare is present in the Event frames.

  • #778 85b0c31 Thanks @threepointone! - feat: optionally send zone_id with a route

    This enables optionally passing a route as {pattern: string, zone_id: string}. There are scenarios where we need to explicitly pass a zone_id to the api, so this enables that.

    Some nuance: The errors from the api aren't super useful when invalid values are passed, but that's something to further work on.

    This also fixes some types in our cli parsing.

    Fixes #774

  • #797 67fc4fc Thanks @threepointone! - feat: optionally send zone_name with routes

    A followup to #778, this lets you send an optional zone_name with routes. This is particularly useful when using ssl for saas (https://developers.cloudflare.com/ssl/ssl-for-saas/).

    Fixes #793

  • #813 5c59f97 Thanks @threepointone! - add a warning if service environments are being used.

    Service environments are not ready for widespread usage, and their behaviour is going to change. This adds a warning if anyone uses them.

    Closes #809

  • #789 5852bba Thanks @threepointone! - polish: don't log all errors when logging in

    This removes a couple of logs we had for literally every error in our oauth flow. We throw the error and handle it separately anyway, so this is a safe cleanup.

    Fixes #788

  • #806 b24aeb5 Thanks @threepointone! - fix: check for updates on the right channel

    This makes the update checker run on the channel that the version being used runs on.

  • #807 7e560e1 Thanks @threepointone! - fix: read isLegacyEnv correctly

    This fixes the signature for isLegacyEnv() since it doesn't use args, and we fix reading legacy_env correctly when creating a draft worker when creating a secret.

  • #779 664803e Thanks @threepointone! - chore: update packages

    This updates some dependencies. Some highlights -

    • updates to @iarna/toml means we can have mixed types for inline arrays, which is great for #774 / #778
    • I also moved timeago.js to devDependencies since it already gets compiled into the bundle
    • updates to esbuild brings along a number of smaller fixes for modern js
  • #810 0ce47a5 Thanks @caass! - Make wrangler tail TTY-aware, and stop printing non-JSON in JSON mode

    Closes #493

    2 quick fixes:

    • Check process.stdout.isTTY at runtime to determine whether to default to "pretty" or "json" output for tailing.
    • Only print messages like "Connected to {worker}" if in "pretty" mode (errors still throw strings)

[email protected]

16 Apr 01:10
1e4fb70
Compare
Choose a tag to compare

[email protected]

09 Apr 12:28
Compare
Choose a tag to compare

Patch Changes

  • #752 6d43e94 Thanks @petebacondarwin! - fix: add a warning if dev is defaulting to the latest compatibility-date

    Fixes #741

  • #767 836ad59 Thanks @threepointone! - fix: use cwd for --experiment-enable-local-persistence

    This sets up --experiment-enable-local-persistence to explicitly use process.cwd() + wrangler-local-state as a path to store values. Without it, local mode uses the temp dir that we use to bundle the worker, which gets wiped out on ending wrangler dev. In the future, based on usage, we may want to make the path configurable as well.

    Fixes #766

  • #723 7942936 Thanks @threepointone! - fix: spread tail messages when logging

    Logged messages (via console, etc) would previously be logged as an array of values. This spreads it when logging to match what is expected.

  • #756 8e38442 Thanks @threepointone! - fix: resolve raw file bindings correctly in wrangler dev local mode

    For wasm_modules/text_blobs/data_blobs in local mode, we need to rewrite the paths as absolute so that they're resolved correctly by miniflare. This also expands some coverage for local mode wrangler dev.

    Fixes #740
    Fixes #416

  • #699 ea8e701 Thanks @JacobMGEvans! - polish: added logout and login to helpstring message.

  • #728 0873049 Thanks @threepointone! - fix: only send durable object migrations when required

    We had a bug where even if you'd published a script with migrations, we would still send a blank set of migrations on the next round. The api doesn't accept this, so the fix is to not do so. I also expanded test coverage for migrations.

    Fixes #705

  • #750 b933641 Thanks @mrbbot! - Upgrade miniflare to 2.4.0

  • #763 f72c943 Thanks @JacobMGEvans! - feat: Added the update check that will check the package once a day against the beta release, distTag can be changed later, then prints the latestbeta version to the user.

    resolves #762

  • #695 48fa89b Thanks @caass! - fix: stop wrangler spamming console after login

    If a user hasn't logged in and then they run a command that needs a login they'll get bounced to the login flow.
    The login flow (if completed) would write their shiny new OAuth2 credentials to disk, but wouldn't reload the
    in-memory state. This led to issues like #693, where even though the user was logged in on-disk, wrangler
    wouldn't be aware of it.

    We now update the in-memory login state each time new credentials are written to disk.

  • #734 a1dadac Thanks @threepointone! - fix: exit dev if build fails on first run

    Because of evanw/esbuild#1037, we can't recover dev if esbuild fails on first run. The workaround is to end the process if it does so, until we have a better fix.

    Reported in #731

  • #757 13e57cd Thanks @sidharthachatterjee! - feature: Add wrangler pages project list

    Adds a new command to list your projects in Cloudflare Pages.

  • #745 6bc3e85 Thanks @petebacondarwin! - feat: add hotkey to clear the console in wrangler dev

    Closes #388

  • #747 db6b830 Thanks @petebacondarwin! - refactor: remove process.exit() from the pages code

    This enables simpler testing, as we do not have to spawn new child processes
    to avoid the process.exit() from killing the jest process.

    As part of the refactor, some of the Error classes have been moved to a
    shared errors.ts file.

  • #726 c4e5dc3 Thanks @threepointone! - fix: assume a worker is a module worker only if it has a default export

    This tweaks the logic that guesses worker formats to check whether a default export is defined on an entry point before assuming it's a module worker.

  • #735 c38ae3d Thanks @threepointone! - text_blobs/Text module support for service worker format in local mode

    This adds support for text_blobs/Text module support in local mode. Now that cloudflare/miniflare#228 has landed in miniflare (thanks @caass!), we can use that in wrangler as well.

  • #743 ac5c48b Thanks @threepointone! - feat: implement [data_blobs]

    This implements [data_blobs] support for service-worker workers, as well as enabling Data module support for service-worker workers. data_blob is a supported binding type, but we never implemented support for it in v1. This implements support, and utilises it for supporting Data modules in service worker format. Implementation wise, it's incredibly similar to how we implemented text_blobs, with relevant changes.

    Partial fix for #740 pending local mode support.

  • #753 cf432ac Thanks @petebacondarwin! - fix: distinguish the command hotkeys in wrangler dev

    Closes #354

  • #746 3e25dcb Thanks @petebacondarwin! - fix: remove superfluous debugger log messages from local dev

    Closes #387

  • #758 9bd95ce Thanks @sidharthachatterjee! - feature: Add wrangler pages deployment list

    Renders a list of deployments in a Cloudflare Pages project

  • #733 91873e4 Thanks @JacobMGEvans! - polish: improved visualization of the deprecation messages between serious and warnings with emojis. This also improves the delineation between messages.

  • #738 c04791c Thanks @petebacondarwin! - fix: add support for cron triggers in dev --local mode

    Currently, I don't know if there is support for doing this in "remote" dev mode.

    Resolves #737

  • #732 c63ea3d Thanks @JacobMGEvans! - fix: abort async operations in the Remote component to avoid unwanted side-effects
    When the Remote component is unmounted, we now signal outstand...

Read more

[email protected]

09 Apr 12:28
Compare
Choose a tag to compare

Patch Changes

  • #750 b933641 Thanks @mrbbot! - Upgrade miniflare to 2.4.0

  • #715 9857fbf Thanks @threepointone! - feat: jest-environment-wrangler

    A starting point for a jest environment powered by wrangler. This is just a proxy for jest-environment-miniflare right now, but we'll add features as we go along.