@pack/hydrogen 3.2.2 → 3.2.3
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/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5537,6 +5537,14 @@ async function fetchTestRulesShared(packClient, withCache, token) {
|
|
|
5537
5537
|
}
|
|
5538
5538
|
);
|
|
5539
5539
|
}
|
|
5540
|
+
function isPrefetchRequest(request) {
|
|
5541
|
+
const secPurpose = request.headers.get("sec-purpose")?.toLowerCase();
|
|
5542
|
+
const purpose = request.headers.get("purpose")?.toLowerCase();
|
|
5543
|
+
const xPurpose = request.headers.get("x-purpose")?.toLowerCase();
|
|
5544
|
+
return [secPurpose, purpose, xPurpose].some(
|
|
5545
|
+
(value) => value?.split(",").map((part) => part.trim()).includes("prefetch")
|
|
5546
|
+
);
|
|
5547
|
+
}
|
|
5540
5548
|
async function packClientFetchTestByRules(packClient, testTargetAudienceAttributes, testSession, request, withCache, token, exposedTest, validateOnly) {
|
|
5541
5549
|
try {
|
|
5542
5550
|
debug3(
|
|
@@ -5768,6 +5776,10 @@ async function getTestInfo({
|
|
|
5768
5776
|
requestUrl: request.url
|
|
5769
5777
|
})
|
|
5770
5778
|
);
|
|
5779
|
+
if (isPrefetchRequest(request)) {
|
|
5780
|
+
debug3("[Pack Test] Skipping test assignment for prefetch request.");
|
|
5781
|
+
return void 0;
|
|
5782
|
+
}
|
|
5771
5783
|
let testInfo = void 0;
|
|
5772
5784
|
let exposedTest = void 0;
|
|
5773
5785
|
if (!testSession) {
|