Releases: cloudflare/workers-sdk
[email protected]
Patch Changes
-
#414
f30426f
Thanks @petebacondarwin! - fix: supportbuild.upload.dir
when usingbuild.upload.main
Although,
build.upload.dir
is deprecated, we should still support using it when the entry-point is being defined by thebuild.upload.main
and the format ismodules
.Fixes #413
-
#447
2c5c934
Thanks @threepointone! - fix: Config should be resolved relative to the entrypointDuring
dev
andpublish
, we should resolvewrangler.toml
starting from the entrypoint, and then working up from there. Currently, we start from the directory from which we callwrangler
, this changes that behaviour to start from the entrypoint instead.(To implement this, I made one big change: Inside commands, we now have to explicitly read configuration from a path, instead of expecting it to 'arrive' coerced into a configuration object.)
-
#472
804523a
Thanks @JacobMGEvans! - bugfix: Replace.destroy()
onfaye-websockets
with.close()
added: Interface to give faye same types as compliantws
with additional.pipe()
implementation;.on("message" => fn)
-
#462
a173c80
Thanks @caass! - Add filtering to wrangler tail, so you can nowwrangler tail <name> --status ok
, for example. Supported options:--status cancelled --status error
--> you can filter onok
,error
, andcancelled
to only tail logs that have that status--header X-CUSTOM-HEADER:somevalue
--> you can filter on headers, including ones that have specific values ("somevalue"
) or just that contain any header (e.g.--header X-CUSTOM-HEADER
with no colon)--method POST --method PUT
--> filter on the HTTP method used to trigger the worker--search catch-this
--> only shows messages that contain the phrase"catch-this"
. Does not (yet!) support regular expressions--ip self --ip 192.0.2.232
--> only show logs from requests that originate from the given IP addresses."self"
will be replaced with the IP address of the computer that sent the tail request.
-
#471
21cde50
Thanks @caass! - Add tests for wrangler tail:- ensure the correct API calls are made
- ensure that filters are sent
- ensure that the correct filters are sent
- ensure that JSON gets spat out into the terminal
-
#398
40d9553
Thanks @threepointone! - feat: guess-worker-formatThis formalises the logic we use to "guess"/infer what a worker's format is - either "modules" or "service worker". Previously we were using the output of the esbuild process metafile to infer this, we now explicitly do so in a separate step (esbuild's so fast that it doesn't have any apparent performance hit, but we also do a simpler form of the build to get this information).
This also adds
--format
as a command line arg forpublish
. -
#438
64d62be
Thanks @Electroid! - feat: Add support for "json" bindingsDid you know? We have support for "json" bindings! Here are a few examples:
[vars]
text = "plain ol' string"
count = 1
complex = { enabled = true, id = 123 } -
#422
ef13735
Thanks @threepointone! - chore: renameopen-in-brower.ts
toopen-in-browser.ts
-
#411
a52f0e0
Thanks @ObsidianMinor! - feat: unsafe-bindingsAdds support for "unsafe bindings", that is, bindings that aren't supported by wrangler, but are
desired when uploading a Worker to Cloudflare. This allows you to use beta features before
official support is added to wrangler, while also letting you migrate to proper support for the
feature when desired. Note: these bindings may not work everywhere, and may break at any time. -
#415
d826f5a
Thanks @threepointone! - fix: don't crash when browser windows don't openWe open browser windows for a few things; during
wrangler dev
, and logging in. There are environments where this doesn't work as expected (like codespaces, stackblitz, etc). This fix simply logs an error instead of breaking the flow. This is the same fix as #263, now applied to the rest of wrangler. -
91d8994
Thanks @Mexican-Man! - fix: do not merge routes with different methods when computing pages routesFixes #92
-
#474
bfedc58
Thanks @JacobMGEvans! - bugfix: createreporting.toml
file in "wrangler/config" and move error reporting user decisions to newreporting.toml
-
#445
d5935e7
Thanks @threepointone! - chore: removeexperimental_services
from configurationNow that we have
[[unsafe.bindings]]
(as of #411), we should use that for experimental features. This removes support for[experimental_services]
, and adds a helpful message for how to rewrite their configuration.This error is temporary, until the internal teams that were using this rewrite their configs. We'll remove it before GA.
What the error looks like -
Error: The "experimental_services" field is no longer supported. Instead, use [[unsafe.bindings]] to enable experimental features. Add this to your wrangler.toml: [[unsafe.bindings]] name = "SomeService" type = "service" service = "some-service" environment = "staging" [[unsafe.bindings]] name = "SomeOtherService" type = "service" service = "some-other-service" environment = "qa"
-
#456
b5f42c5
Thanks @threepointone! - chore: enablestrict
intsconfig.json
In the march towards full strictness, this enables
strict
intsconfig.json
and fixes the errors it pops up. A changeset is included because there are some subtle code changes, and we should leave a trail for them. -
#448
b72a111
Thanks @JacobMGEvans! - feat: add--yes
with alias--y
flag as automatic answer to all prompts and runwrangler init
non-interactively.
generated during setup:- package.json
- TypeScript, which includes tsconfig.json &
@cloudflare/workers-types
- Template "hello world" Worker at src/index.ts
-
#403
f9fef8f
Thanks @JacobMGEvans! - feat: add scripts to package.json & autogenerate name value when initializing a project
To get wrangler init projects up and running with good ergonomics for deploying and development,
added default scripts "start" & "deploy" with assumed TS or JS files in generated ./src/index.
The name property is now derived from user input oninit <name>
or parent directory if no input is provided. -
#452
1cf6701
Thanks @petebacondarwin! - feat: add support for publishing workers with r2 bucket bindingsThis change adds the ability to define bindings in your
wrangler.toml
...
[email protected]
Patch Changes
-
#364
3575892
Thanks @threepointone! - enhance: small tweaks towrangler init
- A slightly better
package.json
- A slightly better
tsconfig.json
- installing
typescript
as a dev dependency
- A slightly better
-
#380
aacd1c2
Thanks @GregBrimble! - fix: ensure pages routes are defined correctlyIn e151223 we introduced a bug where the RouteKey was now an array rather than a simple URL string. When it got stringified into the routing object these were invalid.
E.g.[':page*', undefined]
got stringified to":page*,"
rather than":page*"
.Fixes #379
-
#329
27a1f3b
Thanks @petebacondarwin! - ci: run PR jobs on both Ubuntu, MacOS and Windows- update .gitattributes to be consistent on Windows
- update Prettier command to ignore unknown files
Windows seems to be more brittle here. - tighten up eslint config
Windows seems to be more brittle here as well. - use the matrix.os value in the cache key
Previously we were usingrunning.os
but this appeared not to be working.
-
#347
ede5b22
Thanks @threepointone! - fix: hidewrangler pages functions
in the main help menuThis hides
wrangler pages functions
in the main help menu, since it's only intended for internal usage right now. It still "works", so nothing changes in that regard. We'll bring this back when we have a broader story in wrangler for functions. -
#360
f590943
Thanks @threepointone! - fix:kv:key get
The api for fetching a kv value, unlike every other cloudflare api, returns just the raw value as a string (as opposed to the
FetchResult
-style json). However, our fetch utility tries to convert every api response to json before parsing it further. This leads to bugs like #359. The fix is to special case forkv:key get
.Fixes #359.
-
#373
6e7baf2
Thanks @petebacondarwin! - fix: use the appropriate package manager when initializing a wrangler projectPreviously, when we initialized a project using
wrangler init
, we always used npm as the package manager.Now we check to see whether npm and yarn are actually installed, and also whether there is already a lock file in place before choosing which package manager to use.
Fixes #353
-
#363
0add2a6
Thanks @threepointone! - fix: support uppercase hotkeys inwrangler dev
Just a quick fix to accept uppercase hotkeys during
dev
. -
#331
e151223
Thanks @petebacondarwin! - fix: generate valid URL route paths for pages on WindowsPreviously route paths were manipulated by file-system path utilities.
On Windows this resulted in URLs that had backslashes, which are invalid for such URLs. -
#338
e0d2f35
Thanks @threepointone! - feat: environments for Worker SitesThis adds environments support for Workers Sites. Very simply, it uses a separate kv namespace that's indexed by the environment name. This PR also changes the name of the kv namespace generated to match wrangler 1's implementation.
-
#329
e1d2198
Thanks @petebacondarwin! - test: support testing in CI on Windows-
Don't rely on bash variables to configure tests
The use of bash variables in thenpm test
script is not supported in Windows Powershell, causing CI on Windows to fail.
These bash variables are used to override the API token and the Account ID.This change moves the control of mocking these two concepts into the test code, by adding
mockAccountId()
andmockApiToken()
helpers.- The result is slightly more boilerplate in tests that need to avoid hitting the auth APIs.
- But there are other tests that had to revert these environment variables. So the boilerplate is reduced there.
-
Sanitize command line for snapshot tests
This change appliesnormalizeSlashes()
andtrimTimings()
to command line outputs and error messages to avoid inconsistencies in snapshots.
The benefit here is that authors do not need to keep adding them to all their snapshot tests. -
Move all the helper functions into their own directory to keep the test directory cleaner.
-
-
#380
aacd1c2
Thanks @GregBrimble! - refactor: clean up pages routing -
#343
cfd8ba5
Thanks @threepointone! - chore: update esbuildUpdate esbuild to 0.14.14. Also had to change
import esbuild from "esbuild";
toimport * as esbuild from "esbuild";
indev.tsx
. -
#371
85ceb84
Thanks @nrgnrg! - fix: pages advanced mode usagePreviously in pages projects using advanced mode (a single
_worker.js
or--script-path
file rather than a./functions
folder), callingpages dev
would quit without an error and not launch miniflare.This change fixes that and enables
pages dev
to be used with pages projects in advanced mode. -
#383
969c887
Thanks @threepointone! - fix: remove redundant process.cwd() calls inwrangler init
Followup from #372 (comment), just removing some unnecessary calls to
process.cwd()
/path.join()
, since they're already relative to where they're called from. -
#329
ac168f4
Thanks @petebacondarwin! - refactor: use helpers to manage npm commandsThis change speeds up tests and avoids us checking that npm did what it is supposed to do.
-
#348
b8e3b01
Thanks @threepointone! - chore: replacenode-fetch
withundici
There are several reasons to replace
node-fetch
withundici
:undici
'sfetch()
implementation is set to become node's standardfetch()
implementation, which means we can just remove the dependency in the future (or optionally load it depending on which version of node is being used)node-fetch
pollutes the global type space with a number of standard types- we already bundle
undici
viaminiflare
/pages, so this means our bundle size could ostensibly become smaller.
This replaces
node-fetch
withundici
.- All instances of
import fetch from "node-fetch"
are replaced withimport {fetch} from "undici"
undici
also comes with spec compliant forms ofFormData
andFile
, so we could also removeformdata-node
inform_data.ts
- All the global types that were injected by
node-fetch
are now imported fromundici
(as well as some mistaken ones fromnode:url
) - NOTE: this also turns on
skipLibCheck
intsconfig.json
. Some dependencies oddly depend on browser globals likeRequest
,Response
(like@miniflare/core
,jest-fetch-mock
, etc), which now fail becausenode-fetch
isn't injecting those globals anymore. So we enableskipLibCheck
to bypass them. (I'd thoughtskipLibCheck
completely ignores 'third party' types, but that's not true - it still uses the module graph to scan types. So we're still typesafe. We should enablestrict
sometime to avoidany
s, but that's for later.) - The bundle size isn't s...
[email protected]
Patch Changes
-
#333
6320a32
Thanks @threepointone! - fix: pass worker name to syncAssets indev
This fix passes the correct worker name to
syncAssets
duringwrangler dev
. This function uses the name to create the backing kv store for a Workers Sites definition, so it's important we get the name right.I also fixed the lint warning introduced in #321, to pass
props.enableLocalPersistence
as a dependency in theuseEffect
call that starts the "local" mode dev server. -
#335
a417cb0
Thanks @threepointone! - fix: prevent infinite loop when fetching a list of resultsWhen fetching a list of results from cloudflare APIs (e.g. when fetching a list of keys in a kv namespace), the api returns a
cursor
that a consumer should use to get the next 'page' of results. It appears this cursor can also be a blank string (while we'd only account for it to beundefined
). By only accounting for it to beundefined
, we were infinitely looping through the same page of results and never terminating. This PR fixes it by letting it be a blank string (andnull
, for good measure) -
#332
a2155c1
Thanks @threepointone! - fix: wait for port to be available before creating a dev serverWhen we run
wrangler dev
, we start a server on a port (defaulting to 8787). We do this separately for both local and edge modes. However, when switching between the two with thel
hotkey, we don't 'wait' for the previous server to stop before starting the next one. This can crash the process, and we don't want that (of course). So we introduce a helper functionwaitForPortToBeAvailable()
that waits for a port to be available before returning. This is used in both the local and edge modes, and prevents the bug right now, where switching between edge - local - edge crashes the process.(This isn't a complete fix, and we can still cause errors by very rapidly switching between the two modes. A proper long term fix for the future would probably be to hoist the proxy server hook above the
<Remote/>
and<Local/>
components, and use a single instance throughout. But that requires a deeper refactor, and isn't critical at the moment.) -
#336
ce61000
Thanks @threepointone! - feat: inline text-like files into the worker bundleWe were adding text-like modules (i.e.
.txt
,.html
and.pem
files) as separate modules in the Worker definition, but this only really 'works' with the ES module Worker format. This commit changes that to inline the text-like files into the Worker bundle directly.We still have to do something similar with
.wasm
modules, but that requires a different fix, and we'll do so in a subsequent commit. -
#336
ce61000
Thanks @threepointone! - feat: Sites support for local modewrangler dev
This adds support for Workers Sites in local mode when running wrangler
dev
. Further, it fixes a bug where we were sending the__STATIC_CONTENT_MANIFEST
definition as a separate module even with service worker format, and a bug where we weren't uploading the namespace binding when other kv namespaces weren't present.
[email protected]
Patch Changes
-
#307
53c6318
Thanks @threepointone! - feat:wrangler secret * --local
This PR implements
wrangler secret
for--local
mode. The implementation is simply a no-op, since we don't want to actually write secret values to disk (I think?). I also got the messaging for remote mode right by copying from wrangler 1. Further, I added tests for all thewrangler secret
commands. -
#324
b816333
Thanks @GregBrimble! - Fixeswrangler pages dev
failing to start for just a folder of static assets (no functions) -
#317
d6ef61a
Thanks @threepointone! - fix: restart thedev
proxy server whenever it closesWhen we run
wrangler dev
, the session that we setup with the preview endpoint doesn't last forever, it dies after ignoring it for 5-15 minutes or so. The fix for this is to simply reconnect the server. So we use a state hook as a sigil, and add it to the dependency array of the effect that sets up the server, and simply change it every time the server closes.Fixes #197
(In wrangler1, we used to restart the whole process, including uploading the worker again, making a new preview token, and so on. It looks like that they may not have been necessary.)
-
#312
77aa324
Thanks @threepointone! - fix: remove--prefer-offline
when runningnpm install
We were using
--prefer-offline
when runningnpm install
duringwrangler init
. The behaviour is odd, it doesn't seem to fetch from the remote when the cache isn't hit, which is not what I'm expecting. So we remove--prefer-offline
. -
#311
a5537f1
Thanks @threepointone! - fix: custom builds should allow multiple commandsWe were running custom builds as a regular command with
execa
. This would fail whenever we tried to run compound commands likecargo install -q worker-build && worker-build --release
(via #236). The fix is to useshell: true
, so that the command is run in a shell and can thus use bash-y syntax like&&
, and so on. I also switched to usingexecaCommand
which splits a command string into parts correctly by itself. -
#321
5b64a59
Thanks @geelen! - fix: disable local persistence by default & add--experimental-enable-local-persistence
flagBREAKING CHANGE:
When running
dev
locally any data stored in KV, Durable Objects or the cache are no longer persisted between sessions by default.To turn this back on add the
--experimental-enable-local-persistence
at the command line.
[email protected]
Patch Changes
-
#293
71b0fab
Thanks @petebacondarwin! - fix: warn if thesite.entry-point
configuration is found during publishingAlso updates the message and adds a test for the error when there is no entry-point specified.
Fixes #282
-
#304
7477b52
Thanks @threepointone! - feat: enhancewrangler init
This PR adds some enhancements/fixes to the
wrangler init
command.- doesn't overwrite
wrangler.toml
if it already exists - installs
wrangler
when creatingpackage.json
- offers to install
wrangler
intopackage.json
even ifpackage.json
already exists - offers to install
@cloudflare/workers-types
even iftsconfig.json
already exists - pipes stdio back to the terminal so there's feedback when it's installing npm packages
This does have the side effect of making out tests slower. I added
--prefer-offline
to thenpm install
calls to make this a shade quicker, but I can't figure out a good way of mocking these. I'll think about it some more later. We should work on making the installs themselves quicker (re: #66)This PR also fixes a bug with our tests -
runWrangler
would catch thrown errors, and if we didn't manually verify the error, tests would pass. Instead, it now throws correctly, and I modified all the tests to assert on thrown errors. It seems like a lot, but it was just mechanical rewriting. - doesn't overwrite
-
#294
7746fba
Thanks @threepointone! - feature: add more types that get logged viaconsole
methodsThis PR adds more special logic for some data types that get logged via
console
methods. Types likePromise
,Date
,WeakMaps
, and some more, now get logged correctly (or at least, better than they used to).This PR also fixes a sinister bug - the
type
of theConsoleAPICalled
events don't match 1:1 with actual console methods (eg:console.warn
message type iswarning
). This PR adds a mapping between those types and method names. Some methods don't seem to have a message type, I'm not sure why, but we'll get to them later. -
#310
52c99ee
Thanks @threepointone! - feat: error if a site definition doesn't have abucket
fieldThis adds an assertion error for making sure a
[site]
definition always has abucket
field.As a cleanup, I made some small fixes to theConfig
type definition, and modified the tests inpublish.test.ts
to use the config format when creating awrangler.toml
file.
[email protected]
Patch Changes
-
#292
e5d3690
Thanks @threepointone! - fix: use entrypoint specified in esbuuild's metafile as source for building the workerWhen we pass a non-js file as entry to esbuild, it generates a
.js
file. (which, is the whole job of esbuild, haha). So, given<source>/index.ts
, it'll generate<destination>/index.js
. However, when we try to 'find' the matching file to pass on as an input to creating the actual worker, we try to use the original file name inside the destination directory. At this point, the extension has changed, so it doesn't find the file, and hence we get the error that looks likeENOENT: no such file or directory, open '/var/folders/3f/fwp6mt7n13bfnkd5vl3jmh1w0000gp/T/tmp-61545-4Y5kwyNI8DGU/src/worker.ts'
The actual path to the destination file is actually the key of the block in
metafile.outputs
that matches the given output.entryPoint, so this PR simply rewrites the logic to use that instead.
-
#287
b63efe6
Thanks @threepointone! - fix: propagate api errors to the terminal correctlyAny errors embedded in the response from the Cloudflare API were being lost, because
fetchInternal()
would throw on a non-200 response. This PR fixes that behaviour:- It doesn't throw on non-200 responses
- It first gets the response text with
.text()
and converts it to an object withJSON.parse
, so in case the api returns a non json response, we don't lose response we were sent.
Unfortunately, because of the nature of this abstraction, we do lose the response
status
code andstatusText
, but maybe that's acceptable since we have richer error information in the payload. I considered logging the code and text to the terminal, but that may make it noisy.
[email protected]
Patch Changes
-
#242
014a731
Thanks @petebacondarwin! - Refactor pages code to pass strict-null checks -
#267
e22f9d7
Thanks @petebacondarwin! - refactor: tidy up the typings of the build result in devIn #262 some of the strict null fixes were removed to resolve a regression.
This refactor re-applies these fixes in a way that avoids that problem. -
#284
20377e8
Thanks @petebacondarwin! - Add whoami command -
#270
2453577
Thanks @petebacondarwin! - feat: add support for include and exclude when publishing site assets -
#270
0289882
Thanks @petebacondarwin! - fix: ensurekv:key list
matches the output from Wrangler 1The previous output was passing an array of objects to console.log, which ended up showing something like
[Object object] [Object object] ...
Now the result is JSON stringified before being sent to the console.
The tests have been fixed to check this too. -
#258
f9c1423
Thanks @petebacondarwin! - fix: correctly handle entry-point path when publishingThe
publish
command was failing when the entry-point was specified in the wrangler.toml file and the entry-point imported another file.This was because we were using the
metafile.inputs
to guess the entry-point file path. But the order in which the source-files were added to this object was not well defined, and so we could end up failing to find a match.This fix avoids this by using the fact that the
metadata.outputs
object will only contain one element that has theentrypoint
property - and then using that as the entry-point path. For runtime safety, we now assert that there cannot be zero or multiple such elements. -
#275
e9ab55a
Thanks @petebacondarwin! - feat: add a link to create a github issue when there is an error.When a (non-yargs) error surfaces to the top level,
we know also show a link to Github to encourage the developer to report an issue. -
#286
b661dd0
Thanks @dependabot! - chore: Updatenode-fetch
to 3.1.1, runnpm audit fix
in rootThis commit addresses a secutity issue in
node-fetch
and updates it to 3.1.1. I also rannpm audit fix
in the root directory to address a similar issue with@changesets/get-github-info
. -
#249
9769bc3
Thanks @petebacondarwin! - Do not crash when processing environment configuration.Previously there were corner cases where the configuration might just crash.
These are now handled more cleanly with more appropriate warnings. -
#272
5fcef05
Thanks @petebacondarwin! - refactor: enable TypeScript strict-null checksThe codebase is now strict-null compliant and the CI checks will fail if a PR tries to introduce code that is not.
-
#277
6cc9dde
Thanks @petebacondarwin! - fix: align publishing sites asset keys with Wrangler 1- Use the same hashing strategy for asset keys (xxhash64)
- Include the full path (from cwd) in the asset key
- Match include and exclude patterns against full path (from cwd)
- Validate that the asset key is not over 512 bytes long
-
#270
522d1a6
Thanks @petebacondarwin! - fix: check actual asset file size, not base64 encoded sizePreviously we were checking whether the base64 encoded size of an asset was too large (>25MiB).
But base64 takes up more space than a normal file, so this was too aggressive. -
#263
402c77d
Thanks @jkriss! - fix: appropriately fail silently when the open browser command doesn't work -
#280
f19dde1
Thanks @petebacondarwin! - fix: skip unwanted files and directories when publishing site assetsIn keeping with Wrangler 1, we now skip node_modules and hidden files and directories.
An exception is made for
.well-known
. See https://datatracker.ietf.org/doc/html/rfc8615.The tests also prove that the asset uploader will walk directories in general.
-
#258
ba6fc9c
Thanks @petebacondarwin! - chore: add test-watch script to the wrangler workspaceWatch the files in the wrangler workspace, and run the tests when anything changes:
> npm run test-watch -w wrangler
This will also run all the tests in a single process (rather than in parallel shards) and will increase the test-timeout to 50 seconds, which is helpful when debugging.
[email protected]
Patch Changes
- #243
dc7ce83
Thanks @petebacondarwin! - refactor: update test code to pass strict-null checks
- #244
2e7a75f
Thanks @petebacondarwin! - refactor: update dev and publish commands to pass strict-null checks
-
#238
65f9904
Thanks @threepointone! - refactor: simplify and documentconfig.ts
This PR cleans up the type definition for the configuration object, as well as commenting the hell out of it. There are no duplicate definitions, and I annotated what I could.
@optional
means providing a value isn't mandatory@deprecated
means the field itself isn't necessary anymore in wrangler.toml@breaking
means the deprecation/optionality is a breaking change from wrangler 1@todo
means there's more work to be done (with details attached)@inherited
means the field is copied to all environments
- #247
edc4b53
Thanks @petebacondarwin! - refactor: update miscellaneous source files to pass strict-null checks
- #248
5806932
Thanks @petebacondarwin! - refactor: update proxy code to pass strict-null checks
- #241
5d423e9
Thanks @petebacondarwin! - chore: add common words to the cSpell config to prevent unwanted warnings
-
#257
00e51cd
Thanks @threepointone! - fix: description forkv:bulk delete <filename>
The description for the
kv:bulk delete
command was wrong, it was probably copied earlier from thekv:bulk put
command. This PR fixes the mistake.
-
#262
7494cf7
Thanks @threepointone! - fix: fixdev
andpublish
We introduced some bugs in recent PRs
- In #196, we broke being able to pass an entrypoint directly to the cli. In this PR, I just reverted that fix. I'll reopen #78 and we'll tackle it again later. (cc @jgentes)
- In #215, we broke being able to publish a script by just passing
--latest
or--compatibility-data
in the cli. This PR fixes that by reading the correct argument when choosing whether to publish. - In #247, we broke how we made requests by passing headers to requests. This PR reverts the changes made in
cfetch/internal.ts
. (cc @petebacondarwin) - In #244, we broke
dev
and it would immediately crash. This PR fixes the reference indev.tsx
that was breaking. (cc @petebacondarwin)
- #250
3c74a4a
Thanks @petebacondarwin! - refactor: update inspector code to ensure that strict-null types pass
[email protected]
[email protected]
Patch Changes
-
#231
18f8f65
Thanks @threepointone! - refactor: proxy/preview serverThis PR refactors how we setup the proxy server between the developer and the edge preview service during
wrangler dev
. Of note, we start the server immediately. We also buffer requests/streams and hold on to them, when starting/refreshing the token. This means a developer should never seeERR_CONNECTION_REFUSED
error page, or have an older worker respond after making a change to the code. And when the token does get refreshed, we flush said streams/requests with the newer values, making the iteration process a lot smoother and predictable. -
#239
0431093
Thanks @Warfields! - Added prompt for users to select an account. -
#225
b901bf7
Thanks @GregBrimble! - Fix the--watch
command forwrangler pages functions build
. -
#208
fe4b099
Thanks @petebacondarwin! - Remove explicitany
types from the codebaseThis change removes all use of
any
from the code and updates theno-explicit-any
eslint rule to be an error. -
#223
a979d55
Thanks @GregBrimble! - Add ability to compile a directory other thanfunctions
forwrangler pages functions build
. -
#216
e1c615f
Thanks @GregBrimble! - Ignore non-JS files when compiling Pages Functions -
#217
777f4d5
Thanks @GregBrimble! - Reverse execution order of Pages Functions middlewares -
#196
fc112d7
Thanks @jgentes! - allow specifying only "index" without extension or nothing at all for "wrangler dev" and "wrangler publish" -
#211
3bbfd4f
Thanks @GregBrimble! - Silently fail to auto-open the browser inwrangler pages dev
command when that errors out. -
#189
2f7e1b2
Thanks @petebacondarwin! - Refactor raw value extraction from Cloudflare APIsMost API responses are JSON of the form:
{ result, success, errors, messages, result_info }
where the
result
contains the actual response value.But some API responses only contain the result value.
This change refactors the client-side fetch API to allow callers to specify what kind of response they expect.
-
#202
e26781f
Thanks @threepointone! - Disable @typescript-lint/no-explicit-any eslint rule in pages code -
#214
79d0f2d
Thanks @threepointone! - rename--public
as--experimental-public
-
#215
41d4c3e
Thanks @threepointone! - Add--compatibility-date
,--compatibility-flags
,--latest
cli arguments todev
andpublish
.- A cli arg for adding a compatibility data, e.g
--compatibility_date 2022-01-05
- A shorthand
--latest
that setscompatibility_date
to today's date. Usage of this flag logs a warning. latest
is NOT a config field inwrangler.toml
.- In
dev
, when a compatibility date is not available in eitherwrangler.toml
or as a cli arg, then we default to--latest
. - In
publish
we error if a compatibility date is not available in eitherwrangler.toml
or as a cli arg. Usage of--latest
logs a warning. - We also accept compatibility flags via the cli, e.g:
--compatibility-flags formdata_parser_supports_files
- A cli arg for adding a compatibility data, e.g
-
#210
d381fed
Thanks @GregBrimble! - Exposewrangler pages functions build
command, which takes thefunctions
folder and compiles it into a single Worker.This was already done in
wrangler pages dev
, so this change just exposes this build command for use in our build image, or for people who want to do it themselves. -
#213
5e1222a
Thanks @GregBrimble! - Adds support for building a Worker from a folder of functions which isn't tied to the Pages platform.This lets developers use the same file-based routing system an simplified syntax when developing their own Workers!
-
#199
d9ecb70
Thanks @threepointone! - Refactor inspection/debugging code -- I've installed devtools-protocol, a convenient package that has the static types for the devtools protocol (duh) autogenerated from chrome's devtools codebase.
- We now log messages and exceptions into the terminal directly, so you don't have to open devtools to see those messages.
- Messages are now buffered until a devtools instance connects, so you won't lose any messages while devtools isn't connected.
- We don't lose the connection on making changes to the worker, removing the need for the kludgy hack on the devtools side (where we refresh the whole page when there's a change)
-
#189
2f7e1b2
Thanks @petebacondarwin! - Fix pagination handling of list requests to the Cloudflare APIWhen doing a list request to the API, the server may respond with only a single page of results.
In this case, it will also provide acursor
value in theresult_info
part of the response, which can be used to request the next page.
This change implements this on the client-side so that we get all the results by requesting further pages when there is a cursor. -
#220
6fc2276
Thanks @GregBrimble! - Add--live-reload
option towrangler pages dev
which automatically reloads HTML pages when a change is detected -
#223
a979d55
Thanks @GregBrimble! - Add--output-config-path
option towrangler pages functions build
which writes a config file describing thefunctions
folder.