wrangler 0.0.0-fa045c93 → 0.0.0-fa1b92f5
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/bin/wrangler.js +0 -28
- package/config-schema.json +150 -30
- package/package.json +43 -64
- package/templates/checked-fetch.js +1 -1
- package/templates/facade.d.ts +2 -2
- package/templates/gitignore +3 -0
- package/templates/middleware/loader-modules.ts +14 -13
- package/templates/pages-template-plugin.ts +2 -2
- package/templates/pages-template-worker.ts +1 -1
- package/templates/startDevWorker/InspectorProxyWorker.ts +4 -1
- package/templates/startDevWorker/ProxyWorker.ts +4 -1
- package/templates/tsconfig.init.json +1 -1
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/ProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +2920 -561
- package/wrangler-dist/cli.js +14870 -10926
- package/Cloudflare_CA.pem +0 -18
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) =>
|
package/config-schema.json
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"Text",
|
|
25
25
|
"Data",
|
|
26
26
|
"PythonModule",
|
|
27
|
-
"PythonRequirement"
|
|
27
|
+
"PythonRequirement",
|
|
28
|
+
"NodeJsCompatModule"
|
|
28
29
|
],
|
|
29
30
|
"type": "string"
|
|
30
31
|
},
|
|
@@ -478,6 +479,58 @@
|
|
|
478
479
|
"description": "The entrypoint/path to the JavaScript file that will be executed.",
|
|
479
480
|
"type": "string"
|
|
480
481
|
},
|
|
482
|
+
"migrations": {
|
|
483
|
+
"default": [],
|
|
484
|
+
"description": "A list of migrations that should be uploaded with your Worker.\n\nThese define changes in your Durable Object declarations.\n\nMore details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations",
|
|
485
|
+
"items": {
|
|
486
|
+
"additionalProperties": false,
|
|
487
|
+
"properties": {
|
|
488
|
+
"deleted_classes": {
|
|
489
|
+
"description": "The Durable Objects being removed.",
|
|
490
|
+
"items": {
|
|
491
|
+
"type": "string"
|
|
492
|
+
},
|
|
493
|
+
"type": "array"
|
|
494
|
+
},
|
|
495
|
+
"new_classes": {
|
|
496
|
+
"description": "The new Durable Objects being defined.",
|
|
497
|
+
"items": {
|
|
498
|
+
"type": "string"
|
|
499
|
+
},
|
|
500
|
+
"type": "array"
|
|
501
|
+
},
|
|
502
|
+
"renamed_classes": {
|
|
503
|
+
"description": "The Durable Objects being renamed.",
|
|
504
|
+
"items": {
|
|
505
|
+
"additionalProperties": false,
|
|
506
|
+
"properties": {
|
|
507
|
+
"from": {
|
|
508
|
+
"type": "string"
|
|
509
|
+
},
|
|
510
|
+
"to": {
|
|
511
|
+
"type": "string"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
"required": [
|
|
515
|
+
"from",
|
|
516
|
+
"to"
|
|
517
|
+
],
|
|
518
|
+
"type": "object"
|
|
519
|
+
},
|
|
520
|
+
"type": "array"
|
|
521
|
+
},
|
|
522
|
+
"tag": {
|
|
523
|
+
"description": "A unique identifier for this migration.",
|
|
524
|
+
"type": "string"
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
"required": [
|
|
528
|
+
"tag"
|
|
529
|
+
],
|
|
530
|
+
"type": "object"
|
|
531
|
+
},
|
|
532
|
+
"type": "array"
|
|
533
|
+
},
|
|
481
534
|
"minify": {
|
|
482
535
|
"description": "Minify the script before uploading.",
|
|
483
536
|
"type": "boolean"
|
|
@@ -919,6 +972,7 @@
|
|
|
919
972
|
"jsx_fragment",
|
|
920
973
|
"kv_namespaces",
|
|
921
974
|
"logfwdr",
|
|
975
|
+
"migrations",
|
|
922
976
|
"mtls_certificates",
|
|
923
977
|
"queues",
|
|
924
978
|
"r2_buckets",
|
|
@@ -980,6 +1034,13 @@
|
|
|
980
1034
|
],
|
|
981
1035
|
"type": "object"
|
|
982
1036
|
},
|
|
1037
|
+
"alias": {
|
|
1038
|
+
"additionalProperties": {
|
|
1039
|
+
"type": "string"
|
|
1040
|
+
},
|
|
1041
|
+
"description": "A map of module aliases. Lets you swap out a module for any others. Corresponds with esbuild's `alias` config",
|
|
1042
|
+
"type": "object"
|
|
1043
|
+
},
|
|
983
1044
|
"analytics_engine_datasets": {
|
|
984
1045
|
"default": "`[]`",
|
|
985
1046
|
"description": "Specifies analytics engine datasets that are bound to this Worker environment.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
|
@@ -1003,38 +1064,45 @@
|
|
|
1003
1064
|
"type": "array"
|
|
1004
1065
|
},
|
|
1005
1066
|
"assets": {
|
|
1006
|
-
"
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1067
|
+
"anyOf": [
|
|
1068
|
+
{
|
|
1069
|
+
"additionalProperties": false,
|
|
1070
|
+
"properties": {
|
|
1071
|
+
"browser_TTL": {
|
|
1072
|
+
"type": "number"
|
|
1073
|
+
},
|
|
1074
|
+
"bucket": {
|
|
1075
|
+
"type": "string"
|
|
1076
|
+
},
|
|
1077
|
+
"exclude": {
|
|
1078
|
+
"items": {
|
|
1079
|
+
"type": "string"
|
|
1080
|
+
},
|
|
1081
|
+
"type": "array"
|
|
1082
|
+
},
|
|
1083
|
+
"include": {
|
|
1084
|
+
"items": {
|
|
1085
|
+
"type": "string"
|
|
1086
|
+
},
|
|
1087
|
+
"type": "array"
|
|
1088
|
+
},
|
|
1089
|
+
"serve_single_page_app": {
|
|
1090
|
+
"type": "boolean"
|
|
1091
|
+
}
|
|
1024
1092
|
},
|
|
1025
|
-
"
|
|
1093
|
+
"required": [
|
|
1094
|
+
"bucket",
|
|
1095
|
+
"include",
|
|
1096
|
+
"exclude",
|
|
1097
|
+
"serve_single_page_app"
|
|
1098
|
+
],
|
|
1099
|
+
"type": "object"
|
|
1026
1100
|
},
|
|
1027
|
-
|
|
1028
|
-
"type": "
|
|
1101
|
+
{
|
|
1102
|
+
"type": "string"
|
|
1029
1103
|
}
|
|
1030
|
-
},
|
|
1031
|
-
"required": [
|
|
1032
|
-
"bucket",
|
|
1033
|
-
"include",
|
|
1034
|
-
"exclude",
|
|
1035
|
-
"serve_single_page_app"
|
|
1036
1104
|
],
|
|
1037
|
-
"
|
|
1105
|
+
"description": "Serve a folder of static assets with your Worker, without any additional code. This can either be a string, or an object with additional config fields."
|
|
1038
1106
|
},
|
|
1039
1107
|
"base_dir": {
|
|
1040
1108
|
"description": "The directory in which module rules should be evaluated when including additional files into a Worker deployment. This defaults to the directory containing the `main` entry point of the Worker if not specified.",
|
|
@@ -2389,6 +2457,58 @@
|
|
|
2389
2457
|
"description": "The entrypoint/path to the JavaScript file that will be executed.",
|
|
2390
2458
|
"type": "string"
|
|
2391
2459
|
},
|
|
2460
|
+
"migrations": {
|
|
2461
|
+
"default": [],
|
|
2462
|
+
"description": "A list of migrations that should be uploaded with your Worker.\n\nThese define changes in your Durable Object declarations.\n\nMore details at https://developers.cloudflare.com/workers/learning/using-durable-objects#configuring-durable-object-classes-with-migrations",
|
|
2463
|
+
"items": {
|
|
2464
|
+
"additionalProperties": false,
|
|
2465
|
+
"properties": {
|
|
2466
|
+
"deleted_classes": {
|
|
2467
|
+
"description": "The Durable Objects being removed.",
|
|
2468
|
+
"items": {
|
|
2469
|
+
"type": "string"
|
|
2470
|
+
},
|
|
2471
|
+
"type": "array"
|
|
2472
|
+
},
|
|
2473
|
+
"new_classes": {
|
|
2474
|
+
"description": "The new Durable Objects being defined.",
|
|
2475
|
+
"items": {
|
|
2476
|
+
"type": "string"
|
|
2477
|
+
},
|
|
2478
|
+
"type": "array"
|
|
2479
|
+
},
|
|
2480
|
+
"renamed_classes": {
|
|
2481
|
+
"description": "The Durable Objects being renamed.",
|
|
2482
|
+
"items": {
|
|
2483
|
+
"additionalProperties": false,
|
|
2484
|
+
"properties": {
|
|
2485
|
+
"from": {
|
|
2486
|
+
"type": "string"
|
|
2487
|
+
},
|
|
2488
|
+
"to": {
|
|
2489
|
+
"type": "string"
|
|
2490
|
+
}
|
|
2491
|
+
},
|
|
2492
|
+
"required": [
|
|
2493
|
+
"from",
|
|
2494
|
+
"to"
|
|
2495
|
+
],
|
|
2496
|
+
"type": "object"
|
|
2497
|
+
},
|
|
2498
|
+
"type": "array"
|
|
2499
|
+
},
|
|
2500
|
+
"tag": {
|
|
2501
|
+
"description": "A unique identifier for this migration.",
|
|
2502
|
+
"type": "string"
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
"required": [
|
|
2506
|
+
"tag"
|
|
2507
|
+
],
|
|
2508
|
+
"type": "object"
|
|
2509
|
+
},
|
|
2510
|
+
"type": "array"
|
|
2511
|
+
},
|
|
2392
2512
|
"minify": {
|
|
2393
2513
|
"description": "Minify the script before uploading.",
|
|
2394
2514
|
"type": "boolean"
|
|
@@ -2863,7 +2983,7 @@
|
|
|
2863
2983
|
"additionalProperties": false,
|
|
2864
2984
|
"properties": {
|
|
2865
2985
|
"environment": {
|
|
2866
|
-
"description": "(Optional) The
|
|
2986
|
+
"description": "(Optional) The environment of the service.",
|
|
2867
2987
|
"type": "string"
|
|
2868
2988
|
},
|
|
2869
2989
|
"service": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-fa1b92f5",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -47,97 +47,69 @@
|
|
|
47
47
|
"wrangler-dist",
|
|
48
48
|
"templates",
|
|
49
49
|
"kv-asset-handler.js",
|
|
50
|
-
"Cloudflare_CA.pem",
|
|
51
50
|
"config-schema.json"
|
|
52
51
|
],
|
|
53
|
-
"jest": {
|
|
54
|
-
"moduleNameMapper": {
|
|
55
|
-
"clipboardy": "<rootDir>/src/__tests__/helpers/clipboardy-mock.js",
|
|
56
|
-
"miniflare/cli": "<rootDir>/../../node_modules/miniflare/dist/src/cli.js"
|
|
57
|
-
},
|
|
58
|
-
"restoreMocks": true,
|
|
59
|
-
"setupFilesAfterEnv": [
|
|
60
|
-
"<rootDir>/src/__tests__/jest.setup.ts"
|
|
61
|
-
],
|
|
62
|
-
"testRegex": "src/__tests__/.*\\.(test|spec)\\.[jt]sx?$",
|
|
63
|
-
"testTimeout": 50000,
|
|
64
|
-
"transform": {
|
|
65
|
-
"^.+\\.c?(t|j)sx?$": [
|
|
66
|
-
"esbuild-jest",
|
|
67
|
-
{
|
|
68
|
-
"sourcemap": true
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
"transformIgnorePatterns": [
|
|
73
|
-
"node_modules/.pnpm/(?!find-up|locate-path|p-locate|p-limit|p-timeout|p-queue|yocto-queue|path-exists|execa|strip-final-newline|npm-run-path|path-key|onetime|mimic-fn|human-signals|is-stream|get-port|supports-color|pretty-bytes|strip-ansi|ansi-regex)"
|
|
74
|
-
],
|
|
75
|
-
"snapshotFormat": {
|
|
76
|
-
"escapeString": true,
|
|
77
|
-
"printBasicPrototype": true
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
52
|
"dependencies": {
|
|
81
53
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
82
54
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
83
55
|
"blake3-wasm": "^2.1.5",
|
|
84
56
|
"chokidar": "^3.5.3",
|
|
57
|
+
"date-fns": "^3.6.0",
|
|
85
58
|
"esbuild": "0.17.19",
|
|
86
59
|
"nanoid": "^3.3.3",
|
|
87
60
|
"path-to-regexp": "^6.2.0",
|
|
88
61
|
"resolve": "^1.22.8",
|
|
89
62
|
"resolve.exports": "^2.0.2",
|
|
90
63
|
"selfsigned": "^2.0.1",
|
|
91
|
-
"source-map": "0.6.1",
|
|
64
|
+
"source-map": "^0.6.1",
|
|
65
|
+
"unenv": "npm:unenv-nightly@1.10.0-1717606461.a117952",
|
|
92
66
|
"xxhash-wasm": "^1.0.1",
|
|
93
|
-
"
|
|
94
|
-
"
|
|
67
|
+
"miniflare": "3.20240701.0",
|
|
68
|
+
"@cloudflare/kv-asset-handler": "0.3.4"
|
|
95
69
|
},
|
|
96
70
|
"devDependencies": {
|
|
97
|
-
"@cloudflare/eslint-config-worker": "*",
|
|
98
71
|
"@cloudflare/types": "^6.18.4",
|
|
99
|
-
"@cloudflare/workers-types": "^4.
|
|
72
|
+
"@cloudflare/workers-types": "^4.20240620.0",
|
|
100
73
|
"@cspotcode/source-map-support": "0.8.1",
|
|
101
74
|
"@iarna/toml": "^3.0.0",
|
|
102
|
-
"@microsoft/api-extractor": "^7.
|
|
75
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
103
76
|
"@sentry/node": "^7.86.0",
|
|
104
77
|
"@sentry/types": "^7.86.0",
|
|
105
78
|
"@sentry/utils": "^7.86.0",
|
|
106
79
|
"@types/body-parser": "^1.19.2",
|
|
107
80
|
"@types/command-exists": "^1.2.0",
|
|
108
81
|
"@types/express": "^4.17.13",
|
|
109
|
-
"@types/glob-to-regexp": "0.4.1",
|
|
82
|
+
"@types/glob-to-regexp": "^0.4.1",
|
|
110
83
|
"@types/is-ci": "^3.0.0",
|
|
111
84
|
"@types/javascript-time-ago": "^2.0.3",
|
|
112
|
-
"@types/
|
|
113
|
-
"@types/mime": "^2.0.3",
|
|
85
|
+
"@types/mime": "^3.0.4",
|
|
114
86
|
"@types/minimatch": "^5.1.2",
|
|
115
87
|
"@types/prompts": "^2.0.14",
|
|
116
|
-
"@types/react": "^
|
|
88
|
+
"@types/react": "^18.2.21",
|
|
117
89
|
"@types/resolve": "^1.20.6",
|
|
118
90
|
"@types/serve-static": "^1.13.10",
|
|
119
91
|
"@types/shell-quote": "^1.7.2",
|
|
120
92
|
"@types/signal-exit": "^3.0.1",
|
|
121
93
|
"@types/supports-color": "^8.1.1",
|
|
122
|
-
"@types/ws": "^8.5.
|
|
123
|
-
"@types/yargs": "^17.0.
|
|
94
|
+
"@types/ws": "^8.5.7",
|
|
95
|
+
"@types/yargs": "^17.0.22",
|
|
96
|
+
"@vitest/ui": "^1.6.0",
|
|
124
97
|
"@webcontainer/env": "^1.1.0",
|
|
125
98
|
"body-parser": "^1.20.0",
|
|
126
|
-
"chalk": "^2.
|
|
99
|
+
"chalk": "^5.2.0",
|
|
127
100
|
"cli-table3": "^0.6.3",
|
|
128
101
|
"clipboardy": "^3.0.0",
|
|
129
102
|
"cmd-shim": "^4.1.0",
|
|
130
103
|
"command-exists": "^1.2.9",
|
|
131
|
-
"concurrently": "^
|
|
132
|
-
"devtools-protocol": "^0.0.
|
|
104
|
+
"concurrently": "^8.2.2",
|
|
105
|
+
"devtools-protocol": "^0.0.1182435",
|
|
133
106
|
"dotenv": "^16.0.0",
|
|
134
107
|
"es-module-lexer": "^1.3.0",
|
|
135
|
-
"esbuild-jest": "0.5.0",
|
|
136
108
|
"execa": "^6.1.0",
|
|
137
109
|
"express": "^4.18.1",
|
|
138
110
|
"find-up": "^6.3.0",
|
|
139
|
-
"get-port": "^
|
|
140
|
-
"glob-to-regexp": "0.4.1",
|
|
111
|
+
"get-port": "^7.0.0",
|
|
112
|
+
"glob-to-regexp": "^0.4.1",
|
|
141
113
|
"http-terminator": "^3.2.0",
|
|
142
114
|
"https-proxy-agent": "7.0.2",
|
|
143
115
|
"ignore": "^5.2.0",
|
|
@@ -147,53 +119,60 @@
|
|
|
147
119
|
"ink-table": "^3.0.0",
|
|
148
120
|
"is-ci": "^3.0.1",
|
|
149
121
|
"javascript-time-ago": "^2.5.4",
|
|
150
|
-
"
|
|
151
|
-
"jest-fetch-mock": "^3.0.3",
|
|
152
|
-
"jest-websocket-mock": "^2.5.0",
|
|
122
|
+
"md5-file": "5.0.0",
|
|
153
123
|
"mime": "^3.0.0",
|
|
154
124
|
"minimatch": "^5.1.0",
|
|
155
|
-
"
|
|
125
|
+
"mock-socket": "^9.3.1",
|
|
126
|
+
"msw": "^2.3.0",
|
|
156
127
|
"open": "^8.4.0",
|
|
157
128
|
"p-queue": "^7.2.0",
|
|
158
129
|
"patch-console": "^1.0.0",
|
|
159
130
|
"pretty-bytes": "^6.0.0",
|
|
160
131
|
"prompts": "^2.4.2",
|
|
161
|
-
"
|
|
132
|
+
"ps-list": "^8.1.1",
|
|
133
|
+
"react": "^18.2.0",
|
|
162
134
|
"react-error-boundary": "^3.1.4",
|
|
163
135
|
"semiver": "^1.1.0",
|
|
164
136
|
"serve-static": "^1.15.0",
|
|
165
137
|
"shell-quote": "^1.8.1",
|
|
166
138
|
"shellac": "^0.8.0",
|
|
167
139
|
"signal-exit": "^3.0.7",
|
|
168
|
-
"strip-ansi": "^7.0
|
|
140
|
+
"strip-ansi": "^7.1.0",
|
|
169
141
|
"supports-color": "^9.2.2",
|
|
170
142
|
"timeago.js": "^4.0.2",
|
|
143
|
+
"tree-kill": "^1.2.2",
|
|
171
144
|
"ts-dedent": "^2.2.0",
|
|
172
145
|
"ts-json-schema-generator": "^1.5.0",
|
|
173
|
-
"undici": "5.28.
|
|
146
|
+
"undici": "^5.28.4",
|
|
174
147
|
"update-check": "^1.5.4",
|
|
175
|
-
"
|
|
148
|
+
"vitest": "^1.6.0",
|
|
149
|
+
"vitest-websocket-mock": "^0.3.0",
|
|
150
|
+
"ws": "^8.17.1",
|
|
176
151
|
"xdg-app-paths": "^8.3.0",
|
|
177
152
|
"yargs": "^17.7.2",
|
|
178
153
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
|
179
|
-
"@cloudflare/pages-shared": "^0.11.34",
|
|
180
154
|
"@cloudflare/cli": "1.1.1",
|
|
155
|
+
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
156
|
+
"@cloudflare/pages-shared": "^0.11.46",
|
|
181
157
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
182
158
|
},
|
|
183
|
-
"optionalDependencies": {
|
|
184
|
-
"fsevents": "~2.3.2"
|
|
185
|
-
},
|
|
186
159
|
"peerDependencies": {
|
|
187
|
-
"@cloudflare/workers-types": "^4.
|
|
160
|
+
"@cloudflare/workers-types": "^4.20240620.0"
|
|
188
161
|
},
|
|
189
162
|
"peerDependenciesMeta": {
|
|
190
163
|
"@cloudflare/workers-types": {
|
|
191
164
|
"optional": true
|
|
192
165
|
}
|
|
193
166
|
},
|
|
167
|
+
"optionalDependencies": {
|
|
168
|
+
"fsevents": "~2.3.2"
|
|
169
|
+
},
|
|
194
170
|
"engines": {
|
|
195
171
|
"node": ">=16.17.0"
|
|
196
172
|
},
|
|
173
|
+
"volta": {
|
|
174
|
+
"extends": "../../package.json"
|
|
175
|
+
},
|
|
197
176
|
"workers-sdk": {
|
|
198
177
|
"prerelease": true
|
|
199
178
|
},
|
|
@@ -201,17 +180,17 @@
|
|
|
201
180
|
"assert-git-version": "node -r esbuild-register scripts/assert-git-version.ts",
|
|
202
181
|
"build": "pnpm run clean && pnpm run bundle && pnpm run emit-types && pnpm run generate-json-schema",
|
|
203
182
|
"bundle": "node -r esbuild-register scripts/bundle.ts",
|
|
204
|
-
"check:lint": "eslint .",
|
|
183
|
+
"check:lint": "eslint . --max-warnings=0",
|
|
205
184
|
"check:type": "tsc",
|
|
206
185
|
"clean": "rimraf wrangler-dist miniflare-dist emitted-types",
|
|
207
186
|
"dev": "pnpm run clean && concurrently -c black,blue --kill-others-on-fail false \"pnpm run bundle --watch\" \"pnpm run check:type --watch --preserveWatchOutput\"",
|
|
208
187
|
"emit-types": "tsc -p tsconfig.emit.json && node -r esbuild-register scripts/emit-types.ts",
|
|
209
188
|
"generate-json-schema": "pnpm exec ts-json-schema-generator --no-type-check --path src/config/config.ts --type RawConfig --out config-schema.json",
|
|
210
189
|
"start": "pnpm run bundle && cross-env NODE_OPTIONS=--enable-source-maps ./bin/wrangler.js",
|
|
211
|
-
"test": "pnpm run assert-git-version &&
|
|
212
|
-
"test:ci": "pnpm run test",
|
|
190
|
+
"test": "pnpm run assert-git-version && vitest",
|
|
191
|
+
"test:ci": "pnpm run test run",
|
|
213
192
|
"test:debug": "pnpm run test --silent=false --verbose=true",
|
|
214
|
-
"test:e2e": "vitest -c ./e2e/vitest.config.
|
|
193
|
+
"test:e2e": "vitest -c ./e2e/vitest.config.mts",
|
|
215
194
|
"test:watch": "pnpm run test --testTimeout=50000 --watch",
|
|
216
195
|
"type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"
|
|
217
196
|
}
|
package/templates/facade.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ declare module "__ENTRY_POINT__" {
|
|
|
3
3
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
4
4
|
|
|
5
5
|
export type WorkerEntrypointConstructor = typeof WorkerEntrypoint;
|
|
6
|
-
export type WithMiddleware<T> = T & { middleware?: Middleware[] };
|
|
7
6
|
|
|
8
|
-
const worker:
|
|
7
|
+
const worker: ExportedHandler | WorkerEntrypointConstructor;
|
|
9
8
|
export default worker;
|
|
9
|
+
export const __INTERNAL_WRANGLER_MIDDLEWARE__: Middleware[];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
declare module "__KV_ASSET_HANDLER__" {
|
package/templates/gitignore
CHANGED
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
// export dynamically through wrangler, or we can potentially let users directly
|
|
4
4
|
// add them as a sort of "plugin" system.
|
|
5
5
|
|
|
6
|
-
import ENTRY from "__ENTRY_POINT__";
|
|
6
|
+
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "__ENTRY_POINT__";
|
|
7
7
|
import { __facade_invoke__, __facade_register__, Dispatcher } from "./common";
|
|
8
|
-
import type {
|
|
9
|
-
WithMiddleware,
|
|
10
|
-
WorkerEntrypointConstructor,
|
|
11
|
-
} from "__ENTRY_POINT__";
|
|
8
|
+
import type { WorkerEntrypointConstructor } from "__ENTRY_POINT__";
|
|
12
9
|
|
|
13
10
|
// Preserve all the exports from the worker
|
|
14
11
|
export * from "__ENTRY_POINT__";
|
|
@@ -33,15 +30,16 @@ class __Facade_ScheduledController__ implements ScheduledController {
|
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
|
|
36
|
-
function wrapExportedHandler(
|
|
37
|
-
worker: WithMiddleware<ExportedHandler>
|
|
38
|
-
): ExportedHandler {
|
|
33
|
+
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
|
39
34
|
// If we don't have any middleware defined, just return the handler as is
|
|
40
|
-
if (
|
|
35
|
+
if (
|
|
36
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
|
37
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
|
38
|
+
) {
|
|
41
39
|
return worker;
|
|
42
40
|
}
|
|
43
41
|
// Otherwise, register all middleware once
|
|
44
|
-
for (const middleware of
|
|
42
|
+
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
|
45
43
|
__facade_register__(middleware);
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -75,14 +73,17 @@ function wrapExportedHandler(
|
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
function wrapWorkerEntrypoint(
|
|
78
|
-
klass:
|
|
76
|
+
klass: WorkerEntrypointConstructor
|
|
79
77
|
): WorkerEntrypointConstructor {
|
|
80
78
|
// If we don't have any middleware defined, just return the handler as is
|
|
81
|
-
if (
|
|
79
|
+
if (
|
|
80
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
|
81
|
+
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
|
82
|
+
) {
|
|
82
83
|
return klass;
|
|
83
84
|
}
|
|
84
85
|
// Otherwise, register all middleware once
|
|
85
|
-
for (const middleware of
|
|
86
|
+
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
|
86
87
|
__facade_register__(middleware);
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -41,14 +41,14 @@ type EventPluginContext<Env, P extends string, Data, PluginArgs> = {
|
|
|
41
41
|
declare type PagesFunction<
|
|
42
42
|
Env = unknown,
|
|
43
43
|
P extends string = string,
|
|
44
|
-
Data extends Record<string, unknown> = Record<string, unknown
|
|
44
|
+
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
45
45
|
> = (context: EventContext<Env, P, Data>) => Response | Promise<Response>;
|
|
46
46
|
|
|
47
47
|
declare type PagesPluginFunction<
|
|
48
48
|
Env = unknown,
|
|
49
49
|
P extends string = string,
|
|
50
50
|
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
51
|
-
PluginArgs = unknown
|
|
51
|
+
PluginArgs = unknown,
|
|
52
52
|
> = (
|
|
53
53
|
context: EventPluginContext<Env, P, Data, PluginArgs>
|
|
54
54
|
) => Response | Promise<Response>;
|
|
@@ -29,7 +29,7 @@ type EventContext<Env, P extends string, Data> = {
|
|
|
29
29
|
declare type PagesFunction<
|
|
30
30
|
Env = unknown,
|
|
31
31
|
P extends string = string,
|
|
32
|
-
Data extends Record<string, unknown> = Record<string, unknown
|
|
32
|
+
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
33
33
|
> = (context: EventContext<Env, P, Data>) => Response | Promise<Response>;
|
|
34
34
|
/* end @cloudflare/workers-types */
|
|
35
35
|
|
|
@@ -60,7 +60,10 @@ function isDevToolsEvent<Method extends DevToolsEvents["method"]>(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export class InspectorProxyWorker implements DurableObject {
|
|
63
|
-
constructor(
|
|
63
|
+
constructor(
|
|
64
|
+
_state: DurableObjectState,
|
|
65
|
+
readonly env: Env
|
|
66
|
+
) {}
|
|
64
67
|
|
|
65
68
|
websockets: {
|
|
66
69
|
proxyController?: WebSocket;
|
|
@@ -33,7 +33,10 @@ export default {
|
|
|
33
33
|
} as ExportedHandler<Env, unknown, ProxyWorkerIncomingRequestBody>;
|
|
34
34
|
|
|
35
35
|
export class ProxyWorker implements DurableObject {
|
|
36
|
-
constructor(
|
|
36
|
+
constructor(
|
|
37
|
+
readonly state: DurableObjectState,
|
|
38
|
+
readonly env: Env
|
|
39
|
+
) {}
|
|
37
40
|
|
|
38
41
|
proxyData?: ProxyData;
|
|
39
42
|
requestQueue = new Map<Request, DeferredPromise<Response>>();
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"lib": [
|
|
16
16
|
"es2021"
|
|
17
17
|
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
|
18
|
-
"jsx": "react" /* Specify what JSX code is generated. */,
|
|
18
|
+
"jsx": "react-jsx" /* Specify what JSX code is generated. */,
|
|
19
19
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
20
20
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
21
21
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|