miniflare 0.0.0-eec2a7074 → 0.0.0-eef649c82

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.
@@ -8681,12 +8681,12 @@ var Analytics = class {
8681
8681
  getData(key) {
8682
8682
  return this.data[key];
8683
8683
  }
8684
- write(hostname) {
8684
+ write() {
8685
8685
  this.readyAnalytics && this.readyAnalytics.logEvent({
8686
8686
  version: 1,
8687
8687
  accountId: 0,
8688
8688
  // TODO: need to plumb through
8689
- indexId: hostname,
8689
+ indexId: this.data.hostname?.substring(0, 96),
8690
8690
  doubles: [
8691
8691
  this.data.requestTime ?? -1,
8692
8692
  // double1
@@ -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"));
@@ -9238,7 +9241,19 @@ var handleRequest = async (request, configuration, exists, getByETag) => {
9238
9241
  };
9239
9242
  }
9240
9243
  return null;
9241
- }, decodePath = (pathname) => pathname.split("/").map((x) => decodeURIComponent(x)).join("/"), encodePath = (pathname) => pathname.split("/").map((x) => encodeURIComponent(x)).join("/");
9244
+ }, decodePath = (pathname) => pathname.split("/").map((x) => {
9245
+ try {
9246
+ return decodeURIComponent(x);
9247
+ } catch {
9248
+ return x;
9249
+ }
9250
+ }).join("/"), encodePath = (pathname) => pathname.split("/").map((x) => {
9251
+ try {
9252
+ return encodeURIComponent(x);
9253
+ } catch {
9254
+ return x;
9255
+ }
9256
+ }).join("/");
9242
9257
 
9243
9258
  // ../workers-shared/asset-worker/src/utils/kv.ts
9244
9259
  async function getAssetWithMetadataFromKV(assetsKVNamespace, assetKey, retries = 1) {
@@ -9306,15 +9321,15 @@ var src_default = class extends WorkerEntrypoint {
9306
9321
  }
9307
9322
  }
9308
9323
  async unstable_canFetch(request) {
9309
- let url = new URL(request.url), method = request.method.toUpperCase(), decodedPathname = decodePath(url.pathname), intent = await getIntent(
9324
+ let url = new URL(request.url), decodedPathname = decodePath(url.pathname);
9325
+ return await getIntent(
9310
9326
  decodedPathname,
9311
9327
  {
9312
9328
  ...applyConfigurationDefaults(this.env.CONFIG),
9313
9329
  not_found_handling: "none"
9314
9330
  },
9315
9331
  this.unstable_exists.bind(this)
9316
- );
9317
- return intent && ["GET", "HEAD"].includes(method) ? new MethodNotAllowedResponse() : intent !== null;
9332
+ ) !== null;
9318
9333
  }
9319
9334
  async unstable_getByETag(eTag) {
9320
9335
  let asset = await getAssetWithMetadataFromKV(