@payloadcms/next 4.0.0-internal.d21c039 → 4.0.0-internal.d3909a9
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/adapters/UnmountWhenHidden/index.d.ts +18 -0
- package/dist/adapters/UnmountWhenHidden/index.d.ts.map +1 -0
- package/dist/adapters/UnmountWhenHidden/index.js +64 -0
- package/dist/adapters/UnmountWhenHidden/index.js.map +1 -0
- package/dist/adapters/handleServerFunctions.d.ts.map +1 -1
- package/dist/adapters/handleServerFunctions.js +4 -6
- package/dist/adapters/handleServerFunctions.js.map +1 -1
- package/dist/adapters/layout.d.ts +1 -1
- package/dist/adapters/layout.d.ts.map +1 -1
- package/dist/adapters/layout.js +3 -3
- package/dist/adapters/layout.js.map +1 -1
- package/dist/adapters/metadata.js.map +1 -1
- package/dist/adapters/router.d.ts.map +1 -1
- package/dist/adapters/router.js +1 -1
- package/dist/adapters/router.js.map +1 -1
- package/dist/adapters/views.d.ts +3 -2
- package/dist/adapters/views.d.ts.map +1 -1
- package/dist/adapters/views.js +27 -17
- package/dist/adapters/views.js.map +1 -1
- package/dist/auth/login.js.map +1 -1
- package/dist/cjs/withPayload.cjs +74 -23
- package/dist/cjs/withPayload.cjs.map +3 -3
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.js +3 -3
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/playground.d.ts.map +1 -1
- package/dist/routes/graphql/playground.js +2 -2
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/utilities/initAdminContext.d.ts +8 -0
- package/dist/utilities/initAdminContext.d.ts.map +1 -0
- package/dist/utilities/initAdminContext.js +35 -0
- package/dist/utilities/initAdminContext.js.map +1 -0
- package/dist/utilities/selectiveCache.d.ts +18 -0
- package/dist/utilities/selectiveCache.d.ts.map +1 -0
- package/dist/utilities/selectiveCache.js +36 -0
- package/dist/utilities/selectiveCache.js.map +1 -0
- package/dist/withPayload/instantLoader.d.ts +16 -0
- package/dist/withPayload/instantLoader.d.ts.map +1 -0
- package/dist/withPayload/instantLoader.js +27 -0
- package/dist/withPayload/instantLoader.js.map +1 -0
- package/dist/withPayload/withPayload.d.ts.map +1 -1
- package/dist/withPayload/withPayload.js +49 -24
- package/dist/withPayload/withPayload.js.map +1 -1
- package/package.json +36 -36
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* With `cacheComponents`, Next.js does not unmount pages you navigate away from. It keeps the last
|
|
4
|
+
* few inside a hidden React `<Activity>` boundary so going back can restore them. In the admin
|
|
5
|
+
* panel, that leaves hidden copies of previous views in the DOM (duplicate element IDs, old client
|
|
6
|
+
* state) and breaks selectors that expect a single match.
|
|
7
|
+
*
|
|
8
|
+
* React runs effect cleanups when an `<Activity>` boundary is hidden. This component uses that to
|
|
9
|
+
* render nothing while hidden, so the view is mounted fresh when it becomes visible again, like it
|
|
10
|
+
* is without `cacheComponents`. Only rendered when `cacheComponents` is enabled.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/vercel/next.js/issues/86577
|
|
13
|
+
* @see https://react.dev/reference/react/Activity
|
|
14
|
+
*/
|
|
15
|
+
export declare const UnmountWhenHidden: React.FC<{
|
|
16
|
+
readonly children: React.ReactNode;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/UnmountWhenHidden/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAU9E,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useRouter } from 'next/navigation.js';
|
|
6
|
+
import React, { useLayoutEffect, useState } from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* With `cacheComponents`, Next.js does not unmount pages you navigate away from. It keeps the last
|
|
9
|
+
* few inside a hidden React `<Activity>` boundary so going back can restore them. In the admin
|
|
10
|
+
* panel, that leaves hidden copies of previous views in the DOM (duplicate element IDs, old client
|
|
11
|
+
* state) and breaks selectors that expect a single match.
|
|
12
|
+
*
|
|
13
|
+
* React runs effect cleanups when an `<Activity>` boundary is hidden. This component uses that to
|
|
14
|
+
* render nothing while hidden, so the view is mounted fresh when it becomes visible again, like it
|
|
15
|
+
* is without `cacheComponents`. Only rendered when `cacheComponents` is enabled.
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/vercel/next.js/issues/86577
|
|
18
|
+
* @see https://react.dev/reference/react/Activity
|
|
19
|
+
*/
|
|
20
|
+
export const UnmountWhenHidden = t0 => {
|
|
21
|
+
const $ = _c(3);
|
|
22
|
+
const {
|
|
23
|
+
children
|
|
24
|
+
} = t0;
|
|
25
|
+
const {
|
|
26
|
+
bfcacheId
|
|
27
|
+
} = useRouter();
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[0] !== bfcacheId || $[1] !== children) {
|
|
30
|
+
t1 = _jsx(RenderNothingWhileHidden, {
|
|
31
|
+
children
|
|
32
|
+
}, bfcacheId);
|
|
33
|
+
$[0] = bfcacheId;
|
|
34
|
+
$[1] = children;
|
|
35
|
+
$[2] = t1;
|
|
36
|
+
} else {
|
|
37
|
+
t1 = $[2];
|
|
38
|
+
}
|
|
39
|
+
return t1;
|
|
40
|
+
};
|
|
41
|
+
const RenderNothingWhileHidden = t0 => {
|
|
42
|
+
const $ = _c(2);
|
|
43
|
+
const {
|
|
44
|
+
children
|
|
45
|
+
} = t0;
|
|
46
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
47
|
+
let t1;
|
|
48
|
+
let t2;
|
|
49
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
50
|
+
t1 = () => {
|
|
51
|
+
setIsVisible(true);
|
|
52
|
+
return () => setIsVisible(false);
|
|
53
|
+
};
|
|
54
|
+
t2 = [];
|
|
55
|
+
$[0] = t1;
|
|
56
|
+
$[1] = t2;
|
|
57
|
+
} else {
|
|
58
|
+
t1 = $[0];
|
|
59
|
+
t2 = $[1];
|
|
60
|
+
}
|
|
61
|
+
useLayoutEffect(t1, t2);
|
|
62
|
+
return isVisible ? children : null;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useRouter","React","useLayoutEffect","useState","UnmountWhenHidden","t0","$","children","bfcacheId","t1","_jsx","RenderNothingWhileHidden","isVisible","setIsVisible","t2","Symbol","for"],"sources":["../../../src/adapters/UnmountWhenHidden/index.tsx"],"sourcesContent":["'use client'\nimport { useRouter } from 'next/navigation.js'\nimport React, { useLayoutEffect, useState } from 'react'\n\n/**\n * With `cacheComponents`, Next.js does not unmount pages you navigate away from. It keeps the last\n * few inside a hidden React `<Activity>` boundary so going back can restore them. In the admin\n * panel, that leaves hidden copies of previous views in the DOM (duplicate element IDs, old client\n * state) and breaks selectors that expect a single match.\n *\n * React runs effect cleanups when an `<Activity>` boundary is hidden. This component uses that to\n * render nothing while hidden, so the view is mounted fresh when it becomes visible again, like it\n * is without `cacheComponents`. Only rendered when `cacheComponents` is enabled.\n *\n * @see https://github.com/vercel/next.js/issues/86577\n * @see https://react.dev/reference/react/Activity\n */\nexport const UnmountWhenHidden: React.FC<{ readonly children: React.ReactNode }> = ({\n children,\n}) => {\n // Next.js shows the hidden copy again when you navigate to a view you visited recently. That copy\n // is empty, so it would show a blank page until the view rendered again. `bfcacheId` changes on\n // those navigations, so the new key mounts the view as part of the navigation instead.\n // https://nextjs.org/docs/app/api-reference/functions/use-router#bfcacheid\n const { bfcacheId } = useRouter()\n\n return <RenderNothingWhileHidden key={bfcacheId}>{children}</RenderNothingWhileHidden>\n}\n\nconst RenderNothingWhileHidden: React.FC<{ readonly children: React.ReactNode }> = ({\n children,\n}) => {\n const [isVisible, setIsVisible] = useState(true)\n\n useLayoutEffect(() => {\n setIsVisible(true)\n\n return () => setIsVisible(false)\n }, [])\n\n return isVisible ? children : null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,SAAS,QAAQ;AAC1B,OAAOC,KAAA,IAASC,eAAe,EAAEC,QAAQ,QAAQ;AAEjD;;;;;;;;;;;;;AAaA,OAAO,MAAMC,iBAAA,GAAsEC,EAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EAAC;IAAAQ;EAAA,IAAAF,EAEnF;EAKC;IAAAG;EAAA,IAAsBR,SAAA;EAAA,IAAAS,EAAA;EAAA,IAAAH,CAAA,QAAAE,SAAA,IAAAF,CAAA,QAAAC,QAAA;IAEfE,EAAA,GAAAC,IAAA,CAAAC,wBAAA;MAAAJ;IAAA,GAA+BC,SAAA;IAAAF,CAAA,MAAAE,SAAA;IAAAF,CAAA,MAAAC,QAAA;IAAAD,CAAA,MAAAG,EAAA;EAAA;IAAAA,EAAA,GAAAH,CAAA;EAAA;EAAA,OAA/BG,EAA+B;AAAA,CACxC;AAEA,MAAME,wBAAA,GAA6EN,EAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EAAC;IAAAQ;EAAA,IAAAF,EAEnF;EACC,OAAAO,SAAA,EAAAC,YAAA,IAAkCV,QAAA,KAAS;EAAA,IAAAM,EAAA;EAAA,IAAAK,EAAA;EAAA,IAAAR,CAAA,QAAAS,MAAA,CAAAC,GAAA;IAE3BP,EAAA,GAAAA,CAAA;MACdI,YAAA,KAAa;MAAA,aAEAA,YAAA,MAAa;IAAA;IACzBC,EAAA;IAAER,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAQ,EAAA;EAAA;IAAAL,EAAA,GAAAH,CAAA;IAAAQ,EAAA,GAAAR,CAAA;EAAA;EAJLJ,eAAA,CAAgBO,EAIhB,EAAGK,EAAE;EAAA,OAEEF,SAAA,GAAYL,QAAA,OAAW;AAAA,CAChC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/adapters/handleServerFunctions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handleServerFunctions.d.ts","sourceRoot":"","sources":["../../src/adapters/handleServerFunctions.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,yCAGhC,CAAA"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions';
|
|
2
|
-
import {
|
|
3
|
-
import { nextServerAdapter } from './server.js';
|
|
2
|
+
import { initAdminContext } from '../utilities/initAdminContext.js';
|
|
4
3
|
export const handleServerFunctions = createServerFunctionHandler({
|
|
5
|
-
|
|
4
|
+
initAdminContext: ({
|
|
6
5
|
configPromise,
|
|
7
6
|
importMap
|
|
8
|
-
}) =>
|
|
7
|
+
}) => initAdminContext({
|
|
9
8
|
configPromise,
|
|
10
9
|
importMap,
|
|
11
|
-
key: 'RootLayout'
|
|
12
|
-
serverAdapter: nextServerAdapter
|
|
10
|
+
key: 'RootLayout'
|
|
13
11
|
})
|
|
14
12
|
});
|
|
15
13
|
//# sourceMappingURL=handleServerFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleServerFunctions.js","names":["createServerFunctionHandler","
|
|
1
|
+
{"version":3,"file":"handleServerFunctions.js","names":["createServerFunctionHandler","initAdminContext","handleServerFunctions","configPromise","importMap","key"],"sources":["../../src/adapters/handleServerFunctions.ts"],"sourcesContent":["import { createServerFunctionHandler } from '@payloadcms/ui/utilities/handleServerFunctions'\n\nimport { initAdminContext } from '../utilities/initAdminContext.js'\n\nexport const handleServerFunctions = createServerFunctionHandler({\n initAdminContext: ({ configPromise, importMap }) =>\n initAdminContext({ configPromise, importMap, key: 'RootLayout' }),\n})\n"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ;AAE5C,SAASC,gBAAgB,QAAQ;AAEjC,OAAO,MAAMC,qBAAA,GAAwBF,2BAAA,CAA4B;EAC/DC,gBAAA,EAAkBA,CAAC;IAAEE,aAAa;IAAEC;EAAS,CAAE,KAC7CH,gBAAA,CAAiB;IAAEE,aAAA;IAAeC,SAAA;IAAWC,GAAA,EAAK;EAAa;AACnE","ignoreList":[]}
|
|
@@ -2,6 +2,6 @@ import { RootLayout as UIRootLayout } from '@payloadcms/ui/layouts';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import '@payloadcms/ui/css/app.css';
|
|
4
4
|
export { metadata } from '@payloadcms/ui/layouts';
|
|
5
|
-
type Props = Omit<React.ComponentProps<typeof UIRootLayout>, 'additionalDependencyChecks' | 'fonts' | '
|
|
5
|
+
type Props = Omit<React.ComponentProps<typeof UIRootLayout>, 'additionalDependencyChecks' | 'fonts' | 'initAdminContext' | 'RouterAdapter'>;
|
|
6
6
|
export declare const RootLayout: (props: Props) => React.JSX.Element;
|
|
7
7
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/adapters/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,4BAA4B,CAAA;AAqBnC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EACzC,4BAA4B,GAAG,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/adapters/layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,4BAA4B,CAAA;AAqBnC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EACzC,4BAA4B,GAAG,OAAO,GAAG,kBAAkB,GAAG,eAAe,CAC9E,CAAA;AAED,eAAO,MAAM,UAAU,UAAW,KAAK,sBAWtC,CAAA"}
|
package/dist/adapters/layout.js
CHANGED
|
@@ -3,8 +3,8 @@ import { RootLayout as UIRootLayout } from '@payloadcms/ui/layouts';
|
|
|
3
3
|
// @ts-expect-error - TS6 NodeNext rejects deep imports into `next` (no `exports` field), but Next.js compiler requires this exact specifier
|
|
4
4
|
import { Inter, Roboto_Mono } from 'next/font/google';
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { initAdminContext } from '../utilities/initAdminContext.js';
|
|
6
7
|
import { NextRouterAdapter } from './router.js';
|
|
7
|
-
import { nextServerAdapter } from './server.js';
|
|
8
8
|
const inter = Inter({
|
|
9
9
|
subsets: ['latin'],
|
|
10
10
|
variable: '--font-family-sans'
|
|
@@ -32,7 +32,7 @@ export const RootLayout = props => /*#__PURE__*/_jsx(UIRootLayout, {
|
|
|
32
32
|
className: robotoMono.className,
|
|
33
33
|
variable: robotoMono.variable
|
|
34
34
|
}],
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
initAdminContext: initAdminContext,
|
|
36
|
+
RouterAdapter: NextRouterAdapter
|
|
37
37
|
});
|
|
38
38
|
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","names":["RootLayout","UIRootLayout","Inter","Roboto_Mono","React","
|
|
1
|
+
{"version":3,"file":"layout.js","names":["RootLayout","UIRootLayout","Inter","Roboto_Mono","React","initAdminContext","NextRouterAdapter","inter","subsets","variable","robotoMono","nextDependencyChecks","dependencyVersions","next","required","version","metadata","props","_jsx","additionalDependencyChecks","fonts","className","RouterAdapter"],"sources":["../../src/adapters/layout.tsx"],"sourcesContent":["import { RootLayout as UIRootLayout } from '@payloadcms/ui/layouts'\n// @ts-expect-error - TS6 NodeNext rejects deep imports into `next` (no `exports` field), but Next.js compiler requires this exact specifier\nimport { Inter, Roboto_Mono } from 'next/font/google'\nimport React from 'react'\n\nimport { initAdminContext } from '../utilities/initAdminContext.js'\nimport { NextRouterAdapter } from './router.js'\n// CSS import lives here (not in `@payloadcms/ui`) so the esbuild bundle that produces\n// `@payloadcms/next/css` (`dist/prod/styles.css`) can follow the CSS chain. esbuild\n// treats `@payloadcms/ui` as external; any CSS import inside that package is invisible\n// to it, so the import must be reachable from within `packages/next/src/`.\nimport '@payloadcms/ui/css/app.css'\n\nconst inter = Inter({\n subsets: ['latin'],\n variable: '--font-family-sans',\n})\n\nconst robotoMono = Roboto_Mono({\n subsets: ['latin'],\n variable: '--font-family-mono',\n})\n\nconst nextDependencyChecks = {\n dependencyVersions: {\n next: {\n required: false,\n version: '>=15.0.0',\n },\n },\n}\n\nexport { metadata } from '@payloadcms/ui/layouts'\n\ntype Props = Omit<\n React.ComponentProps<typeof UIRootLayout>,\n 'additionalDependencyChecks' | 'fonts' | 'initAdminContext' | 'RouterAdapter'\n>\n\nexport const RootLayout = (props: Props) => (\n <UIRootLayout\n {...props}\n additionalDependencyChecks={nextDependencyChecks}\n fonts={[\n { className: inter.className, variable: inter.variable },\n { className: robotoMono.className, variable: robotoMono.variable },\n ]}\n initAdminContext={initAdminContext}\n RouterAdapter={NextRouterAdapter}\n />\n)\n"],"mappings":";AAAA,SAASA,UAAA,IAAcC,YAAY,QAAQ;AAC3C;AACA,SAASC,KAAK,EAAEC,WAAW,QAAQ;AACnC,OAAOC,KAAA,MAAW;AAElB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,iBAAiB,QAAQ;AAOlC,MAAMC,KAAA,GAAQL,KAAA,CAAM;EAClBM,OAAA,EAAS,CAAC,QAAQ;EAClBC,QAAA,EAAU;AACZ;AAEA,MAAMC,UAAA,GAAaP,WAAA,CAAY;EAC7BK,OAAA,EAAS,CAAC,QAAQ;EAClBC,QAAA,EAAU;AACZ;AAEA,MAAME,oBAAA,GAAuB;EAC3BC,kBAAA,EAAoB;IAClBC,IAAA,EAAM;MACJC,QAAA,EAAU;MACVC,OAAA,EAAS;IACX;EACF;AACF;AAEA,SAASC,QAAQ,QAAQ;AAOzB,OAAO,MAAMhB,UAAA,GAAciB,KAAA,iBACzBC,IAAA,CAACjB,YAAA;EACE,GAAGgB,KAAK;EACTE,0BAAA,EAA4BR,oBAAA;EAC5BS,KAAA,EAAO,CACL;IAAEC,SAAA,EAAWd,KAAA,CAAMc,SAAS;IAAEZ,QAAA,EAAUF,KAAA,CAAME;EAAS,GACvD;IAAEY,SAAA,EAAWX,UAAA,CAAWW,SAAS;IAAEZ,QAAA,EAAUC,UAAA,CAAWD;EAAS,EAClE;EACDJ,gBAAA,EAAkBA,gBAAA;EAClBiB,aAAA,EAAehB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","names":["generatePageMetadata","generateMetadata","getNextRequestI18n","adminViews","config","configPromise","params","paramsPromise","i18n","metadata"],"sources":["../../src/adapters/metadata.ts"],"sourcesContent":["import type { Metadata } from 'next'\nimport type { SanitizedConfig } from 'payload'\n\nimport { generatePageMetadata as generateMetadata } from '@payloadcms/ui/views/Root/generatePageMetadata'\n\nimport { getNextRequestI18n } from '../utilities/getNextRequestI18n.js'\nimport { adminViews } from './views.js'\n\ntype Args = {\n config: Promise<SanitizedConfig>\n params: Promise<{\n [key: string]: string | string[]\n }>\n searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}\n\nexport const generatePageMetadata = async ({\n config: configPromise,\n params: paramsPromise,\n}: Args): Promise<Metadata> => {\n const config = await configPromise\n const params = await paramsPromise\n const i18n = await getNextRequestI18n({ config })\n\n const metadata = await generateMetadata({ adminViews, config, i18n, params })\n\n return metadata
|
|
1
|
+
{"version":3,"file":"metadata.js","names":["generatePageMetadata","generateMetadata","getNextRequestI18n","adminViews","config","configPromise","params","paramsPromise","i18n","metadata"],"sources":["../../src/adapters/metadata.ts"],"sourcesContent":["import type { Metadata } from 'next'\nimport type { SanitizedConfig } from 'payload'\n\nimport { generatePageMetadata as generateMetadata } from '@payloadcms/ui/views/Root/generatePageMetadata'\n\nimport { getNextRequestI18n } from '../utilities/getNextRequestI18n.js'\nimport { adminViews } from './views.js'\n\ntype Args = {\n config: Promise<SanitizedConfig>\n params: Promise<{\n [key: string]: string | string[]\n }>\n searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}\n\nexport const generatePageMetadata = async ({\n config: configPromise,\n params: paramsPromise,\n}: Args): Promise<Metadata> => {\n const config = await configPromise\n const params = await paramsPromise\n const i18n = await getNextRequestI18n({ config })\n\n const metadata = await generateMetadata({ adminViews, config, i18n, params })\n\n return metadata\n}\n"],"mappings":"AAGA,SAASA,oBAAA,IAAwBC,gBAAgB,QAAQ;AAEzD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,UAAU,QAAQ;AAY3B,OAAO,MAAMH,oBAAA,GAAuB,MAAAA,CAAO;EACzCI,MAAA,EAAQC,aAAa;EACrBC,MAAA,EAAQC;AAAa,CAChB;EACL,MAAMH,MAAA,GAAS,MAAMC,aAAA;EACrB,MAAMC,MAAA,GAAS,MAAMC,aAAA;EACrB,MAAMC,IAAA,GAAO,MAAMN,kBAAA,CAAmB;IAAEE;EAAO;EAE/C,MAAMK,QAAA,GAAW,MAAMR,gBAAA,CAAiB;IAAEE,UAAA;IAAYC,MAAA;IAAQI,IAAA;IAAMF;EAAO;EAE3E,OAAOG,QAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/adapters/router.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/adapters/router.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAA;AAgCzB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA6BrE,CAAA"}
|
package/dist/adapters/router.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.js","names":["RouterAdapterContext","NextLinkImport","useParams","useNextParams","usePathname","useNextPathname","useRouter","useNextRouter","useSearchParams","useNextSearchParams","React","NextLink","default","NextLinkAdapter","children","href","prefetch","ref","replace","scroll","rest","_jsx","NextRouterAdapter","nextRouter","pathname","searchParams","params","router","useMemo","back","push","refresh","replaceState","url","window","history","value","Link"],"sources":["../../src/adapters/router.tsx"],"sourcesContent":["'use client'\nimport type { RouterAdapterContextValue } from '@payloadcms/ui'\nimport type { LinkAdapterProps } from 'payload'\n\nimport { RouterAdapterContext } from '@payloadcms/ui'\nimport NextLinkImport from 'next/link.js'\nimport {\n useParams as useNextParams,\n usePathname as useNextPathname,\n useRouter as useNextRouter,\n useSearchParams as useNextSearchParams,\n} from 'next/navigation.js'\nimport React from 'react'\n\ntype LinkComponent = React.FC<\n {\n children?: React.ReactNode\n href: string\n prefetch?: boolean\n ref?: React.Ref<HTMLAnchorElement>\n replace?: boolean\n scroll?: boolean\n } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>\n>\n\nconst NextLink: LinkComponent
|
|
1
|
+
{"version":3,"file":"router.js","names":["RouterAdapterContext","NextLinkImport","useParams","useNextParams","usePathname","useNextPathname","useRouter","useNextRouter","useSearchParams","useNextSearchParams","React","NextLink","default","NextLinkAdapter","children","href","prefetch","ref","replace","scroll","rest","_jsx","NextRouterAdapter","nextRouter","pathname","searchParams","params","router","useMemo","back","push","refresh","replaceState","url","window","history","value","Link"],"sources":["../../src/adapters/router.tsx"],"sourcesContent":["'use client'\nimport type { RouterAdapterContextValue } from '@payloadcms/ui'\nimport type { LinkAdapterProps } from 'payload'\n\nimport { RouterAdapterContext } from '@payloadcms/ui'\nimport NextLinkImport from 'next/link.js'\nimport {\n useParams as useNextParams,\n usePathname as useNextPathname,\n useRouter as useNextRouter,\n useSearchParams as useNextSearchParams,\n} from 'next/navigation.js'\nimport React from 'react'\n\ntype LinkComponent = React.FC<\n {\n children?: React.ReactNode\n href: string\n prefetch?: boolean\n ref?: React.Ref<HTMLAnchorElement>\n replace?: boolean\n scroll?: boolean\n } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>\n>\n\nconst NextLink: LinkComponent =\n 'default' in NextLinkImport ? NextLinkImport.default : NextLinkImport\n\nconst NextLinkAdapter: React.FC<LinkAdapterProps> = ({\n children,\n href,\n prefetch,\n ref,\n replace,\n scroll,\n ...rest\n}) => {\n return (\n <NextLink href={href} prefetch={prefetch} ref={ref} replace={replace} scroll={scroll} {...rest}>\n {children}\n </NextLink>\n )\n}\n\nexport const NextRouterAdapter: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const nextRouter = useNextRouter()\n const pathname = useNextPathname()\n const searchParams = useNextSearchParams()\n const params = useNextParams()\n\n const router = React.useMemo<RouterAdapterContextValue['router']>(\n () => ({\n back: nextRouter.back,\n push: nextRouter.push,\n refresh: nextRouter.refresh,\n replace: nextRouter.replace,\n replaceState: (url) => window.history.replaceState(null, '', url),\n }),\n [nextRouter],\n )\n\n const value = React.useMemo<RouterAdapterContextValue>(\n () => ({\n Link: NextLinkAdapter,\n params,\n pathname,\n router,\n searchParams,\n }),\n [params, pathname, router, searchParams],\n )\n\n return <RouterAdapterContext value={value}>{children}</RouterAdapterContext>\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,oBAAoB,QAAQ;AACrC,OAAOC,cAAA,MAAoB;AAC3B,SACEC,SAAA,IAAaC,aAAa,EAC1BC,WAAA,IAAeC,eAAe,EAC9BC,SAAA,IAAaC,aAAa,EAC1BC,eAAA,IAAmBC,mBAAmB,QACjC;AACP,OAAOC,KAAA,MAAW;AAalB,MAAMC,QAAA,GACJ,aAAaV,cAAA,GAAiBA,cAAA,CAAeW,OAAO,GAAGX,cAAA;AAEzD,MAAMY,eAAA,GAA8CA,CAAC;EACnDC,QAAQ;EACRC,IAAI;EACJC,QAAQ;EACRC,GAAG;EACHC,OAAO;EACPC,MAAM;EACN,GAAGC;AAAA,CACJ;EACC,oBACEC,IAAA,CAACV,QAAA;IAASI,IAAA,EAAMA,IAAA;IAAMC,QAAA,EAAUA,QAAA;IAAUC,GAAA,EAAKA,GAAA;IAAKC,OAAA,EAASA,OAAA;IAASC,MAAA,EAAQA,MAAA;IAAS,GAAGC,IAAI;cAC3FN;;AAGP;AAEA,OAAO,MAAMQ,iBAAA,GAA6DA,CAAC;EAAER;AAAQ,CAAE;EACrF,MAAMS,UAAA,GAAahB,aAAA;EACnB,MAAMiB,QAAA,GAAWnB,eAAA;EACjB,MAAMoB,YAAA,GAAehB,mBAAA;EACrB,MAAMiB,MAAA,GAASvB,aAAA;EAEf,MAAMwB,MAAA,GAASjB,KAAA,CAAMkB,OAAO,CAC1B,OAAO;IACLC,IAAA,EAAMN,UAAA,CAAWM,IAAI;IACrBC,IAAA,EAAMP,UAAA,CAAWO,IAAI;IACrBC,OAAA,EAASR,UAAA,CAAWQ,OAAO;IAC3Bb,OAAA,EAASK,UAAA,CAAWL,OAAO;IAC3Bc,YAAA,EAAeC,GAAA,IAAQC,MAAA,CAAOC,OAAO,CAACH,YAAY,CAAC,MAAM,IAAIC,GAAA;EAC/D,IACA,CAACV,UAAA,CAAW;EAGd,MAAMa,KAAA,GAAQ1B,KAAA,CAAMkB,OAAO,CACzB,OAAO;IACLS,IAAA,EAAMxB,eAAA;IACNa,MAAA;IACAF,QAAA;IACAG,MAAA;IACAF;EACF,IACA,CAACC,MAAA,EAAQF,QAAA,EAAUG,MAAA,EAAQF,YAAA,CAAa;EAG1C,oBAAOJ,IAAA,CAACrB,oBAAA;IAAqBoC,KAAA,EAAOA,KAAA;cAAQtB;;AAC9C","ignoreList":[]}
|
package/dist/adapters/views.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AdminViewAdapter, AdminViewServerProps, ImportMap, MetaConfig, SanitizedConfig } from 'payload';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
export declare const adminViews: AdminViewAdapter<AdminViewServerProps, MetaConfig>;
|
|
3
4
|
type PageProps = {
|
|
4
5
|
readonly config: Promise<SanitizedConfig>;
|
|
@@ -10,7 +11,7 @@ type PageProps = {
|
|
|
10
11
|
[key: string]: string | string[];
|
|
11
12
|
}>;
|
|
12
13
|
};
|
|
13
|
-
export declare const RootPage: (props: PageProps) => Promise<
|
|
14
|
-
export declare const NotFoundPage: (props: PageProps) => Promise<
|
|
14
|
+
export declare const RootPage: (props: PageProps) => Promise<React.JSX.Element>;
|
|
15
|
+
export declare const NotFoundPage: (props: PageProps) => Promise<React.JSX.Element>;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=views.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/adapters/views.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,eAAe,EAChB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/adapters/views.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,SAAS,EACT,UAAU,EACV,eAAe,EAChB,MAAM,SAAS,CAAA;AAMhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,UAAU,EAAE,gBAAgB,CAAC,oBAAoB,EAAE,UAAU,CAAqB,CAAA;AAE/F,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;IACzC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,MAAM,EAAE,CAAA;KACnB,CAAC,CAAA;IACF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;KACjC,CAAC,CAAA;CACH,CAAA;AAKD,eAAO,MAAM,QAAQ,UAAiB,SAAS,+BAI9C,CAAA;AAED,eAAO,MAAM,YAAY,UAAiB,SAAS,+BAIlD,CAAA"}
|
package/dist/adapters/views.js
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { renderNotFoundPage } from '@payloadcms/ui/views/NotFound/page';
|
|
3
3
|
import { renderRoot } from '@payloadcms/ui/views/Root';
|
|
4
4
|
import { defaultAdminViews } from '@payloadcms/ui/views/Root/adminViews';
|
|
5
5
|
import { notFound, redirect } from 'next/navigation.js';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
serverAdapter: nextServerAdapter
|
|
10
|
-
});
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { initAdminContext } from '../utilities/initAdminContext.js';
|
|
8
|
+
import { UnmountWhenHidden } from './UnmountWhenHidden/index.js';
|
|
11
9
|
export const adminViews = defaultAdminViews;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
// Set by `withPayload`. Only with `cacheComponents` does Next.js keep hidden pages mounted.
|
|
11
|
+
const isCacheComponentsEnabled = process.env.PAYLOAD_CACHE_COMPONENTS_ENABLED === 'true';
|
|
12
|
+
export const RootPage = async props => {
|
|
13
|
+
const page = await renderRoot({
|
|
14
|
+
...props,
|
|
15
|
+
adminViews,
|
|
16
|
+
initAdminContext,
|
|
17
|
+
notFound,
|
|
18
|
+
redirect
|
|
19
|
+
});
|
|
20
|
+
return isCacheComponentsEnabled ? /*#__PURE__*/_jsx(UnmountWhenHidden, {
|
|
21
|
+
children: page
|
|
22
|
+
}) : page;
|
|
23
|
+
};
|
|
24
|
+
export const NotFoundPage = async props => {
|
|
25
|
+
const page = await renderNotFoundPage({
|
|
26
|
+
...props,
|
|
27
|
+
initAdminContext
|
|
28
|
+
});
|
|
29
|
+
return isCacheComponentsEnabled ? /*#__PURE__*/_jsx(UnmountWhenHidden, {
|
|
30
|
+
children: page
|
|
31
|
+
}) : page;
|
|
32
|
+
};
|
|
23
33
|
//# sourceMappingURL=views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.js","names":["
|
|
1
|
+
{"version":3,"file":"views.js","names":["renderNotFoundPage","renderRoot","defaultAdminViews","notFound","redirect","React","initAdminContext","UnmountWhenHidden","adminViews","isCacheComponentsEnabled","process","env","PAYLOAD_CACHE_COMPONENTS_ENABLED","RootPage","props","page","_jsx","NotFoundPage"],"sources":["../../src/adapters/views.tsx"],"sourcesContent":["import type {\n AdminViewAdapter,\n AdminViewServerProps,\n ImportMap,\n MetaConfig,\n SanitizedConfig,\n} from 'payload'\n\nimport { renderNotFoundPage } from '@payloadcms/ui/views/NotFound/page'\nimport { renderRoot } from '@payloadcms/ui/views/Root'\nimport { defaultAdminViews } from '@payloadcms/ui/views/Root/adminViews'\nimport { notFound, redirect } from 'next/navigation.js'\nimport React from 'react'\n\nimport { initAdminContext } from '../utilities/initAdminContext.js'\nimport { UnmountWhenHidden } from './UnmountWhenHidden/index.js'\n\nexport const adminViews: AdminViewAdapter<AdminViewServerProps, MetaConfig> = defaultAdminViews\n\ntype PageProps = {\n readonly config: Promise<SanitizedConfig>\n readonly importMap: ImportMap\n readonly params: Promise<{\n segments: string[]\n }>\n readonly searchParams: Promise<{\n [key: string]: string | string[]\n }>\n}\n\n// Set by `withPayload`. Only with `cacheComponents` does Next.js keep hidden pages mounted.\nconst isCacheComponentsEnabled = process.env.PAYLOAD_CACHE_COMPONENTS_ENABLED === 'true'\n\nexport const RootPage = async (props: PageProps) => {\n const page = await renderRoot({ ...props, adminViews, initAdminContext, notFound, redirect })\n\n return isCacheComponentsEnabled ? <UnmountWhenHidden>{page}</UnmountWhenHidden> : page\n}\n\nexport const NotFoundPage = async (props: PageProps) => {\n const page = await renderNotFoundPage({ ...props, initAdminContext })\n\n return isCacheComponentsEnabled ? <UnmountWhenHidden>{page}</UnmountWhenHidden> : page\n}\n"],"mappings":";AAQA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ;AACnC,OAAOC,KAAA,MAAW;AAElB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,iBAAiB,QAAQ;AAElC,OAAO,MAAMC,UAAA,GAAiEN,iBAAA;AAa9E;AACA,MAAMO,wBAAA,GAA2BC,OAAA,CAAQC,GAAG,CAACC,gCAAgC,KAAK;AAElF,OAAO,MAAMC,QAAA,GAAW,MAAOC,KAAA;EAC7B,MAAMC,IAAA,GAAO,MAAMd,UAAA,CAAW;IAAE,GAAGa,KAAK;IAAEN,UAAA;IAAYF,gBAAA;IAAkBH,QAAA;IAAUC;EAAS;EAE3F,OAAOK,wBAAA,gBAA2BO,IAAA,CAACT,iBAAA;cAAmBQ;OAA4BA,IAAA;AACpF;AAEA,OAAO,MAAME,YAAA,GAAe,MAAOH,KAAA;EACjC,MAAMC,IAAA,GAAO,MAAMf,kBAAA,CAAmB;IAAE,GAAGc,KAAK;IAAER;EAAiB;EAEnE,OAAOG,wBAAA,gBAA2BO,IAAA,CAACT,iBAAA;cAAmBQ;OAA4BA,IAAA;AACpF","ignoreList":[]}
|
package/dist/auth/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","names":["login","loginFn","nextServerAdapter","args","serverAdapter"],"sources":["../../src/auth/login.ts"],"sourcesContent":["'use server'\n\nimport type { AuthCollectionSlug, LoginResult } from 'payload'\n\nimport { type LoginArgs, type LoginArgsWithoutServerAdapter, login as loginFn } from 'payload/auth'\n\nimport { nextServerAdapter } from '../adapters/server.js'\n\nexport async function login<TSlug extends AuthCollectionSlug>(\n args: LoginArgsWithoutServerAdapter<TSlug>,\n): Promise<LoginResult<TSlug>> {\n return loginFn({ ...args, serverAdapter: nextServerAdapter }
|
|
1
|
+
{"version":3,"file":"login.js","names":["login","loginFn","nextServerAdapter","args","serverAdapter"],"sources":["../../src/auth/login.ts"],"sourcesContent":["'use server'\n\nimport type { AuthCollectionSlug, LoginResult } from 'payload'\n\nimport { type LoginArgs, type LoginArgsWithoutServerAdapter, login as loginFn } from 'payload/auth'\n\nimport { nextServerAdapter } from '../adapters/server.js'\n\nexport async function login<TSlug extends AuthCollectionSlug>(\n args: LoginArgsWithoutServerAdapter<TSlug>,\n): Promise<LoginResult<TSlug>> {\n return loginFn({ ...args, serverAdapter: nextServerAdapter })\n}\n"],"mappings":"AAAA;;AAIA,SAA6DA,KAAA,IAASC,OAAO,QAAQ;AAErF,SAASC,iBAAiB,QAAQ;AAElC,OAAO,eAAeF,MACpBG,IAA0C;EAE1C,OAAOF,OAAA,CAAQ;IAAE,GAAGE,IAAI;IAAEC,aAAA,EAAeF;EAAkB;AAC7D","ignoreList":[]}
|
package/dist/cjs/withPayload.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// dist/withPayload/withPayload.js
|
|
@@ -23,12 +33,18 @@ __export(withPayload_exports, {
|
|
|
23
33
|
withPayload: () => withPayload
|
|
24
34
|
});
|
|
25
35
|
module.exports = __toCommonJS(withPayload_exports);
|
|
36
|
+
var import_node_url = require("node:url");
|
|
37
|
+
var import_meta = {};
|
|
26
38
|
var poweredByHeader = {
|
|
27
39
|
key: "X-Powered-By",
|
|
28
40
|
value: "Next.js, Payload"
|
|
29
41
|
};
|
|
30
42
|
var withPayload = (nextConfig = {}, options = {}) => {
|
|
31
|
-
const env =
|
|
43
|
+
const env = {
|
|
44
|
+
...nextConfig.env
|
|
45
|
+
};
|
|
46
|
+
const instantLoader = nextConfig.cacheComponents ? typeof import_meta?.resolve === "function" ? (0, import_node_url.fileURLToPath)(new URL("./instantLoader.js", import_meta.url)) : require.resolve("@payloadcms/next/withPayload/instantLoader") : void 0;
|
|
47
|
+
const instantLoaderRule = "**/{layout,page}.{js,jsx,ts,tsx,mjs,mts,cjs,cts}";
|
|
32
48
|
if (nextConfig.experimental?.staleTimes?.dynamic) {
|
|
33
49
|
console.warn("Payload: detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.");
|
|
34
50
|
env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = "true";
|
|
@@ -51,9 +67,7 @@ var withPayload = (nextConfig = {}, options = {}) => {
|
|
|
51
67
|
};
|
|
52
68
|
const baseConfig = {
|
|
53
69
|
...nextConfig,
|
|
54
|
-
devIndicators: nextConfig.devIndicators !== void 0 ? nextConfig.devIndicators :
|
|
55
|
-
position: "bottom-left"
|
|
56
|
-
},
|
|
70
|
+
devIndicators: nextConfig.devIndicators !== void 0 ? nextConfig.devIndicators : false,
|
|
57
71
|
env,
|
|
58
72
|
experimental: {
|
|
59
73
|
...nextConfig.experimental || {}
|
|
@@ -79,7 +93,24 @@ var withPayload = (nextConfig = {}, options = {}) => {
|
|
|
79
93
|
"**/*": [...nextConfig.outputFileTracingExcludes?.["**/*"] || [], "drizzle-kit", "drizzle-kit/api"]
|
|
80
94
|
},
|
|
81
95
|
turbopack: {
|
|
82
|
-
...nextConfig.turbopack || {}
|
|
96
|
+
...nextConfig.turbopack || {},
|
|
97
|
+
...instantLoader ? {
|
|
98
|
+
rules: {
|
|
99
|
+
...nextConfig.turbopack?.rules,
|
|
100
|
+
[instantLoaderRule]: [...[].concat(nextConfig.turbopack?.rules?.[instantLoaderRule] ?? []), {
|
|
101
|
+
// Only send files that import the admin root components to the loader, so
|
|
102
|
+
// Turbopack does not run a JavaScript loader for every other layout and page.
|
|
103
|
+
condition: {
|
|
104
|
+
all: [{
|
|
105
|
+
not: "foreign"
|
|
106
|
+
}, {
|
|
107
|
+
content: /['"]@payloadcms\/next\/(?:layouts|views)['"]/
|
|
108
|
+
}]
|
|
109
|
+
},
|
|
110
|
+
loaders: [instantLoader]
|
|
111
|
+
}]
|
|
112
|
+
}
|
|
113
|
+
} : {}
|
|
83
114
|
},
|
|
84
115
|
// We disable the poweredByHeader here because we add it manually in the headers function below
|
|
85
116
|
...nextConfig.poweredByHeader !== false ? {
|
|
@@ -120,21 +151,12 @@ var withPayload = (nextConfig = {}, options = {}) => {
|
|
|
120
151
|
...process.env.NODE_ENV === "development" && options.devBundleServerPackages !== true ? (
|
|
121
152
|
/**
|
|
122
153
|
* Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
|
|
123
|
-
* do not bundle server-only packages during dev
|
|
124
|
-
*
|
|
125
|
-
* 1. Performance: Fewer files to compile means faster compilation speeds.
|
|
126
|
-
* 2. Turbopack support: Webpack's externals are not supported by Turbopack.
|
|
127
|
-
*
|
|
128
|
-
* Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to
|
|
129
|
-
* externalized packages that are not resolvable from the project root. So including a package like
|
|
130
|
-
* "drizzle-kit" in here would do nothing - Next.js will ignore the rule and still bundle the package -
|
|
131
|
-
* because it detects that the package is not resolvable from the project root (= not directly installed
|
|
132
|
-
* by the user in their own package.json).
|
|
133
|
-
*
|
|
134
|
-
* Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly
|
|
135
|
-
* by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).
|
|
136
|
-
*
|
|
154
|
+
* do not bundle server-only packages during dev. Node.js loads them directly instead, so there are fewer
|
|
155
|
+
* files to compile, which means faster compilation speeds.
|
|
137
156
|
*
|
|
157
|
+
* A package can only be listed here if the import map never loads a client component from it. Node.js
|
|
158
|
+
* loads external packages as they are, so a `'use client'` file inside one would not become a client
|
|
159
|
+
* component. That is why packages with client components are not listed (see the TODO below).
|
|
138
160
|
*
|
|
139
161
|
* We should only do this during development, not build, because externalizing these packages can hurt
|
|
140
162
|
* the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the
|
|
@@ -145,20 +167,49 @@ var withPayload = (nextConfig = {}, options = {}) => {
|
|
|
145
167
|
* - payload (not in bundle, external) -> installs qs-esm (external because of importer)
|
|
146
168
|
* Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.
|
|
147
169
|
*
|
|
148
|
-
* During development, these bundle size
|
|
149
|
-
*
|
|
170
|
+
* During development, these bundle size differences do not matter much, and development speed is more
|
|
171
|
+
* important.
|
|
150
172
|
*/
|
|
151
|
-
[
|
|
173
|
+
[
|
|
174
|
+
"payload",
|
|
175
|
+
"@payloadcms/db-mongodb",
|
|
176
|
+
"@payloadcms/db-postgres",
|
|
177
|
+
"@payloadcms/db-sqlite",
|
|
178
|
+
"@payloadcms/db-vercel-postgres",
|
|
179
|
+
"@payloadcms/db-d1-sqlite",
|
|
180
|
+
"@payloadcms/drizzle",
|
|
181
|
+
"@payloadcms/email-nodemailer",
|
|
182
|
+
"@payloadcms/email-resend",
|
|
183
|
+
"@payloadcms/graphql",
|
|
184
|
+
"@payloadcms/kv-redis",
|
|
185
|
+
"@payloadcms/payload-cloud",
|
|
186
|
+
// Its `/client` entry has no exports, so the import map never loads anything from it
|
|
187
|
+
"@payloadcms/plugin-mcp",
|
|
188
|
+
"@payloadcms/plugin-nested-docs",
|
|
189
|
+
"@payloadcms/plugin-redirects",
|
|
190
|
+
"@payloadcms/transformer-sharp",
|
|
191
|
+
"@payloadcms/translations"
|
|
192
|
+
]
|
|
152
193
|
) : []
|
|
153
194
|
],
|
|
154
195
|
webpack: (webpackConfig, webpackOptions) => {
|
|
155
196
|
const incomingWebpackConfig = typeof nextConfig.webpack === "function" ? nextConfig.webpack(webpackConfig, webpackOptions) : webpackConfig;
|
|
156
197
|
return {
|
|
157
198
|
...incomingWebpackConfig,
|
|
199
|
+
...instantLoader ? {
|
|
200
|
+
module: {
|
|
201
|
+
...incomingWebpackConfig.module,
|
|
202
|
+
rules: [...incomingWebpackConfig.module?.rules || [], {
|
|
203
|
+
enforce: "pre",
|
|
204
|
+
exclude: /node_modules/,
|
|
205
|
+
test: /[/\\](layout|page)\.(?:[cm]?[jt]s|[jt]sx)$/,
|
|
206
|
+
use: [instantLoader]
|
|
207
|
+
}]
|
|
208
|
+
}
|
|
209
|
+
} : {},
|
|
158
210
|
externals: [
|
|
159
211
|
...incomingWebpackConfig?.externals || [],
|
|
160
212
|
/**
|
|
161
|
-
* See the explanation in the serverExternalPackages section above.
|
|
162
213
|
* We need to force Webpack to emit require() calls for these packages, even though they are not
|
|
163
214
|
* resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.
|
|
164
215
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/withPayload/withPayload.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload: detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (nextConfig.cacheComponents) {\n env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n devIndicators:\n nextConfig.devIndicators !== undefined\n ? nextConfig.devIndicators\n : { position: 'bottom-left' },\n env,\n experimental: {\n ...(nextConfig.experimental || {}),\n },\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./path/to/some/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning: Sass @import rules are deprecated and\n * will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * This can be triggered by any `.scss` file in a consumer's project that\n * still uses `@import`.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n // file-type v22 uses `import(specifier)` with a non-literal specifier, which Turbopack rejects\n // with \"Cannot find module as expression is too dynamic\"\n 'file-type',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n const trailingSlash = nextConfig.trailingSlash === true ? 'true' : 'false'\n process.env.NEXT_TRAILING_SLASH = trailingSlash\n baseConfig.env.NEXT_TRAILING_SLASH = trailingSlash\n\n return baseConfig\n}\n\nexport default withPayload\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["poweredByHeader", "key", "value", "withPayload", "nextConfig", "options", "env", "experimental", "staleTimes", "dynamic", "console", "warn", "NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH", "
|
|
4
|
+
"sourcesContent": ["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\n\nimport { fileURLToPath } from 'node:url'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = { ...nextConfig.env }\n // Adds `export const instant = false` to the admin layout and page. See `instantLoader.js` for\n // why this cannot live in the generated admin files.\n const instantLoader = nextConfig.cacheComponents\n ? typeof import.meta?.resolve === 'function'\n ? fileURLToPath(new URL('./instantLoader.js', import.meta.url))\n : require.resolve('@payloadcms/next/withPayload/instantLoader')\n : undefined\n const instantLoaderRule = '**/{layout,page}.{js,jsx,ts,tsx,mjs,mts,cjs,cts}'\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload: detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (nextConfig.cacheComponents) {\n env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n devIndicators: nextConfig.devIndicators !== undefined ? nextConfig.devIndicators : false,\n env,\n experimental: {\n ...(nextConfig.experimental || {}),\n },\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./path/to/some/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning: Sass @import rules are deprecated and\n * will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * This can be triggered by any `.scss` file in a consumer's project that\n * still uses `@import`.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n ...(instantLoader\n ? {\n rules: {\n ...nextConfig.turbopack?.rules,\n [instantLoaderRule]: [\n ...[].concat(nextConfig.turbopack?.rules?.[instantLoaderRule] ?? []),\n {\n // Only send files that import the admin root components to the loader, so\n // Turbopack does not run a JavaScript loader for every other layout and page.\n condition: {\n all: [\n { not: 'foreign' },\n { content: /['\"]@payloadcms\\/next\\/(?:layouts|views)['\"]/ },\n ],\n },\n loaders: [instantLoader],\n },\n ],\n },\n }\n : {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n // file-type v22 uses `import(specifier)` with a non-literal specifier, which Turbopack rejects\n // with \"Cannot find module as expression is too dynamic\"\n 'file-type',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev. Node.js loads them directly instead, so there are fewer\n * files to compile, which means faster compilation speeds.\n *\n * A package can only be listed here if the import map never loads a client component from it. Node.js\n * loads external packages as they are, so a `'use client'` file inside one would not become a client\n * component. That is why packages with client components are not listed (see the TODO below).\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size differences do not matter much, and development speed is more\n * important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/kv-redis',\n '@payloadcms/payload-cloud',\n // Its `/client` entry has no exports, so the import map never loads anything from it\n '@payloadcms/plugin-mcp',\n '@payloadcms/plugin-nested-docs',\n '@payloadcms/plugin-redirects',\n '@payloadcms/transformer-sharp',\n '@payloadcms/translations',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n ...(instantLoader\n ? {\n module: {\n ...incomingWebpackConfig.module,\n rules: [\n ...(incomingWebpackConfig.module?.rules || []),\n {\n enforce: 'pre',\n exclude: /node_modules/,\n test: /[/\\\\](layout|page)\\.(?:[cm]?[jt]s|[jt]sx)$/,\n use: [instantLoader],\n },\n ],\n },\n }\n : {}),\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n const trailingSlash = nextConfig.trailingSlash === true ? 'true' : 'false'\n process.env.NEXT_TRAILING_SLASH = trailingSlash\n baseConfig.env.NEXT_TRAILING_SLASH = trailingSlash\n\n return baseConfig\n}\n\nexport default withPayload\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["poweredByHeader", "key", "value", "withPayload", "nextConfig", "options", "env", "instantLoader", "cacheComponents", "import", "resolve", "fileURLToPath", "URL", "url", "require", "undefined", "instantLoaderRule", "experimental", "staleTimes", "dynamic", "console", "warn", "NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH", "PAYLOAD_CACHE_COMPONENTS_ENABLED", "consoleWarn", "sassWarningTexts", "args", "some", "text", "includes", "baseConfig", "devIndicators", "sassOptions", "silenceDeprecations", "outputFileTracingExcludes", "turbopack", "rules", "concat", "condition", "all", "not", "content", "loaders", "headers", "headersFromConfig", "source", "serverExternalPackages", "process", "NODE_ENV", "devBundleServerPackages", "webpack", "webpackConfig", "webpackOptions", "incomingWebpackConfig", "module", "enforce", "exclude", "test", "use", "externals", "plugins", "IgnorePlugin", "resourceRegExp", "alias", "fallback", "aws4", "basePath", "NEXT_BASE_PATH", "trailingSlash", "NEXT_TRAILING_SLASH"]
|
|
7
7
|
}
|