wrangler 0.0.0-fb53fda → 0.0.0-fd3517a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -13
- package/bin/wrangler.js +3 -0
- package/miniflare-dist/index.mjs +18 -18
- package/miniflare-dist/index.mjs.map +3 -3
- package/package.json +25 -18
- package/pages/functions/buildPlugin.ts +55 -0
- package/pages/functions/filepath-routing.test.ts +11 -0
- package/pages/functions/filepath-routing.ts +8 -0
- package/pages/functions/routes.ts +6 -1
- package/pages/functions/template-plugin.ts +146 -0
- package/pages/functions/template-worker.ts +21 -8
- package/src/__tests__/config-cache.test.ts +31 -0
- package/src/__tests__/configuration.test.ts +383 -71
- package/src/__tests__/dev.test.tsx +113 -14
- package/src/__tests__/guess-worker-format.test.ts +18 -1
- package/src/__tests__/helpers/mock-cfetch.ts +5 -1
- package/src/__tests__/helpers/mock-console.ts +18 -3
- package/src/__tests__/helpers/mock-http-server.ts +46 -0
- package/src/__tests__/helpers/mock-istty.ts +23 -0
- package/src/__tests__/helpers/mock-oauth-flow.ts +231 -0
- package/src/__tests__/helpers/run-in-tmp.ts +7 -0
- package/src/__tests__/helpers/write-worker-source.ts +31 -0
- package/src/__tests__/https-options.test.ts +4 -2
- package/src/__tests__/index.test.ts +13 -757
- package/src/__tests__/init.test.ts +833 -0
- package/src/__tests__/jest.setup.ts +4 -0
- package/src/__tests__/kv.test.ts +82 -44
- package/src/__tests__/logger.test.ts +115 -0
- package/src/__tests__/pages.test.ts +315 -43
- package/src/__tests__/publish.test.ts +1588 -342
- package/src/__tests__/r2.test.ts +8 -4
- package/src/__tests__/route.test.ts +4 -4
- package/src/__tests__/secret.test.ts +22 -10
- package/src/__tests__/tail.test.ts +100 -2
- package/src/__tests__/user.test.ts +126 -0
- package/src/__tests__/whoami.test.tsx +5 -8
- package/src/bundle.ts +30 -3
- package/src/cli.ts +4 -2
- package/src/config/README.md +1 -1
- package/src/config/config.ts +20 -4
- package/src/config/environment.ts +31 -3
- package/src/config/index.ts +2 -1
- package/src/config/validation-helpers.ts +24 -5
- package/src/config/validation.ts +271 -39
- package/src/config-cache.ts +43 -0
- package/src/create-worker-preview.ts +14 -7
- package/src/create-worker-upload-form.ts +32 -9
- package/src/dev/dev.tsx +62 -32
- package/src/dev/local.tsx +101 -21
- package/src/dev/remote.tsx +23 -13
- package/src/dev/use-esbuild.ts +23 -5
- package/src/dialogs.tsx +2 -1
- package/src/entry.ts +43 -13
- package/src/environment-variables.ts +3 -1
- package/src/errors.ts +11 -0
- package/src/https-options.ts +3 -2
- package/src/index.tsx +389 -310
- package/src/inspect.ts +17 -11
- package/src/logger.ts +56 -0
- package/src/miniflare-cli/index.ts +4 -0
- package/src/miniflare-cli/request-context.ts +40 -0
- package/src/module-collection.ts +7 -7
- package/src/open-in-browser.ts +5 -4
- package/src/package-manager.ts +9 -8
- package/src/pages.tsx +652 -55
- package/src/parse.ts +1 -1
- package/src/proxy.ts +25 -9
- package/src/publish.ts +261 -140
- package/src/reporting.ts +19 -3
- package/src/sites.tsx +27 -14
- package/src/tail/index.ts +1 -1
- package/src/tail/printing.ts +5 -4
- package/src/update-check.ts +19 -0
- package/src/user.tsx +83 -37
- package/src/whoami.tsx +2 -1
- package/src/worker.ts +15 -6
- package/templates/static-asset-facade.js +1 -1
- package/wrangler-dist/cli.js +14641 -10836
- package/wrangler-dist/cli.js.map +3 -3
- package/src/__tests__/logout.test.ts +0 -52
package/README.md
CHANGED
|
@@ -2,46 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
`wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
|
|
4
4
|
|
|
5
|
-
[(Read the full stack week launch blog post.)](https://blog.cloudflare.com/wrangler-v2-beta/)
|
|
6
|
-
|
|
7
|
-
**DISCLAIMER**: This is a work in progress, and is NOT recommended for use in production. We are opening this preview for feedback from the community, and to openly share our [roadmap](https://github.com/cloudflare/wrangler2/issues/12) for the future. As such, expect APIs and documentation to change before the end of the preview.
|
|
8
|
-
|
|
9
|
-
Further, we will NOT do a general release until we are both feature complete, and have a full backward compatibility and incremental migration plan in place. For more details, follow the [parent roadmap issue](https://github.com/cloudflare/wrangler2/issues/12).
|
|
10
|
-
|
|
11
5
|
## Quick Start
|
|
12
6
|
|
|
13
7
|
```bash
|
|
14
8
|
# Make a javascript file
|
|
15
|
-
|
|
9
|
+
echo "export default { fetch() { return new Response('hello world') } }" > index.js
|
|
16
10
|
# try it out
|
|
17
|
-
|
|
11
|
+
npx wrangler dev index.js
|
|
18
12
|
# and then publish it
|
|
19
|
-
|
|
13
|
+
npx wrangler publish index.js --name my-worker
|
|
20
14
|
# visit https://my-worker.<your workers subdomain>.workers.dev
|
|
21
15
|
```
|
|
22
16
|
|
|
17
|
+
## Create a Project
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Generate a new project
|
|
21
|
+
npx wrangler init my-worker
|
|
22
|
+
# try it out
|
|
23
|
+
cd my-worker && npm run start
|
|
24
|
+
# and then publish it
|
|
25
|
+
npx wrangler publish
|
|
26
|
+
```
|
|
27
|
+
|
|
23
28
|
## Installation:
|
|
24
29
|
|
|
25
30
|
```bash
|
|
26
|
-
$ npm install wrangler
|
|
31
|
+
$ npm install wrangler --save-dev
|
|
27
32
|
```
|
|
28
33
|
|
|
29
34
|
## Commands
|
|
30
35
|
|
|
31
36
|
### `wrangler init [name]`
|
|
32
37
|
|
|
33
|
-
Creates a
|
|
38
|
+
Creates a Worker project. For details on configuration keys and values, refer to the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration).
|
|
34
39
|
|
|
35
|
-
### `wrangler dev
|
|
40
|
+
### `wrangler dev`
|
|
36
41
|
|
|
37
42
|
Start a local development server, with live reloading and devtools.
|
|
38
43
|
|
|
39
|
-
### `wrangler publish
|
|
44
|
+
### `wrangler publish`
|
|
40
45
|
|
|
41
46
|
Publish the given script to the worldwide Cloudflare network.
|
|
42
47
|
|
|
43
48
|
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/commands).
|
|
44
49
|
|
|
50
|
+
## Pages
|
|
51
|
+
|
|
45
52
|
### `wrangler pages dev [directory] [-- command]`
|
|
46
53
|
|
|
47
54
|
Either serves a static build asset directory, or proxies itself in front of a command.
|
|
@@ -49,3 +56,7 @@ Either serves a static build asset directory, or proxies itself in front of a co
|
|
|
49
56
|
Builds and runs functions from a `./functions` directory or uses a `_worker.js` file inside the static build asset directory.
|
|
50
57
|
|
|
51
58
|
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/pages/platform/functions#develop-and-preview-locally) or run `wrangler pages dev --help`.
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
For the latest Wrangler documentation, [click here](https://6b05b6e1.cloudflare-docs-7ou.pages.dev/workers/wrangler/).
|
package/bin/wrangler.js
CHANGED
|
@@ -23,6 +23,9 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
|
23
23
|
wranglerProcess = spawn(
|
|
24
24
|
process.execPath,
|
|
25
25
|
[
|
|
26
|
+
...(semiver(process.versions.node, "18.0.0") >= 0
|
|
27
|
+
? ["--no-experimental-fetch"] // TODO: remove this when https://github.com/cloudflare/wrangler2/issues/834 is properly fixed
|
|
28
|
+
: []),
|
|
26
29
|
"--no-warnings",
|
|
27
30
|
"--experimental-vm-modules",
|
|
28
31
|
...process.execArgv,
|