miniflare 0.0.0-e2e6912bc → 0.0.0-e3791f7d8

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.
@@ -8776,7 +8776,8 @@ var AssetsManifest = class {
8776
8776
  // ../workers-shared/asset-worker/src/configuration.ts
8777
8777
  var applyConfigurationDefaults = (configuration) => ({
8778
8778
  html_handling: configuration?.html_handling ?? "auto-trailing-slash",
8779
- not_found_handling: configuration?.not_found_handling ?? "none"
8779
+ not_found_handling: configuration?.not_found_handling ?? "none",
8780
+ serve_directly: configuration?.serve_directly ?? !0
8780
8781
  });
8781
8782
 
8782
8783
  // ../workers-shared/asset-worker/src/responses.ts
@@ -8849,14 +8850,16 @@ function isCacheable(request) {
8849
8850
 
8850
8851
  // ../workers-shared/asset-worker/src/handler.ts
8851
8852
  var handleRequest = async (request, configuration, exists, getByETag) => {
8852
- let { pathname, search } = new URL(request.url), decodedPathname = decodePath(pathname), intent = await getIntent(decodedPathname, configuration, exists);
8853
+ let { pathname, search } = new URL(request.url), decodedPathname = decodePath(pathname);
8854
+ decodedPathname = decodedPathname.replace(/\/+/g, "/");
8855
+ let intent = await getIntent(decodedPathname, configuration, exists);
8853
8856
  if (!intent)
8854
8857
  return new NotFoundResponse();
8855
8858
  let method = request.method.toUpperCase();
8856
8859
  if (!["GET", "HEAD"].includes(method))
8857
8860
  return new MethodNotAllowedResponse();
8858
8861
  let decodedDestination = intent.redirect ?? decodedPathname, encodedDestination = encodePath(decodedDestination);
8859
- if (encodedDestination !== pathname || intent.redirect)
8862
+ if (encodedDestination !== pathname && intent.asset || intent.redirect)
8860
8863
  return new TemporaryRedirectResponse(encodedDestination + search);
8861
8864
  if (!intent.asset)
8862
8865
  return new InternalServerErrorResponse(new Error("Unknown action"));
@@ -9306,15 +9309,15 @@ var src_default = class extends WorkerEntrypoint {
9306
9309
  }
9307
9310
  }
9308
9311
  async unstable_canFetch(request) {
9309
- let url = new URL(request.url), method = request.method.toUpperCase(), decodedPathname = decodePath(url.pathname), intent = await getIntent(
9312
+ let url = new URL(request.url), decodedPathname = decodePath(url.pathname);
9313
+ return await getIntent(
9310
9314
  decodedPathname,
9311
9315
  {
9312
9316
  ...applyConfigurationDefaults(this.env.CONFIG),
9313
9317
  not_found_handling: "none"
9314
9318
  },
9315
9319
  this.unstable_exists.bind(this)
9316
- );
9317
- return intent && ["GET", "HEAD"].includes(method) ? new MethodNotAllowedResponse() : intent !== null;
9320
+ ) !== null;
9318
9321
  }
9319
9322
  async unstable_getByETag(eTag) {
9320
9323
  let asset = await getAssetWithMetadataFromKV(