wrangler 0.0.0-ebc85c36 → 0.0.0-ebf9dcde1
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/config-schema.json +94 -71
- package/package.json +11 -11
- package/templates/no-op-assets-worker.ts +33 -0
- package/templates/startDevWorker/ProxyWorker.ts +26 -24
- package/wrangler-dist/ProxyWorker.js +25 -24
- package/wrangler-dist/ProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +60 -26
- package/wrangler-dist/cli.js +36890 -34566
package/config-schema.json
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"description": "Configuration in wrangler for Cloudchamber",
|
|
8
8
|
"properties": {
|
|
9
|
+
"image": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"ipv4": {
|
|
13
|
+
"type": "boolean"
|
|
14
|
+
},
|
|
15
|
+
"location": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
9
18
|
"memory": {
|
|
10
19
|
"type": "string"
|
|
11
20
|
},
|
|
@@ -247,29 +256,6 @@
|
|
|
247
256
|
},
|
|
248
257
|
"type": "array"
|
|
249
258
|
},
|
|
250
|
-
"constellation": {
|
|
251
|
-
"default": "`[]`",
|
|
252
|
-
"description": "Specifies Constellation projects 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.",
|
|
253
|
-
"items": {
|
|
254
|
-
"additionalProperties": false,
|
|
255
|
-
"properties": {
|
|
256
|
-
"binding": {
|
|
257
|
-
"description": "The binding name used to refer to the project in the Worker.",
|
|
258
|
-
"type": "string"
|
|
259
|
-
},
|
|
260
|
-
"project_id": {
|
|
261
|
-
"description": "The id of the project.",
|
|
262
|
-
"type": "string"
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
"required": [
|
|
266
|
-
"binding",
|
|
267
|
-
"project_id"
|
|
268
|
-
],
|
|
269
|
-
"type": "object"
|
|
270
|
-
},
|
|
271
|
-
"type": "array"
|
|
272
|
-
},
|
|
273
259
|
"d1_databases": {
|
|
274
260
|
"default": "`[]`",
|
|
275
261
|
"description": "Specifies D1 databases 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.",
|
|
@@ -363,6 +349,10 @@
|
|
|
363
349
|
],
|
|
364
350
|
"type": "object"
|
|
365
351
|
},
|
|
352
|
+
"experimental_assets": {
|
|
353
|
+
"$ref": "#/definitions/ExperimentalAssets",
|
|
354
|
+
"description": "Specify the directory of static assets to deploy/serve"
|
|
355
|
+
},
|
|
366
356
|
"find_additional_modules": {
|
|
367
357
|
"description": "If true then Wrangler will traverse the file tree below `base_dir`; Any files that match `rules` will be included in the deployed Worker. Defaults to true if `no_bundle` is true, otherwise false.",
|
|
368
358
|
"type": "boolean"
|
|
@@ -952,6 +942,14 @@
|
|
|
952
942
|
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined",
|
|
953
943
|
"type": "boolean"
|
|
954
944
|
},
|
|
945
|
+
"workflows": {
|
|
946
|
+
"default": "`[]`",
|
|
947
|
+
"description": "A list of workflows that your Worker should be bound to.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
|
948
|
+
"items": {
|
|
949
|
+
"$ref": "#/definitions/WorkflowBinding"
|
|
950
|
+
},
|
|
951
|
+
"type": "array"
|
|
952
|
+
},
|
|
955
953
|
"zone_id": {
|
|
956
954
|
"description": "TODO: remove this as it has been deprecated.\n\nThis is just here for now because the `route` commands use it. So we need to include it in this type so it is available.",
|
|
957
955
|
"type": "string"
|
|
@@ -962,7 +960,6 @@
|
|
|
962
960
|
"build",
|
|
963
961
|
"cloudchamber",
|
|
964
962
|
"compatibility_flags",
|
|
965
|
-
"constellation",
|
|
966
963
|
"d1_databases",
|
|
967
964
|
"define",
|
|
968
965
|
"dispatch_namespaces",
|
|
@@ -981,7 +978,24 @@
|
|
|
981
978
|
"triggers",
|
|
982
979
|
"unsafe",
|
|
983
980
|
"vars",
|
|
984
|
-
"vectorize"
|
|
981
|
+
"vectorize",
|
|
982
|
+
"workflows"
|
|
983
|
+
],
|
|
984
|
+
"type": "object"
|
|
985
|
+
},
|
|
986
|
+
"ExperimentalAssets": {
|
|
987
|
+
"additionalProperties": false,
|
|
988
|
+
"properties": {
|
|
989
|
+
"binding": {
|
|
990
|
+
"type": "string"
|
|
991
|
+
},
|
|
992
|
+
"directory": {
|
|
993
|
+
"description": "Absolute path to assets directory",
|
|
994
|
+
"type": "string"
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
"required": [
|
|
998
|
+
"directory"
|
|
985
999
|
],
|
|
986
1000
|
"type": "object"
|
|
987
1001
|
},
|
|
@@ -1179,29 +1193,6 @@
|
|
|
1179
1193
|
"configPath": {
|
|
1180
1194
|
"type": "string"
|
|
1181
1195
|
},
|
|
1182
|
-
"constellation": {
|
|
1183
|
-
"default": "`[]`",
|
|
1184
|
-
"description": "Specifies Constellation projects 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.",
|
|
1185
|
-
"items": {
|
|
1186
|
-
"additionalProperties": false,
|
|
1187
|
-
"properties": {
|
|
1188
|
-
"binding": {
|
|
1189
|
-
"description": "The binding name used to refer to the project in the Worker.",
|
|
1190
|
-
"type": "string"
|
|
1191
|
-
},
|
|
1192
|
-
"project_id": {
|
|
1193
|
-
"description": "The id of the project.",
|
|
1194
|
-
"type": "string"
|
|
1195
|
-
}
|
|
1196
|
-
},
|
|
1197
|
-
"required": [
|
|
1198
|
-
"binding",
|
|
1199
|
-
"project_id"
|
|
1200
|
-
],
|
|
1201
|
-
"type": "object"
|
|
1202
|
-
},
|
|
1203
|
-
"type": "array"
|
|
1204
|
-
},
|
|
1205
1196
|
"d1_databases": {
|
|
1206
1197
|
"default": "`[]`",
|
|
1207
1198
|
"description": "Specifies D1 databases 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.",
|
|
@@ -1314,6 +1305,10 @@
|
|
|
1314
1305
|
"description": "The `env` section defines overrides for the configuration for different environments.\n\nAll environment fields can be specified at the top level of the config indicating the default environment settings.\n\n- Some fields are inherited and overridable in each environment.\n- But some are not inherited and must be explicitly specified in every environment, if they are specified at the top level.\n\nFor more information, see the documentation at https://developers.cloudflare.com/workers/cli-wrangler/configuration#environments",
|
|
1315
1306
|
"type": "object"
|
|
1316
1307
|
},
|
|
1308
|
+
"experimental_assets": {
|
|
1309
|
+
"$ref": "#/definitions/ExperimentalAssets",
|
|
1310
|
+
"description": "Specify the directory of static assets to deploy/serve"
|
|
1311
|
+
},
|
|
1317
1312
|
"experimental_services": {
|
|
1318
1313
|
"default": "`[]`",
|
|
1319
1314
|
"deprecated": "DO NOT USE. We'd added this to test the new service binding system, but the proper way to test experimental features is to use `unsafe.bindings` configuration.",
|
|
@@ -2063,6 +2058,14 @@
|
|
|
2063
2058
|
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined",
|
|
2064
2059
|
"type": "boolean"
|
|
2065
2060
|
},
|
|
2061
|
+
"workflows": {
|
|
2062
|
+
"default": "`[]`",
|
|
2063
|
+
"description": "A list of workflows that your Worker should be bound to.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
|
2064
|
+
"items": {
|
|
2065
|
+
"$ref": "#/definitions/WorkflowBinding"
|
|
2066
|
+
},
|
|
2067
|
+
"type": "array"
|
|
2068
|
+
},
|
|
2066
2069
|
"zone_id": {
|
|
2067
2070
|
"description": "TODO: remove this as it has been deprecated.\n\nThis is just here for now because the `route` commands use it. So we need to include it in this type so it is available.",
|
|
2068
2071
|
"type": "string"
|
|
@@ -2232,29 +2235,6 @@
|
|
|
2232
2235
|
},
|
|
2233
2236
|
"type": "array"
|
|
2234
2237
|
},
|
|
2235
|
-
"constellation": {
|
|
2236
|
-
"default": "`[]`",
|
|
2237
|
-
"description": "Specifies Constellation projects 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.",
|
|
2238
|
-
"items": {
|
|
2239
|
-
"additionalProperties": false,
|
|
2240
|
-
"properties": {
|
|
2241
|
-
"binding": {
|
|
2242
|
-
"description": "The binding name used to refer to the project in the Worker.",
|
|
2243
|
-
"type": "string"
|
|
2244
|
-
},
|
|
2245
|
-
"project_id": {
|
|
2246
|
-
"description": "The id of the project.",
|
|
2247
|
-
"type": "string"
|
|
2248
|
-
}
|
|
2249
|
-
},
|
|
2250
|
-
"required": [
|
|
2251
|
-
"binding",
|
|
2252
|
-
"project_id"
|
|
2253
|
-
],
|
|
2254
|
-
"type": "object"
|
|
2255
|
-
},
|
|
2256
|
-
"type": "array"
|
|
2257
|
-
},
|
|
2258
2238
|
"d1_databases": {
|
|
2259
2239
|
"default": "`[]`",
|
|
2260
2240
|
"description": "Specifies D1 databases 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.",
|
|
@@ -2348,6 +2328,10 @@
|
|
|
2348
2328
|
],
|
|
2349
2329
|
"type": "object"
|
|
2350
2330
|
},
|
|
2331
|
+
"experimental_assets": {
|
|
2332
|
+
"$ref": "#/definitions/ExperimentalAssets",
|
|
2333
|
+
"description": "Specify the directory of static assets to deploy/serve"
|
|
2334
|
+
},
|
|
2351
2335
|
"experimental_services": {
|
|
2352
2336
|
"default": "`[]`",
|
|
2353
2337
|
"deprecated": "DO NOT USE. We'd added this to test the new service binding system, but the proper way to test experimental features is to use `unsafe.bindings` configuration.",
|
|
@@ -2971,6 +2955,14 @@
|
|
|
2971
2955
|
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined",
|
|
2972
2956
|
"type": "boolean"
|
|
2973
2957
|
},
|
|
2958
|
+
"workflows": {
|
|
2959
|
+
"default": "`[]`",
|
|
2960
|
+
"description": "A list of workflows that your Worker should be bound to.\n\nNOTE: This field is not automatically inherited from the top level environment, and so must be specified in every named environment.",
|
|
2961
|
+
"items": {
|
|
2962
|
+
"$ref": "#/definitions/WorkflowBinding"
|
|
2963
|
+
},
|
|
2964
|
+
"type": "array"
|
|
2965
|
+
},
|
|
2974
2966
|
"zone_id": {
|
|
2975
2967
|
"description": "TODO: remove this as it has been deprecated.\n\nThis is just here for now because the `route` commands use it. So we need to include it in this type so it is available.",
|
|
2976
2968
|
"type": "string"
|
|
@@ -3058,6 +3050,37 @@
|
|
|
3058
3050
|
],
|
|
3059
3051
|
"type": "object"
|
|
3060
3052
|
},
|
|
3053
|
+
"WorkflowBinding": {
|
|
3054
|
+
"additionalProperties": false,
|
|
3055
|
+
"properties": {
|
|
3056
|
+
"binding": {
|
|
3057
|
+
"description": "The name of the binding used to refer to the Workflow",
|
|
3058
|
+
"type": "string"
|
|
3059
|
+
},
|
|
3060
|
+
"class_name": {
|
|
3061
|
+
"description": "The exported class name of the Workflow",
|
|
3062
|
+
"type": "string"
|
|
3063
|
+
},
|
|
3064
|
+
"environment": {
|
|
3065
|
+
"description": "The service environment of the script_name to bind to",
|
|
3066
|
+
"type": "string"
|
|
3067
|
+
},
|
|
3068
|
+
"name": {
|
|
3069
|
+
"description": "The name of the Workflow",
|
|
3070
|
+
"type": "string"
|
|
3071
|
+
},
|
|
3072
|
+
"script_name": {
|
|
3073
|
+
"description": "The script where the Workflow is defined (if it's external to this Worker)",
|
|
3074
|
+
"type": "string"
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
"required": [
|
|
3078
|
+
"binding",
|
|
3079
|
+
"name",
|
|
3080
|
+
"class_name"
|
|
3081
|
+
],
|
|
3082
|
+
"type": "object"
|
|
3083
|
+
},
|
|
3061
3084
|
"ZoneIdRoute": {
|
|
3062
3085
|
"additionalProperties": false,
|
|
3063
3086
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-ebf9dcde1",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -63,14 +63,15 @@
|
|
|
63
63
|
"selfsigned": "^2.0.1",
|
|
64
64
|
"source-map": "^0.6.1",
|
|
65
65
|
"unenv": "npm:unenv-nightly@1.10.0-1717606461.a117952",
|
|
66
|
-
"workerd": "1.
|
|
66
|
+
"workerd": "1.20240821.1",
|
|
67
67
|
"xxhash-wasm": "^1.0.1",
|
|
68
|
-
"@cloudflare/
|
|
69
|
-
"miniflare": "3.
|
|
68
|
+
"@cloudflare/workers-shared": "0.4.0",
|
|
69
|
+
"miniflare": "3.20240821.0",
|
|
70
|
+
"@cloudflare/kv-asset-handler": "0.3.4"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@cloudflare/types": "^6.18.4",
|
|
73
|
-
"@cloudflare/workers-types": "^4.
|
|
74
|
+
"@cloudflare/workers-types": "^4.20240821.1",
|
|
74
75
|
"@cspotcode/source-map-support": "0.8.1",
|
|
75
76
|
"@iarna/toml": "^3.0.0",
|
|
76
77
|
"@microsoft/api-extractor": "^7.47.0",
|
|
@@ -86,7 +87,7 @@
|
|
|
86
87
|
"@types/mime": "^3.0.4",
|
|
87
88
|
"@types/minimatch": "^5.1.2",
|
|
88
89
|
"@types/prompts": "^2.0.14",
|
|
89
|
-
"@types/react": "^18.
|
|
90
|
+
"@types/react": "^18.3.3",
|
|
90
91
|
"@types/resolve": "^1.20.6",
|
|
91
92
|
"@types/serve-static": "^1.13.10",
|
|
92
93
|
"@types/shell-quote": "^1.7.2",
|
|
@@ -131,7 +132,7 @@
|
|
|
131
132
|
"pretty-bytes": "^6.0.0",
|
|
132
133
|
"prompts": "^2.4.2",
|
|
133
134
|
"ps-list": "^8.1.1",
|
|
134
|
-
"react": "^18.
|
|
135
|
+
"react": "^18.3.1",
|
|
135
136
|
"react-error-boundary": "^3.1.4",
|
|
136
137
|
"semiver": "^1.1.0",
|
|
137
138
|
"serve-static": "^1.15.0",
|
|
@@ -141,7 +142,6 @@
|
|
|
141
142
|
"strip-ansi": "^7.1.0",
|
|
142
143
|
"supports-color": "^9.2.2",
|
|
143
144
|
"timeago.js": "^4.0.2",
|
|
144
|
-
"tree-kill": "^1.2.2",
|
|
145
145
|
"ts-dedent": "^2.2.0",
|
|
146
146
|
"ts-json-schema-generator": "^1.5.0",
|
|
147
147
|
"undici": "^5.28.4",
|
|
@@ -152,13 +152,13 @@
|
|
|
152
152
|
"xdg-app-paths": "^8.3.0",
|
|
153
153
|
"yargs": "^17.7.2",
|
|
154
154
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
|
155
|
-
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
156
|
-
"@cloudflare/pages-shared": "^0.11.48",
|
|
157
155
|
"@cloudflare/cli": "1.1.1",
|
|
156
|
+
"@cloudflare/pages-shared": "^0.11.53",
|
|
157
|
+
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
158
158
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
159
159
|
},
|
|
160
160
|
"peerDependencies": {
|
|
161
|
-
"@cloudflare/workers-types": "^4.
|
|
161
|
+
"@cloudflare/workers-types": "^4.20240821.1"
|
|
162
162
|
},
|
|
163
163
|
"peerDependenciesMeta": {
|
|
164
164
|
"@cloudflare/workers-types": {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Worker is used as a default entry-point for Assets-only
|
|
3
|
+
* Workers. It proxies the request directly on to the Asset Sever
|
|
4
|
+
* Worker service binding.
|
|
5
|
+
*
|
|
6
|
+
* In an Assets-only Workers world, we want to enable users
|
|
7
|
+
* to deploy a Worker with Assets without ever having to provide
|
|
8
|
+
* a User Worker.
|
|
9
|
+
*
|
|
10
|
+
* ```bash
|
|
11
|
+
* wrangler dev --experimental-assets dist
|
|
12
|
+
* wrangler deploy --experimental-assets dist
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* ```toml
|
|
16
|
+
* name = "assets-only-worker"
|
|
17
|
+
* compatibility_date = "2024-01-01"
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Without a user-defined Worker, which usually serves as the entry
|
|
21
|
+
* point in the bundling process, wrangler needs to default to some
|
|
22
|
+
* other entry-point Worker for all intents and purposes. This is what
|
|
23
|
+
* this Worker is.
|
|
24
|
+
*/
|
|
25
|
+
type Env = {
|
|
26
|
+
ASSET_WORKER: Fetcher;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
async fetch(request: Request, env: Env) {
|
|
31
|
+
return env.ASSET_WORKER.fetch(request);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -124,8 +124,10 @@ export class ProxyWorker implements DurableObject {
|
|
|
124
124
|
Object.assign(userWorkerUrl, proxyData.userWorkerUrl);
|
|
125
125
|
|
|
126
126
|
// set request.url in the UserWorker
|
|
127
|
-
const innerUrl =
|
|
128
|
-
|
|
127
|
+
const innerUrl = urlFromParts(
|
|
128
|
+
proxyData.userWorkerInnerUrlOverrides ?? {},
|
|
129
|
+
request.url
|
|
130
|
+
);
|
|
129
131
|
headers.set("MF-Original-URL", innerUrl.href);
|
|
130
132
|
headers.set("MF-Disable-Pretty-Error", "true"); // disables the UserWorker miniflare instance from rendering the pretty error -- instead the ProxyWorker miniflare instance will intercept the json error response and render the pretty error page
|
|
131
133
|
|
|
@@ -276,28 +278,7 @@ function insertLiveReloadScript(
|
|
|
276
278
|
websocketUrl.protocol =
|
|
277
279
|
websocketUrl.protocol === "http:" ? "ws:" : "wss:";
|
|
278
280
|
|
|
279
|
-
end.append(
|
|
280
|
-
`
|
|
281
|
-
<script>
|
|
282
|
-
(function() {
|
|
283
|
-
var ws;
|
|
284
|
-
function recover() {
|
|
285
|
-
ws = null;
|
|
286
|
-
setTimeout(initLiveReload, 100);
|
|
287
|
-
}
|
|
288
|
-
function initLiveReload() {
|
|
289
|
-
if (ws) return;
|
|
290
|
-
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
|
|
291
|
-
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
|
|
292
|
-
ws.onclose = recover;
|
|
293
|
-
ws.onerror = recover;
|
|
294
|
-
ws.onmessage = location.reload.bind(location);
|
|
295
|
-
}
|
|
296
|
-
})();
|
|
297
|
-
</script>
|
|
298
|
-
`,
|
|
299
|
-
{ html: true }
|
|
300
|
-
);
|
|
281
|
+
end.append(liveReloadScript, { html: true });
|
|
301
282
|
}
|
|
302
283
|
},
|
|
303
284
|
});
|
|
@@ -305,6 +286,27 @@ function insertLiveReloadScript(
|
|
|
305
286
|
return htmlRewriter.transform(response);
|
|
306
287
|
}
|
|
307
288
|
|
|
289
|
+
const liveReloadScript = `
|
|
290
|
+
<script defer type="application/javascript">
|
|
291
|
+
(function() {
|
|
292
|
+
var ws;
|
|
293
|
+
function recover() {
|
|
294
|
+
ws = null;
|
|
295
|
+
setTimeout(initLiveReload, 100);
|
|
296
|
+
}
|
|
297
|
+
function initLiveReload() {
|
|
298
|
+
if (ws) return;
|
|
299
|
+
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
|
|
300
|
+
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
|
|
301
|
+
ws.onclose = recover;
|
|
302
|
+
ws.onerror = recover;
|
|
303
|
+
ws.onmessage = location.reload.bind(location);
|
|
304
|
+
}
|
|
305
|
+
initLiveReload();
|
|
306
|
+
})();
|
|
307
|
+
</script>
|
|
308
|
+
`;
|
|
309
|
+
|
|
308
310
|
/**
|
|
309
311
|
* Rewrite references to URLs in request/response headers.
|
|
310
312
|
*
|
|
@@ -94,8 +94,10 @@ var ProxyWorker = class {
|
|
|
94
94
|
const headers = new Headers(request.headers);
|
|
95
95
|
const userWorkerUrl = new URL(request.url);
|
|
96
96
|
Object.assign(userWorkerUrl, proxyData.userWorkerUrl);
|
|
97
|
-
const innerUrl =
|
|
98
|
-
|
|
97
|
+
const innerUrl = urlFromParts(
|
|
98
|
+
proxyData.userWorkerInnerUrlOverrides ?? {},
|
|
99
|
+
request.url
|
|
100
|
+
);
|
|
99
101
|
headers.set("MF-Original-URL", innerUrl.href);
|
|
100
102
|
headers.set("MF-Disable-Pretty-Error", "true");
|
|
101
103
|
const encoding = request.cf?.clientAcceptEncoding;
|
|
@@ -185,33 +187,32 @@ function insertLiveReloadScript(request, response, env, proxyData) {
|
|
|
185
187
|
if (proxyData.liveReload) {
|
|
186
188
|
const websocketUrl = new URL(request.url);
|
|
187
189
|
websocketUrl.protocol = websocketUrl.protocol === "http:" ? "ws:" : "wss:";
|
|
188
|
-
end.append(
|
|
189
|
-
`
|
|
190
|
-
<script>
|
|
191
|
-
(function() {
|
|
192
|
-
var ws;
|
|
193
|
-
function recover() {
|
|
194
|
-
ws = null;
|
|
195
|
-
setTimeout(initLiveReload, 100);
|
|
196
|
-
}
|
|
197
|
-
function initLiveReload() {
|
|
198
|
-
if (ws) return;
|
|
199
|
-
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
|
|
200
|
-
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
|
|
201
|
-
ws.onclose = recover;
|
|
202
|
-
ws.onerror = recover;
|
|
203
|
-
ws.onmessage = location.reload.bind(location);
|
|
204
|
-
}
|
|
205
|
-
})();
|
|
206
|
-
</script>
|
|
207
|
-
`,
|
|
208
|
-
{ html: true }
|
|
209
|
-
);
|
|
190
|
+
end.append(liveReloadScript, { html: true });
|
|
210
191
|
}
|
|
211
192
|
}
|
|
212
193
|
});
|
|
213
194
|
return htmlRewriter.transform(response);
|
|
214
195
|
}
|
|
196
|
+
var liveReloadScript = `
|
|
197
|
+
<script defer type="application/javascript">
|
|
198
|
+
(function() {
|
|
199
|
+
var ws;
|
|
200
|
+
function recover() {
|
|
201
|
+
ws = null;
|
|
202
|
+
setTimeout(initLiveReload, 100);
|
|
203
|
+
}
|
|
204
|
+
function initLiveReload() {
|
|
205
|
+
if (ws) return;
|
|
206
|
+
var origin = (location.protocol === "http:" ? "ws://" : "wss://") + location.host;
|
|
207
|
+
ws = new WebSocket(origin + "/cdn-cgi/live-reload", "${LIVE_RELOAD_PROTOCOL}");
|
|
208
|
+
ws.onclose = recover;
|
|
209
|
+
ws.onerror = recover;
|
|
210
|
+
ws.onmessage = location.reload.bind(location);
|
|
211
|
+
}
|
|
212
|
+
initLiveReload();
|
|
213
|
+
})();
|
|
214
|
+
</script>
|
|
215
|
+
`;
|
|
215
216
|
function rewriteUrlRelatedHeaders(headers, from, to) {
|
|
216
217
|
const setCookie = headers.getAll("Set-Cookie");
|
|
217
218
|
headers.delete("Set-Cookie");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/api/startDevWorker/utils.ts", "../templates/startDevWorker/ProxyWorker.ts"],
|
|
4
|
-
"mappings": ";AAAA,OAAO,YAAY;AAqBZ,SAAS,eACf,kBACqB;AACrB,MAAI,SAAS;AACb,QAAM,aAAa,IAAI,QAAW,CAAC,UAAU,YAAY;AACxD,cAAU;AACV,aAAS;AAAA,EACV,CAAC;AACD,SAAO,OAAO;AACd,SAAO,MAAM;AAIb,oBAAkB,QAAQ,UAAU;AAEpC,SAAO;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACD;AACD;AAIO,SAAS,aACf,OACA,OAAO,oBACD;AACN,QAAM,MAAM,IAAI,IAAI,IAAI;AAExB,SAAO,OAAO,KAAK,KAAK;AAExB,SAAO;AACR;;;AC9BA,IAAM,uBAAuB;AAC7B,IAAO,sBAAQ;AAAA,EACd,MAAM,KAAK,KAAK;AACf,UAAM,YAAY,IAAI,eAAe,WAA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