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.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
wrangler@0.0.18
Patch Changes
#523
8c99449
Thanks @threepointone! - feat: secrets + environmentsThis implements environment support for
wrangler secret
(both legacy and services). We now consistently generate the right script name across commands with thegetScriptName()
helper.Based on the work by @mitchelvanbever in Added support for environments on secrets command #95.
#554
18ac439
Thanks @petebacondarwin! - fix: limit bulk put API requests to batches of 5,000The
kv:bulk put
command now batches up put requests in groups of 5,000,displaying progress for each request.
#437
2805205
Thanks @jacobbednarz! - feat: useCLOUDFLARE_...
environment variables deprecatingCF_...
Now one should use
CLOUDFLARE_API_TOKEN
,CLOUDFLARE_ACCOUNT_ID
andCLOUDFLARE_API_BASE_URL
rather thanCF_API_TOKEN
,CF_ACCOUNT_ID
andCF_API_BASE_URL
, which have been deprecated.If you use the deprecated variables they will still work but you will see a warning message.
Within the Cloudflare tooling ecosystem, we have a mix of
CF_
andCLOUDFLARE_
for prefixing environment variables. Until recently, many of the tools
were fine with
CF_
however, there started to be conflicts withexternal tools (such as Cloudfoundary CLI), which also uses
CF_
as aprefix, and would potentially be reading and writing the same value the
Cloudflare tooling.
The Go SDK1, Terraform2 and cf-terraforming3 have made the jump to
the
CLOUDFLARE_
prefix for environment variable prefix.In future, all SDKs will use this prefix for consistency and to allow all the tooling to reuse the same environment variables in the scenario where they are present.
#530
fdb4afd
Thanks @threepointone! - feat: implementrules
config fieldThis implements the top level
rules
configuration field. It lets you specify transport rules for non-js modules. For example, you can specify*.md
files to be included as a text file with -We also include a default ruleset -
More info at https://developers.cloudflare.com/workers/cli-wrangler/configuration/#build.
Known issues -
--local
modeData
type does not work in service worker format, in either mode#517
201a6bb
Thanks @threepointone! - fix: publish environment specific routesThis adds some tests for publishing routes, and fixes a couple of bugs with the flow.
workers_dev
tofalse
if there are any routes specifiedworkers.dev
subdomain (which should have been caught by theno-floating-promises
lint rule, so that's concerning)#528
26f5ad2
Thanks @threepointone! - feat: top levelmain
config fieldThis implements a top level
main
field forwrangler.toml
to define an entry point for the worker , and adds a deprecation warning forbuild.upload.main
. The deprecation warning is detailed enough to give the exact line to copy-paste into your config file. Example -This also makes
./dist
a default forbuild.upload.dir
, to match wrangler 1's behaviour.Closes 🐛 BUG: build.upload dir doesn't default to dist #488
#521
5947bfe
Thanks @threepointone! - chore: update esbuild from 0.14.18 to 0.14.23#480
10cb789
Thanks @caass! - Refactored tail functionality in preparation for adding pretty printing.debug
toggle from a build-time constant to a (hidden) CLI flag--format pretty
CLI option#525
9d5c14d
Thanks @threepointone! - feat: tail+envsThis implements service environment support for
wrangler tail
. Fairly simple, we just generate the right URLs. wrangler tail already works for legacy envs, so there's nothing to do there.#553
bc85682
Thanks @threepointone! - feat: disable tunnel inwrangler dev
Disables sharing local development server on the internet. We will bring this back after it's more polished/ready.
Fixes Disable experimental sharing #550
#522
a283836
Thanks @threepointone! - fix: websocketsThis fixes websockets in
wrangler dev
. It looks like we broke it in Some minor websocket updates #503. I've reverted the specific changes made toproxy.ts
.Test plan -
#481
8874548
Thanks @threepointone! - fix: replace the word "deploy" with "publish" everywhere.We should be consistent with the word that describes how we get a worker to the edge. The command is
publish
, so let's use that everywhere.#537
b978db4
Thanks @threepointone! - feat:--local
mode only applies inwrangler dev
We'd originally planned for
--local
mode to be a thing across all wrangler commands. In hindsight, that didn't make much sense, since every command other thanwrangler dev
assumes some interaction with cloudflare and their API. The only command other than dev where this "worked" waskv
, but even that didn't make sense because wrangler dev wouldn't even read from it. We also have--experimental-enable-local-persistence
there anyway.So this moves the
--local
flag to only apply forwrangler dev
and removes any trace from other commands.#518
72f035e
Thanks @threepointone! - feat: implement[text_blobs]
This implements support for
[text_blobs]
as defined by Module upload format + custom build commands + durable object support wrangler-legacy#1677.Text blobs can be defined in service-worker format with configuration in
wrangler.toml
as -The content of the file will then be available as the global
MYTEXT
inside your code. Note that this ONLY makes sense in service-worker format workers (for now).Workers Sites now uses
[text_blobs]
internally. Previously, we were inlining the asset manifest into the worker itself, but we now attach the asset manifest to the uploaded worker. I also added an additional example of Workers Sites with a modules format worker.#532
046b17d
Thanks @threepointone! - feat: dev+envsThis implements service environments +
wrangler dev
. Fairly simple, it just needed the right url when creating the edge preview token.I tested this by publishing a service under one env, adding secrets under it in the dashboard, and then trying to dev under another env, and verifying that the secrets didn't leak.
#552
3cee150
Thanks @petebacondarwin! - feat: add confirmation and success messages tokv:bulk delete
commandAdded the following:
Success!
logged to the console.--force
/-f
to avoid the confirmation check.#533
1b3a5f7
Thanks @threepointone! - feat: default to legacy environmentsWhile implementing support for service environments, we unearthed a small number of usage issues. While we work those out, we should default to using regular "legacy" environments.
#519
93576a8
Thanks @caass! - fix: Improve port selection forwrangler dev
for both worker ports and inspector ports.Previously when running
wrangler dev
on multiple workers at the same time, you couldn't attach DevTools to both workers, since they were both listening on port 9229.With this PR, that behavior is improved -- you can now pass an
--inspector-port
flag to specify a port for DevTools to connect to on a per-worker basis, orif the option is omitted, wrangler will assign a random unused port for you.
This "if no option is given, assign a random unused port" behavior has also been added to
wrangler dev --port
, so runningwrangler dev
on twoworkers at once should now "just work". Hopefully.
#545
9e89dd7
Thanks @threepointone! - feat: zoned worker support forwrangler dev
This implements support for zoned workers in
wrangler dev
. Of note, since we're deprecatingzone_id
, we instead use the domain provided via--host
/config.dev.host
/--routes
/--route
/config.routes
/config.route
and infer the zone id from it.Fixes feat: implement
wrangler dev
support for zoned workers #544#494
6e6c30f
Thanks @caass! - - Add tests covering pretty-printing of logs inwrangler tail
RequestEvent
typesDate
types tonumber
to make parsing easierexception
andlog
message
properties tounknown
#496
5a640f0
Thanks @jahands! - chore: Remove acorn/acorn-walk dependency used in Pages Functions filepath-routing.This shouldn't cause any functional changes, Pages Functions filepath-routing now uses esbuild to find exports.
#419
04f4332
Thanks @Electroid! - refactor: use esbuild's message formatting for cleaner error messagesThis is the first step in making a standard format for error messages. For now, this uses esbuild's error formatting, which is nice and colored, but we could decide to customize our own later. Moreover, we should use the
parseJSON
,parseTOML
, andreadFile
utilities so there are pretty errors for any configuration.#501
824d8c0
Thanks @petebacondarwin! - refactor: delegate deprecatedpreview
command todev
if possibleThe
preview
command is deprecated and not supported in this version of Wrangler.Instead, one should use the
dev
command for mostpreview
use-cases.This change attempts to delegate any use of
preview
todev
failing if the command line contains positional arguments that are not compatible withdev
.Resolves [DEPRECATION]
wrangler preview
#9#541
371e6c5
Thanks @threepointone! - chore: refactor some common code intorequireAuth()
There was a common chunk of code across most commands that ensures a user is logged in, and retrieves an account ID. I'd resisted making this into an abstraction for a while. Now that the codebase is stable, and feat:
--local
mode only applies inwrangler dev
#537 removes some surrounding code there, I made an abstraction for this common code asrequireAuth()
. This gets a mention in the changelog simply because it touches a bunch of code, although it's mostly mechanical deletion/replacement.#551
afd4b0e
Thanks @petebacondarwin! - fix: do not log thenull
returned fromkv:bulk put
andkv:bulk delete
#503
e5c7ed8
Thanks @petebacondarwin! - refact: consolidate onws
websocket libraryRemoves the
faye-websocket
library and usesws
across the code base.#502
b30349a
Thanks @petebacondarwin! - fix(pages): ensure remaining args passed topages dev
command are capturedIt is common to pass additional commands to
pages dev
to generate the input source.For example:
Previously the args after
--
were being dropped.This change ensures that these are captured and used correctly.
Fixes 🐛 BUG:
npx wrangler@beta pages dev -- npm run dev
does not work? #482#512
b093df7
Thanks @threepointone! - feat: a bettertsconfig.json
This makes a better
tsconfig.json
when usingwrangler init
. Of note, it takes the defaulttsconfig.json
generated bytsc --init
, and adds our modifications.#510
9534c7f
Thanks @threepointone! - feat:--legacy-env
cli arg /legacy_env
configThis is the first of a few changes to codify how we do environments in wrangler2, both older legacy style environments, and newer service environments. Here, we add a cli arg and a config field for specifying whether to enable/disable legacy style environments, and pass it on to dev/publish commands. We also fix how we were generating kv namespaces for Workers Sites, among other smaller fixes.
#549
3d2ce01
Thanks @petebacondarwin! - fix: kv:bulk should JSON encode its contentsThe body passed to
kv:bulk delete
andkv:bulk put
must be JSON encoded.This change fixes that and adds some tests to prove it.
Fixes kv:bulk put/delete error #547
#554
6e5319b
Thanks @petebacondarwin! - fix: limit bulk delete API requests to batches of 5,000The
kv:bulk delete
command now batches up delete requests in groups of 5,000,displaying progress for each request.
#538
4b6c973
Thanks @threepointone! - feat: withwrangler init
, create a new directory for named workersCurrently, when creating a new project, we usually first have to create a directory before running
wrangler init
, since it defaults to creating thewrangler.toml
,package.json
, etc in the current working directory. This fix introduces an enhancement, where using thewrangler init [name]
form creates a directory named[name]
and initialises the project files inside it. This matches the usage pattern a little better, and still preserves the older behaviour when we're creating a worker inside existing projects.#548
e3cab74
Thanks @petebacondarwin! - refactor: clean up unnecessary async functionsThe
readFile()
andreadConfig()
helpers do not need to be async.Doing so just adds complexity to their call sites.
#529
9d7e946
Thanks @petebacondarwin! - feat: add more comprehensive config validation checkingThe configuration for a Worker is complicated since we can define different "environments", and each environment can have its own configuration.
There is a default ("top-level") environment and then named environments that provide environment specific configuration.
This is further complicated by the fact that there are three kinds of environment configuration:
Named environments do not need to provide their own values, in which case they inherit the value from the top-level.
Named environments do not inherit such configuration and must provide their own values.
All configuration values in
wrangler.toml
are optional and will receive a default value if not defined.This change adds more strict interfaces for top-level
Config
andEnvironment
types,as well as validation and normalization of the optional fields that are read from
wrangler.toml
.#486
ff8c9f6
Thanks @threepointone! - fix: remove warning if worker with a durable object doesn't have a nameWe were warning if you were trying to develop a durable object with an unnamed worker. Further, the internal api would actually throw if you tried to develop with a named worker if it wasn't already published. The latter is being fixed internally and should live soon, and this fix removes the warning completely.