@uniformdev/next-app-router 20.49.5-alpha.8 → 20.50.1-alpha.1
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/cache.js +1 -1
- package/dist/cache.mjs +1 -1
- package/dist/component.js +1 -1
- package/dist/component.mjs +1 -1
- package/dist/handler.js +1 -1
- package/dist/handler.mjs +1 -1
- package/dist/index.esm.js +19 -3
- package/dist/index.js +27 -11
- package/dist/index.mjs +19 -3
- package/dist/middleware.js +21 -9
- package/dist/middleware.mjs +21 -9
- package/package.json +8 -8
package/dist/cache.js
CHANGED
|
@@ -330,7 +330,7 @@ async function handleRateLimits(callApi) {
|
|
|
330
330
|
}
|
|
331
331
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
332
332
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
333
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
333
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
334
334
|
backoffRetriesLeft -= 1;
|
|
335
335
|
}
|
|
336
336
|
return response;
|
package/dist/cache.mjs
CHANGED
|
@@ -317,7 +317,7 @@ async function handleRateLimits(callApi) {
|
|
|
317
317
|
}
|
|
318
318
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
319
319
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
320
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
320
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
321
321
|
backoffRetriesLeft -= 1;
|
|
322
322
|
}
|
|
323
323
|
return response;
|
package/dist/component.js
CHANGED
|
@@ -385,7 +385,7 @@ async function handleRateLimits(callApi) {
|
|
|
385
385
|
}
|
|
386
386
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
387
387
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
388
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
388
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
389
389
|
backoffRetriesLeft -= 1;
|
|
390
390
|
}
|
|
391
391
|
return response;
|
package/dist/component.mjs
CHANGED
|
@@ -370,7 +370,7 @@ async function handleRateLimits(callApi) {
|
|
|
370
370
|
}
|
|
371
371
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
372
372
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
373
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
373
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
374
374
|
backoffRetriesLeft -= 1;
|
|
375
375
|
}
|
|
376
376
|
return response;
|
package/dist/handler.js
CHANGED
|
@@ -329,7 +329,7 @@ async function handleRateLimits(callApi) {
|
|
|
329
329
|
}
|
|
330
330
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
331
331
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
332
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
332
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
333
333
|
backoffRetriesLeft -= 1;
|
|
334
334
|
}
|
|
335
335
|
return response;
|
package/dist/handler.mjs
CHANGED
|
@@ -314,7 +314,7 @@ async function handleRateLimits(callApi) {
|
|
|
314
314
|
}
|
|
315
315
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
316
316
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
317
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
317
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
318
318
|
backoffRetriesLeft -= 1;
|
|
319
319
|
}
|
|
320
320
|
return response;
|
package/dist/index.esm.js
CHANGED
|
@@ -320,7 +320,7 @@ async function handleRateLimits(callApi) {
|
|
|
320
320
|
}
|
|
321
321
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
322
322
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
323
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
323
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
324
324
|
backoffRetriesLeft -= 1;
|
|
325
325
|
}
|
|
326
326
|
return response;
|
|
@@ -2749,6 +2749,13 @@ var createTestComponentProps = ({
|
|
|
2749
2749
|
test
|
|
2750
2750
|
}) => {
|
|
2751
2751
|
var _a;
|
|
2752
|
+
if (pageState.isPrefetch) {
|
|
2753
|
+
return {
|
|
2754
|
+
...common,
|
|
2755
|
+
index: void 0,
|
|
2756
|
+
test
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2752
2759
|
const component = resolveComponentFromPageState({
|
|
2753
2760
|
pageState,
|
|
2754
2761
|
componentId
|
|
@@ -2787,6 +2794,7 @@ var applyEditableParameters = ({
|
|
|
2787
2794
|
};
|
|
2788
2795
|
|
|
2789
2796
|
// src/components/Test.tsx
|
|
2797
|
+
import { ClientTest } from "@uniformdev/next-app-router-client";
|
|
2790
2798
|
import { createElement, Fragment } from "react";
|
|
2791
2799
|
|
|
2792
2800
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -2799,7 +2807,14 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
2799
2807
|
// src/components/Test.tsx
|
|
2800
2808
|
var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
2801
2809
|
var _a, _b, _c, _d, _e, _f;
|
|
2802
|
-
|
|
2810
|
+
if (typeof index !== "number") {
|
|
2811
|
+
return createElement(ClientTest, {
|
|
2812
|
+
slots,
|
|
2813
|
+
test,
|
|
2814
|
+
context: compositionContext
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
|
|
2803
2818
|
const event = {
|
|
2804
2819
|
name: test.name,
|
|
2805
2820
|
control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
|
|
@@ -3580,7 +3595,8 @@ var generatePossiblePageStates = ({
|
|
|
3580
3595
|
defaultConsent: void 0,
|
|
3581
3596
|
previewMode: void 0,
|
|
3582
3597
|
rules: void 0,
|
|
3583
|
-
locale
|
|
3598
|
+
locale,
|
|
3599
|
+
isPrefetch: void 0
|
|
3584
3600
|
};
|
|
3585
3601
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3586
3602
|
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
package/dist/index.js
CHANGED
|
@@ -347,7 +347,7 @@ async function handleRateLimits(callApi) {
|
|
|
347
347
|
}
|
|
348
348
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
349
349
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
350
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
350
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
351
351
|
backoffRetriesLeft -= 1;
|
|
352
352
|
}
|
|
353
353
|
return response;
|
|
@@ -2678,7 +2678,7 @@ var getRouteClient = (options) => {
|
|
|
2678
2678
|
|
|
2679
2679
|
// src/components/UniformComposition.tsx
|
|
2680
2680
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
2681
|
-
var
|
|
2681
|
+
var import_next_app_router_client5 = require("@uniformdev/next-app-router-client");
|
|
2682
2682
|
var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared");
|
|
2683
2683
|
var import_navigation = require("next/navigation");
|
|
2684
2684
|
var import_react6 = __toESM(require("react"));
|
|
@@ -2772,6 +2772,13 @@ var createTestComponentProps = ({
|
|
|
2772
2772
|
test
|
|
2773
2773
|
}) => {
|
|
2774
2774
|
var _a;
|
|
2775
|
+
if (pageState.isPrefetch) {
|
|
2776
|
+
return {
|
|
2777
|
+
...common,
|
|
2778
|
+
index: void 0,
|
|
2779
|
+
test
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2775
2782
|
const component = (0, import_next_app_router_shared2.resolveComponentFromPageState)({
|
|
2776
2783
|
pageState,
|
|
2777
2784
|
componentId
|
|
@@ -2810,6 +2817,7 @@ var applyEditableParameters = ({
|
|
|
2810
2817
|
};
|
|
2811
2818
|
|
|
2812
2819
|
// src/components/Test.tsx
|
|
2820
|
+
var import_next_app_router_client2 = require("@uniformdev/next-app-router-client");
|
|
2813
2821
|
var import_react2 = require("react");
|
|
2814
2822
|
|
|
2815
2823
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -2822,7 +2830,14 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
2822
2830
|
// src/components/Test.tsx
|
|
2823
2831
|
var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
2824
2832
|
var _a, _b, _c, _d, _e, _f;
|
|
2825
|
-
|
|
2833
|
+
if (typeof index !== "number") {
|
|
2834
|
+
return (0, import_react2.createElement)(import_next_app_router_client2.ClientTest, {
|
|
2835
|
+
slots,
|
|
2836
|
+
test,
|
|
2837
|
+
context: compositionContext
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
|
|
2826
2841
|
const event = {
|
|
2827
2842
|
name: test.name,
|
|
2828
2843
|
control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
|
|
@@ -2854,7 +2869,7 @@ var UniformCompositionWrapper = ({
|
|
|
2854
2869
|
};
|
|
2855
2870
|
|
|
2856
2871
|
// src/components/UniformContext.tsx
|
|
2857
|
-
var
|
|
2872
|
+
var import_next_app_router_client3 = require("@uniformdev/next-app-router-client");
|
|
2858
2873
|
var import_react4 = __toESM(require("react"));
|
|
2859
2874
|
|
|
2860
2875
|
// src/config/helpers.ts
|
|
@@ -2907,7 +2922,7 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2907
2922
|
dynamicInputs: route.dynamicInputs,
|
|
2908
2923
|
matchedRoute: route.matchedRoute
|
|
2909
2924
|
} : void 0;
|
|
2910
|
-
const ContextComponent = clientContextComponent ||
|
|
2925
|
+
const ContextComponent = clientContextComponent || import_next_app_router_client3.DefaultUniformClientContext;
|
|
2911
2926
|
const disableDevTools = getDisabledDevTools();
|
|
2912
2927
|
const defaultConsent = (_a = result == null ? void 0 : result.pageState.defaultConsent) != null ? _a : getDefaultConsent();
|
|
2913
2928
|
const experimentalQuirkSerialization = getQuirkSerialization();
|
|
@@ -2924,14 +2939,14 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2924
2939
|
};
|
|
2925
2940
|
|
|
2926
2941
|
// src/components/VisibilityRulesWrapper.tsx
|
|
2927
|
-
var
|
|
2942
|
+
var import_next_app_router_client4 = require("@uniformdev/next-app-router-client");
|
|
2928
2943
|
var import_react5 = __toESM(require("react"));
|
|
2929
2944
|
var VisibilityRulesWrapper = ({
|
|
2930
2945
|
parameter,
|
|
2931
2946
|
initialIsVisible,
|
|
2932
2947
|
children
|
|
2933
2948
|
}) => {
|
|
2934
|
-
return /* @__PURE__ */ import_react5.default.createElement(
|
|
2949
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_next_app_router_client4.VisibilityRulesWrapperClient, { parameter, initialIsVisible }, children);
|
|
2935
2950
|
};
|
|
2936
2951
|
|
|
2937
2952
|
// src/components/UniformComposition.tsx
|
|
@@ -2994,7 +3009,7 @@ async function UniformCompositionInner({
|
|
|
2994
3009
|
route
|
|
2995
3010
|
}
|
|
2996
3011
|
}
|
|
2997
|
-
)), (pageState.compositionState === CANVAS_EDITOR_STATE || pageState.compositionState === CANVAS_DRAFT_STATE) && /* @__PURE__ */ import_react6.default.createElement(
|
|
3012
|
+
)), (pageState.compositionState === CANVAS_EDITOR_STATE || pageState.compositionState === CANVAS_DRAFT_STATE) && /* @__PURE__ */ import_react6.default.createElement(import_next_app_router_client5.UniformScript, null));
|
|
2998
3013
|
}
|
|
2999
3014
|
var resolveComponents = ({
|
|
3000
3015
|
target,
|
|
@@ -3090,7 +3105,7 @@ var resolveComponents = ({
|
|
|
3090
3105
|
}
|
|
3091
3106
|
let tagElement = null;
|
|
3092
3107
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
3093
|
-
tagElement = (0, import_react6.createElement)(
|
|
3108
|
+
tagElement = (0, import_react6.createElement)(import_next_app_router_client5.ContextUpdateTransfer, {
|
|
3094
3109
|
key: `${slotName}-${componentIndex}-tags`,
|
|
3095
3110
|
update: {
|
|
3096
3111
|
enrichments: enrichmentTags
|
|
@@ -3165,7 +3180,7 @@ var createResolvedComponent = ({
|
|
|
3165
3180
|
componentId: component._id,
|
|
3166
3181
|
pageState
|
|
3167
3182
|
});
|
|
3168
|
-
return (0, import_react6.createElement)(
|
|
3183
|
+
return (0, import_react6.createElement)(import_next_app_router_client5.Personalize, { ...personalizeProps, key });
|
|
3169
3184
|
}
|
|
3170
3185
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
3171
3186
|
const extractedTest = extractTest({
|
|
@@ -3601,7 +3616,8 @@ var generatePossiblePageStates = ({
|
|
|
3601
3616
|
defaultConsent: void 0,
|
|
3602
3617
|
previewMode: void 0,
|
|
3603
3618
|
rules: void 0,
|
|
3604
|
-
locale
|
|
3619
|
+
locale,
|
|
3620
|
+
isPrefetch: void 0
|
|
3605
3621
|
};
|
|
3606
3622
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3607
3623
|
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
|
package/dist/index.mjs
CHANGED
|
@@ -320,7 +320,7 @@ async function handleRateLimits(callApi) {
|
|
|
320
320
|
}
|
|
321
321
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
322
322
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
323
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
323
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
324
324
|
backoffRetriesLeft -= 1;
|
|
325
325
|
}
|
|
326
326
|
return response;
|
|
@@ -2749,6 +2749,13 @@ var createTestComponentProps = ({
|
|
|
2749
2749
|
test
|
|
2750
2750
|
}) => {
|
|
2751
2751
|
var _a;
|
|
2752
|
+
if (pageState.isPrefetch) {
|
|
2753
|
+
return {
|
|
2754
|
+
...common,
|
|
2755
|
+
index: void 0,
|
|
2756
|
+
test
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2752
2759
|
const component = resolveComponentFromPageState({
|
|
2753
2760
|
pageState,
|
|
2754
2761
|
componentId
|
|
@@ -2787,6 +2794,7 @@ var applyEditableParameters = ({
|
|
|
2787
2794
|
};
|
|
2788
2795
|
|
|
2789
2796
|
// src/components/Test.tsx
|
|
2797
|
+
import { ClientTest } from "@uniformdev/next-app-router-client";
|
|
2790
2798
|
import { createElement, Fragment } from "react";
|
|
2791
2799
|
|
|
2792
2800
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -2799,7 +2807,14 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
2799
2807
|
// src/components/Test.tsx
|
|
2800
2808
|
var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
2801
2809
|
var _a, _b, _c, _d, _e, _f;
|
|
2802
|
-
|
|
2810
|
+
if (typeof index !== "number") {
|
|
2811
|
+
return createElement(ClientTest, {
|
|
2812
|
+
slots,
|
|
2813
|
+
test,
|
|
2814
|
+
context: compositionContext
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
|
|
2803
2818
|
const event = {
|
|
2804
2819
|
name: test.name,
|
|
2805
2820
|
control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
|
|
@@ -3580,7 +3595,8 @@ var generatePossiblePageStates = ({
|
|
|
3580
3595
|
defaultConsent: void 0,
|
|
3581
3596
|
previewMode: void 0,
|
|
3582
3597
|
rules: void 0,
|
|
3583
|
-
locale
|
|
3598
|
+
locale,
|
|
3599
|
+
isPrefetch: void 0
|
|
3584
3600
|
};
|
|
3585
3601
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3586
3602
|
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
package/dist/middleware.js
CHANGED
|
@@ -525,7 +525,7 @@ async function handleRateLimits(callApi) {
|
|
|
525
525
|
}
|
|
526
526
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
527
527
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
528
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
528
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
529
529
|
backoffRetriesLeft -= 1;
|
|
530
530
|
}
|
|
531
531
|
return response;
|
|
@@ -3047,7 +3047,8 @@ var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared
|
|
|
3047
3047
|
var evaluateRunnables = async ({
|
|
3048
3048
|
runnables,
|
|
3049
3049
|
context,
|
|
3050
|
-
compositionContext
|
|
3050
|
+
compositionContext,
|
|
3051
|
+
isPrefetch
|
|
3051
3052
|
}) => {
|
|
3052
3053
|
var _a;
|
|
3053
3054
|
const result = {
|
|
@@ -3057,6 +3058,9 @@ var evaluateRunnables = async ({
|
|
|
3057
3058
|
const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
|
|
3058
3059
|
let item;
|
|
3059
3060
|
while (item = runnablesToProcess.shift()) {
|
|
3061
|
+
if (item.type === "test" && isPrefetch) {
|
|
3062
|
+
continue;
|
|
3063
|
+
}
|
|
3060
3064
|
if (item.type === "test") {
|
|
3061
3065
|
const testResult = (0, import_next_app_router_shared4.evaluateTest)({
|
|
3062
3066
|
context,
|
|
@@ -5562,7 +5566,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5562
5566
|
searchParams: request.nextUrl.searchParams,
|
|
5563
5567
|
isDraftModeEnabled: true
|
|
5564
5568
|
// this is checked above
|
|
5565
|
-
})
|
|
5569
|
+
}),
|
|
5570
|
+
isPrefetch: false
|
|
5566
5571
|
});
|
|
5567
5572
|
const pageState = {
|
|
5568
5573
|
routePath: id,
|
|
@@ -5580,7 +5585,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5580
5585
|
// this is checked above
|
|
5581
5586
|
}),
|
|
5582
5587
|
rules,
|
|
5583
|
-
locale: options.locale
|
|
5588
|
+
locale: options.locale,
|
|
5589
|
+
isPrefetch: void 0
|
|
5584
5590
|
};
|
|
5585
5591
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5586
5592
|
payload: pageState
|
|
@@ -5629,7 +5635,7 @@ var handleRouteRequest = async ({
|
|
|
5629
5635
|
})
|
|
5630
5636
|
]);
|
|
5631
5637
|
if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
|
|
5632
|
-
return import_server.NextResponse.
|
|
5638
|
+
return import_server.NextResponse.rewrite(new URL("/404", request.url));
|
|
5633
5639
|
}
|
|
5634
5640
|
if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
|
|
5635
5641
|
return handleRedirect({ request, route: routeResult.route });
|
|
@@ -5681,8 +5687,10 @@ var handleRouteRequest = async ({
|
|
|
5681
5687
|
searchParams: request.nextUrl.searchParams,
|
|
5682
5688
|
isDraftModeEnabled: true
|
|
5683
5689
|
// this is checked above
|
|
5684
|
-
})
|
|
5690
|
+
}),
|
|
5691
|
+
isPrefetch: request.headers.get("Next-Router-Prefetch") === "1"
|
|
5685
5692
|
});
|
|
5693
|
+
const isPrefetch = request.headers.get("Next-Router-Prefetch") === "1";
|
|
5686
5694
|
const pageState = {
|
|
5687
5695
|
routePath,
|
|
5688
5696
|
compositionState: state,
|
|
@@ -5695,7 +5703,8 @@ var handleRouteRequest = async ({
|
|
|
5695
5703
|
}),
|
|
5696
5704
|
previewMode,
|
|
5697
5705
|
rules,
|
|
5698
|
-
locale: options.locale
|
|
5706
|
+
locale: options.locale,
|
|
5707
|
+
isPrefetch: isPrefetch || void 0
|
|
5699
5708
|
};
|
|
5700
5709
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5701
5710
|
payload: pageState
|
|
@@ -5725,12 +5734,14 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5725
5734
|
releaseId,
|
|
5726
5735
|
defaultConsent,
|
|
5727
5736
|
keys,
|
|
5728
|
-
previewMode
|
|
5737
|
+
previewMode,
|
|
5738
|
+
isPrefetch
|
|
5729
5739
|
}) => {
|
|
5730
5740
|
const extracted = extractRunnables(composition);
|
|
5731
5741
|
const result = await evaluateRunnables({
|
|
5732
5742
|
runnables: extracted,
|
|
5733
5743
|
context,
|
|
5744
|
+
isPrefetch,
|
|
5734
5745
|
compositionContext: {
|
|
5735
5746
|
_id: composition._id,
|
|
5736
5747
|
type: composition.type,
|
|
@@ -5748,7 +5759,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5748
5759
|
defaultConsent,
|
|
5749
5760
|
previewMode,
|
|
5750
5761
|
rules: void 0,
|
|
5751
|
-
locale: void 0
|
|
5762
|
+
locale: void 0,
|
|
5763
|
+
isPrefetch: isPrefetch || void 0
|
|
5752
5764
|
}
|
|
5753
5765
|
}
|
|
5754
5766
|
});
|
package/dist/middleware.mjs
CHANGED
|
@@ -510,7 +510,7 @@ async function handleRateLimits(callApi) {
|
|
|
510
510
|
}
|
|
511
511
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
512
512
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
513
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
513
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
514
514
|
backoffRetriesLeft -= 1;
|
|
515
515
|
}
|
|
516
516
|
return response;
|
|
@@ -3039,7 +3039,8 @@ import {
|
|
|
3039
3039
|
var evaluateRunnables = async ({
|
|
3040
3040
|
runnables,
|
|
3041
3041
|
context,
|
|
3042
|
-
compositionContext
|
|
3042
|
+
compositionContext,
|
|
3043
|
+
isPrefetch
|
|
3043
3044
|
}) => {
|
|
3044
3045
|
var _a;
|
|
3045
3046
|
const result = {
|
|
@@ -3049,6 +3050,9 @@ var evaluateRunnables = async ({
|
|
|
3049
3050
|
const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
|
|
3050
3051
|
let item;
|
|
3051
3052
|
while (item = runnablesToProcess.shift()) {
|
|
3053
|
+
if (item.type === "test" && isPrefetch) {
|
|
3054
|
+
continue;
|
|
3055
|
+
}
|
|
3052
3056
|
if (item.type === "test") {
|
|
3053
3057
|
const testResult = evaluateTest({
|
|
3054
3058
|
context,
|
|
@@ -5554,7 +5558,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5554
5558
|
searchParams: request.nextUrl.searchParams,
|
|
5555
5559
|
isDraftModeEnabled: true
|
|
5556
5560
|
// this is checked above
|
|
5557
|
-
})
|
|
5561
|
+
}),
|
|
5562
|
+
isPrefetch: false
|
|
5558
5563
|
});
|
|
5559
5564
|
const pageState = {
|
|
5560
5565
|
routePath: id,
|
|
@@ -5572,7 +5577,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5572
5577
|
// this is checked above
|
|
5573
5578
|
}),
|
|
5574
5579
|
rules,
|
|
5575
|
-
locale: options.locale
|
|
5580
|
+
locale: options.locale,
|
|
5581
|
+
isPrefetch: void 0
|
|
5576
5582
|
};
|
|
5577
5583
|
const code = serializeEvaluationResult({
|
|
5578
5584
|
payload: pageState
|
|
@@ -5621,7 +5627,7 @@ var handleRouteRequest = async ({
|
|
|
5621
5627
|
})
|
|
5622
5628
|
]);
|
|
5623
5629
|
if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
|
|
5624
|
-
return NextResponse.
|
|
5630
|
+
return NextResponse.rewrite(new URL("/404", request.url));
|
|
5625
5631
|
}
|
|
5626
5632
|
if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
|
|
5627
5633
|
return handleRedirect({ request, route: routeResult.route });
|
|
@@ -5673,8 +5679,10 @@ var handleRouteRequest = async ({
|
|
|
5673
5679
|
searchParams: request.nextUrl.searchParams,
|
|
5674
5680
|
isDraftModeEnabled: true
|
|
5675
5681
|
// this is checked above
|
|
5676
|
-
})
|
|
5682
|
+
}),
|
|
5683
|
+
isPrefetch: request.headers.get("Next-Router-Prefetch") === "1"
|
|
5677
5684
|
});
|
|
5685
|
+
const isPrefetch = request.headers.get("Next-Router-Prefetch") === "1";
|
|
5678
5686
|
const pageState = {
|
|
5679
5687
|
routePath,
|
|
5680
5688
|
compositionState: state,
|
|
@@ -5687,7 +5695,8 @@ var handleRouteRequest = async ({
|
|
|
5687
5695
|
}),
|
|
5688
5696
|
previewMode,
|
|
5689
5697
|
rules,
|
|
5690
|
-
locale: options.locale
|
|
5698
|
+
locale: options.locale,
|
|
5699
|
+
isPrefetch: isPrefetch || void 0
|
|
5691
5700
|
};
|
|
5692
5701
|
const code = serializeEvaluationResult({
|
|
5693
5702
|
payload: pageState
|
|
@@ -5717,12 +5726,14 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5717
5726
|
releaseId,
|
|
5718
5727
|
defaultConsent,
|
|
5719
5728
|
keys,
|
|
5720
|
-
previewMode
|
|
5729
|
+
previewMode,
|
|
5730
|
+
isPrefetch
|
|
5721
5731
|
}) => {
|
|
5722
5732
|
const extracted = extractRunnables(composition);
|
|
5723
5733
|
const result = await evaluateRunnables({
|
|
5724
5734
|
runnables: extracted,
|
|
5725
5735
|
context,
|
|
5736
|
+
isPrefetch,
|
|
5726
5737
|
compositionContext: {
|
|
5727
5738
|
_id: composition._id,
|
|
5728
5739
|
type: composition.type,
|
|
@@ -5740,7 +5751,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5740
5751
|
defaultConsent,
|
|
5741
5752
|
previewMode,
|
|
5742
5753
|
rules: void 0,
|
|
5743
|
-
locale: void 0
|
|
5754
|
+
locale: void 0,
|
|
5755
|
+
isPrefetch: isPrefetch || void 0
|
|
5744
5756
|
}
|
|
5745
5757
|
}
|
|
5746
5758
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.50.1-alpha.1+b0bc8e0346",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"vitest": "3.2.4"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@uniformdev/canvas-react": "20.
|
|
103
|
-
"@uniformdev/next-app-router-client": "20.
|
|
104
|
-
"@uniformdev/next-app-router-shared": "20.
|
|
105
|
-
"@uniformdev/redirect": "20.
|
|
106
|
-
"@uniformdev/richtext": "20.
|
|
107
|
-
"@uniformdev/webhooks": "20.
|
|
102
|
+
"@uniformdev/canvas-react": "20.50.1-alpha.1+b0bc8e0346",
|
|
103
|
+
"@uniformdev/next-app-router-client": "20.50.1-alpha.1+b0bc8e0346",
|
|
104
|
+
"@uniformdev/next-app-router-shared": "20.50.1-alpha.1+b0bc8e0346",
|
|
105
|
+
"@uniformdev/redirect": "20.50.1-alpha.1+b0bc8e0346",
|
|
106
|
+
"@uniformdev/richtext": "20.50.1-alpha.1+b0bc8e0346",
|
|
107
|
+
"@uniformdev/webhooks": "20.50.1-alpha.1+b0bc8e0346",
|
|
108
108
|
"@vercel/functions": "^2.2.2",
|
|
109
109
|
"encoding": "^0.1.13",
|
|
110
110
|
"server-only": "^0.0.1",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"publishConfig": {
|
|
122
122
|
"access": "public"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "b0bc8e034642a423b0309bfed8be51f7966aa5d6"
|
|
125
125
|
}
|