wrangler 4.156.0 → 4.156.2

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.
@@ -4442,19 +4442,19 @@
4442
4442
  "type": "object",
4443
4443
  "properties": {
4444
4444
  "logpush": {
4445
- "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-623842004818536"
4445
+ "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-627292004818536"
4446
4446
  },
4447
4447
  "observability": {
4448
- "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-623842004818536"
4448
+ "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-627292004818536"
4449
4449
  },
4450
4450
  "limits": {
4451
- "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-623842004818536"
4451
+ "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-627292004818536"
4452
4452
  },
4453
4453
  "placement": {
4454
- "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-623842004818536"
4454
+ "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-627292004818536"
4455
4455
  },
4456
4456
  "cache": {
4457
- "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-623842004818536"
4457
+ "$ref": "#/definitions/interface-769040647-14884-25493-769040647-0-627292004818536"
4458
4458
  },
4459
4459
  "define": {
4460
4460
  "type": "object",
@@ -5829,7 +5829,7 @@
5829
5829
  "description": "Configuration for Worker Previews.\n\nThis defines the settings used when creating Preview deployments. Previews are branches of your Worker's main instance used to test features during feature development outside of production.\n\nThe `previews` block contains any intentionally divergent configuration intended solely for Previews, including:\n- All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)\n- Select inheritable properties: `logpush`, `observability`, `limits`, `placement`, `cache`",
5830
5830
  "markdownDescription": "Configuration for Worker Previews.\n\nThis defines the settings used when creating Preview deployments.\nPreviews are branches of your Worker's main instance used to test features\nduring feature development outside of production.\n\nThe `previews` block contains any intentionally divergent configuration intended solely for Previews, including:\n- All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)\n- Select inheritable properties: `logpush`, `observability`, `limits`, `placement`, `cache`"
5831
5831
  },
5832
- "interface-769040647-14884-25493-769040647-0-623842004818536": {
5832
+ "interface-769040647-14884-25493-769040647-0-627292004818536": {
5833
5833
  "type": "object",
5834
5834
  "properties": {
5835
5835
  "name": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrangler",
3
- "version": "4.156.0",
3
+ "version": "4.156.2",
4
4
  "description": "Command-line interface for all things Cloudflare Workers",
5
5
  "keywords": [
6
6
  "assembly",
@@ -67,22 +67,22 @@
67
67
  "./package.json": "./package.json"
68
68
  },
69
69
  "dependencies": {
70
+ "@cspotcode/source-map-support": "0.8.1",
70
71
  "blake3-wasm": "2.1.5",
71
72
  "esbuild": "0.28.2",
72
73
  "path-to-regexp": "6.3.0",
73
74
  "unenv": "2.0.0-rc.24",
74
- "workerd": "1.20261023.1",
75
+ "workerd": "1.20261102.1",
75
76
  "@cloudflare/kv-asset-handler": "0.5.0",
76
- "miniflare": "5.20261023.3-beta",
77
- "@cloudflare/unenv-preset": "2.16.2"
77
+ "@cloudflare/unenv-preset": "2.16.2",
78
+ "miniflare": "5.20261102.0-beta"
78
79
  },
79
80
  "devDependencies": {
80
81
  "@aws-sdk/client-s3": "^3.721.0",
81
82
  "@aws-sdk/s3-request-presigner": "^3.721.0",
82
83
  "@bomb.sh/tab": "^0.0.12",
83
84
  "@cloudflare/types": "6.18.4",
84
- "@cloudflare/workers-types": "^5.20261023.1",
85
- "@cspotcode/source-map-support": "0.8.1",
85
+ "@cloudflare/workers-types": "^5.20261102.1",
86
86
  "@netlify/build-info": "10.5.1",
87
87
  "@sentry/node": "^7.86.0",
88
88
  "@sentry/types": "^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.8.3",
168
- "@cloudflare/build-output-utils": "0.9.6",
169
- "@cloudflare/cli-shared-helpers": "0.3.0",
170
- "@cloudflare/config": "0.29.0",
171
- "@cloudflare/containers-shared": "0.23.5",
172
- "@cloudflare/deploy-helpers": "0.24.3",
173
- "@cloudflare/pages-functions": "0.1.2",
174
- "@cloudflare/pages-shared": "^0.13.205",
175
- "@cloudflare/remote-bindings": "0.0.56",
176
- "@cloudflare/runtime-types": "0.1.19",
167
+ "@cloudflare/autoconfig": "0.9.1",
168
+ "@cloudflare/build-output-utils": "0.9.8",
169
+ "@cloudflare/cli-shared-helpers": "0.3.2",
170
+ "@cloudflare/config": "0.30.0",
171
+ "@cloudflare/containers-shared": "0.23.7",
172
+ "@cloudflare/deploy-helpers": "0.24.5",
173
+ "@cloudflare/pages-functions": "0.1.4",
174
+ "@cloudflare/pages-shared": "^0.13.207",
175
+ "@cloudflare/runtime-types": "0.1.21",
176
+ "@cloudflare/remote-bindings": "0.0.58",
177
177
  "@cloudflare/shared-ast-primitives": "1.1.0",
178
- "@cloudflare/workers-auth": "0.15.3",
178
+ "@cloudflare/workers-auth": "0.15.5",
179
179
  "@cloudflare/workers-shared": "0.20.2",
180
- "@cloudflare/workers-utils": "0.50.1",
181
- "@cloudflare/workflows-shared": "0.15.3",
182
- "@cloudflare/workers-tsconfig": "0.0.0"
180
+ "@cloudflare/workers-tsconfig": "0.0.0",
181
+ "@cloudflare/workers-utils": "0.51.0",
182
+ "@cloudflare/workflows-shared": "0.15.3"
183
183
  },
184
184
  "peerDependencies": {
185
- "@cloudflare/workers-types": "^5.20261023.1"
185
+ "@cloudflare/workers-types": "^5.20261102.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 = routeMatcher(requestPath);
79
- const mountMatchResult = mountMatcher(requestPath);
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: mountMatchResult.path,
110
+ path,
86
111
  };
87
112
  }
88
113
  }
@@ -3607,11 +3607,6 @@ declare function runCfWranglerBuild(args: BuildArgs): Promise<number>;
3607
3607
  */
3608
3608
  declare function runCfWranglerDev(options: StartDevOptions): Promise<number>;
3609
3609
 
3610
- /**
3611
- * Split an SQLQuery into an array of statements
3612
- */
3613
- declare function splitSqlQuery(sql: string): string[];
3614
-
3615
3610
  /**
3616
3611
  * The implementation for fetching a kv value from the cloudflare API.
3617
3612
  * We special-case this one call, because it's the only API call that
@@ -4092,6 +4087,10 @@ declare function experimental_getWranglerCommands(): {
4092
4087
  * It also re-exports the public API of the package.
4093
4088
  */
4094
4089
 
4090
+ /**
4091
+ * Split an SQLQuery into an array of statements
4092
+ */
4093
+ declare function unstable_splitSqlQuery(sql: string): string[];
4095
4094
  interface Unstable_ASSETSBindingsOptions {
4096
4095
  log: Logger;
4097
4096
  proxyPort?: number;
@@ -4100,4 +4099,4 @@ interface Unstable_ASSETSBindingsOptions {
4100
4099
  }
4101
4100
  declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
4102
4101
 
4103
- export { ArgParseError, type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type WorkerHandle, createTestHarness, generateTypes as experimental_generateTypes, experimental_getWranglerCommands, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, parseArgs as parseCfWranglerArgs, parseBuildArgs as parseCfWranglerBuildArgs, runCfWranglerBuild, runCfWranglerDev, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, unstable_pages, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
4102
+ export { ArgParseError, type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type WorkerHandle, createTestHarness, generateTypes as experimental_generateTypes, experimental_getWranglerCommands, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, parseArgs as parseCfWranglerArgs, parseBuildArgs as parseCfWranglerBuildArgs, runCfWranglerBuild, runCfWranglerDev, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, unstable_pages, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, unstable_splitSqlQuery, startWorker as unstable_startWorker };