wrangler 0.0.0-d86200d2 → 0.0.0-d86abb2c
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 +7 -9
- package/bin/wrangler.js +5 -28
- package/config-schema.json +3058 -0
- package/package.json +197 -191
- package/templates/__tests__/tsconfig.json +1 -1
- package/templates/checked-fetch.js +10 -3
- package/templates/facade.d.ts +7 -2
- 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 +94 -44
- package/templates/middleware/loader-sw.ts +4 -3
- package/templates/middleware/middleware-ensure-req-body-drained.ts +18 -0
- package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
- package/templates/middleware/middleware-serve-static-assets.ts +56 -0
- package/templates/modules-watch-stub.js +4 -0
- package/templates/no-op-assets-worker.ts +33 -0
- package/templates/pages-dev-pipeline.ts +2 -1
- package/templates/pages-template-plugin.ts +14 -4
- package/templates/pages-template-worker.ts +12 -3
- package/templates/startDevWorker/InspectorProxyWorker.ts +664 -0
- package/templates/startDevWorker/ProxyWorker.ts +336 -0
- package/templates/tsconfig.init.json +4 -87
- package/templates/tsconfig.json +1 -1
- package/wrangler-dist/InspectorProxyWorker.js +464 -0
- package/wrangler-dist/InspectorProxyWorker.js.map +6 -0
- package/wrangler-dist/ProxyWorker.js +242 -0
- package/wrangler-dist/ProxyWorker.js.map +6 -0
- package/wrangler-dist/cli.d.ts +24876 -213
- package/wrangler-dist/cli.js +155960 -93663
- package/wrangler-dist/wasm-sync.wasm +0 -0
- package/Cloudflare_CA.pem +0 -18
- package/templates/__tests__/tsconfig.tsbuildinfo +0 -1
- package/templates/d1-beta-facade.js +0 -244
- package/templates/first-party-worker-module-facade.ts +0 -19
- package/templates/format-dev-errors.ts +0 -34
- package/templates/serve-static-assets.ts +0 -66
- package/templates/service-bindings-module-facade.js +0 -55
- package/templates/service-bindings-sw-facade.js +0 -42
- package/templates/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
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
|
-
> This package is for wrangler v2.x, released first in May 2022. If you're looking for v1.x of the `@cloudflare/wrangler` package, visit https://www.npmjs.com/package/@cloudflare/wrangler / https://github.com/cloudflare/wrangler-legacy.
|
|
10
|
-
|
|
11
9
|
`wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
|
|
12
10
|
|
|
13
11
|
## Quick Start
|
|
@@ -26,7 +24,7 @@ npx wrangler deploy index.js --name my-worker
|
|
|
26
24
|
|
|
27
25
|
```bash
|
|
28
26
|
# Generate a new project
|
|
29
|
-
npx wrangler init my-worker
|
|
27
|
+
npx wrangler init my-worker --no-delegate-c3
|
|
30
28
|
# try it out
|
|
31
29
|
cd my-worker && npm run start
|
|
32
30
|
# and then deploy it
|
|
@@ -43,15 +41,15 @@ $ npm install wrangler --save-dev
|
|
|
43
41
|
|
|
44
42
|
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.
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
Example:
|
|
47
45
|
|
|
48
46
|
```toml
|
|
49
|
-
main = "./src/index.ts" # init w/ TypeScript
|
|
50
47
|
name = "my-worker"
|
|
51
|
-
|
|
48
|
+
main = "./src/index.ts" # init w/ TypeScript
|
|
49
|
+
compatibility_date = "YYYY-MM-DD"
|
|
52
50
|
```
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
For more detailed information about configuration, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/configuration/).
|
|
55
53
|
|
|
56
54
|
## Commands
|
|
57
55
|
|
|
@@ -67,7 +65,7 @@ Start a local development server, with live reloading and devtools.
|
|
|
67
65
|
|
|
68
66
|
Publish the given script to the worldwide Cloudflare network.
|
|
69
67
|
|
|
70
|
-
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/
|
|
68
|
+
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/wrangler/commands/).
|
|
71
69
|
|
|
72
70
|
## Pages
|
|
73
71
|
|
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
|
|