@uniformdev/next-app-router 20.7.1-alpha.134 → 20.48.0
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/{UniformComposition-r8a9xGZn.d.ts → UniformComposition-d7_93l3F.d.ts} +5 -0
- package/dist/{UniformComposition-CHUPULqc.d.mts → UniformComposition-hhRIBHmn.d.mts} +5 -0
- package/dist/cache.js +55 -56
- package/dist/cache.mjs +55 -58
- package/dist/compat.d.mts +2 -2
- package/dist/compat.d.ts +2 -2
- package/dist/config/default.d.mts +5 -0
- package/dist/config/default.d.ts +5 -0
- package/dist/config/default.js +32 -0
- package/dist/config/default.mjs +11 -0
- package/dist/config.d.mts +6 -1
- package/dist/config.d.ts +6 -1
- package/dist/config.js +12 -21
- package/dist/config.mjs +12 -21
- package/dist/handler.js +14 -6
- package/dist/handler.mjs +14 -6
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +45 -19
- package/dist/index.js +45 -19
- package/dist/index.mjs +45 -19
- package/dist/middleware.js +102 -71
- package/dist/middleware.mjs +102 -71
- package/package.json +19 -8
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import { ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import React, { ComponentType } from 'react';
|
|
4
|
+
import { D as DataClient } from './client-BCGVjYM-.js';
|
|
4
5
|
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-DgTsfMK8.js';
|
|
5
6
|
import { ClientContextComponent } from '@uniformdev/next-app-router-client';
|
|
6
7
|
|
|
@@ -60,6 +61,10 @@ type UniformCompositionProps = {
|
|
|
60
61
|
* Function to map composition components to React components.
|
|
61
62
|
*/
|
|
62
63
|
resolveComponent: ResolveComponentFunction;
|
|
64
|
+
/**
|
|
65
|
+
* If provided, the composition will use the data client to retrieve data.
|
|
66
|
+
*/
|
|
67
|
+
dataClient?: DataClient;
|
|
63
68
|
/**
|
|
64
69
|
* Function to map empty placeholders to React components.
|
|
65
70
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import { ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import React, { ComponentType } from 'react';
|
|
4
|
+
import { D as DataClient } from './client-BCGVjYM-.mjs';
|
|
4
5
|
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-CKaYNXte.mjs';
|
|
5
6
|
import { ClientContextComponent } from '@uniformdev/next-app-router-client';
|
|
6
7
|
|
|
@@ -60,6 +61,10 @@ type UniformCompositionProps = {
|
|
|
60
61
|
* Function to map composition components to React components.
|
|
61
62
|
*/
|
|
62
63
|
resolveComponent: ResolveComponentFunction;
|
|
64
|
+
/**
|
|
65
|
+
* If provided, the composition will use the data client to retrieve data.
|
|
66
|
+
*/
|
|
67
|
+
dataClient?: DataClient;
|
|
63
68
|
/**
|
|
64
69
|
* Function to map empty placeholders to React components.
|
|
65
70
|
*/
|
package/dist/cache.js
CHANGED
|
@@ -154,7 +154,6 @@ __export(cache_exports, {
|
|
|
154
154
|
resolveRouteFromCode: () => resolveRouteFromCode2
|
|
155
155
|
});
|
|
156
156
|
module.exports = __toCommonJS(cache_exports);
|
|
157
|
-
var import_cache4 = require("next/cache");
|
|
158
157
|
|
|
159
158
|
// src/data/resolveRouteFromCode.ts
|
|
160
159
|
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
@@ -1363,7 +1362,7 @@ var RouteClient = class extends ApiClient {
|
|
|
1363
1362
|
// src/data/client.ts
|
|
1364
1363
|
var import_functions = require("@vercel/functions");
|
|
1365
1364
|
|
|
1366
|
-
// src/clients/
|
|
1365
|
+
// src/clients/manifest.ts
|
|
1367
1366
|
var import_server_only = require("server-only");
|
|
1368
1367
|
|
|
1369
1368
|
// src/utils/env.ts
|
|
@@ -1623,7 +1622,47 @@ var generateManifestCacheTags = () => {
|
|
|
1623
1622
|
return ["manifest"];
|
|
1624
1623
|
};
|
|
1625
1624
|
|
|
1625
|
+
// src/clients/manifest.ts
|
|
1626
|
+
var getManifestClient = (options) => {
|
|
1627
|
+
const cache = resolveManifestCache(options);
|
|
1628
|
+
const manifestClient = new ManifestClient({
|
|
1629
|
+
apiHost: env.getApiHost(),
|
|
1630
|
+
apiKey: env.getApiKey(),
|
|
1631
|
+
projectId: env.getProjectId(),
|
|
1632
|
+
limitPolicy: createLimitPolicy2({
|
|
1633
|
+
limit: 6
|
|
1634
|
+
}),
|
|
1635
|
+
fetch: (req, init) => {
|
|
1636
|
+
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1637
|
+
return fetch(req, {
|
|
1638
|
+
...init,
|
|
1639
|
+
headers: {
|
|
1640
|
+
...init == null ? void 0 : init.headers,
|
|
1641
|
+
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1642
|
+
},
|
|
1643
|
+
cache: fetchCache,
|
|
1644
|
+
next: {
|
|
1645
|
+
revalidate,
|
|
1646
|
+
tags: generateManifestCacheTags()
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
return manifestClient;
|
|
1652
|
+
};
|
|
1653
|
+
var getManifest = async (options) => {
|
|
1654
|
+
let preview = false;
|
|
1655
|
+
if (options && isStateCacheMode(options)) {
|
|
1656
|
+
preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
|
|
1657
|
+
}
|
|
1658
|
+
const manifestClient = getManifestClient(options);
|
|
1659
|
+
return manifestClient.get({
|
|
1660
|
+
preview
|
|
1661
|
+
});
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1626
1664
|
// src/clients/route.ts
|
|
1665
|
+
var import_server_only2 = require("server-only");
|
|
1627
1666
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1628
1667
|
const tags = ["route"];
|
|
1629
1668
|
if (requestedUrl) {
|
|
@@ -1674,57 +1713,26 @@ var getRouteClient = (options) => {
|
|
|
1674
1713
|
};
|
|
1675
1714
|
|
|
1676
1715
|
// src/config/helpers.ts
|
|
1677
|
-
var
|
|
1678
|
-
var
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
var import_server_only2 = require("server-only");
|
|
1684
|
-
var getManifestClient = (options) => {
|
|
1685
|
-
const cache = resolveManifestCache(options);
|
|
1686
|
-
const manifestClient = new ManifestClient({
|
|
1687
|
-
apiHost: env.getApiHost(),
|
|
1688
|
-
apiKey: env.getApiKey(),
|
|
1689
|
-
projectId: env.getProjectId(),
|
|
1690
|
-
limitPolicy: createLimitPolicy2({
|
|
1691
|
-
limit: 6
|
|
1692
|
-
}),
|
|
1693
|
-
fetch: (req, init) => {
|
|
1694
|
-
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1695
|
-
return fetch(req, {
|
|
1696
|
-
...init,
|
|
1697
|
-
headers: {
|
|
1698
|
-
...init == null ? void 0 : init.headers,
|
|
1699
|
-
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1700
|
-
},
|
|
1701
|
-
cache: fetchCache,
|
|
1702
|
-
next: {
|
|
1703
|
-
revalidate,
|
|
1704
|
-
tags: generateManifestCacheTags()
|
|
1705
|
-
}
|
|
1706
|
-
});
|
|
1707
|
-
}
|
|
1708
|
-
});
|
|
1709
|
-
return manifestClient;
|
|
1716
|
+
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1717
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1718
|
+
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1719
|
+
return import_resolved.default.middlewareRuntimeCache;
|
|
1720
|
+
}
|
|
1721
|
+
return true;
|
|
1710
1722
|
};
|
|
1711
|
-
var
|
|
1712
|
-
|
|
1713
|
-
if (
|
|
1714
|
-
|
|
1723
|
+
var getDisableSwrMiddlewareCache = () => {
|
|
1724
|
+
var _a;
|
|
1725
|
+
if (typeof ((_a = import_resolved.default.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
|
|
1726
|
+
return import_resolved.default.experimental.disableSwrMiddlewareCache;
|
|
1715
1727
|
}
|
|
1716
|
-
|
|
1717
|
-
return manifestClient.get({
|
|
1718
|
-
preview
|
|
1719
|
-
});
|
|
1728
|
+
return false;
|
|
1720
1729
|
};
|
|
1721
1730
|
|
|
1722
1731
|
// src/data/client.ts
|
|
1723
1732
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
1724
1733
|
var DefaultDataClient = class {
|
|
1725
1734
|
async getManifest(options) {
|
|
1726
|
-
|
|
1727
|
-
const cache = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? (0, import_functions.getCache)() : null;
|
|
1735
|
+
const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
|
|
1728
1736
|
if (cache) {
|
|
1729
1737
|
const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
|
|
1730
1738
|
if (cachedManifest) {
|
|
@@ -1810,18 +1818,16 @@ var DefaultDataClient = class {
|
|
|
1810
1818
|
async enhanceRoute(_options) {
|
|
1811
1819
|
}
|
|
1812
1820
|
async getRouteMiddleware(options) {
|
|
1813
|
-
var _a, _b, _c, _d;
|
|
1814
1821
|
const routeClient = getRouteClient({
|
|
1815
1822
|
searchParams: options.searchParams,
|
|
1816
1823
|
draftModeEnabled: options.draftModeEnabled
|
|
1817
1824
|
});
|
|
1818
|
-
const config = getServerConfig();
|
|
1819
1825
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1820
1826
|
source: "middleware",
|
|
1821
1827
|
route: options.route,
|
|
1822
1828
|
routeClient,
|
|
1823
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
1824
|
-
disableSwrCache: (
|
|
1829
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
1830
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
1825
1831
|
});
|
|
1826
1832
|
if (resolvedRoute.type === "composition") {
|
|
1827
1833
|
await this.enhanceRoute({
|
|
@@ -1904,13 +1910,6 @@ var resolveRouteFromCode2 = async ({
|
|
|
1904
1910
|
code,
|
|
1905
1911
|
dataClient: providedDataClient
|
|
1906
1912
|
});
|
|
1907
|
-
if (process.env.NODE_ENV === "development") {
|
|
1908
|
-
(0, import_cache4.cacheLife)({
|
|
1909
|
-
expire: 0,
|
|
1910
|
-
revalidate: 0,
|
|
1911
|
-
stale: 0
|
|
1912
|
-
});
|
|
1913
|
-
}
|
|
1914
1913
|
return result;
|
|
1915
1914
|
};
|
|
1916
1915
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/cache.mjs
CHANGED
|
@@ -142,9 +142,6 @@ var require_p_limit = __commonJS({
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
// src/cache.ts
|
|
146
|
-
import { cacheLife } from "next/cache";
|
|
147
|
-
|
|
148
145
|
// src/data/resolveRouteFromCode.ts
|
|
149
146
|
import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
|
|
150
147
|
|
|
@@ -1352,7 +1349,7 @@ var RouteClient = class extends ApiClient {
|
|
|
1352
1349
|
// src/data/client.ts
|
|
1353
1350
|
import { getCache, waitUntil } from "@vercel/functions";
|
|
1354
1351
|
|
|
1355
|
-
// src/clients/
|
|
1352
|
+
// src/clients/manifest.ts
|
|
1356
1353
|
import "server-only";
|
|
1357
1354
|
|
|
1358
1355
|
// src/utils/env.ts
|
|
@@ -1612,7 +1609,47 @@ var generateManifestCacheTags = () => {
|
|
|
1612
1609
|
return ["manifest"];
|
|
1613
1610
|
};
|
|
1614
1611
|
|
|
1612
|
+
// src/clients/manifest.ts
|
|
1613
|
+
var getManifestClient = (options) => {
|
|
1614
|
+
const cache = resolveManifestCache(options);
|
|
1615
|
+
const manifestClient = new ManifestClient({
|
|
1616
|
+
apiHost: env.getApiHost(),
|
|
1617
|
+
apiKey: env.getApiKey(),
|
|
1618
|
+
projectId: env.getProjectId(),
|
|
1619
|
+
limitPolicy: createLimitPolicy2({
|
|
1620
|
+
limit: 6
|
|
1621
|
+
}),
|
|
1622
|
+
fetch: (req, init) => {
|
|
1623
|
+
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1624
|
+
return fetch(req, {
|
|
1625
|
+
...init,
|
|
1626
|
+
headers: {
|
|
1627
|
+
...init == null ? void 0 : init.headers,
|
|
1628
|
+
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1629
|
+
},
|
|
1630
|
+
cache: fetchCache,
|
|
1631
|
+
next: {
|
|
1632
|
+
revalidate,
|
|
1633
|
+
tags: generateManifestCacheTags()
|
|
1634
|
+
}
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
return manifestClient;
|
|
1639
|
+
};
|
|
1640
|
+
var getManifest = async (options) => {
|
|
1641
|
+
let preview = false;
|
|
1642
|
+
if (options && isStateCacheMode(options)) {
|
|
1643
|
+
preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
|
|
1644
|
+
}
|
|
1645
|
+
const manifestClient = getManifestClient(options);
|
|
1646
|
+
return manifestClient.get({
|
|
1647
|
+
preview
|
|
1648
|
+
});
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1615
1651
|
// src/clients/route.ts
|
|
1652
|
+
import "server-only";
|
|
1616
1653
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1617
1654
|
const tags = ["route"];
|
|
1618
1655
|
if (requestedUrl) {
|
|
@@ -1663,57 +1700,26 @@ var getRouteClient = (options) => {
|
|
|
1663
1700
|
};
|
|
1664
1701
|
|
|
1665
1702
|
// src/config/helpers.ts
|
|
1666
|
-
import
|
|
1667
|
-
var
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
import "server-only";
|
|
1673
|
-
var getManifestClient = (options) => {
|
|
1674
|
-
const cache = resolveManifestCache(options);
|
|
1675
|
-
const manifestClient = new ManifestClient({
|
|
1676
|
-
apiHost: env.getApiHost(),
|
|
1677
|
-
apiKey: env.getApiKey(),
|
|
1678
|
-
projectId: env.getProjectId(),
|
|
1679
|
-
limitPolicy: createLimitPolicy2({
|
|
1680
|
-
limit: 6
|
|
1681
|
-
}),
|
|
1682
|
-
fetch: (req, init) => {
|
|
1683
|
-
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1684
|
-
return fetch(req, {
|
|
1685
|
-
...init,
|
|
1686
|
-
headers: {
|
|
1687
|
-
...init == null ? void 0 : init.headers,
|
|
1688
|
-
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1689
|
-
},
|
|
1690
|
-
cache: fetchCache,
|
|
1691
|
-
next: {
|
|
1692
|
-
revalidate,
|
|
1693
|
-
tags: generateManifestCacheTags()
|
|
1694
|
-
}
|
|
1695
|
-
});
|
|
1696
|
-
}
|
|
1697
|
-
});
|
|
1698
|
-
return manifestClient;
|
|
1703
|
+
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1704
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1705
|
+
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1706
|
+
return config.middlewareRuntimeCache;
|
|
1707
|
+
}
|
|
1708
|
+
return true;
|
|
1699
1709
|
};
|
|
1700
|
-
var
|
|
1701
|
-
|
|
1702
|
-
if (
|
|
1703
|
-
|
|
1710
|
+
var getDisableSwrMiddlewareCache = () => {
|
|
1711
|
+
var _a;
|
|
1712
|
+
if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
|
|
1713
|
+
return config.experimental.disableSwrMiddlewareCache;
|
|
1704
1714
|
}
|
|
1705
|
-
|
|
1706
|
-
return manifestClient.get({
|
|
1707
|
-
preview
|
|
1708
|
-
});
|
|
1715
|
+
return false;
|
|
1709
1716
|
};
|
|
1710
1717
|
|
|
1711
1718
|
// src/data/client.ts
|
|
1712
1719
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
1713
1720
|
var DefaultDataClient = class {
|
|
1714
1721
|
async getManifest(options) {
|
|
1715
|
-
|
|
1716
|
-
const cache = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? getCache() : null;
|
|
1722
|
+
const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? getCache() : null;
|
|
1717
1723
|
if (cache) {
|
|
1718
1724
|
const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
|
|
1719
1725
|
if (cachedManifest) {
|
|
@@ -1799,18 +1805,16 @@ var DefaultDataClient = class {
|
|
|
1799
1805
|
async enhanceRoute(_options) {
|
|
1800
1806
|
}
|
|
1801
1807
|
async getRouteMiddleware(options) {
|
|
1802
|
-
var _a, _b, _c, _d;
|
|
1803
1808
|
const routeClient = getRouteClient({
|
|
1804
1809
|
searchParams: options.searchParams,
|
|
1805
1810
|
draftModeEnabled: options.draftModeEnabled
|
|
1806
1811
|
});
|
|
1807
|
-
const config = getServerConfig();
|
|
1808
1812
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1809
1813
|
source: "middleware",
|
|
1810
1814
|
route: options.route,
|
|
1811
1815
|
routeClient,
|
|
1812
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
1813
|
-
disableSwrCache: (
|
|
1816
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
1817
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
1814
1818
|
});
|
|
1815
1819
|
if (resolvedRoute.type === "composition") {
|
|
1816
1820
|
await this.enhanceRoute({
|
|
@@ -1893,13 +1897,6 @@ var resolveRouteFromCode2 = async ({
|
|
|
1893
1897
|
code,
|
|
1894
1898
|
dataClient: providedDataClient
|
|
1895
1899
|
});
|
|
1896
|
-
if (process.env.NODE_ENV === "development") {
|
|
1897
|
-
cacheLife({
|
|
1898
|
-
expire: 0,
|
|
1899
|
-
revalidate: 0,
|
|
1900
|
-
stale: 0
|
|
1901
|
-
});
|
|
1902
|
-
}
|
|
1903
1900
|
return result;
|
|
1904
1901
|
};
|
|
1905
1902
|
export {
|
package/dist/compat.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.mjs';
|
|
4
|
-
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-hhRIBHmn.mjs';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './resolveRouteFromCode-CKaYNXte.mjs';
|
|
8
7
|
import './client-BCGVjYM-.mjs';
|
|
9
8
|
import '@uniformdev/context';
|
|
9
|
+
import './resolveRouteFromCode-CKaYNXte.mjs';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
package/dist/compat.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.js';
|
|
4
|
-
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-d7_93l3F.js';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './resolveRouteFromCode-DgTsfMK8.js';
|
|
8
7
|
import './client-BCGVjYM-.js';
|
|
9
8
|
import '@uniformdev/context';
|
|
9
|
+
import './resolveRouteFromCode-DgTsfMK8.js';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/config/default.ts
|
|
21
|
+
var default_exports = {};
|
|
22
|
+
__export(default_exports, {
|
|
23
|
+
default: () => default_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(default_exports);
|
|
26
|
+
var config = {
|
|
27
|
+
defaultConsent: true,
|
|
28
|
+
quirkSerialization: true,
|
|
29
|
+
middlewareRuntimeCache: true,
|
|
30
|
+
playgroundPath: "/uniform/playground"
|
|
31
|
+
};
|
|
32
|
+
var default_default = config;
|
package/dist/config.d.mts
CHANGED
|
@@ -3,7 +3,12 @@ export { UniformServerConfig } from '@uniformdev/next-app-router-shared';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Wraps the Next.js config to set up the Uniform server config alias.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* If a `uniform.server.config.{js,cjs,mjs,ts}` file exists in the project root,
|
|
8
|
+
* this sets up an alias so that `@uniformdev/next-app-router/config/resolved`
|
|
9
|
+
* imports the user's config instead of the default.
|
|
10
|
+
*
|
|
11
|
+
* This wrapper is optional - without it, the default config will be used.
|
|
7
12
|
*
|
|
8
13
|
* @param nextConfig - The Next.js configuration object
|
|
9
14
|
* @returns The modified Next.js configuration with Uniform config alias set up
|
package/dist/config.d.ts
CHANGED
|
@@ -3,7 +3,12 @@ export { UniformServerConfig } from '@uniformdev/next-app-router-shared';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Wraps the Next.js config to set up the Uniform server config alias.
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* If a `uniform.server.config.{js,cjs,mjs,ts}` file exists in the project root,
|
|
8
|
+
* this sets up an alias so that `@uniformdev/next-app-router/config/resolved`
|
|
9
|
+
* imports the user's config instead of the default.
|
|
10
|
+
*
|
|
11
|
+
* This wrapper is optional - without it, the default config will be used.
|
|
7
12
|
*
|
|
8
13
|
* @param nextConfig - The Next.js configuration object
|
|
9
14
|
* @returns The modified Next.js configuration with Uniform config alias set up
|
package/dist/config.js
CHANGED
|
@@ -25,37 +25,29 @@ __export(config_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(config_exports);
|
|
26
26
|
var import_fs = require("fs");
|
|
27
27
|
var import_path = require("path");
|
|
28
|
+
var CONFIG_IMPORT_PATH = "@uniformdev/next-app-router/config/resolved";
|
|
28
29
|
var getConfigPath = () => {
|
|
29
30
|
const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
|
|
30
|
-
let configFilePath;
|
|
31
|
-
let configFileName;
|
|
32
31
|
for (const extension of possibleExtensions) {
|
|
33
32
|
const fileName = `uniform.server.config${extension}`;
|
|
34
33
|
const filePath = (0, import_path.join)(process.cwd(), fileName);
|
|
35
34
|
if ((0, import_fs.existsSync)(filePath)) {
|
|
36
|
-
|
|
37
|
-
configFileName = fileName;
|
|
38
|
-
break;
|
|
35
|
+
return { filePath, fileName };
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
filePath: configFilePath,
|
|
46
|
-
fileName: configFileName
|
|
47
|
-
};
|
|
38
|
+
return void 0;
|
|
48
39
|
};
|
|
49
40
|
var withUniformConfig = (nextConfig) => {
|
|
50
41
|
var _a;
|
|
51
|
-
const
|
|
42
|
+
const configPath = getConfigPath();
|
|
43
|
+
if (!configPath) {
|
|
44
|
+
return nextConfig;
|
|
45
|
+
}
|
|
46
|
+
console.log("Using Uniform config from", configPath.fileName);
|
|
52
47
|
const turbopackResolveAlias = {
|
|
53
|
-
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
|
|
48
|
+
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias,
|
|
49
|
+
[CONFIG_IMPORT_PATH]: `./${configPath.fileName}`
|
|
54
50
|
};
|
|
55
|
-
if (uniformConfigFileName) {
|
|
56
|
-
console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
|
|
57
|
-
turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
58
|
-
}
|
|
59
51
|
return {
|
|
60
52
|
...nextConfig,
|
|
61
53
|
turbopack: {
|
|
@@ -66,9 +58,8 @@ var withUniformConfig = (nextConfig) => {
|
|
|
66
58
|
if (nextConfig.webpack) {
|
|
67
59
|
nextConfig.webpack(config, context);
|
|
68
60
|
}
|
|
69
|
-
if (context.isServer
|
|
70
|
-
|
|
71
|
-
config.resolve.alias["uniform.server.config"] = (0, import_path.resolve)(config.context, uniformConfigFilePath);
|
|
61
|
+
if (context.isServer) {
|
|
62
|
+
config.resolve.alias[CONFIG_IMPORT_PATH] = (0, import_path.resolve)(config.context, configPath.filePath);
|
|
72
63
|
}
|
|
73
64
|
return config;
|
|
74
65
|
}
|
package/dist/config.mjs
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { join, resolve } from "path";
|
|
4
|
+
var CONFIG_IMPORT_PATH = "@uniformdev/next-app-router/config/resolved";
|
|
4
5
|
var getConfigPath = () => {
|
|
5
6
|
const possibleExtensions = [".js", ".cjs", ".mjs", ".ts"];
|
|
6
|
-
let configFilePath;
|
|
7
|
-
let configFileName;
|
|
8
7
|
for (const extension of possibleExtensions) {
|
|
9
8
|
const fileName = `uniform.server.config${extension}`;
|
|
10
9
|
const filePath = join(process.cwd(), fileName);
|
|
11
10
|
if (existsSync(filePath)) {
|
|
12
|
-
|
|
13
|
-
configFileName = fileName;
|
|
14
|
-
break;
|
|
11
|
+
return { filePath, fileName };
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
|
-
|
|
18
|
-
return void 0;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
filePath: configFilePath,
|
|
22
|
-
fileName: configFileName
|
|
23
|
-
};
|
|
14
|
+
return void 0;
|
|
24
15
|
};
|
|
25
16
|
var withUniformConfig = (nextConfig) => {
|
|
26
17
|
var _a;
|
|
27
|
-
const
|
|
18
|
+
const configPath = getConfigPath();
|
|
19
|
+
if (!configPath) {
|
|
20
|
+
return nextConfig;
|
|
21
|
+
}
|
|
22
|
+
console.log("Using Uniform config from", configPath.fileName);
|
|
28
23
|
const turbopackResolveAlias = {
|
|
29
|
-
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias
|
|
24
|
+
...(_a = nextConfig.turbopack) == null ? void 0 : _a.resolveAlias,
|
|
25
|
+
[CONFIG_IMPORT_PATH]: `./${configPath.fileName}`
|
|
30
26
|
};
|
|
31
|
-
if (uniformConfigFileName) {
|
|
32
|
-
console.log("(Turbopack) Using Uniform config from", uniformConfigFileName);
|
|
33
|
-
turbopackResolveAlias["uniform.server.config"] = `./${uniformConfigFileName}`;
|
|
34
|
-
}
|
|
35
27
|
return {
|
|
36
28
|
...nextConfig,
|
|
37
29
|
turbopack: {
|
|
@@ -42,9 +34,8 @@ var withUniformConfig = (nextConfig) => {
|
|
|
42
34
|
if (nextConfig.webpack) {
|
|
43
35
|
nextConfig.webpack(config, context);
|
|
44
36
|
}
|
|
45
|
-
if (context.isServer
|
|
46
|
-
|
|
47
|
-
config.resolve.alias["uniform.server.config"] = resolve(config.context, uniformConfigFilePath);
|
|
37
|
+
if (context.isServer) {
|
|
38
|
+
config.resolve.alias[CONFIG_IMPORT_PATH] = resolve(config.context, configPath.filePath);
|
|
48
39
|
}
|
|
49
40
|
return config;
|
|
50
41
|
}
|
package/dist/handler.js
CHANGED
|
@@ -1536,9 +1536,18 @@ var import_navigation = require("next/navigation");
|
|
|
1536
1536
|
var import_server = require("next/server");
|
|
1537
1537
|
|
|
1538
1538
|
// src/config/helpers.ts
|
|
1539
|
-
var
|
|
1540
|
-
var
|
|
1541
|
-
|
|
1539
|
+
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1540
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1541
|
+
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1542
|
+
return import_resolved.default.middlewareRuntimeCache;
|
|
1543
|
+
}
|
|
1544
|
+
return true;
|
|
1545
|
+
};
|
|
1546
|
+
var getPlaygroundPath = () => {
|
|
1547
|
+
if (typeof import_resolved.default.playgroundPath === "string") {
|
|
1548
|
+
return import_resolved.default.playgroundPath;
|
|
1549
|
+
}
|
|
1550
|
+
return "/uniform/playground";
|
|
1542
1551
|
};
|
|
1543
1552
|
|
|
1544
1553
|
// src/handler/createPreviewGETRouteHandler.ts
|
|
@@ -1557,7 +1566,7 @@ var contextualEditingQueryParams = [
|
|
|
1557
1566
|
var createPreviewGETRouteHandler = (options) => {
|
|
1558
1567
|
return async (request) => {
|
|
1559
1568
|
const isConfigCheck = getQueryParam(request, "is_config_check") === "true";
|
|
1560
|
-
const
|
|
1569
|
+
const playgroundPath = getPlaygroundPath();
|
|
1561
1570
|
if (isConfigCheck) {
|
|
1562
1571
|
return Response.json(
|
|
1563
1572
|
{
|
|
@@ -2603,7 +2612,6 @@ var createPreviewPOSTRouteHandler = () => {
|
|
|
2603
2612
|
};
|
|
2604
2613
|
};
|
|
2605
2614
|
var handleSvixMessage = async (request) => {
|
|
2606
|
-
var _a;
|
|
2607
2615
|
const handlers = [
|
|
2608
2616
|
handleProjectMapNodeUpdate,
|
|
2609
2617
|
handleProjectMapNodeInsert,
|
|
@@ -2637,7 +2645,7 @@ var handleSvixMessage = async (request) => {
|
|
|
2637
2645
|
}
|
|
2638
2646
|
}
|
|
2639
2647
|
if (tags == null ? void 0 : tags.length) {
|
|
2640
|
-
const cache = (
|
|
2648
|
+
const cache = getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : void 0;
|
|
2641
2649
|
for (let i = 0; i < tags.length; i++) {
|
|
2642
2650
|
const tag = tags[i];
|
|
2643
2651
|
(0, import_cache4.revalidateTag)(tag, "max");
|