@payloadcms/tanstack-start 4.0.0-internal.a0ef1b8 → 4.0.0-internal.c7d5de4
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/LICENSE.md +1 -1
- package/dist/elements/RouterAdapter/index.d.ts.map +1 -1
- package/dist/elements/RouterAdapter/index.js +55 -16
- package/dist/elements/RouterAdapter/index.js.map +1 -1
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +4 -0
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.d.ts +1 -0
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -0
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/server.d.ts +4 -2
- package/dist/exports/server.d.ts.map +1 -1
- package/dist/exports/server.js +4 -2
- package/dist/exports/server.js.map +1 -1
- package/dist/exports/vite.d.ts +2 -2
- package/dist/exports/vite.d.ts.map +1 -1
- package/dist/exports/vite.js +1 -1
- package/dist/exports/vite.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/getLayoutData.d.ts.map +1 -1
- package/dist/layouts/Root/getLayoutData.js +37 -1
- package/dist/layouts/Root/getLayoutData.js.map +1 -1
- package/dist/layouts/Root/index.d.ts +9 -2
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +4 -2
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/layouts/Root/withPayloadRoot.d.ts +41 -0
- package/dist/layouts/Root/withPayloadRoot.d.ts.map +1 -0
- package/dist/layouts/Root/withPayloadRoot.js +91 -0
- package/dist/layouts/Root/withPayloadRoot.js.map +1 -0
- package/dist/node/cssLoader.d.mts +24 -2
- package/dist/node/cssLoader.d.mts.map +1 -1
- package/dist/routes/adminRoutes.d.ts +111 -0
- package/dist/routes/adminRoutes.d.ts.map +1 -0
- package/dist/routes/adminRoutes.js +108 -0
- package/dist/routes/adminRoutes.js.map +1 -0
- package/dist/routes/apiRoute.d.ts +34 -0
- package/dist/routes/apiRoute.d.ts.map +1 -0
- package/dist/routes/apiRoute.js +43 -0
- package/dist/routes/apiRoute.js.map +1 -0
- package/dist/routes/layoutRoute.d.ts +26 -0
- package/dist/routes/layoutRoute.d.ts.map +1 -0
- package/dist/routes/layoutRoute.js +57 -0
- package/dist/routes/layoutRoute.js.map +1 -0
- package/dist/utilities/graphqlHandler.server.d.ts.map +1 -1
- package/dist/utilities/handleAPIRoute.server.d.ts +11 -0
- package/dist/utilities/handleAPIRoute.server.d.ts.map +1 -0
- package/dist/utilities/handleAPIRoute.server.js +17 -0
- package/dist/utilities/handleAPIRoute.server.js.map +1 -0
- package/dist/utilities/importMap.server.d.ts +4 -5
- package/dist/utilities/importMap.server.d.ts.map +1 -1
- package/dist/utilities/importMap.server.js +5 -6
- package/dist/utilities/importMap.server.js.map +1 -1
- package/dist/utilities/loadAdminPage.d.ts +54 -0
- package/dist/utilities/loadAdminPage.d.ts.map +1 -0
- package/dist/utilities/loadAdminPage.js +239 -0
- package/dist/utilities/loadAdminPage.js.map +1 -0
- package/dist/utilities/loadLayoutData.d.ts +15 -0
- package/dist/utilities/loadLayoutData.d.ts.map +1 -0
- package/dist/utilities/loadLayoutData.js +23 -0
- package/dist/utilities/loadLayoutData.js.map +1 -0
- package/dist/utilities/meta.d.ts +1 -0
- package/dist/utilities/meta.d.ts.map +1 -1
- package/dist/utilities/meta.js +2 -1
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/routerSearch.d.ts +40 -0
- package/dist/utilities/routerSearch.d.ts.map +1 -0
- package/dist/utilities/routerSearch.js +45 -0
- package/dist/utilities/routerSearch.js.map +1 -0
- package/dist/utilities/serializeForRsc.d.ts.map +1 -1
- package/dist/utilities/serializeForRsc.js +17 -0
- package/dist/utilities/serializeForRsc.js.map +1 -1
- package/dist/utilities/serverAdapter.server.d.ts.map +1 -1
- package/dist/utilities/serverFunctionClient.d.ts +29 -0
- package/dist/utilities/serverFunctionClient.d.ts.map +1 -0
- package/dist/utilities/serverFunctionClient.js +109 -0
- package/dist/utilities/serverFunctionClient.js.map +1 -0
- package/dist/vite/config/external.d.ts +26 -0
- package/dist/vite/config/external.d.ts.map +1 -0
- package/dist/vite/config/external.js +72 -0
- package/dist/vite/config/external.js.map +1 -0
- package/dist/vite/config/optimizeDeps.d.ts +25 -0
- package/dist/vite/config/optimizeDeps.d.ts.map +1 -0
- package/dist/vite/config/optimizeDeps.js +123 -0
- package/dist/vite/config/optimizeDeps.js.map +1 -0
- package/dist/vite/config/scss.d.ts +14 -0
- package/dist/vite/config/scss.d.ts.map +1 -0
- package/dist/vite/config/scss.js +28 -0
- package/dist/vite/config/scss.js.map +1 -0
- package/dist/vite/index.d.ts +99 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +258 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/workarounds/clientModuleResolution.d.ts.map +1 -0
- package/dist/vite/workarounds/clientModuleResolution.js.map +1 -0
- package/dist/vite/workarounds/devTransforms.d.ts +19 -0
- package/dist/vite/workarounds/devTransforms.d.ts.map +1 -0
- package/dist/vite/{plugins → workarounds}/devTransforms.js +18 -2
- package/dist/vite/workarounds/devTransforms.js.map +1 -0
- package/dist/vite/workarounds/reactDomServerInRsc.d.ts.map +1 -0
- package/dist/vite/workarounds/reactDomServerInRsc.js.map +1 -0
- package/dist/vite/workarounds/stripDistStyleImports.d.ts.map +1 -0
- package/dist/vite/workarounds/stripDistStyleImports.js +140 -0
- package/dist/vite/workarounds/stripDistStyleImports.js.map +1 -0
- package/dist/vite/workarounds/stubPrettierInClient.d.ts +13 -0
- package/dist/vite/workarounds/stubPrettierInClient.d.ts.map +1 -0
- package/dist/vite/workarounds/stubPrettierInClient.js +32 -0
- package/dist/vite/workarounds/stubPrettierInClient.js.map +1 -0
- package/dist/vite/workarounds/wrapCjsForClient.d.ts.map +1 -0
- package/dist/vite/workarounds/wrapCjsForClient.js.map +1 -0
- package/package.json +12 -7
- package/dist/@types/assets.d.js +0 -2
- package/dist/@types/assets.d.js.map +0 -1
- package/dist/auth/switchLanguage.d.ts +0 -6
- package/dist/auth/switchLanguage.d.ts.map +0 -1
- package/dist/auth/switchLanguage.js +0 -11
- package/dist/auth/switchLanguage.js.map +0 -1
- package/dist/utilities/getRequestTheme.d.ts +0 -10
- package/dist/utilities/getRequestTheme.d.ts.map +0 -1
- package/dist/utilities/getRequestTheme.js +0 -25
- package/dist/utilities/getRequestTheme.js.map +0 -1
- package/dist/vite/constants.d.ts +0 -37
- package/dist/vite/constants.d.ts.map +0 -1
- package/dist/vite/constants.js +0 -129
- package/dist/vite/constants.js.map +0 -1
- package/dist/vite/plugin.d.ts +0 -38
- package/dist/vite/plugin.d.ts.map +0 -1
- package/dist/vite/plugin.js +0 -182
- package/dist/vite/plugin.js.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.d.ts.map +0 -1
- package/dist/vite/plugins/clientModuleResolution.js.map +0 -1
- package/dist/vite/plugins/devTransforms.d.ts +0 -8
- package/dist/vite/plugins/devTransforms.d.ts.map +0 -1
- package/dist/vite/plugins/devTransforms.js.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.d.ts.map +0 -1
- package/dist/vite/plugins/reactDomServerInRsc.js.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.d.ts.map +0 -1
- package/dist/vite/plugins/stripDistStyleImports.js +0 -89
- package/dist/vite/plugins/stripDistStyleImports.js.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.d.ts.map +0 -1
- package/dist/vite/plugins/wrapCjsForClient.js.map +0 -1
- /package/dist/vite/{plugins → workarounds}/clientModuleResolution.d.ts +0 -0
- /package/dist/vite/{plugins → workarounds}/clientModuleResolution.js +0 -0
- /package/dist/vite/{plugins → workarounds}/reactDomServerInRsc.d.ts +0 -0
- /package/dist/vite/{plugins → workarounds}/reactDomServerInRsc.js +0 -0
- /package/dist/vite/{plugins → workarounds}/stripDistStyleImports.d.ts +0 -0
- /package/dist/vite/{plugins → workarounds}/wrapCjsForClient.d.ts +0 -0
- /package/dist/vite/{plugins → workarounds}/wrapCjsForClient.js +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const STYLE_EXTENSION_RE = /\.(?:s?css|less)$/i;
|
|
2
|
+
/**
|
|
3
|
+
* Static `import './foo.css'` (or .scss/.less) — top-level only.
|
|
4
|
+
* Captures the entire statement so we can replace it with an empty line.
|
|
5
|
+
*
|
|
6
|
+
* Matches:
|
|
7
|
+
* import './foo.css';
|
|
8
|
+
* import "../bar.scss"
|
|
9
|
+
* import './baz.less' ;
|
|
10
|
+
*/ const STATIC_STYLE_IMPORT_RE = /^[ \t]*import\s+['"][^'"]+\.(?:s?css|less)['"]\s*(?:;[ \t]*)?$/gm;
|
|
11
|
+
/**
|
|
12
|
+
* Monorepo Payload package source, e.g. `…/packages/ui/src/…`. In the
|
|
13
|
+
* core-dev / test setup Payload packages resolve to their workspace `src`
|
|
14
|
+
* (not a published `dist`), so the `dist/` rule below doesn't cover them and
|
|
15
|
+
* their `.css` side-effect imports survive into the SSR/RSC graph.
|
|
16
|
+
*/ const PAYLOAD_PKG_SRC_RE = /\/packages\/[^/]+\/src\//;
|
|
17
|
+
/**
|
|
18
|
+
* The version-diff component trees — matched in either published `dist/` or
|
|
19
|
+
* workspace `src/` form. The `.css` side-effect imports of these must be
|
|
20
|
+
* stripped in the RSC env (the rest of `@payloadcms/ui` must NOT be — see the
|
|
21
|
+
* note in `resolveId`/`transform` below), for two reasons rooted in the same
|
|
22
|
+
* `@vitejs/plugin-rsc` behaviour: it wraps every exported CSS-importing
|
|
23
|
+
* component with an async CSS-collector child
|
|
24
|
+
* (`__vite_rsc_wrap_css__` → `await import('virtual:vite-rsc/css?…')`).
|
|
25
|
+
*
|
|
26
|
+
* 1. Correctness: the diff converters render `CheckIcon` (`icons/*`) and `File`
|
|
27
|
+
* (`graphics/*`) through the SYNCHRONOUS `renderToStaticMarkup` (see
|
|
28
|
+
* `reactDomServerInRsc`). The async wrapper suspends, crashing that render
|
|
29
|
+
* with "A component suspended while responding to synchronous input" and
|
|
30
|
+
* taking down the entire field-diffs tree.
|
|
31
|
+
* 2. Performance: the diff view (`views/Version/*` — `RenderFieldsToDiff` and
|
|
32
|
+
* its per-field components, `DiffCollapser`, `SelectComparison`, the
|
|
33
|
+
* `Default` template — plus the `HTMLDiff`/`FieldDiffContainer`/
|
|
34
|
+
* `FieldDiffLabel` elements and lexical's `field/Diff/*`) renders dozens of
|
|
35
|
+
* these wrapped components in the Flight stream. Each async CSS import
|
|
36
|
+
* serializes a round-trip, ballooning the render from ~3s to ~25s and
|
|
37
|
+
* blowing past the e2e waits. Stripping them collapses it back to ~3s.
|
|
38
|
+
*
|
|
39
|
+
* Safe because every one of these components' styles also ship in the global
|
|
40
|
+
* `@payloadcms/ui/scss/app.scss` the admin imports, so dropping the per-module
|
|
41
|
+
* RSC collection here changes nothing visually (verified: diff + Nav stay
|
|
42
|
+
* styled). The admin `Nav` etc. are deliberately excluded — they rely on the
|
|
43
|
+
* RSC collection and a broad strip leaves them unstyled.
|
|
44
|
+
*/ const DIFF_VIEW_COMPONENT_RE = /@payloadcms\/ui\/(?:dist|src)\/(?:icons|graphics|views\/Version|elements\/(?:HTMLDiff|FieldDiffContainer|FieldDiffLabel))\/|@payloadcms\/richtext-lexical\/(?:dist|src)\/field\/Diff\//;
|
|
45
|
+
/**
|
|
46
|
+
* Stops Vite (and the underlying Node ESM loader) from trying to load
|
|
47
|
+
* SCSS/CSS/LESS during SSR/RSC when the importer lives inside a built
|
|
48
|
+
* `dist/` directory or when the specifier is a bare package name.
|
|
49
|
+
*
|
|
50
|
+
* We do this two ways, because either layer can fail:
|
|
51
|
+
*
|
|
52
|
+
* 1. `resolveId` redirects style specifiers to a virtual empty module —
|
|
53
|
+
* handles cases where Vite asks us to resolve them.
|
|
54
|
+
* 2. `transform` strips top-level `import './x.css'` statements out of any
|
|
55
|
+
* JS/TS file living under `node_modules/.../dist/` for non-client envs.
|
|
56
|
+
* This is the bulletproof path for prod-packed `@payloadcms/ui` (and
|
|
57
|
+
* similar) dependencies that get pre-bundled by Vite's SSR/RSC dep
|
|
58
|
+
* optimizer (esbuild). Esbuild preserves `.css` import statements as-is,
|
|
59
|
+
* and Node's native ESM loader then crashes with
|
|
60
|
+
* `Unknown file extension ".css"`. Removing them at the source avoids
|
|
61
|
+
* that entirely.
|
|
62
|
+
*/ export function ssrStripDistStyleImports() {
|
|
63
|
+
return {
|
|
64
|
+
name: 'payload:ssr-strip-dist-style-imports',
|
|
65
|
+
enforce: 'pre',
|
|
66
|
+
load (id) {
|
|
67
|
+
if (id === '\0ssr-empty-style') {
|
|
68
|
+
return '';
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
resolveId (id, importer, options) {
|
|
72
|
+
const envName = this.environment?.name;
|
|
73
|
+
const isServerEnv = options?.ssr || envName && envName !== 'client';
|
|
74
|
+
if (!isServerEnv) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Do NOT strip in the RSC environment. Server components (e.g. the admin
|
|
78
|
+
// `Nav`, a non-'use client' component that `import './index.css'`) render
|
|
79
|
+
// in the RSC graph, and `@vitejs/plugin-rsc` must SEE their `.css` imports
|
|
80
|
+
// there to collect them as client stylesheets. Stripping them here means
|
|
81
|
+
// their CSS is never emitted and the admin renders unstyled (broken nav
|
|
82
|
+
// scroll/layout, etc.). The Node-side `.css` no-op is handled by
|
|
83
|
+
// `cssLoader.mjs` (dev) and by Vite's CSS extraction (build), so the
|
|
84
|
+
// crash this plugin guards against does not require touching the RSC env.
|
|
85
|
+
if (envName === 'rsc') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!STYLE_EXTENSION_RE.test(id)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (importer && (/\/dist\//.test(importer) || PAYLOAD_PKG_SRC_RE.test(importer))) {
|
|
92
|
+
return '\0ssr-empty-style';
|
|
93
|
+
}
|
|
94
|
+
if (/^@?[a-z]/.test(id) && !id.startsWith('.') && !id.startsWith('/')) {
|
|
95
|
+
return '\0ssr-empty-style';
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
transform (code, id) {
|
|
99
|
+
const envName = this.environment?.name;
|
|
100
|
+
const isServerEnv = envName && envName !== 'client';
|
|
101
|
+
if (!isServerEnv) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// In the RSC env, only strip from the version-diff component trees (see
|
|
105
|
+
// `DIFF_VIEW_COMPONENT_RE`). Every other server component (the admin
|
|
106
|
+
// `Nav`, etc.) must keep its `.css` import so plugin-rsc can collect it —
|
|
107
|
+
// see the matching note in `resolveId` above.
|
|
108
|
+
if (envName === 'rsc' && !DIFF_VIEW_COMPONENT_RE.test(id)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
// Only touch Payload dependency files: published `node_modules/.../dist/`
|
|
112
|
+
// builds, or workspace `…/packages/<pkg>/src/…` sources in the core-dev /
|
|
113
|
+
// test setup. Don't strip from the consumer's own app source — devs may
|
|
114
|
+
// legitimately want SSR-rendered <link>s from their own CSS imports.
|
|
115
|
+
const isPayloadDistFile = /\/node_modules\//.test(id) && /\/dist\//.test(id);
|
|
116
|
+
const isPayloadSrcFile = PAYLOAD_PKG_SRC_RE.test(id);
|
|
117
|
+
if (!isPayloadDistFile && !isPayloadSrcFile) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Allow a trailing query (`?v=…`, `?t=…`): Vite appends version/timestamp
|
|
121
|
+
// queries to module ids, especially in the RSC graph, so a strict `$`
|
|
122
|
+
// anchor would skip e.g. `icons/Check/index.js?v=83de8543`.
|
|
123
|
+
if (!/\.[mc]?[jt]sx?(?:$|\?)/.test(id)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (!STATIC_STYLE_IMPORT_RE.test(code)) {
|
|
127
|
+
STATIC_STYLE_IMPORT_RE.lastIndex = 0;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
STATIC_STYLE_IMPORT_RE.lastIndex = 0;
|
|
131
|
+
const stripped = code.replace(STATIC_STYLE_IMPORT_RE, '');
|
|
132
|
+
return {
|
|
133
|
+
code: stripped,
|
|
134
|
+
map: null
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=stripDistStyleImports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/workarounds/stripDistStyleImports.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\nconst STYLE_EXTENSION_RE = /\\.(?:s?css|less)$/i\n\n/**\n * Static `import './foo.css'` (or .scss/.less) — top-level only.\n * Captures the entire statement so we can replace it with an empty line.\n *\n * Matches:\n * import './foo.css';\n * import \"../bar.scss\"\n * import './baz.less' ;\n */\nconst STATIC_STYLE_IMPORT_RE = /^[ \\t]*import\\s+['\"][^'\"]+\\.(?:s?css|less)['\"]\\s*(?:;[ \\t]*)?$/gm\n\n/**\n * Monorepo Payload package source, e.g. `…/packages/ui/src/…`. In the\n * core-dev / test setup Payload packages resolve to their workspace `src`\n * (not a published `dist`), so the `dist/` rule below doesn't cover them and\n * their `.css` side-effect imports survive into the SSR/RSC graph.\n */\nconst PAYLOAD_PKG_SRC_RE = /\\/packages\\/[^/]+\\/src\\//\n\n/**\n * The version-diff component trees — matched in either published `dist/` or\n * workspace `src/` form. The `.css` side-effect imports of these must be\n * stripped in the RSC env (the rest of `@payloadcms/ui` must NOT be — see the\n * note in `resolveId`/`transform` below), for two reasons rooted in the same\n * `@vitejs/plugin-rsc` behaviour: it wraps every exported CSS-importing\n * component with an async CSS-collector child\n * (`__vite_rsc_wrap_css__` → `await import('virtual:vite-rsc/css?…')`).\n *\n * 1. Correctness: the diff converters render `CheckIcon` (`icons/*`) and `File`\n * (`graphics/*`) through the SYNCHRONOUS `renderToStaticMarkup` (see\n * `reactDomServerInRsc`). The async wrapper suspends, crashing that render\n * with \"A component suspended while responding to synchronous input\" and\n * taking down the entire field-diffs tree.\n * 2. Performance: the diff view (`views/Version/*` — `RenderFieldsToDiff` and\n * its per-field components, `DiffCollapser`, `SelectComparison`, the\n * `Default` template — plus the `HTMLDiff`/`FieldDiffContainer`/\n * `FieldDiffLabel` elements and lexical's `field/Diff/*`) renders dozens of\n * these wrapped components in the Flight stream. Each async CSS import\n * serializes a round-trip, ballooning the render from ~3s to ~25s and\n * blowing past the e2e waits. Stripping them collapses it back to ~3s.\n *\n * Safe because every one of these components' styles also ship in the global\n * `@payloadcms/ui/scss/app.scss` the admin imports, so dropping the per-module\n * RSC collection here changes nothing visually (verified: diff + Nav stay\n * styled). The admin `Nav` etc. are deliberately excluded — they rely on the\n * RSC collection and a broad strip leaves them unstyled.\n */\nconst DIFF_VIEW_COMPONENT_RE =\n /@payloadcms\\/ui\\/(?:dist|src)\\/(?:icons|graphics|views\\/Version|elements\\/(?:HTMLDiff|FieldDiffContainer|FieldDiffLabel))\\/|@payloadcms\\/richtext-lexical\\/(?:dist|src)\\/field\\/Diff\\//\n\n/**\n * Stops Vite (and the underlying Node ESM loader) from trying to load\n * SCSS/CSS/LESS during SSR/RSC when the importer lives inside a built\n * `dist/` directory or when the specifier is a bare package name.\n *\n * We do this two ways, because either layer can fail:\n *\n * 1. `resolveId` redirects style specifiers to a virtual empty module —\n * handles cases where Vite asks us to resolve them.\n * 2. `transform` strips top-level `import './x.css'` statements out of any\n * JS/TS file living under `node_modules/.../dist/` for non-client envs.\n * This is the bulletproof path for prod-packed `@payloadcms/ui` (and\n * similar) dependencies that get pre-bundled by Vite's SSR/RSC dep\n * optimizer (esbuild). Esbuild preserves `.css` import statements as-is,\n * and Node's native ESM loader then crashes with\n * `Unknown file extension \".css\"`. Removing them at the source avoids\n * that entirely.\n */\nexport function ssrStripDistStyleImports(): PluginOption {\n return {\n name: 'payload:ssr-strip-dist-style-imports',\n enforce: 'pre',\n load(id) {\n if (id === '\\0ssr-empty-style') {\n return ''\n }\n },\n resolveId(id, importer, options) {\n const envName = (this as any).environment?.name as string | undefined\n const isServerEnv = options?.ssr || (envName && envName !== 'client')\n if (!isServerEnv) {\n return\n }\n // Do NOT strip in the RSC environment. Server components (e.g. the admin\n // `Nav`, a non-'use client' component that `import './index.css'`) render\n // in the RSC graph, and `@vitejs/plugin-rsc` must SEE their `.css` imports\n // there to collect them as client stylesheets. Stripping them here means\n // their CSS is never emitted and the admin renders unstyled (broken nav\n // scroll/layout, etc.). The Node-side `.css` no-op is handled by\n // `cssLoader.mjs` (dev) and by Vite's CSS extraction (build), so the\n // crash this plugin guards against does not require touching the RSC env.\n if (envName === 'rsc') {\n return\n }\n if (!STYLE_EXTENSION_RE.test(id)) {\n return\n }\n if (importer && (/\\/dist\\//.test(importer) || PAYLOAD_PKG_SRC_RE.test(importer))) {\n return '\\0ssr-empty-style'\n }\n if (/^@?[a-z]/.test(id) && !id.startsWith('.') && !id.startsWith('/')) {\n return '\\0ssr-empty-style'\n }\n },\n transform(code, id) {\n const envName = (this as any).environment?.name as string | undefined\n const isServerEnv = envName && envName !== 'client'\n if (!isServerEnv) {\n return\n }\n // In the RSC env, only strip from the version-diff component trees (see\n // `DIFF_VIEW_COMPONENT_RE`). Every other server component (the admin\n // `Nav`, etc.) must keep its `.css` import so plugin-rsc can collect it —\n // see the matching note in `resolveId` above.\n if (envName === 'rsc' && !DIFF_VIEW_COMPONENT_RE.test(id)) {\n return\n }\n // Only touch Payload dependency files: published `node_modules/.../dist/`\n // builds, or workspace `…/packages/<pkg>/src/…` sources in the core-dev /\n // test setup. Don't strip from the consumer's own app source — devs may\n // legitimately want SSR-rendered <link>s from their own CSS imports.\n const isPayloadDistFile = /\\/node_modules\\//.test(id) && /\\/dist\\//.test(id)\n const isPayloadSrcFile = PAYLOAD_PKG_SRC_RE.test(id)\n if (!isPayloadDistFile && !isPayloadSrcFile) {\n return\n }\n // Allow a trailing query (`?v=…`, `?t=…`): Vite appends version/timestamp\n // queries to module ids, especially in the RSC graph, so a strict `$`\n // anchor would skip e.g. `icons/Check/index.js?v=83de8543`.\n if (!/\\.[mc]?[jt]sx?(?:$|\\?)/.test(id)) {\n return\n }\n if (!STATIC_STYLE_IMPORT_RE.test(code)) {\n STATIC_STYLE_IMPORT_RE.lastIndex = 0\n return\n }\n STATIC_STYLE_IMPORT_RE.lastIndex = 0\n const stripped = code.replace(STATIC_STYLE_IMPORT_RE, '')\n return { code: stripped, map: null }\n },\n }\n}\n"],"names":["STYLE_EXTENSION_RE","STATIC_STYLE_IMPORT_RE","PAYLOAD_PKG_SRC_RE","DIFF_VIEW_COMPONENT_RE","ssrStripDistStyleImports","name","enforce","load","id","resolveId","importer","options","envName","environment","isServerEnv","ssr","test","startsWith","transform","code","isPayloadDistFile","isPayloadSrcFile","lastIndex","stripped","replace","map"],"mappings":"AAEA,MAAMA,qBAAqB;AAE3B;;;;;;;;CAQC,GACD,MAAMC,yBAAyB;AAE/B;;;;;CAKC,GACD,MAAMC,qBAAqB;AAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GACD,MAAMC,yBACJ;AAEF;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,MAAM;QACNC,SAAS;QACTC,MAAKC,EAAE;YACL,IAAIA,OAAO,qBAAqB;gBAC9B,OAAO;YACT;QACF;QACAC,WAAUD,EAAE,EAAEE,QAAQ,EAAEC,OAAO;YAC7B,MAAMC,UAAU,AAAC,IAAI,CAASC,WAAW,EAAER;YAC3C,MAAMS,cAAcH,SAASI,OAAQH,WAAWA,YAAY;YAC5D,IAAI,CAACE,aAAa;gBAChB;YACF;YACA,yEAAyE;YACzE,0EAA0E;YAC1E,2EAA2E;YAC3E,yEAAyE;YACzE,wEAAwE;YACxE,iEAAiE;YACjE,qEAAqE;YACrE,0EAA0E;YAC1E,IAAIF,YAAY,OAAO;gBACrB;YACF;YACA,IAAI,CAACZ,mBAAmBgB,IAAI,CAACR,KAAK;gBAChC;YACF;YACA,IAAIE,YAAa,CAAA,WAAWM,IAAI,CAACN,aAAaR,mBAAmBc,IAAI,CAACN,SAAQ,GAAI;gBAChF,OAAO;YACT;YACA,IAAI,WAAWM,IAAI,CAACR,OAAO,CAACA,GAAGS,UAAU,CAAC,QAAQ,CAACT,GAAGS,UAAU,CAAC,MAAM;gBACrE,OAAO;YACT;QACF;QACAC,WAAUC,IAAI,EAAEX,EAAE;YAChB,MAAMI,UAAU,AAAC,IAAI,CAASC,WAAW,EAAER;YAC3C,MAAMS,cAAcF,WAAWA,YAAY;YAC3C,IAAI,CAACE,aAAa;gBAChB;YACF;YACA,wEAAwE;YACxE,qEAAqE;YACrE,0EAA0E;YAC1E,8CAA8C;YAC9C,IAAIF,YAAY,SAAS,CAACT,uBAAuBa,IAAI,CAACR,KAAK;gBACzD;YACF;YACA,0EAA0E;YAC1E,0EAA0E;YAC1E,wEAAwE;YACxE,qEAAqE;YACrE,MAAMY,oBAAoB,mBAAmBJ,IAAI,CAACR,OAAO,WAAWQ,IAAI,CAACR;YACzE,MAAMa,mBAAmBnB,mBAAmBc,IAAI,CAACR;YACjD,IAAI,CAACY,qBAAqB,CAACC,kBAAkB;gBAC3C;YACF;YACA,0EAA0E;YAC1E,sEAAsE;YACtE,4DAA4D;YAC5D,IAAI,CAAC,yBAAyBL,IAAI,CAACR,KAAK;gBACtC;YACF;YACA,IAAI,CAACP,uBAAuBe,IAAI,CAACG,OAAO;gBACtClB,uBAAuBqB,SAAS,GAAG;gBACnC;YACF;YACArB,uBAAuBqB,SAAS,GAAG;YACnC,MAAMC,WAAWJ,KAAKK,OAAO,CAACvB,wBAAwB;YACtD,OAAO;gBAAEkB,MAAMI;gBAAUE,KAAK;YAAK;QACrC;IACF;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PluginOption } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Stubs `prettier` in the CLIENT bundle only.
|
|
4
|
+
*
|
|
5
|
+
* `payload`'s barrel transitively pulls `json-schema-to-typescript` → `prettier`
|
|
6
|
+
* (CommonJS) into the client graph. That path is type-gen only and never runs in
|
|
7
|
+
* the browser, but the bundler still drags in `prettier`'s `index.cjs`, which
|
|
8
|
+
* fails to parse as ESM and breaks the client build. SSR/RSC keep real prettier.
|
|
9
|
+
*
|
|
10
|
+
* Delete once `payload`'s barrel no longer reaches type-gen from the client graph.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stubPrettierInClient(): PluginOption;
|
|
13
|
+
//# sourceMappingURL=stubPrettierInClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubPrettierInClient.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/stubPrettierInClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,CAqBnD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stubs `prettier` in the CLIENT bundle only.
|
|
3
|
+
*
|
|
4
|
+
* `payload`'s barrel transitively pulls `json-schema-to-typescript` → `prettier`
|
|
5
|
+
* (CommonJS) into the client graph. That path is type-gen only and never runs in
|
|
6
|
+
* the browser, but the bundler still drags in `prettier`'s `index.cjs`, which
|
|
7
|
+
* fails to parse as ESM and breaks the client build. SSR/RSC keep real prettier.
|
|
8
|
+
*
|
|
9
|
+
* Delete once `payload`'s barrel no longer reaches type-gen from the client graph.
|
|
10
|
+
*/ export function stubPrettierInClient() {
|
|
11
|
+
const RESOLVED_ID = '\0payload:prettier-client-stub';
|
|
12
|
+
return {
|
|
13
|
+
name: 'payload:stub-prettier-in-client',
|
|
14
|
+
enforce: 'pre',
|
|
15
|
+
load (id) {
|
|
16
|
+
if (id === RESOLVED_ID) {
|
|
17
|
+
return 'export const format = (source) => source;\nexport default { format };';
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
resolveId (id, importer, options) {
|
|
21
|
+
if (options?.ssr) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Only stub the type-gen import; leave a host's own client `prettier` alone.
|
|
25
|
+
if (id === 'prettier' && importer?.includes('json-schema-to-typescript')) {
|
|
26
|
+
return RESOLVED_ID;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=stubPrettierInClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/workarounds/stubPrettierInClient.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Stubs `prettier` in the CLIENT bundle only.\n *\n * `payload`'s barrel transitively pulls `json-schema-to-typescript` → `prettier`\n * (CommonJS) into the client graph. That path is type-gen only and never runs in\n * the browser, but the bundler still drags in `prettier`'s `index.cjs`, which\n * fails to parse as ESM and breaks the client build. SSR/RSC keep real prettier.\n *\n * Delete once `payload`'s barrel no longer reaches type-gen from the client graph.\n */\nexport function stubPrettierInClient(): PluginOption {\n const RESOLVED_ID = '\\0payload:prettier-client-stub'\n\n return {\n name: 'payload:stub-prettier-in-client',\n enforce: 'pre',\n load(id) {\n if (id === RESOLVED_ID) {\n return 'export const format = (source) => source;\\nexport default { format };'\n }\n },\n resolveId(id, importer, options) {\n if (options?.ssr) {\n return\n }\n // Only stub the type-gen import; leave a host's own client `prettier` alone.\n if (id === 'prettier' && importer?.includes('json-schema-to-typescript')) {\n return RESOLVED_ID\n }\n },\n }\n}\n"],"names":["stubPrettierInClient","RESOLVED_ID","name","enforce","load","id","resolveId","importer","options","ssr","includes"],"mappings":"AAEA;;;;;;;;;CASC,GACD,OAAO,SAASA;IACd,MAAMC,cAAc;IAEpB,OAAO;QACLC,MAAM;QACNC,SAAS;QACTC,MAAKC,EAAE;YACL,IAAIA,OAAOJ,aAAa;gBACtB,OAAO;YACT;QACF;QACAK,WAAUD,EAAE,EAAEE,QAAQ,EAAEC,OAAO;YAC7B,IAAIA,SAASC,KAAK;gBAChB;YACF;YACA,6EAA6E;YAC7E,IAAIJ,OAAO,cAAcE,UAAUG,SAAS,8BAA8B;gBACxE,OAAOT;YACT;QACF;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapCjsForClient.d.ts","sourceRoot":"","sources":["../../../src/vite/workarounds/wrapCjsForClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,CAqE/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/vite/workarounds/wrapCjsForClient.ts"],"sourcesContent":["import type { PluginOption } from 'vite'\n\n/**\n * Wraps CJS `node_modules` files in ESM-compatible code when served to the\n * client.\n *\n * Packages in `optimizeDeps.exclude` (like `payload`, `@payloadcms/ui`) import\n * CJS dependencies that Vite serves via raw `/@fs/` URLs, bypassing\n * pre-bundling. The browser fails to parse them because they use\n * `module.exports` / `exports.X` syntax.\n *\n * This plugin detects CJS patterns in the transform phase and wraps them with\n * a CommonJS-like runtime shim so the browser can execute them as ESM.\n */\nexport function wrapCjsForClient(): PluginOption {\n return {\n name: 'payload:wrap-cjs-client',\n apply: 'serve',\n enforce: 'post',\n transform(code, id, options) {\n if (options?.ssr) {\n return\n }\n\n if (!id.includes('/node_modules/') || id.includes('/node_modules/.vite/')) {\n return\n }\n\n const cleanId = id.replace(/\\?.*$/, '')\n if (!cleanId.endsWith('.js') && !cleanId.endsWith('.cjs')) {\n return\n }\n\n if (code.includes('import ') || code.includes('export ')) {\n return\n }\n\n if (\n !code.includes('module.exports') &&\n !code.includes('exports.') &&\n !code.includes('Object.defineProperty(exports')\n ) {\n return\n }\n\n const namedExports = extractCjsExports(code)\n const names = Object.keys(namedExports)\n\n const declaredIdentifiers = extractDeclaredIdentifiers(code)\n const safeNames = names.filter((name) => !declaredIdentifiers.has(name))\n\n // If the module already declares its own top-level `require` (rare but\n // possible for hand-written CJS), skip injecting our stub so we don't\n // produce a `SyntaxError: Identifier 'require' has already been declared`.\n const injectRequireStub = !declaredIdentifiers.has('require')\n\n const wrapped = [\n `var module = { exports: {} };`,\n `var exports = module.exports;`,\n // Expose a `require` stub so UMD wrappers that gate their CJS branch on\n // `typeof require === 'function'` (e.g. pluralize) take that branch and\n // assign to our `module.exports` instead of falling through to the\n // browser-globals branch (`root.foo = ...`), which throws in strict ESM\n // because the IIFE receives `this === undefined`.\n // The stub throws on actual invocation so any module that *really* needs\n // require fails loudly instead of silently misbehaving.\n injectRequireStub\n ? `var require = function require() { throw new Error(\"require() is not available in the browser bundle\"); };`\n : ``,\n ``,\n code,\n ``,\n `var __cjs_result__ = module.exports;`,\n `export default __cjs_result__;`,\n ...safeNames.map(\n (name) =>\n `export var ${name} = typeof __cjs_result__ === 'object' && __cjs_result__ !== null ? __cjs_result__[\"${name}\"] : undefined;`,\n ),\n ].join('\\n')\n\n return { code: wrapped, map: null }\n },\n }\n}\n\nfunction extractCjsExports(code: string): Record<string, true> {\n const found: Record<string, true> = {}\n const patterns = [\n /exports\\.(\\w+)\\s*=/g,\n /exports\\[[\"'](\\w+)[\"']\\]\\s*=/g,\n /Object\\.defineProperty\\(exports,\\s*[\"'](\\w+)[\"']/g,\n ]\n for (const re of patterns) {\n let m\n while ((m = re.exec(code)) !== null) {\n const name = m[1]!\n if (name !== '__esModule' && name !== 'default') {\n found[name] = true\n }\n }\n }\n return found\n}\n\n/**\n * Detects top-level identifiers declared with class/function/var/let/const in\n * CJS code. Used to avoid re-declaring them via `export var` in the CJS\n * wrapper, which would cause `SyntaxError: Identifier has already been\n * declared` in strict mode (ESM).\n */\nfunction extractDeclaredIdentifiers(code: string): Set<string> {\n const identifiers = new Set<string>()\n const patterns = [/\\bclass\\s+(\\w+)/g, /\\bfunction\\s+(\\w+)/g, /\\b(?:var|let|const)\\s+(\\w+)/g]\n for (const re of patterns) {\n let m\n while ((m = re.exec(code)) !== null) {\n identifiers.add(m[1]!)\n }\n }\n return identifiers\n}\n"],"names":["wrapCjsForClient","name","apply","enforce","transform","code","id","options","ssr","includes","cleanId","replace","endsWith","namedExports","extractCjsExports","names","Object","keys","declaredIdentifiers","extractDeclaredIdentifiers","safeNames","filter","has","injectRequireStub","wrapped","map","join","found","patterns","re","m","exec","identifiers","Set","add"],"mappings":"AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASA;IACd,OAAO;QACLC,MAAM;QACNC,OAAO;QACPC,SAAS;QACTC,WAAUC,IAAI,EAAEC,EAAE,EAAEC,OAAO;YACzB,IAAIA,SAASC,KAAK;gBAChB;YACF;YAEA,IAAI,CAACF,GAAGG,QAAQ,CAAC,qBAAqBH,GAAGG,QAAQ,CAAC,yBAAyB;gBACzE;YACF;YAEA,MAAMC,UAAUJ,GAAGK,OAAO,CAAC,SAAS;YACpC,IAAI,CAACD,QAAQE,QAAQ,CAAC,UAAU,CAACF,QAAQE,QAAQ,CAAC,SAAS;gBACzD;YACF;YAEA,IAAIP,KAAKI,QAAQ,CAAC,cAAcJ,KAAKI,QAAQ,CAAC,YAAY;gBACxD;YACF;YAEA,IACE,CAACJ,KAAKI,QAAQ,CAAC,qBACf,CAACJ,KAAKI,QAAQ,CAAC,eACf,CAACJ,KAAKI,QAAQ,CAAC,kCACf;gBACA;YACF;YAEA,MAAMI,eAAeC,kBAAkBT;YACvC,MAAMU,QAAQC,OAAOC,IAAI,CAACJ;YAE1B,MAAMK,sBAAsBC,2BAA2Bd;YACvD,MAAMe,YAAYL,MAAMM,MAAM,CAAC,CAACpB,OAAS,CAACiB,oBAAoBI,GAAG,CAACrB;YAElE,uEAAuE;YACvE,sEAAsE;YACtE,2EAA2E;YAC3E,MAAMsB,oBAAoB,CAACL,oBAAoBI,GAAG,CAAC;YAEnD,MAAME,UAAU;gBACd,CAAC,6BAA6B,CAAC;gBAC/B,CAAC,6BAA6B,CAAC;gBAC/B,wEAAwE;gBACxE,wEAAwE;gBACxE,mEAAmE;gBACnE,wEAAwE;gBACxE,kDAAkD;gBAClD,yEAAyE;gBACzE,wDAAwD;gBACxDD,oBACI,CAAC,0GAA0G,CAAC,GAC5G,EAAE;gBACN,EAAE;gBACFlB;gBACA,EAAE;gBACF,CAAC,oCAAoC,CAAC;gBACtC,CAAC,8BAA8B,CAAC;mBAC7Be,UAAUK,GAAG,CACd,CAACxB,OACC,CAAC,WAAW,EAAEA,KAAK,mFAAmF,EAAEA,KAAK,eAAe,CAAC;aAElI,CAACyB,IAAI,CAAC;YAEP,OAAO;gBAAErB,MAAMmB;gBAASC,KAAK;YAAK;QACpC;IACF;AACF;AAEA,SAASX,kBAAkBT,IAAY;IACrC,MAAMsB,QAA8B,CAAC;IACrC,MAAMC,WAAW;QACf;QACA;QACA;KACD;IACD,KAAK,MAAMC,MAAMD,SAAU;QACzB,IAAIE;QACJ,MAAO,AAACA,CAAAA,IAAID,GAAGE,IAAI,CAAC1B,KAAI,MAAO,KAAM;YACnC,MAAMJ,OAAO6B,CAAC,CAAC,EAAE;YACjB,IAAI7B,SAAS,gBAAgBA,SAAS,WAAW;gBAC/C0B,KAAK,CAAC1B,KAAK,GAAG;YAChB;QACF;IACF;IACA,OAAO0B;AACT;AAEA;;;;;CAKC,GACD,SAASR,2BAA2Bd,IAAY;IAC9C,MAAM2B,cAAc,IAAIC;IACxB,MAAML,WAAW;QAAC;QAAoB;QAAuB;KAA+B;IAC5F,KAAK,MAAMC,MAAMD,SAAU;QACzB,IAAIE;QACJ,MAAO,AAACA,CAAAA,IAAID,GAAGE,IAAI,CAAC1B,KAAI,MAAO,KAAM;YACnC2B,YAAYE,GAAG,CAACJ,CAAC,CAAC,EAAE;QACtB;IACF;IACA,OAAOE;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/tanstack-start",
|
|
3
|
-
"version": "4.0.0-internal.
|
|
3
|
+
"version": "4.0.0-internal.c7d5de4",
|
|
4
4
|
"description": "TanStack Start framework adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -58,33 +58,38 @@
|
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"qs-esm": "^7.0.2",
|
|
61
|
-
"@payloadcms/translations": "4.0.0-internal.
|
|
62
|
-
"@payloadcms/ui": "4.0.0-internal.
|
|
61
|
+
"@payloadcms/translations": "4.0.0-internal.c7d5de4",
|
|
62
|
+
"@payloadcms/ui": "4.0.0-internal.c7d5de4"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@tanstack/react-router": "^1.120.0",
|
|
66
|
-
"@tanstack/react-start": "^1.
|
|
66
|
+
"@tanstack/react-start": "^1.168.26",
|
|
67
67
|
"@types/react": "^19.0.0",
|
|
68
68
|
"@types/react-dom": "^19.0.0",
|
|
69
69
|
"@vitejs/plugin-react": "^6.0.0",
|
|
70
|
+
"@vitejs/plugin-rsc": "^0.5.21",
|
|
70
71
|
"react": "^19.0.0",
|
|
71
72
|
"react-dom": "^19.0.0",
|
|
72
73
|
"vite": ">=8.0.0",
|
|
73
|
-
"payload": "4.0.0-internal.
|
|
74
|
+
"payload": "4.0.0-internal.c7d5de4"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
77
|
"@tanstack/react-router": "^1.120.0",
|
|
77
|
-
"@tanstack/react-start": "^1.
|
|
78
|
+
"@tanstack/react-start": "^1.168.26",
|
|
78
79
|
"@vitejs/plugin-react": "^6.0.0",
|
|
80
|
+
"@vitejs/plugin-rsc": "^0.5.21",
|
|
79
81
|
"react": "^19.0.0",
|
|
80
82
|
"react-dom": "^19.0.0",
|
|
81
83
|
"vite": ">=8.0.0",
|
|
82
|
-
"payload": "4.0.0-internal.
|
|
84
|
+
"payload": "4.0.0-internal.c7d5de4"
|
|
83
85
|
},
|
|
84
86
|
"peerDependenciesMeta": {
|
|
85
87
|
"@vitejs/plugin-react": {
|
|
86
88
|
"optional": true
|
|
87
89
|
},
|
|
90
|
+
"@vitejs/plugin-rsc": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
88
93
|
"vite": {
|
|
89
94
|
"optional": true
|
|
90
95
|
}
|
package/dist/@types/assets.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/@types/assets.d.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switchLanguage.d.ts","sourceRoot":"","sources":["../../src/auth/switchLanguage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAK5D,wBAAsB,cAAc,CAAC,EACnC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;CACjB,iBAQA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { setResponseHeader } from '@tanstack/react-start/server';
|
|
2
|
-
import { getPayload } from 'payload';
|
|
3
|
-
export async function switchLanguage({ config, language }) {
|
|
4
|
-
const payload = await getPayload({
|
|
5
|
-
config
|
|
6
|
-
});
|
|
7
|
-
const cookiePrefix = payload.config.cookiePrefix || 'payload';
|
|
8
|
-
setResponseHeader('Set-Cookie', `${encodeURIComponent(`${cookiePrefix}-lng`)}=${encodeURIComponent(language)}; Path=/`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=switchLanguage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/switchLanguage.ts"],"sourcesContent":["import type { MaybePromise, SanitizedConfig } from 'payload'\n\nimport { setResponseHeader } from '@tanstack/react-start/server'\nimport { getPayload } from 'payload'\n\nexport async function switchLanguage({\n config,\n language,\n}: {\n config: MaybePromise<SanitizedConfig>\n language: string\n}) {\n const payload = await getPayload({ config })\n const cookiePrefix = payload.config.cookiePrefix || 'payload'\n\n setResponseHeader(\n 'Set-Cookie',\n `${encodeURIComponent(`${cookiePrefix}-lng`)}=${encodeURIComponent(language)}; Path=/`,\n )\n}\n"],"names":["setResponseHeader","getPayload","switchLanguage","config","language","payload","cookiePrefix","encodeURIComponent"],"mappings":"AAEA,SAASA,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,UAAU,QAAQ,UAAS;AAEpC,OAAO,eAAeC,eAAe,EACnCC,MAAM,EACNC,QAAQ,EAIT;IACC,MAAMC,UAAU,MAAMJ,WAAW;QAAEE;IAAO;IAC1C,MAAMG,eAAeD,QAAQF,MAAM,CAACG,YAAY,IAAI;IAEpDN,kBACE,cACA,GAAGO,mBAAmB,GAAGD,aAAa,IAAI,CAAC,EAAE,CAAC,EAAEC,mBAAmBH,UAAU,QAAQ,CAAC;AAE1F"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '@payloadcms/ui';
|
|
2
|
-
import type { SanitizedConfig } from 'payload';
|
|
3
|
-
type GetRequestThemeArgs = {
|
|
4
|
-
config: SanitizedConfig;
|
|
5
|
-
cookies: Map<string, string>;
|
|
6
|
-
headers: Headers;
|
|
7
|
-
};
|
|
8
|
-
export declare function getRequestTheme({ config, cookies, headers }: GetRequestThemeArgs): Theme;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=getRequestTheme.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRequestTheme.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAUD,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,KAAK,CAkBxF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Defined locally rather than imported from `@payloadcms/ui` (a `'use client'`
|
|
2
|
-
// barrel) because its value exports resolve to non-serializable client
|
|
3
|
-
// references in this adapter's RSC server context. `Theme` is a type-only
|
|
4
|
-
// import and is safely erased at runtime.
|
|
5
|
-
const defaultTheme = 'light';
|
|
6
|
-
const acceptedThemes = [
|
|
7
|
-
'dark',
|
|
8
|
-
'light'
|
|
9
|
-
];
|
|
10
|
-
export function getRequestTheme({ config, cookies, headers }) {
|
|
11
|
-
if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {
|
|
12
|
-
return config.admin.theme;
|
|
13
|
-
}
|
|
14
|
-
const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`);
|
|
15
|
-
if (themeCookie && acceptedThemes.includes(themeCookie)) {
|
|
16
|
-
return themeCookie;
|
|
17
|
-
}
|
|
18
|
-
const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme');
|
|
19
|
-
if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {
|
|
20
|
-
return themeFromHeader;
|
|
21
|
-
}
|
|
22
|
-
return defaultTheme;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=getRequestTheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/getRequestTheme.ts"],"sourcesContent":["import type { Theme } from '@payloadcms/ui'\nimport type { SanitizedConfig } from 'payload'\n\ntype GetRequestThemeArgs = {\n config: SanitizedConfig\n cookies: Map<string, string>\n headers: Headers\n}\n\n// Defined locally rather than imported from `@payloadcms/ui` (a `'use client'`\n// barrel) because its value exports resolve to non-serializable client\n// references in this adapter's RSC server context. `Theme` is a type-only\n// import and is safely erased at runtime.\nconst defaultTheme: Theme = 'light'\n\nconst acceptedThemes: Theme[] = ['dark', 'light']\n\nexport function getRequestTheme({ config, cookies, headers }: GetRequestThemeArgs): Theme {\n if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {\n return config.admin.theme\n }\n\n const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`)\n\n if (themeCookie && acceptedThemes.includes(themeCookie as Theme)) {\n return themeCookie as Theme\n }\n\n const themeFromHeader = headers.get('Sec-CH-Prefers-Color-Scheme') as Theme\n\n if (themeFromHeader && acceptedThemes.includes(themeFromHeader)) {\n return themeFromHeader\n }\n\n return defaultTheme\n}\n"],"names":["defaultTheme","acceptedThemes","getRequestTheme","config","cookies","headers","admin","theme","includes","themeCookie","get","cookiePrefix","themeFromHeader"],"mappings":"AASA,+EAA+E;AAC/E,uEAAuE;AACvE,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAMA,eAAsB;AAE5B,MAAMC,iBAA0B;IAAC;IAAQ;CAAQ;AAEjD,OAAO,SAASC,gBAAgB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAuB;IAC/E,IAAIF,OAAOG,KAAK,CAACC,KAAK,KAAK,SAASN,eAAeO,QAAQ,CAACL,OAAOG,KAAK,CAACC,KAAK,GAAG;QAC/E,OAAOJ,OAAOG,KAAK,CAACC,KAAK;IAC3B;IAEA,MAAME,cAAcL,QAAQM,GAAG,CAAC,GAAGP,OAAOQ,YAAY,IAAI,UAAU,MAAM,CAAC;IAE3E,IAAIF,eAAeR,eAAeO,QAAQ,CAACC,cAAuB;QAChE,OAAOA;IACT;IAEA,MAAMG,kBAAkBP,QAAQK,GAAG,CAAC;IAEpC,IAAIE,mBAAmBX,eAAeO,QAAQ,CAACI,kBAAkB;QAC/D,OAAOA;IACT;IAEA,OAAOZ;AACT"}
|
package/dist/vite/constants.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vite-level configuration constants used by `payloadPlugin`. Kept separate so
|
|
3
|
-
* `plugin.ts` stays focused on wiring.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Server-only packages (Node-only or only ever used by the server bundle).
|
|
7
|
-
* These are the Vite equivalent of Next.js's `serverExternalPackages`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const ssrExternalPackages: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Payload packages whose source must be processed by Vite even on the server
|
|
12
|
-
* (because they are workspace `.ts` files in dev). Server-only adapters
|
|
13
|
-
* (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
|
|
14
|
-
* intentionally not included — those should stay external on the SSR side.
|
|
15
|
-
*/
|
|
16
|
-
export declare const payloadNoExternalPatterns: Array<RegExp | string>;
|
|
17
|
-
/**
|
|
18
|
-
* The subset of `payloadNoExternalPatterns` that needs to participate in the
|
|
19
|
-
* RSC environment. The RSC graph is narrower — plugins and storage adapters
|
|
20
|
-
* don't run in RSC, only the admin UI surface does.
|
|
21
|
-
*/
|
|
22
|
-
export declare const payloadRscNoExternalPatterns: Array<RegExp | string>;
|
|
23
|
-
/**
|
|
24
|
-
* Packages we know contain Node-only code or top-level side effects requiring
|
|
25
|
-
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
26
|
-
* walking into their main entries and trying to bundle server-only imports
|
|
27
|
-
* for the browser.
|
|
28
|
-
*/
|
|
29
|
-
export declare const optimizeDepsExcludeDefaults: string[];
|
|
30
|
-
/**
|
|
31
|
-
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
32
|
-
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
33
|
-
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
34
|
-
* list them explicitly using the `parent > child` syntax.
|
|
35
|
-
*/
|
|
36
|
-
export declare const optimizeDepsIncludeDefaults: string[];
|
|
37
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/vite/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,EA0BvC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAO5D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAK/D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAsB/C,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,EAqC/C,CAAA"}
|
package/dist/vite/constants.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vite-level configuration constants used by `payloadPlugin`. Kept separate so
|
|
3
|
-
* `plugin.ts` stays focused on wiring.
|
|
4
|
-
*/ /**
|
|
5
|
-
* Server-only packages (Node-only or only ever used by the server bundle).
|
|
6
|
-
* These are the Vite equivalent of Next.js's `serverExternalPackages`.
|
|
7
|
-
*/ export const ssrExternalPackages = [
|
|
8
|
-
'ajv',
|
|
9
|
-
'fast-uri',
|
|
10
|
-
'drizzle-kit',
|
|
11
|
-
'drizzle-kit/api',
|
|
12
|
-
'drizzle-orm',
|
|
13
|
-
'sharp',
|
|
14
|
-
'libsql',
|
|
15
|
-
'require-in-the-middle',
|
|
16
|
-
'json-schema-to-typescript',
|
|
17
|
-
'pino',
|
|
18
|
-
'pino-pretty',
|
|
19
|
-
'graphql',
|
|
20
|
-
'mongodb',
|
|
21
|
-
'mongoose',
|
|
22
|
-
'better-sqlite3',
|
|
23
|
-
'pg',
|
|
24
|
-
'pg-native',
|
|
25
|
-
'nodemailer',
|
|
26
|
-
'aws4',
|
|
27
|
-
'pluralize',
|
|
28
|
-
'console-table-printer',
|
|
29
|
-
'@azure/storage-blob',
|
|
30
|
-
'@aws-sdk/client-s3',
|
|
31
|
-
'@aws-sdk/s3-request-presigner',
|
|
32
|
-
'@google-cloud/storage'
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Payload packages whose source must be processed by Vite even on the server
|
|
36
|
-
* (because they are workspace `.ts` files in dev). Server-only adapters
|
|
37
|
-
* (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are
|
|
38
|
-
* intentionally not included — those should stay external on the SSR side.
|
|
39
|
-
*/ export const payloadNoExternalPatterns = [
|
|
40
|
-
'@payloadcms/ui',
|
|
41
|
-
'@payloadcms/translations',
|
|
42
|
-
'@payloadcms/tanstack-start',
|
|
43
|
-
/^@payloadcms\/richtext-lexical/,
|
|
44
|
-
/^@payloadcms\/plugin-/,
|
|
45
|
-
/^@payloadcms\/storage-/
|
|
46
|
-
];
|
|
47
|
-
/**
|
|
48
|
-
* The subset of `payloadNoExternalPatterns` that needs to participate in the
|
|
49
|
-
* RSC environment. The RSC graph is narrower — plugins and storage adapters
|
|
50
|
-
* don't run in RSC, only the admin UI surface does.
|
|
51
|
-
*/ export const payloadRscNoExternalPatterns = [
|
|
52
|
-
'@payloadcms/ui',
|
|
53
|
-
'@payloadcms/translations',
|
|
54
|
-
'@payloadcms/tanstack-start',
|
|
55
|
-
/^@payloadcms\/richtext-lexical/
|
|
56
|
-
];
|
|
57
|
-
/**
|
|
58
|
-
* Packages we know contain Node-only code or top-level side effects requiring
|
|
59
|
-
* Node APIs. Excluding them from the client optimizer prevents Vite from
|
|
60
|
-
* walking into their main entries and trying to bundle server-only imports
|
|
61
|
-
* for the browser.
|
|
62
|
-
*/ export const optimizeDepsExcludeDefaults = [
|
|
63
|
-
'sharp',
|
|
64
|
-
'@payloadcms/ui',
|
|
65
|
-
'@payloadcms/tanstack-start',
|
|
66
|
-
'payload',
|
|
67
|
-
'pino',
|
|
68
|
-
'pino-pretty',
|
|
69
|
-
'busboy',
|
|
70
|
-
'get-tsconfig',
|
|
71
|
-
'ws',
|
|
72
|
-
'croner',
|
|
73
|
-
'prompts',
|
|
74
|
-
'file-type',
|
|
75
|
-
// Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite
|
|
76
|
-
// sometimes walks these from the main package entry while scanning
|
|
77
|
-
// workspace deps, and the browser sub-bundles do not expose the
|
|
78
|
-
// server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev
|
|
79
|
-
// server with a `MISSING_EXPORT` error before any test runs.
|
|
80
|
-
'@azure/storage-blob',
|
|
81
|
-
'@aws-sdk/client-s3',
|
|
82
|
-
'@aws-sdk/s3-request-presigner',
|
|
83
|
-
'@google-cloud/storage'
|
|
84
|
-
];
|
|
85
|
-
/**
|
|
86
|
-
* Transitive dependencies of `@payloadcms/ui` and `payload` that need to be
|
|
87
|
-
* pre-bundled for the client. Vite's auto-discovery doesn't reliably pick
|
|
88
|
-
* these up because their parent packages are in `optimizeDeps.exclude`, so we
|
|
89
|
-
* list them explicitly using the `parent > child` syntax.
|
|
90
|
-
*/ export const optimizeDepsIncludeDefaults = [
|
|
91
|
-
'@payloadcms/ui > sonner',
|
|
92
|
-
'@payloadcms/ui > @faceless-ui/modal',
|
|
93
|
-
'@payloadcms/ui > @faceless-ui/window-info',
|
|
94
|
-
'@payloadcms/ui > @faceless-ui/scroll-info',
|
|
95
|
-
'@payloadcms/ui > @dnd-kit/core',
|
|
96
|
-
'@payloadcms/ui > @dnd-kit/sortable',
|
|
97
|
-
'@payloadcms/ui > @dnd-kit/utilities',
|
|
98
|
-
'@payloadcms/ui > react-datepicker',
|
|
99
|
-
'@payloadcms/ui > react-select',
|
|
100
|
-
'@payloadcms/ui > react-select/creatable',
|
|
101
|
-
'@payloadcms/ui > react-image-crop',
|
|
102
|
-
'@payloadcms/ui > @monaco-editor/react',
|
|
103
|
-
'@payloadcms/ui > date-fns',
|
|
104
|
-
'@payloadcms/ui > date-fns/transpose',
|
|
105
|
-
'@payloadcms/ui > @date-fns/tz/date/mini',
|
|
106
|
-
'@payloadcms/ui > uuid',
|
|
107
|
-
'@payloadcms/ui > use-context-selector',
|
|
108
|
-
'@payloadcms/ui > bson-objectid',
|
|
109
|
-
'@payloadcms/ui > dequal',
|
|
110
|
-
'@payloadcms/ui > object-to-formdata',
|
|
111
|
-
'@payloadcms/ui > md5',
|
|
112
|
-
'payload > deepmerge',
|
|
113
|
-
'payload > pluralize',
|
|
114
|
-
'scheduler',
|
|
115
|
-
// Transitive deps that Vite otherwise discovers *after* the initial crawl
|
|
116
|
-
// (react-select pulls in @floating-ui at runtime; react-is is reached via
|
|
117
|
-
// react-transition-group/prop-types; the default date-fns locale is loaded
|
|
118
|
-
// through a dynamic `date-fns/locale/${key}` import). A late discovery forces
|
|
119
|
-
// a full dep re-optimization mid-session, which 404s every in-flight
|
|
120
|
-
// `.vite/deps/*` chunk ("Pre-transform error: file does not exist in the
|
|
121
|
-
// optimize deps directory") and breaks the admin UI in CI cold starts.
|
|
122
|
-
// Pre-bundling them keeps the first optimization pass complete.
|
|
123
|
-
'@payloadcms/ui > react-select > @floating-ui/dom',
|
|
124
|
-
'@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',
|
|
125
|
-
'@payloadcms/ui > react-select > prop-types > react-is',
|
|
126
|
-
'@payloadcms/ui > date-fns/locale/en-US'
|
|
127
|
-
];
|
|
128
|
-
|
|
129
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/vite/constants.ts"],"sourcesContent":["/**\n * Vite-level configuration constants used by `payloadPlugin`. Kept separate so\n * `plugin.ts` stays focused on wiring.\n */\n\n/**\n * Server-only packages (Node-only or only ever used by the server bundle).\n * These are the Vite equivalent of Next.js's `serverExternalPackages`.\n */\nexport const ssrExternalPackages: string[] = [\n 'ajv',\n 'fast-uri',\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'drizzle-orm',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n 'pino',\n 'pino-pretty',\n 'graphql',\n 'mongodb',\n 'mongoose',\n 'better-sqlite3',\n 'pg',\n 'pg-native',\n 'nodemailer',\n 'aws4',\n 'pluralize',\n 'console-table-printer',\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Payload packages whose source must be processed by Vite even on the server\n * (because they are workspace `.ts` files in dev). Server-only adapters\n * (`@payloadcms/db-*`, `@payloadcms/email-*`, `@payloadcms/next`, etc.) are\n * intentionally not included — those should stay external on the SSR side.\n */\nexport const payloadNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n /^@payloadcms\\/plugin-/,\n /^@payloadcms\\/storage-/,\n]\n\n/**\n * The subset of `payloadNoExternalPatterns` that needs to participate in the\n * RSC environment. The RSC graph is narrower — plugins and storage adapters\n * don't run in RSC, only the admin UI surface does.\n */\nexport const payloadRscNoExternalPatterns: Array<RegExp | string> = [\n '@payloadcms/ui',\n '@payloadcms/translations',\n '@payloadcms/tanstack-start',\n /^@payloadcms\\/richtext-lexical/,\n]\n\n/**\n * Packages we know contain Node-only code or top-level side effects requiring\n * Node APIs. Excluding them from the client optimizer prevents Vite from\n * walking into their main entries and trying to bundle server-only imports\n * for the browser.\n */\nexport const optimizeDepsExcludeDefaults: string[] = [\n 'sharp',\n '@payloadcms/ui',\n '@payloadcms/tanstack-start',\n 'payload',\n 'pino',\n 'pino-pretty',\n 'busboy',\n 'get-tsconfig',\n 'ws',\n 'croner',\n 'prompts',\n 'file-type',\n // Server-only SDKs used by `@payloadcms/storage-*` adapters. Vite\n // sometimes walks these from the main package entry while scanning\n // workspace deps, and the browser sub-bundles do not expose the\n // server-only APIs (e.g. `BlobSASPermissions`), which crashes the dev\n // server with a `MISSING_EXPORT` error before any test runs.\n '@azure/storage-blob',\n '@aws-sdk/client-s3',\n '@aws-sdk/s3-request-presigner',\n '@google-cloud/storage',\n]\n\n/**\n * Transitive dependencies of `@payloadcms/ui` and `payload` that need to be\n * pre-bundled for the client. Vite's auto-discovery doesn't reliably pick\n * these up because their parent packages are in `optimizeDeps.exclude`, so we\n * list them explicitly using the `parent > child` syntax.\n */\nexport const optimizeDepsIncludeDefaults: string[] = [\n '@payloadcms/ui > sonner',\n '@payloadcms/ui > @faceless-ui/modal',\n '@payloadcms/ui > @faceless-ui/window-info',\n '@payloadcms/ui > @faceless-ui/scroll-info',\n '@payloadcms/ui > @dnd-kit/core',\n '@payloadcms/ui > @dnd-kit/sortable',\n '@payloadcms/ui > @dnd-kit/utilities',\n '@payloadcms/ui > react-datepicker',\n '@payloadcms/ui > react-select',\n '@payloadcms/ui > react-select/creatable',\n '@payloadcms/ui > react-image-crop',\n '@payloadcms/ui > @monaco-editor/react',\n '@payloadcms/ui > date-fns',\n '@payloadcms/ui > date-fns/transpose',\n '@payloadcms/ui > @date-fns/tz/date/mini',\n '@payloadcms/ui > uuid',\n '@payloadcms/ui > use-context-selector',\n '@payloadcms/ui > bson-objectid',\n '@payloadcms/ui > dequal',\n '@payloadcms/ui > object-to-formdata',\n '@payloadcms/ui > md5',\n 'payload > deepmerge',\n 'payload > pluralize',\n 'scheduler',\n // Transitive deps that Vite otherwise discovers *after* the initial crawl\n // (react-select pulls in @floating-ui at runtime; react-is is reached via\n // react-transition-group/prop-types; the default date-fns locale is loaded\n // through a dynamic `date-fns/locale/${key}` import). A late discovery forces\n // a full dep re-optimization mid-session, which 404s every in-flight\n // `.vite/deps/*` chunk (\"Pre-transform error: file does not exist in the\n // optimize deps directory\") and breaks the admin UI in CI cold starts.\n // Pre-bundling them keeps the first optimization pass complete.\n '@payloadcms/ui > react-select > @floating-ui/dom',\n '@payloadcms/ui > react-select > @floating-ui/dom > @floating-ui/core',\n '@payloadcms/ui > react-select > prop-types > react-is',\n '@payloadcms/ui > date-fns/locale/en-US',\n]\n"],"names":["ssrExternalPackages","payloadNoExternalPatterns","payloadRscNoExternalPatterns","optimizeDepsExcludeDefaults","optimizeDepsIncludeDefaults"],"mappings":"AAAA;;;CAGC,GAED;;;CAGC,GACD,OAAO,MAAMA,sBAAgC;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,4BAAoD;IAC/D;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;CAIC,GACD,OAAO,MAAMC,+BAAuD;IAClE;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,kEAAkE;IAClE,mEAAmE;IACnE,gEAAgE;IAChE,sEAAsE;IACtE,6DAA6D;IAC7D;IACA;IACA;IACA;CACD,CAAA;AAED;;;;;CAKC,GACD,OAAO,MAAMC,8BAAwC;IACnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,8EAA8E;IAC9E,qEAAqE;IACrE,yEAAyE;IACzE,uEAAuE;IACvE,gEAAgE;IAChE;IACA;IACA;IACA;CACD,CAAA"}
|
package/dist/vite/plugin.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { PluginOption, UserConfigFnObject } from 'vite';
|
|
2
|
-
export interface PayloadPluginOptions {
|
|
3
|
-
/** Additional resolve aliases */
|
|
4
|
-
additionalAliases?: Array<{
|
|
5
|
-
find: RegExp | string;
|
|
6
|
-
replacement: string;
|
|
7
|
-
}>;
|
|
8
|
-
/** Additional import protection ignoreImporters patterns */
|
|
9
|
-
additionalIgnoreImporters?: RegExp[];
|
|
10
|
-
/** Extra optimizeDeps.include entries */
|
|
11
|
-
additionalOptimizeDepsInclude?: string[];
|
|
12
|
-
/** Extra ssr.external entries */
|
|
13
|
-
additionalSsrExternal?: string[];
|
|
14
|
-
/** Path to the user's payload.config.ts (required) */
|
|
15
|
-
payloadConfigPath: string;
|
|
16
|
-
/** Extra Vite plugins to include */
|
|
17
|
-
plugins?: PluginOption[];
|
|
18
|
-
/** @vitejs/plugin-react instance — must be passed by consumer to ensure correct resolution */
|
|
19
|
-
reactPlugin: PluginOption;
|
|
20
|
-
/** TanStack router routes directory relative to srcDirectory. Defaults to 'app' */
|
|
21
|
-
routesDirectory?: string;
|
|
22
|
-
/** @vitejs/plugin-rsc instance — required for RSC support, must be passed by consumer */
|
|
23
|
-
rscPlugin: PluginOption;
|
|
24
|
-
/** TanStack source directory. Defaults to 'src' */
|
|
25
|
-
srcDirectory?: string;
|
|
26
|
-
/** tanstackStart from '@tanstack/react-start/plugin/vite' — must be passed by consumer to ensure correct resolution */
|
|
27
|
-
tanstackStart: typeof import('@tanstack/react-start/plugin/vite').tanstackStart;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Vite plugin for Payload + TanStack Start. The Vite-side counterpart to
|
|
31
|
-
* `withPayload` for Next.js: it configures the Vite environment so the Payload
|
|
32
|
-
* admin can run, then composes the TanStack Start plugin with two small
|
|
33
|
-
* Payload-specific workarounds (dev HMR injection, SSR style stripping). Each
|
|
34
|
-
* remaining workaround lives in its own file under `./plugins/` so it can be
|
|
35
|
-
* deleted individually once the corresponding upstream fix lands.
|
|
36
|
-
*/
|
|
37
|
-
export declare function payloadPlugin(options: PayloadPluginOptions): UserConfigFnObject;
|
|
38
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/vite/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AAsB5D,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACzE,4DAA4D;IAC5D,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC,yCAAyC;IACzC,6BAA6B,CAAC,EAAE,MAAM,EAAE,CAAA;IACxC,iCAAiC;IACjC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC,sDAAsD;IACtD,iBAAiB,EAAE,MAAM,CAAA;IACzB,oCAAoC;IACpC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,8FAA8F;IAC9F,WAAW,EAAE,YAAY,CAAA;IACzB,mFAAmF;IACnF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yFAAyF;IACzF,SAAS,EAAE,YAAY,CAAA;IACvB,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uHAAuH;IACvH,aAAa,EAAE,cAAc,mCAAmC,EAAE,aAAa,CAAA;CAChF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAkI/E"}
|