@uniformdev/next-app-router 20.56.1-alpha.21 → 20.56.2-alpha.5
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 +20 -6
- package/dist/cache.mjs +20 -6
- package/dist/handler.js +6 -1
- package/dist/handler.mjs +6 -1
- package/dist/index.esm.js +23 -8
- package/dist/index.js +23 -8
- package/dist/index.mjs +23 -8
- package/dist/middleware.js +30 -12
- package/dist/middleware.mjs +30 -12
- package/package.json +8 -8
package/dist/cache.js
CHANGED
|
@@ -1412,8 +1412,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1412
1412
|
var isDevelopmentEnvironment = () => {
|
|
1413
1413
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1414
1414
|
};
|
|
1415
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1416
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1417
|
+
return isNotPublished ? true : void 0;
|
|
1418
|
+
};
|
|
1415
1419
|
|
|
1416
1420
|
// src/clients/cache.ts
|
|
1421
|
+
var isSpecificCacheMode = (options) => {
|
|
1422
|
+
return "cache" in options;
|
|
1423
|
+
};
|
|
1417
1424
|
var isStateCacheMode = (options) => {
|
|
1418
1425
|
return "state" in options;
|
|
1419
1426
|
};
|
|
@@ -1435,7 +1442,9 @@ var resolveCache = ({
|
|
|
1435
1442
|
}) => {
|
|
1436
1443
|
let cache = void 0;
|
|
1437
1444
|
if (options) {
|
|
1438
|
-
if (
|
|
1445
|
+
if (isSpecificCacheMode(options)) {
|
|
1446
|
+
cache = options.cache;
|
|
1447
|
+
} else if (isStateCacheMode(options)) {
|
|
1439
1448
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1440
1449
|
cache = {
|
|
1441
1450
|
type: "no-cache",
|
|
@@ -1755,7 +1764,10 @@ var DefaultDataClient = class {
|
|
|
1755
1764
|
}
|
|
1756
1765
|
}
|
|
1757
1766
|
const manifest = await getManifest({
|
|
1758
|
-
cache: {
|
|
1767
|
+
cache: isDevelopmentEnvironment() ? {
|
|
1768
|
+
type: "no-cache",
|
|
1769
|
+
bypassCache: true
|
|
1770
|
+
} : {
|
|
1759
1771
|
type: "force-cache"
|
|
1760
1772
|
}
|
|
1761
1773
|
});
|
|
@@ -1858,12 +1870,13 @@ var DefaultDataClient = class {
|
|
|
1858
1870
|
};
|
|
1859
1871
|
}
|
|
1860
1872
|
async getRoutePageState(options) {
|
|
1873
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
1861
1874
|
const routeClient = getRouteClient({
|
|
1862
|
-
cache:
|
|
1863
|
-
type: "force-cache"
|
|
1864
|
-
} : {
|
|
1875
|
+
cache: shouldBypassCache ? {
|
|
1865
1876
|
type: "no-cache",
|
|
1866
1877
|
bypassCache: true
|
|
1878
|
+
} : {
|
|
1879
|
+
type: "force-cache"
|
|
1867
1880
|
}
|
|
1868
1881
|
});
|
|
1869
1882
|
const originalRoute = {
|
|
@@ -1871,7 +1884,8 @@ var DefaultDataClient = class {
|
|
|
1871
1884
|
state: options.pageState.compositionState,
|
|
1872
1885
|
withComponentIDs: true,
|
|
1873
1886
|
releaseId: options.pageState.releaseId,
|
|
1874
|
-
locale: options.pageState.locale
|
|
1887
|
+
locale: options.pageState.locale,
|
|
1888
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
1875
1889
|
};
|
|
1876
1890
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1877
1891
|
source: "pageState",
|
package/dist/cache.mjs
CHANGED
|
@@ -1399,8 +1399,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1399
1399
|
var isDevelopmentEnvironment = () => {
|
|
1400
1400
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1401
1401
|
};
|
|
1402
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1403
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1404
|
+
return isNotPublished ? true : void 0;
|
|
1405
|
+
};
|
|
1402
1406
|
|
|
1403
1407
|
// src/clients/cache.ts
|
|
1408
|
+
var isSpecificCacheMode = (options) => {
|
|
1409
|
+
return "cache" in options;
|
|
1410
|
+
};
|
|
1404
1411
|
var isStateCacheMode = (options) => {
|
|
1405
1412
|
return "state" in options;
|
|
1406
1413
|
};
|
|
@@ -1422,7 +1429,9 @@ var resolveCache = ({
|
|
|
1422
1429
|
}) => {
|
|
1423
1430
|
let cache = void 0;
|
|
1424
1431
|
if (options) {
|
|
1425
|
-
if (
|
|
1432
|
+
if (isSpecificCacheMode(options)) {
|
|
1433
|
+
cache = options.cache;
|
|
1434
|
+
} else if (isStateCacheMode(options)) {
|
|
1426
1435
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1427
1436
|
cache = {
|
|
1428
1437
|
type: "no-cache",
|
|
@@ -1742,7 +1751,10 @@ var DefaultDataClient = class {
|
|
|
1742
1751
|
}
|
|
1743
1752
|
}
|
|
1744
1753
|
const manifest = await getManifest({
|
|
1745
|
-
cache: {
|
|
1754
|
+
cache: isDevelopmentEnvironment() ? {
|
|
1755
|
+
type: "no-cache",
|
|
1756
|
+
bypassCache: true
|
|
1757
|
+
} : {
|
|
1746
1758
|
type: "force-cache"
|
|
1747
1759
|
}
|
|
1748
1760
|
});
|
|
@@ -1845,12 +1857,13 @@ var DefaultDataClient = class {
|
|
|
1845
1857
|
};
|
|
1846
1858
|
}
|
|
1847
1859
|
async getRoutePageState(options) {
|
|
1860
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
1848
1861
|
const routeClient = getRouteClient({
|
|
1849
|
-
cache:
|
|
1850
|
-
type: "force-cache"
|
|
1851
|
-
} : {
|
|
1862
|
+
cache: shouldBypassCache ? {
|
|
1852
1863
|
type: "no-cache",
|
|
1853
1864
|
bypassCache: true
|
|
1865
|
+
} : {
|
|
1866
|
+
type: "force-cache"
|
|
1854
1867
|
}
|
|
1855
1868
|
});
|
|
1856
1869
|
const originalRoute = {
|
|
@@ -1858,7 +1871,8 @@ var DefaultDataClient = class {
|
|
|
1858
1871
|
state: options.pageState.compositionState,
|
|
1859
1872
|
withComponentIDs: true,
|
|
1860
1873
|
releaseId: options.pageState.releaseId,
|
|
1861
|
-
locale: options.pageState.locale
|
|
1874
|
+
locale: options.pageState.locale,
|
|
1875
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
1862
1876
|
};
|
|
1863
1877
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1864
1878
|
source: "pageState",
|
package/dist/handler.js
CHANGED
|
@@ -1786,6 +1786,9 @@ var isDevelopmentEnvironment = () => {
|
|
|
1786
1786
|
};
|
|
1787
1787
|
|
|
1788
1788
|
// src/clients/cache.ts
|
|
1789
|
+
var isSpecificCacheMode = (options) => {
|
|
1790
|
+
return "cache" in options;
|
|
1791
|
+
};
|
|
1789
1792
|
var isStateCacheMode = (options) => {
|
|
1790
1793
|
return "state" in options;
|
|
1791
1794
|
};
|
|
@@ -1807,7 +1810,9 @@ var resolveCache = ({
|
|
|
1807
1810
|
}) => {
|
|
1808
1811
|
let cache = void 0;
|
|
1809
1812
|
if (options) {
|
|
1810
|
-
if (
|
|
1813
|
+
if (isSpecificCacheMode(options)) {
|
|
1814
|
+
cache = options.cache;
|
|
1815
|
+
} else if (isStateCacheMode(options)) {
|
|
1811
1816
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1812
1817
|
cache = {
|
|
1813
1818
|
type: "no-cache",
|
package/dist/handler.mjs
CHANGED
|
@@ -1771,6 +1771,9 @@ var isDevelopmentEnvironment = () => {
|
|
|
1771
1771
|
};
|
|
1772
1772
|
|
|
1773
1773
|
// src/clients/cache.ts
|
|
1774
|
+
var isSpecificCacheMode = (options) => {
|
|
1775
|
+
return "cache" in options;
|
|
1776
|
+
};
|
|
1774
1777
|
var isStateCacheMode = (options) => {
|
|
1775
1778
|
return "state" in options;
|
|
1776
1779
|
};
|
|
@@ -1792,7 +1795,9 @@ var resolveCache = ({
|
|
|
1792
1795
|
}) => {
|
|
1793
1796
|
let cache = void 0;
|
|
1794
1797
|
if (options) {
|
|
1795
|
-
if (
|
|
1798
|
+
if (isSpecificCacheMode(options)) {
|
|
1799
|
+
cache = options.cache;
|
|
1800
|
+
} else if (isStateCacheMode(options)) {
|
|
1796
1801
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1797
1802
|
cache = {
|
|
1798
1803
|
type: "no-cache",
|
package/dist/index.esm.js
CHANGED
|
@@ -1991,8 +1991,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1991
1991
|
var isDevelopmentEnvironment = () => {
|
|
1992
1992
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1993
1993
|
};
|
|
1994
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1995
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1996
|
+
return isNotPublished ? true : void 0;
|
|
1997
|
+
};
|
|
1994
1998
|
|
|
1995
1999
|
// src/clients/cache.ts
|
|
2000
|
+
var isSpecificCacheMode = (options) => {
|
|
2001
|
+
return "cache" in options;
|
|
2002
|
+
};
|
|
1996
2003
|
var isStateCacheMode = (options) => {
|
|
1997
2004
|
return "state" in options;
|
|
1998
2005
|
};
|
|
@@ -2019,7 +2026,9 @@ var resolveCache = ({
|
|
|
2019
2026
|
}) => {
|
|
2020
2027
|
let cache2 = void 0;
|
|
2021
2028
|
if (options) {
|
|
2022
|
-
if (
|
|
2029
|
+
if (isSpecificCacheMode(options)) {
|
|
2030
|
+
cache2 = options.cache;
|
|
2031
|
+
} else if (isStateCacheMode(options)) {
|
|
2023
2032
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2024
2033
|
cache2 = {
|
|
2025
2034
|
type: "no-cache",
|
|
@@ -2775,7 +2784,7 @@ var createTestComponentProps = ({
|
|
|
2775
2784
|
const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
|
|
2776
2785
|
return {
|
|
2777
2786
|
...common,
|
|
2778
|
-
index: testIndex
|
|
2787
|
+
index: testIndex,
|
|
2779
2788
|
test
|
|
2780
2789
|
};
|
|
2781
2790
|
};
|
|
@@ -3610,8 +3619,9 @@ var generatePossiblePageStates = ({
|
|
|
3610
3619
|
locale,
|
|
3611
3620
|
isPrefetch: void 0
|
|
3612
3621
|
};
|
|
3622
|
+
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3613
3623
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3614
|
-
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
|
3624
|
+
return allStates.map((payload) => serializeEvaluationResult({ payload, allComponentIds }));
|
|
3615
3625
|
};
|
|
3616
3626
|
function permutationsWithoutRepetition(options, k) {
|
|
3617
3627
|
if (k === 0) return [[]];
|
|
@@ -3660,7 +3670,10 @@ var DefaultDataClient = class {
|
|
|
3660
3670
|
}
|
|
3661
3671
|
}
|
|
3662
3672
|
const manifest = await getManifest({
|
|
3663
|
-
cache: {
|
|
3673
|
+
cache: isDevelopmentEnvironment() ? {
|
|
3674
|
+
type: "no-cache",
|
|
3675
|
+
bypassCache: true
|
|
3676
|
+
} : {
|
|
3664
3677
|
type: "force-cache"
|
|
3665
3678
|
}
|
|
3666
3679
|
});
|
|
@@ -3763,12 +3776,13 @@ var DefaultDataClient = class {
|
|
|
3763
3776
|
};
|
|
3764
3777
|
}
|
|
3765
3778
|
async getRoutePageState(options) {
|
|
3779
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
3766
3780
|
const routeClient = getRouteClient({
|
|
3767
|
-
cache:
|
|
3768
|
-
type: "force-cache"
|
|
3769
|
-
} : {
|
|
3781
|
+
cache: shouldBypassCache ? {
|
|
3770
3782
|
type: "no-cache",
|
|
3771
3783
|
bypassCache: true
|
|
3784
|
+
} : {
|
|
3785
|
+
type: "force-cache"
|
|
3772
3786
|
}
|
|
3773
3787
|
});
|
|
3774
3788
|
const originalRoute = {
|
|
@@ -3776,7 +3790,8 @@ var DefaultDataClient = class {
|
|
|
3776
3790
|
state: options.pageState.compositionState,
|
|
3777
3791
|
withComponentIDs: true,
|
|
3778
3792
|
releaseId: options.pageState.releaseId,
|
|
3779
|
-
locale: options.pageState.locale
|
|
3793
|
+
locale: options.pageState.locale,
|
|
3794
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
3780
3795
|
};
|
|
3781
3796
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3782
3797
|
source: "pageState",
|
package/dist/index.js
CHANGED
|
@@ -2018,8 +2018,15 @@ var isIncontextEditingEnabled = ({
|
|
|
2018
2018
|
var isDevelopmentEnvironment = () => {
|
|
2019
2019
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
2020
2020
|
};
|
|
2021
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
2022
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
2023
|
+
return isNotPublished ? true : void 0;
|
|
2024
|
+
};
|
|
2021
2025
|
|
|
2022
2026
|
// src/clients/cache.ts
|
|
2027
|
+
var isSpecificCacheMode = (options) => {
|
|
2028
|
+
return "cache" in options;
|
|
2029
|
+
};
|
|
2023
2030
|
var isStateCacheMode = (options) => {
|
|
2024
2031
|
return "state" in options;
|
|
2025
2032
|
};
|
|
@@ -2046,7 +2053,9 @@ var resolveCache = ({
|
|
|
2046
2053
|
}) => {
|
|
2047
2054
|
let cache2 = void 0;
|
|
2048
2055
|
if (options) {
|
|
2049
|
-
if (
|
|
2056
|
+
if (isSpecificCacheMode(options)) {
|
|
2057
|
+
cache2 = options.cache;
|
|
2058
|
+
} else if (isStateCacheMode(options)) {
|
|
2050
2059
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2051
2060
|
cache2 = {
|
|
2052
2061
|
type: "no-cache",
|
|
@@ -2798,7 +2807,7 @@ var createTestComponentProps = ({
|
|
|
2798
2807
|
const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
|
|
2799
2808
|
return {
|
|
2800
2809
|
...common,
|
|
2801
|
-
index: testIndex
|
|
2810
|
+
index: testIndex,
|
|
2802
2811
|
test
|
|
2803
2812
|
};
|
|
2804
2813
|
};
|
|
@@ -3631,8 +3640,9 @@ var generatePossiblePageStates = ({
|
|
|
3631
3640
|
locale,
|
|
3632
3641
|
isPrefetch: void 0
|
|
3633
3642
|
};
|
|
3643
|
+
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3634
3644
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3635
|
-
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
|
|
3645
|
+
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload, allComponentIds }));
|
|
3636
3646
|
};
|
|
3637
3647
|
function permutationsWithoutRepetition(options, k) {
|
|
3638
3648
|
if (k === 0) return [[]];
|
|
@@ -3681,7 +3691,10 @@ var DefaultDataClient = class {
|
|
|
3681
3691
|
}
|
|
3682
3692
|
}
|
|
3683
3693
|
const manifest = await getManifest({
|
|
3684
|
-
cache: {
|
|
3694
|
+
cache: isDevelopmentEnvironment() ? {
|
|
3695
|
+
type: "no-cache",
|
|
3696
|
+
bypassCache: true
|
|
3697
|
+
} : {
|
|
3685
3698
|
type: "force-cache"
|
|
3686
3699
|
}
|
|
3687
3700
|
});
|
|
@@ -3784,12 +3797,13 @@ var DefaultDataClient = class {
|
|
|
3784
3797
|
};
|
|
3785
3798
|
}
|
|
3786
3799
|
async getRoutePageState(options) {
|
|
3800
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
3787
3801
|
const routeClient = getRouteClient({
|
|
3788
|
-
cache:
|
|
3789
|
-
type: "force-cache"
|
|
3790
|
-
} : {
|
|
3802
|
+
cache: shouldBypassCache ? {
|
|
3791
3803
|
type: "no-cache",
|
|
3792
3804
|
bypassCache: true
|
|
3805
|
+
} : {
|
|
3806
|
+
type: "force-cache"
|
|
3793
3807
|
}
|
|
3794
3808
|
});
|
|
3795
3809
|
const originalRoute = {
|
|
@@ -3797,7 +3811,8 @@ var DefaultDataClient = class {
|
|
|
3797
3811
|
state: options.pageState.compositionState,
|
|
3798
3812
|
withComponentIDs: true,
|
|
3799
3813
|
releaseId: options.pageState.releaseId,
|
|
3800
|
-
locale: options.pageState.locale
|
|
3814
|
+
locale: options.pageState.locale,
|
|
3815
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
3801
3816
|
};
|
|
3802
3817
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3803
3818
|
source: "pageState",
|
package/dist/index.mjs
CHANGED
|
@@ -1991,8 +1991,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1991
1991
|
var isDevelopmentEnvironment = () => {
|
|
1992
1992
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1993
1993
|
};
|
|
1994
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1995
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1996
|
+
return isNotPublished ? true : void 0;
|
|
1997
|
+
};
|
|
1994
1998
|
|
|
1995
1999
|
// src/clients/cache.ts
|
|
2000
|
+
var isSpecificCacheMode = (options) => {
|
|
2001
|
+
return "cache" in options;
|
|
2002
|
+
};
|
|
1996
2003
|
var isStateCacheMode = (options) => {
|
|
1997
2004
|
return "state" in options;
|
|
1998
2005
|
};
|
|
@@ -2019,7 +2026,9 @@ var resolveCache = ({
|
|
|
2019
2026
|
}) => {
|
|
2020
2027
|
let cache2 = void 0;
|
|
2021
2028
|
if (options) {
|
|
2022
|
-
if (
|
|
2029
|
+
if (isSpecificCacheMode(options)) {
|
|
2030
|
+
cache2 = options.cache;
|
|
2031
|
+
} else if (isStateCacheMode(options)) {
|
|
2023
2032
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2024
2033
|
cache2 = {
|
|
2025
2034
|
type: "no-cache",
|
|
@@ -2775,7 +2784,7 @@ var createTestComponentProps = ({
|
|
|
2775
2784
|
const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
|
|
2776
2785
|
return {
|
|
2777
2786
|
...common,
|
|
2778
|
-
index: testIndex
|
|
2787
|
+
index: testIndex,
|
|
2779
2788
|
test
|
|
2780
2789
|
};
|
|
2781
2790
|
};
|
|
@@ -3610,8 +3619,9 @@ var generatePossiblePageStates = ({
|
|
|
3610
3619
|
locale,
|
|
3611
3620
|
isPrefetch: void 0
|
|
3612
3621
|
};
|
|
3622
|
+
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3613
3623
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3614
|
-
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
|
3624
|
+
return allStates.map((payload) => serializeEvaluationResult({ payload, allComponentIds }));
|
|
3615
3625
|
};
|
|
3616
3626
|
function permutationsWithoutRepetition(options, k) {
|
|
3617
3627
|
if (k === 0) return [[]];
|
|
@@ -3660,7 +3670,10 @@ var DefaultDataClient = class {
|
|
|
3660
3670
|
}
|
|
3661
3671
|
}
|
|
3662
3672
|
const manifest = await getManifest({
|
|
3663
|
-
cache: {
|
|
3673
|
+
cache: isDevelopmentEnvironment() ? {
|
|
3674
|
+
type: "no-cache",
|
|
3675
|
+
bypassCache: true
|
|
3676
|
+
} : {
|
|
3664
3677
|
type: "force-cache"
|
|
3665
3678
|
}
|
|
3666
3679
|
});
|
|
@@ -3763,12 +3776,13 @@ var DefaultDataClient = class {
|
|
|
3763
3776
|
};
|
|
3764
3777
|
}
|
|
3765
3778
|
async getRoutePageState(options) {
|
|
3779
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
3766
3780
|
const routeClient = getRouteClient({
|
|
3767
|
-
cache:
|
|
3768
|
-
type: "force-cache"
|
|
3769
|
-
} : {
|
|
3781
|
+
cache: shouldBypassCache ? {
|
|
3770
3782
|
type: "no-cache",
|
|
3771
3783
|
bypassCache: true
|
|
3784
|
+
} : {
|
|
3785
|
+
type: "force-cache"
|
|
3772
3786
|
}
|
|
3773
3787
|
});
|
|
3774
3788
|
const originalRoute = {
|
|
@@ -3776,7 +3790,8 @@ var DefaultDataClient = class {
|
|
|
3776
3790
|
state: options.pageState.compositionState,
|
|
3777
3791
|
withComponentIDs: true,
|
|
3778
3792
|
releaseId: options.pageState.releaseId,
|
|
3779
|
-
locale: options.pageState.locale
|
|
3793
|
+
locale: options.pageState.locale,
|
|
3794
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
3780
3795
|
};
|
|
3781
3796
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3782
3797
|
source: "pageState",
|
package/dist/middleware.js
CHANGED
|
@@ -2351,8 +2351,15 @@ var isIncontextEditingEnabled = ({
|
|
|
2351
2351
|
var isDevelopmentEnvironment = () => {
|
|
2352
2352
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
2353
2353
|
};
|
|
2354
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
2355
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
2356
|
+
return isNotPublished ? true : void 0;
|
|
2357
|
+
};
|
|
2354
2358
|
|
|
2355
2359
|
// src/clients/cache.ts
|
|
2360
|
+
var isSpecificCacheMode = (options) => {
|
|
2361
|
+
return "cache" in options;
|
|
2362
|
+
};
|
|
2356
2363
|
var isStateCacheMode = (options) => {
|
|
2357
2364
|
return "state" in options;
|
|
2358
2365
|
};
|
|
@@ -2374,7 +2381,9 @@ var resolveCache = ({
|
|
|
2374
2381
|
}) => {
|
|
2375
2382
|
let cache = void 0;
|
|
2376
2383
|
if (options) {
|
|
2377
|
-
if (
|
|
2384
|
+
if (isSpecificCacheMode(options)) {
|
|
2385
|
+
cache = options.cache;
|
|
2386
|
+
} else if (isStateCacheMode(options)) {
|
|
2378
2387
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2379
2388
|
cache = {
|
|
2380
2389
|
type: "no-cache",
|
|
@@ -2769,7 +2778,10 @@ var DefaultDataClient = class {
|
|
|
2769
2778
|
}
|
|
2770
2779
|
}
|
|
2771
2780
|
const manifest = await getManifest({
|
|
2772
|
-
cache: {
|
|
2781
|
+
cache: isDevelopmentEnvironment() ? {
|
|
2782
|
+
type: "no-cache",
|
|
2783
|
+
bypassCache: true
|
|
2784
|
+
} : {
|
|
2773
2785
|
type: "force-cache"
|
|
2774
2786
|
}
|
|
2775
2787
|
});
|
|
@@ -2872,12 +2884,13 @@ var DefaultDataClient = class {
|
|
|
2872
2884
|
};
|
|
2873
2885
|
}
|
|
2874
2886
|
async getRoutePageState(options) {
|
|
2887
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
2875
2888
|
const routeClient = getRouteClient({
|
|
2876
|
-
cache:
|
|
2877
|
-
type: "force-cache"
|
|
2878
|
-
} : {
|
|
2889
|
+
cache: shouldBypassCache ? {
|
|
2879
2890
|
type: "no-cache",
|
|
2880
2891
|
bypassCache: true
|
|
2892
|
+
} : {
|
|
2893
|
+
type: "force-cache"
|
|
2881
2894
|
}
|
|
2882
2895
|
});
|
|
2883
2896
|
const originalRoute = {
|
|
@@ -2885,7 +2898,8 @@ var DefaultDataClient = class {
|
|
|
2885
2898
|
state: options.pageState.compositionState,
|
|
2886
2899
|
withComponentIDs: true,
|
|
2887
2900
|
releaseId: options.pageState.releaseId,
|
|
2888
|
-
locale: options.pageState.locale
|
|
2901
|
+
locale: options.pageState.locale,
|
|
2902
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
2889
2903
|
};
|
|
2890
2904
|
const resolvedRoute = await this.getRouteFromApi({
|
|
2891
2905
|
source: "pageState",
|
|
@@ -5434,7 +5448,8 @@ var retrieveRouteByPath = async ({
|
|
|
5434
5448
|
withComponentIDs: true,
|
|
5435
5449
|
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5436
5450
|
releaseId,
|
|
5437
|
-
locale
|
|
5451
|
+
locale,
|
|
5452
|
+
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
5438
5453
|
}
|
|
5439
5454
|
});
|
|
5440
5455
|
};
|
|
@@ -5561,7 +5576,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5561
5576
|
})
|
|
5562
5577
|
});
|
|
5563
5578
|
const context = await onDemandContext.getContext();
|
|
5564
|
-
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5579
|
+
const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
|
|
5565
5580
|
composition: composition.composition,
|
|
5566
5581
|
routePath: id,
|
|
5567
5582
|
state: composition.state,
|
|
@@ -5601,7 +5616,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5601
5616
|
isPrefetch: void 0
|
|
5602
5617
|
};
|
|
5603
5618
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5604
|
-
payload: pageState
|
|
5619
|
+
payload: pageState,
|
|
5620
|
+
allComponentIds
|
|
5605
5621
|
});
|
|
5606
5622
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
|
|
5607
5623
|
if (!pathToRewriteTo) {
|
|
@@ -5683,7 +5699,7 @@ var handleRouteRequest = async ({
|
|
|
5683
5699
|
isDraftModeEnabled: draftModeEnabled
|
|
5684
5700
|
});
|
|
5685
5701
|
const isPrefetch = isPrefetchRequest(request);
|
|
5686
|
-
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5702
|
+
const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
|
|
5687
5703
|
composition: route.compositionApiResponse.composition,
|
|
5688
5704
|
routePath,
|
|
5689
5705
|
state,
|
|
@@ -5719,7 +5735,8 @@ var handleRouteRequest = async ({
|
|
|
5719
5735
|
isPrefetch: isPrefetch || void 0
|
|
5720
5736
|
};
|
|
5721
5737
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5722
|
-
payload: pageState
|
|
5738
|
+
payload: pageState,
|
|
5739
|
+
allComponentIds
|
|
5723
5740
|
});
|
|
5724
5741
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5725
5742
|
if (!pathToRewriteTo) {
|
|
@@ -5779,7 +5796,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5779
5796
|
}
|
|
5780
5797
|
}
|
|
5781
5798
|
});
|
|
5782
|
-
|
|
5799
|
+
const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
5800
|
+
return { ...result, allComponentIds };
|
|
5783
5801
|
};
|
|
5784
5802
|
var handleRedirect = ({ request, route }) => {
|
|
5785
5803
|
const href = resolveRedirectHref({
|
package/dist/middleware.mjs
CHANGED
|
@@ -2338,8 +2338,15 @@ var isIncontextEditingEnabled = ({
|
|
|
2338
2338
|
var isDevelopmentEnvironment = () => {
|
|
2339
2339
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
2340
2340
|
};
|
|
2341
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
2342
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
2343
|
+
return isNotPublished ? true : void 0;
|
|
2344
|
+
};
|
|
2341
2345
|
|
|
2342
2346
|
// src/clients/cache.ts
|
|
2347
|
+
var isSpecificCacheMode = (options) => {
|
|
2348
|
+
return "cache" in options;
|
|
2349
|
+
};
|
|
2343
2350
|
var isStateCacheMode = (options) => {
|
|
2344
2351
|
return "state" in options;
|
|
2345
2352
|
};
|
|
@@ -2361,7 +2368,9 @@ var resolveCache = ({
|
|
|
2361
2368
|
}) => {
|
|
2362
2369
|
let cache = void 0;
|
|
2363
2370
|
if (options) {
|
|
2364
|
-
if (
|
|
2371
|
+
if (isSpecificCacheMode(options)) {
|
|
2372
|
+
cache = options.cache;
|
|
2373
|
+
} else if (isStateCacheMode(options)) {
|
|
2365
2374
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2366
2375
|
cache = {
|
|
2367
2376
|
type: "no-cache",
|
|
@@ -2756,7 +2765,10 @@ var DefaultDataClient = class {
|
|
|
2756
2765
|
}
|
|
2757
2766
|
}
|
|
2758
2767
|
const manifest = await getManifest({
|
|
2759
|
-
cache: {
|
|
2768
|
+
cache: isDevelopmentEnvironment() ? {
|
|
2769
|
+
type: "no-cache",
|
|
2770
|
+
bypassCache: true
|
|
2771
|
+
} : {
|
|
2760
2772
|
type: "force-cache"
|
|
2761
2773
|
}
|
|
2762
2774
|
});
|
|
@@ -2859,12 +2871,13 @@ var DefaultDataClient = class {
|
|
|
2859
2871
|
};
|
|
2860
2872
|
}
|
|
2861
2873
|
async getRoutePageState(options) {
|
|
2874
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
2862
2875
|
const routeClient = getRouteClient({
|
|
2863
|
-
cache:
|
|
2864
|
-
type: "force-cache"
|
|
2865
|
-
} : {
|
|
2876
|
+
cache: shouldBypassCache ? {
|
|
2866
2877
|
type: "no-cache",
|
|
2867
2878
|
bypassCache: true
|
|
2879
|
+
} : {
|
|
2880
|
+
type: "force-cache"
|
|
2868
2881
|
}
|
|
2869
2882
|
});
|
|
2870
2883
|
const originalRoute = {
|
|
@@ -2872,7 +2885,8 @@ var DefaultDataClient = class {
|
|
|
2872
2885
|
state: options.pageState.compositionState,
|
|
2873
2886
|
withComponentIDs: true,
|
|
2874
2887
|
releaseId: options.pageState.releaseId,
|
|
2875
|
-
locale: options.pageState.locale
|
|
2888
|
+
locale: options.pageState.locale,
|
|
2889
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
2876
2890
|
};
|
|
2877
2891
|
const resolvedRoute = await this.getRouteFromApi({
|
|
2878
2892
|
source: "pageState",
|
|
@@ -5426,7 +5440,8 @@ var retrieveRouteByPath = async ({
|
|
|
5426
5440
|
withComponentIDs: true,
|
|
5427
5441
|
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5428
5442
|
releaseId,
|
|
5429
|
-
locale
|
|
5443
|
+
locale,
|
|
5444
|
+
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
5430
5445
|
}
|
|
5431
5446
|
});
|
|
5432
5447
|
};
|
|
@@ -5553,7 +5568,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5553
5568
|
})
|
|
5554
5569
|
});
|
|
5555
5570
|
const context = await onDemandContext.getContext();
|
|
5556
|
-
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5571
|
+
const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
|
|
5557
5572
|
composition: composition.composition,
|
|
5558
5573
|
routePath: id,
|
|
5559
5574
|
state: composition.state,
|
|
@@ -5593,7 +5608,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5593
5608
|
isPrefetch: void 0
|
|
5594
5609
|
};
|
|
5595
5610
|
const code = serializeEvaluationResult({
|
|
5596
|
-
payload: pageState
|
|
5611
|
+
payload: pageState,
|
|
5612
|
+
allComponentIds
|
|
5597
5613
|
});
|
|
5598
5614
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "playground" }) : void 0);
|
|
5599
5615
|
if (!pathToRewriteTo) {
|
|
@@ -5675,7 +5691,7 @@ var handleRouteRequest = async ({
|
|
|
5675
5691
|
isDraftModeEnabled: draftModeEnabled
|
|
5676
5692
|
});
|
|
5677
5693
|
const isPrefetch = isPrefetchRequest(request);
|
|
5678
|
-
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5694
|
+
const { components, rules, allComponentIds } = await extractAndEvaluateRunnables({
|
|
5679
5695
|
composition: route.compositionApiResponse.composition,
|
|
5680
5696
|
routePath,
|
|
5681
5697
|
state,
|
|
@@ -5711,7 +5727,8 @@ var handleRouteRequest = async ({
|
|
|
5711
5727
|
isPrefetch: isPrefetch || void 0
|
|
5712
5728
|
};
|
|
5713
5729
|
const code = serializeEvaluationResult({
|
|
5714
|
-
payload: pageState
|
|
5730
|
+
payload: pageState,
|
|
5731
|
+
allComponentIds
|
|
5715
5732
|
});
|
|
5716
5733
|
let pathToRewriteTo = await (options.rewriteDestinationPath ? options.rewriteDestinationPath({ code, pageState, source: "route" }) : void 0);
|
|
5717
5734
|
if (!pathToRewriteTo) {
|
|
@@ -5771,7 +5788,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5771
5788
|
}
|
|
5772
5789
|
}
|
|
5773
5790
|
});
|
|
5774
|
-
|
|
5791
|
+
const allComponentIds = extracted.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
5792
|
+
return { ...result, allComponentIds };
|
|
5775
5793
|
};
|
|
5776
5794
|
var handleRedirect = ({ request, route }) => {
|
|
5777
5795
|
const href = resolveRedirectHref({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.56.
|
|
3
|
+
"version": "20.56.2-alpha.5+ae5a0d2550",
|
|
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.56.
|
|
103
|
-
"@uniformdev/next-app-router-client": "20.56.
|
|
104
|
-
"@uniformdev/next-app-router-shared": "20.56.
|
|
105
|
-
"@uniformdev/redirect": "20.56.
|
|
106
|
-
"@uniformdev/richtext": "20.56.
|
|
107
|
-
"@uniformdev/webhooks": "20.56.
|
|
102
|
+
"@uniformdev/canvas-react": "20.56.2-alpha.5+ae5a0d2550",
|
|
103
|
+
"@uniformdev/next-app-router-client": "20.56.2-alpha.5+ae5a0d2550",
|
|
104
|
+
"@uniformdev/next-app-router-shared": "20.56.2-alpha.5+ae5a0d2550",
|
|
105
|
+
"@uniformdev/redirect": "20.56.2-alpha.5+ae5a0d2550",
|
|
106
|
+
"@uniformdev/richtext": "20.56.2-alpha.5+ae5a0d2550",
|
|
107
|
+
"@uniformdev/webhooks": "20.56.2-alpha.5+ae5a0d2550",
|
|
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": "ae5a0d255085f10d36ad4f557d393536033eac7f"
|
|
125
125
|
}
|