wrangler 0.0.0-c43fc4e8 → 0.0.0-c46e02dfd
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 +10 -6
- package/bin/wrangler.js +5 -28
- package/config-schema.json +3123 -0
- package/package.json +184 -195
- package/templates/checked-fetch.js +1 -1
- package/templates/facade.d.ts +7 -5
- package/templates/gitignore +2 -4
- package/templates/init-tests/test-vitest-new-worker.js +1 -1
- package/templates/init-tests/test-vitest-new-worker.ts +1 -1
- package/templates/middleware/loader-modules.ts +92 -85
- package/templates/middleware/loader-sw.ts +4 -3
- package/templates/middleware/middleware-ensure-req-body-drained.ts +18 -0
- 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-scheduled.ts +15 -1
- package/templates/middleware/middleware-serve-static-assets.ts +7 -7
- package/templates/modules-watch-stub.js +4 -0
- package/templates/pages-dev-pipeline.ts +2 -1
- package/templates/pages-template-plugin.ts +2 -2
- package/templates/pages-template-worker.ts +1 -1
- package/templates/startDevWorker/InspectorProxyWorker.ts +664 -0
- package/templates/startDevWorker/ProxyWorker.ts +336 -0
- package/templates/tsconfig.init.json +4 -87
- package/wrangler-dist/InspectorProxyWorker.js +464 -0
- package/wrangler-dist/InspectorProxyWorker.js.map +6 -0
- package/wrangler-dist/ProxyWorker.js +241 -0
- package/wrangler-dist/ProxyWorker.js.map +6 -0
- package/wrangler-dist/cli.d.ts +25053 -258
- package/wrangler-dist/cli.js +140163 -113200
- package/Cloudflare_CA.pem +0 -18
- package/templates/middleware/middleware-d1-beta.d.ts +0 -3
- package/templates/middleware/middleware-d1-beta.ts +0 -244
- package/templates/middleware/middleware-multiworker-dev.d.ts +0 -4
- package/templates/middleware/middleware-multiworker-dev.ts +0 -59
- package/wrangler-dist/wasm-sync.wasm +0 -0
package/README.md
CHANGED
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
<a href="https://www.npmjs.com/package/wrangler"><img alt="npm" src="https://img.shields.io/npm/dw/wrangler?style=flat-square"></a>
|
|
4
4
|
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/cloudflare/workers-sdk?style=flat-square">
|
|
5
5
|
<img alt="GitHub commit activity (branch)" src="https://img.shields.io/github/commit-activity/w/cloudflare/workers-sdk/main?style=flat-square">
|
|
6
|
-
<a href="https://discord.
|
|
6
|
+
<a href="https://discord.cloudflare.com"><img alt="Discord" src="https://img.shields.io/discord/595317990191398933?color=%23F48120&style=flat-square"></a>
|
|
7
7
|
</section>
|
|
8
8
|
|
|
9
9
|
`wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
|
|
10
10
|
|
|
11
|
+
> [!WARNING]
|
|
12
|
+
>
|
|
13
|
+
> Wrangler v2 is **only receiving critical security updates.** We recommend you [migrate to Wrangler v3](https://developers.cloudflare.com/workers/wrangler/migration/update-v2-to-v3/) if you can.
|
|
14
|
+
|
|
11
15
|
## Quick Start
|
|
12
16
|
|
|
13
17
|
```bash
|
|
@@ -41,15 +45,15 @@ $ npm install wrangler --save-dev
|
|
|
41
45
|
|
|
42
46
|
Wrangler is configured via a `wrangler.toml` file in the project root. When utilizing the `wrangler init` command, a `wrangler.toml` file will be created for you.
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
Example:
|
|
45
49
|
|
|
46
50
|
```toml
|
|
47
|
-
main = "./src/index.ts" # init w/ TypeScript
|
|
48
51
|
name = "my-worker"
|
|
49
|
-
|
|
52
|
+
main = "./src/index.ts" # init w/ TypeScript
|
|
53
|
+
compatibility_date = "YYYY-MM-DD"
|
|
50
54
|
```
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
For more detailed information about configuration, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/configuration/).
|
|
53
57
|
|
|
54
58
|
## Commands
|
|
55
59
|
|
|
@@ -65,7 +69,7 @@ Start a local development server, with live reloading and devtools.
|
|
|
65
69
|
|
|
66
70
|
Publish the given script to the worldwide Cloudflare network.
|
|
67
71
|
|
|
68
|
-
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/
|
|
72
|
+
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/).
|
|
69
73
|
|
|
70
74
|
## Pages
|
|
71
75
|
|
package/bin/wrangler.js
CHANGED
|
@@ -28,30 +28,6 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
let pathToCACerts = process.env.NODE_EXTRA_CA_CERTS;
|
|
32
|
-
if (pathToCACerts) {
|
|
33
|
-
// TODO:
|
|
34
|
-
// - should we log a warning here?
|
|
35
|
-
// - maybe we can generate a certificate that concatenates with ours?
|
|
36
|
-
//
|
|
37
|
-
// I do think it'll be rare that someone wants to add a cert AND
|
|
38
|
-
// use Cloudflare WARP, but let's wait till the situation actually
|
|
39
|
-
// arises before we do anything about it
|
|
40
|
-
} else {
|
|
41
|
-
const osTempDir = os.tmpdir();
|
|
42
|
-
const certDir = path.join(osTempDir, "wrangler-cert");
|
|
43
|
-
const certPath = path.join(certDir, "Cloudflare_CA.pem");
|
|
44
|
-
// copy cert to the system temp dir if needed
|
|
45
|
-
if (!fs.existsSync(certPath)) {
|
|
46
|
-
fs.mkdirSync(certDir, { recursive: true });
|
|
47
|
-
fs.writeFileSync(
|
|
48
|
-
certPath,
|
|
49
|
-
fs.readFileSync(path.join(__dirname, "../Cloudflare_CA.pem"), "utf-8")
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
pathToCACerts = certPath;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
31
|
return spawn(
|
|
56
32
|
process.execPath,
|
|
57
33
|
[
|
|
@@ -63,10 +39,6 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
|
63
39
|
],
|
|
64
40
|
{
|
|
65
41
|
stdio: ["inherit", "inherit", "inherit", "ipc"],
|
|
66
|
-
env: {
|
|
67
|
-
...process.env,
|
|
68
|
-
NODE_EXTRA_CA_CERTS: pathToCACerts,
|
|
69
|
-
},
|
|
70
42
|
}
|
|
71
43
|
)
|
|
72
44
|
.on("exit", (code) =>
|
|
@@ -76,6 +48,11 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
|
76
48
|
if (process.send) {
|
|
77
49
|
process.send(message);
|
|
78
50
|
}
|
|
51
|
+
})
|
|
52
|
+
.on("disconnect", () => {
|
|
53
|
+
if (process.disconnect) {
|
|
54
|
+
process.disconnect();
|
|
55
|
+
}
|
|
79
56
|
});
|
|
80
57
|
}
|
|
81
58
|
|