wrangler 0.0.0-fa42d7ca → 0.0.0-fa7e4da92
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 +29 -37
- package/bin/wrangler.js +2 -8
- package/config-schema.json +519 -1288
- package/package.json +38 -52
- package/templates/init-tests/test-vitest-new-worker.ts +2 -2
- package/templates/middleware/middleware-mock-analytics-engine.d.ts +3 -0
- package/templates/middleware/middleware-mock-analytics-engine.ts +30 -0
- package/templates/middleware/middleware-patch-console-prefix.d.ts +3 -0
- package/templates/middleware/middleware-patch-console-prefix.ts +21 -0
- package/templates/middleware/middleware-scheduled.ts +15 -1
- package/templates/pages-dev-pipeline.ts +3 -2
- package/templates/startDevWorker/ProxyWorker.ts +26 -24
- package/templates/tsconfig.json +8 -1
- package/templates/tsconfig.tsbuildinfo +1 -0
- package/wrangler-dist/InspectorProxyWorker.js +4 -8
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/ProxyWorker.js +28 -30
- package/wrangler-dist/ProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +623 -430
- package/wrangler-dist/cli.js +125780 -183788
- package/templates/middleware/middleware-serve-static-assets.d.ts +0 -6
- package/templates/middleware/middleware-serve-static-assets.ts +0 -56
- package/wrangler-dist/wasm-sync.wasm +0 -0
package/README.md
CHANGED
|
@@ -10,42 +10,40 @@
|
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
+
To get started quickly with a Hello World worker, run the command below:
|
|
14
|
+
|
|
13
15
|
```bash
|
|
14
|
-
|
|
15
|
-
echo "export default { fetch() { return new Response('hello world') } }" > index.js
|
|
16
|
-
# try it out
|
|
17
|
-
npx wrangler dev index.js
|
|
18
|
-
# and then deploy it
|
|
19
|
-
npx wrangler deploy index.js --name my-worker
|
|
20
|
-
# visit https://my-worker.<your workers subdomain>.workers.dev
|
|
16
|
+
npx wrangler init my-worker -y
|
|
21
17
|
```
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
For more info, visit our [Getting Started](https://developers.cloudflare.com/workers/get-started/guide/) guide.
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
# Generate a new project
|
|
27
|
-
npx wrangler init my-worker --no-delegate-c3
|
|
28
|
-
# try it out
|
|
29
|
-
cd my-worker && npm run start
|
|
30
|
-
# and then deploy it
|
|
31
|
-
npm run deploy
|
|
32
|
-
```
|
|
21
|
+
<details><summary>Wrangler System Requirements</summary>
|
|
33
22
|
|
|
34
|
-
|
|
23
|
+
We support running the Wrangler CLI with the [Current, Active, and Maintenance](https://nodejs.org/en/about/previous-releases) versions of Node.js. Your Worker will always be executed in `workerd`, the open source Cloudflare Workers runtime.
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
Wrangler is only supported on macOS 13.5+, Windows 11, and Linux distros that support glib 2.35. This follows [`workerd`'s OS support policy](https://github.com/cloudflare/workerd?tab=readme-ov-file#running-workerd).
|
|
26
|
+
|
|
27
|
+
</details>
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
For the latest Wrangler documentation, [click here](https://developers.cloudflare.com/workers/wrangler/).
|
|
32
|
+
|
|
33
|
+
To read more about Workers in general:
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
- [Getting Started](https://developers.cloudflare.com/workers/get-started/guide/)
|
|
36
|
+
- [How Workers works](https://developers.cloudflare.com/workers/reference/how-workers-works/)
|
|
37
|
+
- [Observability](https://developers.cloudflare.com/workers/observability/)
|
|
38
|
+
- [Platform](https://developers.cloudflare.com/workers/platform/)
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
## Configuration
|
|
41
|
+
|
|
42
|
+
Wrangler is configured via a `wrangler.toml` or `wrangler.json` file in the project root. An example configuration generated by `npx wrangler init` or `npx create cloudflare` is as follows:
|
|
45
43
|
|
|
46
44
|
```toml
|
|
47
45
|
name = "my-worker"
|
|
48
|
-
main = "./src/index.ts"
|
|
46
|
+
main = "./src/index.ts"
|
|
49
47
|
compatibility_date = "YYYY-MM-DD"
|
|
50
48
|
```
|
|
51
49
|
|
|
@@ -53,30 +51,24 @@ For more detailed information about configuration, refer to the [documentation](
|
|
|
53
51
|
|
|
54
52
|
## Commands
|
|
55
53
|
|
|
56
|
-
###
|
|
57
|
-
|
|
58
|
-
Creates a Worker project. For details on configuration keys and values, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/#init).
|
|
54
|
+
### Workers
|
|
59
55
|
|
|
60
|
-
|
|
56
|
+
#### `wrangler dev`
|
|
61
57
|
|
|
62
58
|
Start a local development server, with live reloading and devtools.
|
|
63
59
|
|
|
64
|
-
|
|
60
|
+
#### `wrangler deploy`
|
|
65
61
|
|
|
66
|
-
Publish the given script to
|
|
62
|
+
Publish the given script to Cloudflare's global network.
|
|
67
63
|
|
|
68
64
|
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/).
|
|
69
65
|
|
|
70
|
-
|
|
66
|
+
### Pages
|
|
71
67
|
|
|
72
|
-
|
|
68
|
+
#### `wrangler pages dev [directory]`
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
Serves a static build asset directory.
|
|
75
71
|
|
|
76
72
|
Builds and runs functions from a `./functions` directory or uses a `_worker.js` file inside the static build asset directory.
|
|
77
73
|
|
|
78
74
|
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`.
|
|
79
|
-
|
|
80
|
-
## Documentation
|
|
81
|
-
|
|
82
|
-
For the latest Wrangler documentation, [click here](https://developers.cloudflare.com/workers/wrangler/).
|
package/bin/wrangler.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawn } = require("child_process");
|
|
3
3
|
const path = require("path");
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const MIN_NODE_VERSION = "16.13.0";
|
|
8
|
-
const debug =
|
|
9
|
-
process.env["WRANGLER_LOG"] === "debug"
|
|
10
|
-
? (...args) => console.log(...args)
|
|
11
|
-
: () => {};
|
|
4
|
+
|
|
5
|
+
const MIN_NODE_VERSION = "18.0.0";
|
|
12
6
|
|
|
13
7
|
let wranglerProcess;
|
|
14
8
|
|