wrangler 0.0.0-a73deb3 → 0.0.0-acbf420
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 +51 -0
- package/bin/wrangler.js +2 -2
- package/package.json +35 -28
- package/src/__tests__/clipboardy-mock.js +4 -0
- package/src/__tests__/index.test.ts +376 -76
- package/src/__tests__/mock-cfetch.js +42 -0
- package/src/api/form_data.ts +35 -19
- package/src/api/inspect.ts +0 -11
- package/src/api/preview.ts +28 -23
- package/src/api/worker.ts +24 -3
- package/src/{index_node.ts → cli.ts} +1 -1
- package/src/config.ts +27 -1
- package/src/dev.tsx +150 -44
- package/src/dialogs.tsx +77 -0
- package/src/index.tsx +270 -107
- package/src/kv.tsx +2 -2
- package/src/module-collection.ts +64 -0
- package/src/pages.tsx +558 -80
- package/src/publish.ts +181 -114
- package/src/sites.tsx +1 -1
- package/src/tail.tsx +1 -1
- package/src/user.tsx +20 -1
- package/wrangler-dist/{index_node.js → cli.js} +50746 -61367
- package/wrangler-dist/{index_node.js.map → cli.js.map} +3 -3
- package/src/__tests__/fixtures/init/.gitkeep +0 -0
- package/src/secret.tsx +0 -40
- package/src/util/fetch.ts +0 -74
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## 🤠 wrangler
|
|
2
|
+
|
|
3
|
+
`wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
|
|
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
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Make a javascript file
|
|
15
|
+
$ echo "export default { fetch() { return new Response('hello world') } }" > index.js
|
|
16
|
+
# try it out
|
|
17
|
+
$ npx wrangler@beta dev index.js
|
|
18
|
+
# and then publish it
|
|
19
|
+
$ npx wrangler@beta publish index.js --name my-worker
|
|
20
|
+
# visit https://my-worker.<your workers subdomain>.workers.dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Installation:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
$ npm install wrangler@beta
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### `wrangler init [name]`
|
|
32
|
+
|
|
33
|
+
Creates a `wrangler.toml` configuration file. For more details on the configuration keys and values, refer to the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/configuration).
|
|
34
|
+
|
|
35
|
+
### `wrangler dev [script]`
|
|
36
|
+
|
|
37
|
+
Start a local development server, with live reloading and devtools.
|
|
38
|
+
|
|
39
|
+
### `wrangler publish [script] --name [name]`
|
|
40
|
+
|
|
41
|
+
Publish the given script to the worldwide Cloudflare network.
|
|
42
|
+
|
|
43
|
+
For more commands and options, refer to the [documentation](https://developers.cloudflare.com/workers/cli-wrangler/commands).
|
|
44
|
+
|
|
45
|
+
### `wrangler pages dev [directory] [-- command]`
|
|
46
|
+
|
|
47
|
+
Either serves a static build asset directory, or proxies itself in front of a command.
|
|
48
|
+
|
|
49
|
+
Builds and runs functions from a `./functions` directory or uses a `_worker.js` file inside the static build asset directory.
|
|
50
|
+
|
|
51
|
+
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`.
|
package/bin/wrangler.js
CHANGED
|
@@ -10,7 +10,7 @@ async function main() {
|
|
|
10
10
|
// Note Volta and nvm are also recommended in the official docs:
|
|
11
11
|
// https://developers.cloudflare.com/workers/get-started/guide#2-install-the-workers-cli
|
|
12
12
|
console.error(
|
|
13
|
-
`Wrangler requires at least Node.js ${MIN_NODE_VERSION}.
|
|
13
|
+
`Wrangler requires at least Node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}.
|
|
14
14
|
You should use the latest Node.js version if possible, as Cloudflare Workers use a very up-to-date version of V8.
|
|
15
15
|
Consider using a Node.js version manager such as https://volta.sh/ or https://github.com/nvm-sh/nvm.`
|
|
16
16
|
);
|
|
@@ -24,7 +24,7 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
|
|
|
24
24
|
"--no-warnings",
|
|
25
25
|
"--experimental-vm-modules",
|
|
26
26
|
...process.execArgv,
|
|
27
|
-
join(__dirname, "../wrangler-dist/
|
|
27
|
+
join(__dirname, "../wrangler-dist/cli.js"),
|
|
28
28
|
...process.argv.slice(2),
|
|
29
29
|
],
|
|
30
30
|
{ stdio: "inherit" }
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-acbf420",
|
|
4
4
|
"author": "wrangler@cloudflare.com",
|
|
5
5
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
6
|
-
"bin":
|
|
6
|
+
"bin": {
|
|
7
|
+
"wrangler": "./bin/wrangler.js",
|
|
8
|
+
"wrangler2": "./bin/wrangler.js"
|
|
9
|
+
},
|
|
7
10
|
"license": "MIT OR Apache-2.0",
|
|
8
11
|
"bugs": {
|
|
9
12
|
"url": "https://github.com/cloudflare/wrangler/issues"
|
|
@@ -33,44 +36,43 @@
|
|
|
33
36
|
"cli"
|
|
34
37
|
],
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"@cloudflare/pages-functions-compiler": "
|
|
37
|
-
"esbuild": "0.
|
|
38
|
-
"miniflare": "2.0.0-rc.
|
|
39
|
-
"semiver": "^1.1.0"
|
|
40
|
-
"serve": "^13.0.2"
|
|
39
|
+
"@cloudflare/pages-functions-compiler": "0.3.8",
|
|
40
|
+
"esbuild": "0.14.1",
|
|
41
|
+
"miniflare": "2.0.0-rc.4",
|
|
42
|
+
"semiver": "^1.1.0"
|
|
41
43
|
},
|
|
42
44
|
"optionalDependencies": {
|
|
43
45
|
"fsevents": "~2.3.2"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@iarna/toml": "^2.2.5",
|
|
47
|
-
"@types/
|
|
48
|
-
"@types/express": "^4.17.13",
|
|
49
|
-
"@types/react": "^17.0.34",
|
|
49
|
+
"@types/react": "^17.0.37",
|
|
50
50
|
"@types/signal-exit": "^3.0.1",
|
|
51
|
-
"@types/ws": "^8.2.
|
|
52
|
-
"@types/yargs": "^17.0.
|
|
51
|
+
"@types/ws": "^8.2.1",
|
|
52
|
+
"@types/yargs": "^17.0.7",
|
|
53
|
+
"chokidar": "^3.5.2",
|
|
53
54
|
"clipboardy": "^3.0.0",
|
|
54
55
|
"command-exists": "^1.2.9",
|
|
55
|
-
"execa": "^
|
|
56
|
-
"express": "^4.17.1",
|
|
56
|
+
"execa": "^6.0.0",
|
|
57
57
|
"finalhandler": "^1.1.2",
|
|
58
58
|
"find-up": "^6.2.0",
|
|
59
59
|
"formdata-node": "^4.3.1",
|
|
60
60
|
"http-proxy": "^1.18.1",
|
|
61
|
-
"http-proxy-middleware": "^2.0.1",
|
|
62
61
|
"ink": "^3.2.0",
|
|
63
|
-
"ink-select-input": "^4.2.
|
|
62
|
+
"ink-select-input": "^4.2.1",
|
|
64
63
|
"ink-table": "^3.0.0",
|
|
65
|
-
"ink-text-input": "^4.0.
|
|
66
|
-
"node-fetch": "
|
|
64
|
+
"ink-text-input": "^4.0.2",
|
|
65
|
+
"node-fetch": "^3.1.0",
|
|
67
66
|
"open": "^8.4.0",
|
|
67
|
+
"path-to-regexp": "^6.2.0",
|
|
68
68
|
"react": "^17.0.2",
|
|
69
|
+
"react-error-boundary": "^3.1.4",
|
|
69
70
|
"serve-static": "^1.14.1",
|
|
70
|
-
"signal-exit": "^3.0.
|
|
71
|
+
"signal-exit": "^3.0.6",
|
|
71
72
|
"tmp-promise": "^3.0.3",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
73
|
+
"undici": "^4.11.1",
|
|
74
|
+
"ws": "^8.3.0",
|
|
75
|
+
"yargs": "^17.3.0"
|
|
74
76
|
},
|
|
75
77
|
"files": [
|
|
76
78
|
"src",
|
|
@@ -86,20 +88,25 @@
|
|
|
86
88
|
"bundle": "node -r esbuild-register scripts/bundle.ts",
|
|
87
89
|
"build": "npm run clean && npm run bundle",
|
|
88
90
|
"start": "npm run bundle && NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
|
|
89
|
-
"test": "
|
|
91
|
+
"test": "CF_API_TOKEN=some-api-token CF_ACCOUNT_ID=some-account-id jest --silent=false --verbose=true"
|
|
90
92
|
},
|
|
91
93
|
"engines": {
|
|
92
|
-
"node": ">=16.
|
|
94
|
+
"node": ">=16.7.0"
|
|
93
95
|
},
|
|
94
96
|
"jest": {
|
|
97
|
+
"restoreMocks": true,
|
|
98
|
+
"testRegex": ".*.(test|spec)\\.[jt]sx?$",
|
|
99
|
+
"transformIgnorePatterns": [
|
|
100
|
+
"node_modules/(?!node-fetch|fetch-blob|find-up|locate-path|p-locate|p-limit|yocto-queue|path-exists|data-uri-to-buffer|formdata-polyfill|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream)"
|
|
101
|
+
],
|
|
102
|
+
"moduleNameMapper": {
|
|
103
|
+
"clipboardy": "<rootDir>/src/__tests__/clipboardy-mock.js"
|
|
104
|
+
},
|
|
95
105
|
"transform": {
|
|
96
|
-
"^.+\\.
|
|
106
|
+
"^.+\\.c?(t|j)sx?$": [
|
|
97
107
|
"esbuild-jest",
|
|
98
108
|
{
|
|
99
|
-
"sourcemap": true
|
|
100
|
-
"loaders": {
|
|
101
|
-
".spec.ts": "tsx"
|
|
102
|
-
}
|
|
109
|
+
"sourcemap": true
|
|
103
110
|
}
|
|
104
111
|
]
|
|
105
112
|
}
|