miniflare 0.0.0-05973bba4 → 0.0.0-05b1e8391
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/dist/src/index.d.ts +551 -253
- package/dist/src/index.js +1184 -384
- package/dist/src/index.js.map +3 -3
- package/dist/src/workers/assets/assets.worker.js +156 -63
- package/dist/src/workers/assets/assets.worker.js.map +2 -2
- package/dist/src/workers/assets/rpc-proxy.worker.js +7 -0
- package/dist/src/workers/assets/rpc-proxy.worker.js.map +1 -1
- package/dist/src/workers/cache/cache.worker.js +2 -1
- package/dist/src/workers/cache/cache.worker.js.map +1 -1
- package/dist/src/workers/core/entry.worker.js +3360 -46
- package/dist/src/workers/core/entry.worker.js.map +3 -3
- package/dist/src/workers/email/email.worker.js +23 -0
- package/dist/src/workers/email/email.worker.js.map +6 -0
- package/dist/src/workers/email/send_email.worker.js +3180 -0
- package/dist/src/workers/email/send_email.worker.js.map +6 -0
- package/dist/src/workers/kv/namespace.worker.js +61 -2
- package/dist/src/workers/kv/namespace.worker.js.map +2 -2
- package/dist/src/workers/kv/sites.worker.js +2 -1
- package/dist/src/workers/kv/sites.worker.js.map +1 -1
- package/dist/src/workers/secrets-store/secret.worker.js +65 -0
- package/dist/src/workers/secrets-store/secret.worker.js.map +6 -0
- package/dist/src/workers/workflows/binding.worker.js +161 -7
- package/dist/src/workers/workflows/binding.worker.js.map +1 -1
- package/package.json +11 -8
|
@@ -7804,7 +7804,12 @@ function mockJaegerBinding() {
|
|
|
7804
7804
|
}
|
|
7805
7805
|
|
|
7806
7806
|
// ../workers-shared/asset-worker/src/analytics.ts
|
|
7807
|
-
var
|
|
7807
|
+
var COMPATIBILITY_FLAG_MASKS = {
|
|
7808
|
+
assets_navigation_prefers_asset_serving: 1
|
|
7809
|
+
// next_one: 1 << 1
|
|
7810
|
+
// one_after_that: 1 << 2
|
|
7811
|
+
// etc: 1 << 3
|
|
7812
|
+
}, Analytics = class {
|
|
7808
7813
|
constructor(readyAnalytics) {
|
|
7809
7814
|
this.data = {};
|
|
7810
7815
|
this.readyAnalytics = readyAnalytics;
|
|
@@ -7816,7 +7821,14 @@ var Analytics = class {
|
|
|
7816
7821
|
return this.data[key];
|
|
7817
7822
|
}
|
|
7818
7823
|
write() {
|
|
7819
|
-
|
|
7824
|
+
if (!this.readyAnalytics)
|
|
7825
|
+
return;
|
|
7826
|
+
let compatibilityFlagsBitmask = 0;
|
|
7827
|
+
for (let compatibilityFlag of this.data.compatibilityFlags || []) {
|
|
7828
|
+
let mask = COMPATIBILITY_FLAG_MASKS[compatibilityFlag];
|
|
7829
|
+
mask && (compatibilityFlagsBitmask += mask);
|
|
7830
|
+
}
|
|
7831
|
+
this.readyAnalytics.logEvent({
|
|
7820
7832
|
version: 1,
|
|
7821
7833
|
accountId: this.data.accountId,
|
|
7822
7834
|
indexId: this.data.scriptId?.toString(),
|
|
@@ -7829,8 +7841,10 @@ var Analytics = class {
|
|
|
7829
7841
|
// double3
|
|
7830
7842
|
this.data.coloTier ?? -1,
|
|
7831
7843
|
// double4
|
|
7832
|
-
this.data.status ?? -1
|
|
7844
|
+
this.data.status ?? -1,
|
|
7833
7845
|
// double5
|
|
7846
|
+
compatibilityFlagsBitmask
|
|
7847
|
+
// double6
|
|
7834
7848
|
],
|
|
7835
7849
|
blobs: [
|
|
7836
7850
|
this.data.hostname?.substring(0, 256),
|
|
@@ -7912,24 +7926,50 @@ var AssetsManifest = class {
|
|
|
7912
7926
|
32
|
|
7913
7927
|
)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
7914
7928
|
|
|
7929
|
+
// ../workers-shared/asset-worker/src/compatibility-flags.ts
|
|
7930
|
+
var SEC_FETCH_MODE_NAVIGATE_HEADER_PREFERS_ASSET_SERVING = {
|
|
7931
|
+
enable: "assets_navigation_prefers_asset_serving",
|
|
7932
|
+
disable: "assets_navigation_has_no_effect",
|
|
7933
|
+
onByDefaultAfter: "2025-04-01"
|
|
7934
|
+
}, COMPATIBILITY_FLAGS = [
|
|
7935
|
+
SEC_FETCH_MODE_NAVIGATE_HEADER_PREFERS_ASSET_SERVING
|
|
7936
|
+
], resolveCompatibilityOptions = (configuration) => {
|
|
7937
|
+
let compatibilityDate = configuration?.compatibility_date ?? "2021-11-02", resolvedCompatibilityFlags = configuration?.compatibility_flags ?? [];
|
|
7938
|
+
for (let compatibilityFlag of COMPATIBILITY_FLAGS)
|
|
7939
|
+
compatibilityFlag.onByDefaultAfter && compatibilityDate >= compatibilityFlag.onByDefaultAfter && !resolvedCompatibilityFlags.find(
|
|
7940
|
+
(flag) => flag === compatibilityFlag.disable
|
|
7941
|
+
) && !resolvedCompatibilityFlags.find(
|
|
7942
|
+
(flag) => flag === compatibilityFlag.enable
|
|
7943
|
+
) && resolvedCompatibilityFlags.push(compatibilityFlag.enable);
|
|
7944
|
+
return {
|
|
7945
|
+
compatibilityDate,
|
|
7946
|
+
compatibilityFlags: resolvedCompatibilityFlags
|
|
7947
|
+
};
|
|
7948
|
+
}, flagIsEnabled = (configuration, compatibilityFlag) => !!configuration.compatibility_flags.find(
|
|
7949
|
+
(flag) => flag === compatibilityFlag.enable
|
|
7950
|
+
);
|
|
7951
|
+
|
|
7915
7952
|
// ../workers-shared/asset-worker/src/configuration.ts
|
|
7916
|
-
var
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7953
|
+
var normalizeConfiguration = (configuration) => {
|
|
7954
|
+
let compatibilityOptions = resolveCompatibilityOptions(configuration);
|
|
7955
|
+
return {
|
|
7956
|
+
compatibility_date: compatibilityOptions.compatibilityDate,
|
|
7957
|
+
compatibility_flags: compatibilityOptions.compatibilityFlags,
|
|
7958
|
+
html_handling: configuration?.html_handling ?? "auto-trailing-slash",
|
|
7959
|
+
not_found_handling: configuration?.not_found_handling ?? "none",
|
|
7960
|
+
redirects: configuration?.redirects ?? {
|
|
7961
|
+
version: 1,
|
|
7962
|
+
staticRules: {},
|
|
7963
|
+
rules: {}
|
|
7964
|
+
},
|
|
7965
|
+
headers: configuration?.headers ?? {
|
|
7966
|
+
version: 2,
|
|
7967
|
+
rules: {}
|
|
7968
|
+
},
|
|
7969
|
+
account_id: configuration?.account_id ?? -1,
|
|
7970
|
+
script_id: configuration?.script_id ?? -1
|
|
7971
|
+
};
|
|
7972
|
+
};
|
|
7933
7973
|
|
|
7934
7974
|
// ../workers-shared/asset-worker/src/experiment-analytics.ts
|
|
7935
7975
|
var ExperimentAnalytics = class {
|
|
@@ -8192,7 +8232,12 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8192
8232
|
return new FoundResponse(location);
|
|
8193
8233
|
}
|
|
8194
8234
|
}
|
|
8195
|
-
let decodedPathname = decodePath(pathname), intent = await getIntent(
|
|
8235
|
+
let decodedPathname = decodePath(pathname), intent = await getIntent(
|
|
8236
|
+
decodedPathname,
|
|
8237
|
+
request,
|
|
8238
|
+
configuration,
|
|
8239
|
+
exists
|
|
8240
|
+
);
|
|
8196
8241
|
if (!intent) {
|
|
8197
8242
|
let response = proxied ? new NotFoundResponse() : new NoIntentResponse();
|
|
8198
8243
|
return env.JAEGER.enterSpan("no_intent", (span) => (span.setTags({
|
|
@@ -8222,7 +8267,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8222
8267
|
pathname,
|
|
8223
8268
|
eTag: assetIntent.eTag,
|
|
8224
8269
|
status: assetIntent.status
|
|
8225
|
-
}), await getByETag(assetIntent.eTag))), headers = getAssetHeaders(
|
|
8270
|
+
}), await getByETag(assetIntent.eTag, request))), headers = getAssetHeaders(
|
|
8226
8271
|
assetIntent.eTag,
|
|
8227
8272
|
asset.contentType,
|
|
8228
8273
|
asset.cacheStatus,
|
|
@@ -8247,15 +8292,18 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8247
8292
|
return new OkResponse(body, { headers });
|
|
8248
8293
|
}
|
|
8249
8294
|
});
|
|
8250
|
-
}, canFetch = async (request, env, configuration, exists) =>
|
|
8295
|
+
}, canFetch = async (request, env, configuration, exists) => (flagIsEnabled(
|
|
8296
|
+
configuration,
|
|
8297
|
+
SEC_FETCH_MODE_NAVIGATE_HEADER_PREFERS_ASSET_SERVING
|
|
8298
|
+
) && request.headers.get("Sec-Fetch-Mode") === "navigate" || (configuration = {
|
|
8299
|
+
...configuration,
|
|
8300
|
+
not_found_handling: "none"
|
|
8301
|
+
}), !(await getResponseOrAssetIntent(
|
|
8251
8302
|
request,
|
|
8252
8303
|
env,
|
|
8253
|
-
|
|
8254
|
-
...configuration,
|
|
8255
|
-
not_found_handling: "none"
|
|
8256
|
-
},
|
|
8304
|
+
configuration,
|
|
8257
8305
|
exists
|
|
8258
|
-
) instanceof NoIntentResponse), handleRequest = async (request, env, configuration, exists, getByETag, analytics) => {
|
|
8306
|
+
) instanceof NoIntentResponse)), handleRequest = async (request, env, configuration, exists, getByETag, analytics) => {
|
|
8259
8307
|
let responseOrAssetIntent = await getResponseOrAssetIntent(
|
|
8260
8308
|
request,
|
|
8261
8309
|
env,
|
|
@@ -8269,11 +8317,12 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8269
8317
|
analytics
|
|
8270
8318
|
);
|
|
8271
8319
|
return attachCustomHeaders(request, response, configuration);
|
|
8272
|
-
}, getIntent = async (pathname, configuration, exists, skipRedirects = !1) => {
|
|
8320
|
+
}, getIntent = async (pathname, request, configuration, exists, skipRedirects = !1) => {
|
|
8273
8321
|
switch (configuration.html_handling) {
|
|
8274
8322
|
case "auto-trailing-slash":
|
|
8275
8323
|
return htmlHandlingAutoTrailingSlash(
|
|
8276
8324
|
pathname,
|
|
8325
|
+
request,
|
|
8277
8326
|
configuration,
|
|
8278
8327
|
exists,
|
|
8279
8328
|
skipRedirects
|
|
@@ -8281,6 +8330,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8281
8330
|
case "force-trailing-slash":
|
|
8282
8331
|
return htmlHandlingForceTrailingSlash(
|
|
8283
8332
|
pathname,
|
|
8333
|
+
request,
|
|
8284
8334
|
configuration,
|
|
8285
8335
|
exists,
|
|
8286
8336
|
skipRedirects
|
|
@@ -8288,15 +8338,16 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8288
8338
|
case "drop-trailing-slash":
|
|
8289
8339
|
return htmlHandlingDropTrailingSlash(
|
|
8290
8340
|
pathname,
|
|
8341
|
+
request,
|
|
8291
8342
|
configuration,
|
|
8292
8343
|
exists,
|
|
8293
8344
|
skipRedirects
|
|
8294
8345
|
);
|
|
8295
8346
|
case "none":
|
|
8296
|
-
return htmlHandlingNone(pathname, configuration, exists);
|
|
8347
|
+
return htmlHandlingNone(pathname, request, configuration, exists);
|
|
8297
8348
|
}
|
|
8298
|
-
}, htmlHandlingAutoTrailingSlash = async (pathname, configuration, exists, skipRedirects) => {
|
|
8299
|
-
let redirectResult = null, eTagResult = null, exactETag = await exists(pathname);
|
|
8349
|
+
}, htmlHandlingAutoTrailingSlash = async (pathname, request, configuration, exists, skipRedirects) => {
|
|
8350
|
+
let redirectResult = null, eTagResult = null, exactETag = await exists(pathname, request);
|
|
8300
8351
|
if (pathname.endsWith("/index")) {
|
|
8301
8352
|
if (exactETag)
|
|
8302
8353
|
return {
|
|
@@ -8305,6 +8356,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8305
8356
|
};
|
|
8306
8357
|
if (redirectResult = await safeRedirect(
|
|
8307
8358
|
`${pathname}.html`,
|
|
8359
|
+
request,
|
|
8308
8360
|
pathname.slice(0, -5),
|
|
8309
8361
|
configuration,
|
|
8310
8362
|
exists,
|
|
@@ -8313,6 +8365,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8313
8365
|
return redirectResult;
|
|
8314
8366
|
if (redirectResult = await safeRedirect(
|
|
8315
8367
|
`${pathname.slice(0, -6)}.html`,
|
|
8368
|
+
request,
|
|
8316
8369
|
pathname.slice(0, -6),
|
|
8317
8370
|
configuration,
|
|
8318
8371
|
exists,
|
|
@@ -8322,6 +8375,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8322
8375
|
} else if (pathname.endsWith("/index.html")) {
|
|
8323
8376
|
if (redirectResult = await safeRedirect(
|
|
8324
8377
|
pathname,
|
|
8378
|
+
request,
|
|
8325
8379
|
pathname.slice(0, -10),
|
|
8326
8380
|
configuration,
|
|
8327
8381
|
exists,
|
|
@@ -8330,6 +8384,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8330
8384
|
return redirectResult;
|
|
8331
8385
|
if (redirectResult = await safeRedirect(
|
|
8332
8386
|
`${pathname.slice(0, -11)}.html`,
|
|
8387
|
+
request,
|
|
8333
8388
|
pathname.slice(0, -11),
|
|
8334
8389
|
configuration,
|
|
8335
8390
|
exists,
|
|
@@ -8337,13 +8392,14 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8337
8392
|
))
|
|
8338
8393
|
return redirectResult;
|
|
8339
8394
|
} else if (pathname.endsWith("/")) {
|
|
8340
|
-
if (eTagResult = await exists(`${pathname}index.html
|
|
8395
|
+
if (eTagResult = await exists(`${pathname}index.html`, request))
|
|
8341
8396
|
return {
|
|
8342
8397
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8343
8398
|
redirect: null
|
|
8344
8399
|
};
|
|
8345
8400
|
if (redirectResult = await safeRedirect(
|
|
8346
8401
|
`${pathname.slice(0, -1)}.html`,
|
|
8402
|
+
request,
|
|
8347
8403
|
pathname.slice(0, -1),
|
|
8348
8404
|
configuration,
|
|
8349
8405
|
exists,
|
|
@@ -8353,6 +8409,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8353
8409
|
} else if (pathname.endsWith(".html")) {
|
|
8354
8410
|
if (redirectResult = await safeRedirect(
|
|
8355
8411
|
pathname,
|
|
8412
|
+
request,
|
|
8356
8413
|
pathname.slice(0, -5),
|
|
8357
8414
|
configuration,
|
|
8358
8415
|
exists,
|
|
@@ -8361,6 +8418,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8361
8418
|
return redirectResult;
|
|
8362
8419
|
if (redirectResult = await safeRedirect(
|
|
8363
8420
|
`${pathname.slice(0, -5)}/index.html`,
|
|
8421
|
+
request,
|
|
8364
8422
|
`${pathname.slice(0, -5)}/`,
|
|
8365
8423
|
configuration,
|
|
8366
8424
|
exists,
|
|
@@ -8371,18 +8429,19 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8371
8429
|
return exactETag ? {
|
|
8372
8430
|
asset: { eTag: exactETag, status: OkResponse.status },
|
|
8373
8431
|
redirect: null
|
|
8374
|
-
} : (eTagResult = await exists(`${pathname}.html
|
|
8432
|
+
} : (eTagResult = await exists(`${pathname}.html`, request)) ? {
|
|
8375
8433
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8376
8434
|
redirect: null
|
|
8377
8435
|
} : (redirectResult = await safeRedirect(
|
|
8378
8436
|
`${pathname}/index.html`,
|
|
8437
|
+
request,
|
|
8379
8438
|
`${pathname}/`,
|
|
8380
8439
|
configuration,
|
|
8381
8440
|
exists,
|
|
8382
8441
|
skipRedirects
|
|
8383
|
-
)) ? redirectResult : notFound(pathname, configuration, exists);
|
|
8384
|
-
}, htmlHandlingForceTrailingSlash = async (pathname, configuration, exists, skipRedirects) => {
|
|
8385
|
-
let redirectResult = null, eTagResult = null, exactETag = await exists(pathname);
|
|
8442
|
+
)) ? redirectResult : notFound(pathname, request, configuration, exists);
|
|
8443
|
+
}, htmlHandlingForceTrailingSlash = async (pathname, request, configuration, exists, skipRedirects) => {
|
|
8444
|
+
let redirectResult = null, eTagResult = null, exactETag = await exists(pathname, request);
|
|
8386
8445
|
if (pathname.endsWith("/index")) {
|
|
8387
8446
|
if (exactETag)
|
|
8388
8447
|
return {
|
|
@@ -8391,6 +8450,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8391
8450
|
};
|
|
8392
8451
|
if (redirectResult = await safeRedirect(
|
|
8393
8452
|
`${pathname}.html`,
|
|
8453
|
+
request,
|
|
8394
8454
|
pathname.slice(0, -5),
|
|
8395
8455
|
configuration,
|
|
8396
8456
|
exists,
|
|
@@ -8399,6 +8459,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8399
8459
|
return redirectResult;
|
|
8400
8460
|
if (redirectResult = await safeRedirect(
|
|
8401
8461
|
`${pathname.slice(0, -6)}.html`,
|
|
8462
|
+
request,
|
|
8402
8463
|
pathname.slice(0, -5),
|
|
8403
8464
|
configuration,
|
|
8404
8465
|
exists,
|
|
@@ -8408,6 +8469,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8408
8469
|
} else if (pathname.endsWith("/index.html")) {
|
|
8409
8470
|
if (redirectResult = await safeRedirect(
|
|
8410
8471
|
pathname,
|
|
8472
|
+
request,
|
|
8411
8473
|
pathname.slice(0, -10),
|
|
8412
8474
|
configuration,
|
|
8413
8475
|
exists,
|
|
@@ -8416,6 +8478,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8416
8478
|
return redirectResult;
|
|
8417
8479
|
if (redirectResult = await safeRedirect(
|
|
8418
8480
|
`${pathname.slice(0, -11)}.html`,
|
|
8481
|
+
request,
|
|
8419
8482
|
pathname.slice(0, -10),
|
|
8420
8483
|
configuration,
|
|
8421
8484
|
exists,
|
|
@@ -8423,12 +8486,15 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8423
8486
|
))
|
|
8424
8487
|
return redirectResult;
|
|
8425
8488
|
} else if (pathname.endsWith("/")) {
|
|
8426
|
-
if (eTagResult = await exists(`${pathname}index.html
|
|
8489
|
+
if (eTagResult = await exists(`${pathname}index.html`, request))
|
|
8427
8490
|
return {
|
|
8428
8491
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8429
8492
|
redirect: null
|
|
8430
8493
|
};
|
|
8431
|
-
if (eTagResult = await exists(
|
|
8494
|
+
if (eTagResult = await exists(
|
|
8495
|
+
`${pathname.slice(0, -1)}.html`,
|
|
8496
|
+
request
|
|
8497
|
+
))
|
|
8432
8498
|
return {
|
|
8433
8499
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8434
8500
|
redirect: null
|
|
@@ -8436,6 +8502,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8436
8502
|
} else if (pathname.endsWith(".html")) {
|
|
8437
8503
|
if (redirectResult = await safeRedirect(
|
|
8438
8504
|
pathname,
|
|
8505
|
+
request,
|
|
8439
8506
|
`${pathname.slice(0, -5)}/`,
|
|
8440
8507
|
configuration,
|
|
8441
8508
|
exists,
|
|
@@ -8449,6 +8516,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8449
8516
|
};
|
|
8450
8517
|
if (redirectResult = await safeRedirect(
|
|
8451
8518
|
`${pathname.slice(0, -5)}/index.html`,
|
|
8519
|
+
request,
|
|
8452
8520
|
`${pathname.slice(0, -5)}/`,
|
|
8453
8521
|
configuration,
|
|
8454
8522
|
exists,
|
|
@@ -8461,19 +8529,21 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8461
8529
|
redirect: null
|
|
8462
8530
|
} : (redirectResult = await safeRedirect(
|
|
8463
8531
|
`${pathname}.html`,
|
|
8532
|
+
request,
|
|
8464
8533
|
`${pathname}/`,
|
|
8465
8534
|
configuration,
|
|
8466
8535
|
exists,
|
|
8467
8536
|
skipRedirects
|
|
8468
8537
|
)) || (redirectResult = await safeRedirect(
|
|
8469
8538
|
`${pathname}/index.html`,
|
|
8539
|
+
request,
|
|
8470
8540
|
`${pathname}/`,
|
|
8471
8541
|
configuration,
|
|
8472
8542
|
exists,
|
|
8473
8543
|
skipRedirects
|
|
8474
|
-
)) ? redirectResult : notFound(pathname, configuration, exists);
|
|
8475
|
-
}, htmlHandlingDropTrailingSlash = async (pathname, configuration, exists, skipRedirects) => {
|
|
8476
|
-
let redirectResult = null, eTagResult = null, exactETag = await exists(pathname);
|
|
8544
|
+
)) ? redirectResult : notFound(pathname, request, configuration, exists);
|
|
8545
|
+
}, htmlHandlingDropTrailingSlash = async (pathname, request, configuration, exists, skipRedirects) => {
|
|
8546
|
+
let redirectResult = null, eTagResult = null, exactETag = await exists(pathname, request);
|
|
8477
8547
|
if (pathname.endsWith("/index")) {
|
|
8478
8548
|
if (exactETag)
|
|
8479
8549
|
return {
|
|
@@ -8483,6 +8553,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8483
8553
|
if (pathname === "/index") {
|
|
8484
8554
|
if (redirectResult = await safeRedirect(
|
|
8485
8555
|
"/index.html",
|
|
8556
|
+
request,
|
|
8486
8557
|
"/",
|
|
8487
8558
|
configuration,
|
|
8488
8559
|
exists,
|
|
@@ -8492,6 +8563,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8492
8563
|
} else {
|
|
8493
8564
|
if (redirectResult = await safeRedirect(
|
|
8494
8565
|
`${pathname.slice(0, -6)}.html`,
|
|
8566
|
+
request,
|
|
8495
8567
|
pathname.slice(0, -6),
|
|
8496
8568
|
configuration,
|
|
8497
8569
|
exists,
|
|
@@ -8500,6 +8572,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8500
8572
|
return redirectResult;
|
|
8501
8573
|
if (redirectResult = await safeRedirect(
|
|
8502
8574
|
`${pathname}.html`,
|
|
8575
|
+
request,
|
|
8503
8576
|
pathname.slice(0, -6),
|
|
8504
8577
|
configuration,
|
|
8505
8578
|
exists,
|
|
@@ -8511,6 +8584,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8511
8584
|
if (pathname === "/index.html") {
|
|
8512
8585
|
if (redirectResult = await safeRedirect(
|
|
8513
8586
|
"/index.html",
|
|
8587
|
+
request,
|
|
8514
8588
|
"/",
|
|
8515
8589
|
configuration,
|
|
8516
8590
|
exists,
|
|
@@ -8520,6 +8594,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8520
8594
|
} else {
|
|
8521
8595
|
if (redirectResult = await safeRedirect(
|
|
8522
8596
|
pathname,
|
|
8597
|
+
request,
|
|
8523
8598
|
pathname.slice(0, -11),
|
|
8524
8599
|
configuration,
|
|
8525
8600
|
exists,
|
|
@@ -8533,6 +8608,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8533
8608
|
};
|
|
8534
8609
|
if (redirectResult = await safeRedirect(
|
|
8535
8610
|
`${pathname.slice(0, -11)}.html`,
|
|
8611
|
+
request,
|
|
8536
8612
|
pathname.slice(0, -11),
|
|
8537
8613
|
configuration,
|
|
8538
8614
|
exists,
|
|
@@ -8542,7 +8618,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8542
8618
|
}
|
|
8543
8619
|
else if (pathname.endsWith("/"))
|
|
8544
8620
|
if (pathname === "/") {
|
|
8545
|
-
if (eTagResult = await exists("/index.html"))
|
|
8621
|
+
if (eTagResult = await exists("/index.html", request))
|
|
8546
8622
|
return {
|
|
8547
8623
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8548
8624
|
redirect: null
|
|
@@ -8550,6 +8626,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8550
8626
|
} else {
|
|
8551
8627
|
if (redirectResult = await safeRedirect(
|
|
8552
8628
|
`${pathname.slice(0, -1)}.html`,
|
|
8629
|
+
request,
|
|
8553
8630
|
pathname.slice(0, -1),
|
|
8554
8631
|
configuration,
|
|
8555
8632
|
exists,
|
|
@@ -8558,6 +8635,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8558
8635
|
return redirectResult;
|
|
8559
8636
|
if (redirectResult = await safeRedirect(
|
|
8560
8637
|
`${pathname.slice(0, -1)}/index.html`,
|
|
8638
|
+
request,
|
|
8561
8639
|
pathname.slice(0, -1),
|
|
8562
8640
|
configuration,
|
|
8563
8641
|
exists,
|
|
@@ -8568,6 +8646,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8568
8646
|
else if (pathname.endsWith(".html")) {
|
|
8569
8647
|
if (redirectResult = await safeRedirect(
|
|
8570
8648
|
pathname,
|
|
8649
|
+
request,
|
|
8571
8650
|
pathname.slice(0, -5),
|
|
8572
8651
|
configuration,
|
|
8573
8652
|
exists,
|
|
@@ -8576,6 +8655,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8576
8655
|
return redirectResult;
|
|
8577
8656
|
if (redirectResult = await safeRedirect(
|
|
8578
8657
|
`${pathname.slice(0, -5)}/index.html`,
|
|
8658
|
+
request,
|
|
8579
8659
|
pathname.slice(0, -5),
|
|
8580
8660
|
configuration,
|
|
8581
8661
|
exists,
|
|
@@ -8586,23 +8666,23 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8586
8666
|
return exactETag ? {
|
|
8587
8667
|
asset: { eTag: exactETag, status: OkResponse.status },
|
|
8588
8668
|
redirect: null
|
|
8589
|
-
} : (eTagResult = await exists(`${pathname}.html
|
|
8669
|
+
} : (eTagResult = await exists(`${pathname}.html`, request)) ? {
|
|
8590
8670
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8591
8671
|
redirect: null
|
|
8592
|
-
} : (eTagResult = await exists(`${pathname}/index.html
|
|
8672
|
+
} : (eTagResult = await exists(`${pathname}/index.html`, request)) ? {
|
|
8593
8673
|
asset: { eTag: eTagResult, status: OkResponse.status },
|
|
8594
8674
|
redirect: null
|
|
8595
|
-
} : notFound(pathname, configuration, exists);
|
|
8596
|
-
}, htmlHandlingNone = async (pathname, configuration, exists) => {
|
|
8597
|
-
let exactETag = await exists(pathname);
|
|
8675
|
+
} : notFound(pathname, request, configuration, exists);
|
|
8676
|
+
}, htmlHandlingNone = async (pathname, request, configuration, exists) => {
|
|
8677
|
+
let exactETag = await exists(pathname, request);
|
|
8598
8678
|
return exactETag ? {
|
|
8599
8679
|
asset: { eTag: exactETag, status: OkResponse.status },
|
|
8600
8680
|
redirect: null
|
|
8601
|
-
} : notFound(pathname, configuration, exists);
|
|
8602
|
-
}, notFound = async (pathname, configuration, exists) => {
|
|
8681
|
+
} : notFound(pathname, request, configuration, exists);
|
|
8682
|
+
}, notFound = async (pathname, request, configuration, exists) => {
|
|
8603
8683
|
switch (configuration.not_found_handling) {
|
|
8604
8684
|
case "single-page-application": {
|
|
8605
|
-
let eTag = await exists("/index.html");
|
|
8685
|
+
let eTag = await exists("/index.html", request);
|
|
8606
8686
|
return eTag ? {
|
|
8607
8687
|
asset: { eTag, status: OkResponse.status },
|
|
8608
8688
|
redirect: null
|
|
@@ -8612,7 +8692,7 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8612
8692
|
let cwd = pathname;
|
|
8613
8693
|
for (; cwd; ) {
|
|
8614
8694
|
cwd = cwd.slice(0, cwd.lastIndexOf("/"));
|
|
8615
|
-
let eTag = await exists(`${cwd}/404.html
|
|
8695
|
+
let eTag = await exists(`${cwd}/404.html`, request);
|
|
8616
8696
|
if (eTag)
|
|
8617
8697
|
return {
|
|
8618
8698
|
asset: { eTag, status: NotFoundResponse.status },
|
|
@@ -8625,12 +8705,18 @@ var REDIRECTS_VERSION = 1, HEADERS_VERSION = 2, getResponseOrAssetIntent = async
|
|
|
8625
8705
|
default:
|
|
8626
8706
|
return null;
|
|
8627
8707
|
}
|
|
8628
|
-
}, safeRedirect = async (file, destination, configuration, exists, skip) => {
|
|
8708
|
+
}, safeRedirect = async (file, request, destination, configuration, exists, skip) => {
|
|
8629
8709
|
if (skip)
|
|
8630
8710
|
return null;
|
|
8631
|
-
if (!await exists(destination)) {
|
|
8632
|
-
let intent = await getIntent(
|
|
8633
|
-
|
|
8711
|
+
if (!await exists(destination, request)) {
|
|
8712
|
+
let intent = await getIntent(
|
|
8713
|
+
destination,
|
|
8714
|
+
request,
|
|
8715
|
+
configuration,
|
|
8716
|
+
exists,
|
|
8717
|
+
!0
|
|
8718
|
+
);
|
|
8719
|
+
if (intent?.asset && intent.asset.eTag === await exists(file, request))
|
|
8634
8720
|
return {
|
|
8635
8721
|
asset: null,
|
|
8636
8722
|
redirect: destination
|
|
@@ -8721,7 +8807,13 @@ var src_default = class extends WorkerEntrypoint {
|
|
|
8721
8807
|
this.env.CONFIG?.account_id,
|
|
8722
8808
|
this.env.CONFIG?.script_id
|
|
8723
8809
|
);
|
|
8724
|
-
let config =
|
|
8810
|
+
let config = normalizeConfiguration(this.env.CONFIG);
|
|
8811
|
+
sentry?.setContext("compatibilityOptions", {
|
|
8812
|
+
compatibilityDate: config.compatibility_date,
|
|
8813
|
+
compatibilityFlags: config.compatibility_flags,
|
|
8814
|
+
originalCompatibilityFlags: this.env.CONFIG.compatibility_flags
|
|
8815
|
+
});
|
|
8816
|
+
let userAgent = request.headers.get("user-agent") ?? "UA UNKNOWN", url = new URL(request.url);
|
|
8725
8817
|
return this.env.COLO_METADATA && this.env.VERSION_METADATA && this.env.CONFIG && analytics.setData({
|
|
8726
8818
|
accountId: this.env.CONFIG.account_id,
|
|
8727
8819
|
scriptId: this.env.CONFIG.script_id,
|
|
@@ -8733,6 +8825,7 @@ var src_default = class extends WorkerEntrypoint {
|
|
|
8733
8825
|
hostname: url.hostname,
|
|
8734
8826
|
htmlHandling: config.html_handling,
|
|
8735
8827
|
notFoundHandling: config.not_found_handling,
|
|
8828
|
+
compatibilityFlags: config.compatibility_flags,
|
|
8736
8829
|
userAgent
|
|
8737
8830
|
}), await this.env.JAEGER.enterSpan("handleRequest", async (span) => {
|
|
8738
8831
|
span.setTags({
|
|
@@ -8762,11 +8855,11 @@ var src_default = class extends WorkerEntrypoint {
|
|
|
8762
8855
|
return this.env.JAEGER ??= mockJaegerBinding(), canFetch(
|
|
8763
8856
|
request,
|
|
8764
8857
|
this.env,
|
|
8765
|
-
|
|
8858
|
+
normalizeConfiguration(this.env.CONFIG),
|
|
8766
8859
|
this.unstable_exists.bind(this)
|
|
8767
8860
|
);
|
|
8768
8861
|
}
|
|
8769
|
-
async unstable_getByETag(eTag) {
|
|
8862
|
+
async unstable_getByETag(eTag, _request) {
|
|
8770
8863
|
let performance = new PerformanceTimer(this.env.UNSAFE_PERFORMANCE), startTime = performance.now(), asset = await getAssetWithMetadataFromKV(
|
|
8771
8864
|
this.env.ASSETS_KV_NAMESPACE,
|
|
8772
8865
|
eTag
|
|
@@ -8784,11 +8877,11 @@ var src_default = class extends WorkerEntrypoint {
|
|
|
8784
8877
|
cacheStatus: assetFetchTime <= 100 ? "HIT" : "MISS"
|
|
8785
8878
|
};
|
|
8786
8879
|
}
|
|
8787
|
-
async unstable_getByPathname(pathname) {
|
|
8788
|
-
let eTag = await this.unstable_exists(pathname);
|
|
8789
|
-
return eTag ? this.unstable_getByETag(eTag) : null;
|
|
8880
|
+
async unstable_getByPathname(pathname, request) {
|
|
8881
|
+
let eTag = await this.unstable_exists(pathname, request);
|
|
8882
|
+
return eTag ? this.unstable_getByETag(eTag, request) : null;
|
|
8790
8883
|
}
|
|
8791
|
-
async unstable_exists(pathname) {
|
|
8884
|
+
async unstable_exists(pathname, _request) {
|
|
8792
8885
|
let analytics = new ExperimentAnalytics(this.env.EXPERIMENT_ANALYTICS), performance = new PerformanceTimer(this.env.UNSAFE_PERFORMANCE);
|
|
8793
8886
|
this.env.COLO_METADATA && this.env.VERSION_METADATA && this.env.CONFIG && analytics.setData({
|
|
8794
8887
|
accountId: this.env.CONFIG.account_id,
|