wrangler 4.156.0 → 4.156.1
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/package.json +21 -21
- package/templates/pages-template-worker.ts +28 -3
- package/wrangler-dist/cli.js +1239 -857
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.156.
|
|
3
|
+
"version": "4.156.1",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assembly",
|
|
@@ -71,17 +71,17 @@
|
|
|
71
71
|
"esbuild": "0.28.2",
|
|
72
72
|
"path-to-regexp": "6.3.0",
|
|
73
73
|
"unenv": "2.0.0-rc.24",
|
|
74
|
-
"workerd": "1.
|
|
75
|
-
"@cloudflare/
|
|
76
|
-
"miniflare": "5.
|
|
77
|
-
"@cloudflare/
|
|
74
|
+
"workerd": "1.20261101.1",
|
|
75
|
+
"@cloudflare/unenv-preset": "2.16.2",
|
|
76
|
+
"miniflare": "5.20261101.0-beta",
|
|
77
|
+
"@cloudflare/kv-asset-handler": "0.5.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@aws-sdk/client-s3": "^3.721.0",
|
|
81
81
|
"@aws-sdk/s3-request-presigner": "^3.721.0",
|
|
82
82
|
"@bomb.sh/tab": "^0.0.12",
|
|
83
83
|
"@cloudflare/types": "6.18.4",
|
|
84
|
-
"@cloudflare/workers-types": "^5.
|
|
84
|
+
"@cloudflare/workers-types": "^5.20261101.1",
|
|
85
85
|
"@cspotcode/source-map-support": "0.8.1",
|
|
86
86
|
"@netlify/build-info": "10.5.1",
|
|
87
87
|
"@sentry/node": "^7.86.0",
|
|
@@ -164,25 +164,25 @@
|
|
|
164
164
|
"yaml": "^2.8.1",
|
|
165
165
|
"yargs": "^17.7.2",
|
|
166
166
|
"zod": "4.6.6",
|
|
167
|
-
"@cloudflare/autoconfig": "0.
|
|
168
|
-
"@cloudflare/build-output-utils": "0.9.
|
|
169
|
-
"@cloudflare/cli-shared-helpers": "0.3.
|
|
170
|
-
"@cloudflare/config": "0.29.
|
|
171
|
-
"@cloudflare/containers-shared": "0.23.
|
|
172
|
-
"@cloudflare/deploy-helpers": "0.24.
|
|
173
|
-
"@cloudflare/pages-functions": "0.1.
|
|
174
|
-
"@cloudflare/pages-shared": "^0.13.
|
|
175
|
-
"@cloudflare/remote-bindings": "0.0.
|
|
176
|
-
"@cloudflare/runtime-types": "0.1.
|
|
167
|
+
"@cloudflare/autoconfig": "0.9.0",
|
|
168
|
+
"@cloudflare/build-output-utils": "0.9.7",
|
|
169
|
+
"@cloudflare/cli-shared-helpers": "0.3.1",
|
|
170
|
+
"@cloudflare/config": "0.29.1",
|
|
171
|
+
"@cloudflare/containers-shared": "0.23.6",
|
|
172
|
+
"@cloudflare/deploy-helpers": "0.24.4",
|
|
173
|
+
"@cloudflare/pages-functions": "0.1.3",
|
|
174
|
+
"@cloudflare/pages-shared": "^0.13.206",
|
|
175
|
+
"@cloudflare/remote-bindings": "0.0.57",
|
|
176
|
+
"@cloudflare/runtime-types": "0.1.20",
|
|
177
177
|
"@cloudflare/shared-ast-primitives": "1.1.0",
|
|
178
|
-
"@cloudflare/workers-auth": "0.15.
|
|
178
|
+
"@cloudflare/workers-auth": "0.15.4",
|
|
179
179
|
"@cloudflare/workers-shared": "0.20.2",
|
|
180
|
-
"@cloudflare/workers-
|
|
181
|
-
"@cloudflare/
|
|
182
|
-
"@cloudflare/
|
|
180
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
181
|
+
"@cloudflare/workers-utils": "0.50.2",
|
|
182
|
+
"@cloudflare/workflows-shared": "0.15.3"
|
|
183
183
|
},
|
|
184
184
|
"peerDependencies": {
|
|
185
|
-
"@cloudflare/workers-types": "^5.
|
|
185
|
+
"@cloudflare/workers-types": "^5.20261101.1"
|
|
186
186
|
},
|
|
187
187
|
"peerDependenciesMeta": {
|
|
188
188
|
"@cloudflare/workers-types": {
|
|
@@ -59,8 +59,27 @@ type WorkerContext = {
|
|
|
59
59
|
passThroughOnException: () => void;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Restore repeated slashes in a middleware prefix so functionPath can be removed
|
|
64
|
+
* from the original request URL by mounted handlers such as assets imports.
|
|
65
|
+
*/
|
|
66
|
+
function getOriginalPathPrefix(requestPath: string, normalizedPrefix: string) {
|
|
67
|
+
let end = 0;
|
|
68
|
+
for (let index = 0; index < normalizedPrefix.length; index++) {
|
|
69
|
+
end++;
|
|
70
|
+
if (normalizedPrefix[index] === "/") {
|
|
71
|
+
while (requestPath[end] === "/") {
|
|
72
|
+
end++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return requestPath.slice(0, end);
|
|
77
|
+
}
|
|
78
|
+
|
|
62
79
|
function* executeRequest(request: Request) {
|
|
63
80
|
const requestPath = new URL(request.url).pathname;
|
|
81
|
+
// Match the asset server's slash normalization so requests cannot bypass middleware.
|
|
82
|
+
const normalizedRequestPath = requestPath.replace(/\/+/g, "/");
|
|
64
83
|
|
|
65
84
|
// First, iterate through the routes (backwards) and execute "middlewares" on partial route matches
|
|
66
85
|
for (const route of [...routes].reverse()) {
|
|
@@ -75,14 +94,20 @@ function* executeRequest(request: Request) {
|
|
|
75
94
|
const mountMatcher = match(route.mountPath.replace(escapeRegex, "\\$&"), {
|
|
76
95
|
end: false,
|
|
77
96
|
});
|
|
78
|
-
const matchResult =
|
|
79
|
-
|
|
97
|
+
const matchResult =
|
|
98
|
+
routeMatcher(requestPath) || routeMatcher(normalizedRequestPath);
|
|
99
|
+
const originalMountMatch = mountMatcher(requestPath);
|
|
100
|
+
const mountMatchResult =
|
|
101
|
+
originalMountMatch || mountMatcher(normalizedRequestPath);
|
|
80
102
|
if (matchResult && mountMatchResult) {
|
|
103
|
+
const path = originalMountMatch
|
|
104
|
+
? originalMountMatch.path
|
|
105
|
+
: getOriginalPathPrefix(requestPath, mountMatchResult.path);
|
|
81
106
|
for (const handler of route.middlewares.flat()) {
|
|
82
107
|
yield {
|
|
83
108
|
handler,
|
|
84
109
|
params: matchResult.params as Params,
|
|
85
|
-
path
|
|
110
|
+
path,
|
|
86
111
|
};
|
|
87
112
|
}
|
|
88
113
|
}
|