create-payload-app 4.0.0-internal.af6aad0 → 4.0.0-internal.b8a92d2
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/lib/agent-config.d.ts +2 -5
- package/dist/lib/agent-config.d.ts.map +1 -1
- package/dist/lib/agent-config.js +1 -8
- package/dist/lib/agent-config.js.map +1 -1
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +51 -8
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/get-package-manager.d.ts +9 -0
- package/dist/lib/get-package-manager.d.ts.map +1 -1
- package/dist/lib/get-package-manager.js +20 -0
- package/dist/lib/get-package-manager.js.map +1 -1
- package/dist/lib/tanstack/template-files.d.ts +2 -2
- package/dist/lib/tanstack/template-files.d.ts.map +1 -1
- package/dist/lib/tanstack/template-files.js +2 -2
- package/dist/lib/tanstack/template-files.js.map +1 -1
- package/dist/lib/update-payload-in-project.d.ts.map +1 -1
- package/dist/lib/update-payload-in-project.js +7 -2
- package/dist/lib/update-payload-in-project.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +0 -1
- package/dist/main.js.map +1 -1
- package/dist/template/src/app/(frontend)/styles.css +7 -0
- package/dist/template/src/app/(payload)/admin/importMap.js +17 -0
- package/dist/template/src/payload-types.ts +72 -1
- package/dist/template/src/payload.config.ts +8 -0
- package/dist/template-tanstack/routes/_payload.tsx +22 -5
- package/dist/template-tanstack/src/payload.css +1 -0
- package/dist/utils/messages.js +1 -1
- package/dist/utils/messages.js.map +1 -1
- package/package.json +2 -2
- package/dist/ast-integration.spec.js +0 -132
- package/dist/ast-integration.spec.js.map +0 -1
- package/dist/lib/agent-config.spec.js +0 -23
- package/dist/lib/agent-config.spec.js.map +0 -1
- package/dist/lib/ast/package-json.spec.js +0 -139
- package/dist/lib/ast/package-json.spec.js.map +0 -1
- package/dist/lib/ast/payload-config.spec.js +0 -365
- package/dist/lib/ast/payload-config.spec.js.map +0 -1
- package/dist/lib/ast/utils.spec.js +0 -226
- package/dist/lib/ast/utils.spec.js.map +0 -1
- package/dist/lib/configure-payload-tsconfig.spec.js +0 -135
- package/dist/lib/configure-payload-tsconfig.spec.js.map +0 -1
- package/dist/lib/create-project.spec.js +0 -199
- package/dist/lib/create-project.spec.js.map +0 -1
- package/dist/lib/init-tanstack-default-template.spec.js +0 -119
- package/dist/lib/init-tanstack-default-template.spec.js.map +0 -1
- package/dist/lib/init-tanstack.spec.js +0 -394
- package/dist/lib/init-tanstack.spec.js.map +0 -1
- package/dist/lib/manage-env-files.spec.js +0 -118
- package/dist/lib/manage-env-files.spec.js.map +0 -1
- package/dist/lib/tanstack/detect.spec.js +0 -227
- package/dist/lib/tanstack/detect.spec.js.map +0 -1
- package/dist/lib/tanstack/prepare.spec.js +0 -288
- package/dist/lib/tanstack/prepare.spec.js.map +0 -1
- package/dist/lib/tanstack/transform-root-route.spec.js +0 -484
- package/dist/lib/tanstack/transform-root-route.spec.js.map +0 -1
- package/dist/lib/tanstack/transform-router.spec.js +0 -264
- package/dist/lib/tanstack/transform-router.spec.js.map +0 -1
- package/dist/lib/tanstack/transform-vite-config.spec.js +0 -456
- package/dist/lib/tanstack/transform-vite-config.spec.js.map +0 -1
- package/dist/lib/update-payload-in-project.spec.js +0 -258
- package/dist/lib/update-payload-in-project.spec.js.map +0 -1
- package/dist/lib/wrap-next-config.spec.js +0 -167
- package/dist/lib/wrap-next-config.spec.js.map +0 -1
- package/dist/main.spec.js +0 -102
- package/dist/main.spec.js.map +0 -1
- package/dist/template-tanstack/src/payload-foundation.css +0 -10
- package/dist/utils/resolvePackageVersion.spec.js +0 -77
- package/dist/utils/resolvePackageVersion.spec.js.map +0 -1
|
@@ -1,484 +0,0 @@
|
|
|
1
|
-
import { Project } from 'ts-morph';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { transformTanStackRootRoute } from './transform-root-route.js';
|
|
4
|
-
function expectSuccessfulTransform(result) {
|
|
5
|
-
expect(result.success).toBe(true);
|
|
6
|
-
if (!result.success) {
|
|
7
|
-
throw new Error(result.reason);
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
function getStartRoot({ appCssHref = 'appCss', extraImports = '', shellComponent = 'RootDocument' } = {}) {
|
|
12
|
-
return `import { createRootRoute as createAppRoot, HeadContent, Scripts } from '@tanstack/react-router'
|
|
13
|
-
import appCss from '../styles.css?url'
|
|
14
|
-
import { ThemeProvider } from './theme-provider'
|
|
15
|
-
${extraImports}
|
|
16
|
-
|
|
17
|
-
export const Route = createAppRoot({
|
|
18
|
-
head: () => ({
|
|
19
|
-
meta: [
|
|
20
|
-
{ charSet: 'utf-8' },
|
|
21
|
-
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
22
|
-
{ title: 'Custom title' },
|
|
23
|
-
],
|
|
24
|
-
links: [
|
|
25
|
-
{ rel: 'stylesheet', href: ${appCssHref} },
|
|
26
|
-
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
|
|
27
|
-
],
|
|
28
|
-
}),
|
|
29
|
-
notFoundComponent: NotFound,
|
|
30
|
-
shellComponent: ${shellComponent},
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
34
|
-
return (
|
|
35
|
-
<html lang="en">
|
|
36
|
-
<head>
|
|
37
|
-
<meta name="theme-color" content="black" />
|
|
38
|
-
<HeadContent />
|
|
39
|
-
</head>
|
|
40
|
-
<body>
|
|
41
|
-
<ThemeProvider>{children}</ThemeProvider>
|
|
42
|
-
<Scripts />
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
function getRouterOnlyRoot({ extraImports = '', stylesheetImport = `import '../styles.css'` } = {}) {
|
|
50
|
-
return `import { createRootRoute as createAppRoot, Outlet } from '@tanstack/react-router'
|
|
51
|
-
import { AuthProvider } from './auth-provider'
|
|
52
|
-
${stylesheetImport}
|
|
53
|
-
${extraImports}
|
|
54
|
-
|
|
55
|
-
export const Route = createAppRoot({
|
|
56
|
-
component: RootComponent,
|
|
57
|
-
head: () => ({
|
|
58
|
-
meta: [{ title: 'Router app' }],
|
|
59
|
-
links: [{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
|
|
60
|
-
}),
|
|
61
|
-
notFoundComponent: NotFound,
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
function RootComponent() {
|
|
65
|
-
return (
|
|
66
|
-
<AuthProvider>
|
|
67
|
-
<main data-layout="custom">
|
|
68
|
-
<Outlet />
|
|
69
|
-
</main>
|
|
70
|
-
</AuthProvider>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
}
|
|
75
|
-
function getRouterOnlyDocumentRoot(returnExpression) {
|
|
76
|
-
return `import { Outlet, createRootRoute } from '@tanstack/react-router'
|
|
77
|
-
|
|
78
|
-
import '../styles.css'
|
|
79
|
-
|
|
80
|
-
export const Route = createRootRoute({
|
|
81
|
-
component: RootComponent,
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
function RootComponent() {
|
|
85
|
-
return (${returnExpression})
|
|
86
|
-
}
|
|
87
|
-
`;
|
|
88
|
-
}
|
|
89
|
-
function getRouterNamedImports(content, importedNames) {
|
|
90
|
-
const project = new Project({
|
|
91
|
-
useInMemoryFileSystem: true
|
|
92
|
-
});
|
|
93
|
-
const sourceFile = project.createSourceFile('__root.tsx', content);
|
|
94
|
-
return sourceFile.getImportDeclarations().filter((declaration)=>declaration.getModuleSpecifierValue() === '@tanstack/react-router').flatMap((declaration)=>declaration.getNamedImports().filter((namedImport)=>importedNames.includes(namedImport.getName())).map((namedImport)=>({
|
|
95
|
-
importedName: namedImport.getName(),
|
|
96
|
-
localName: namedImport.getAliasNode()?.getText() ?? namedImport.getName()
|
|
97
|
-
})));
|
|
98
|
-
}
|
|
99
|
-
describe('transformTanStackRootRoute', ()=>{
|
|
100
|
-
it('should wrap the official Start shell and isolate its app stylesheet from admin', ()=>{
|
|
101
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
102
|
-
content: getStartRoot(),
|
|
103
|
-
kind: 'start'
|
|
104
|
-
}));
|
|
105
|
-
expect(result.modified).toBe(true);
|
|
106
|
-
expect(result.content).toContain("import { withPayloadRoot } from '@payloadcms/tanstack-start/client'");
|
|
107
|
-
expect(result.content).toContain('shellComponent: withPayloadRoot(RootDocument)');
|
|
108
|
-
expect(result.content).not.toContain("{ rel: 'stylesheet', href: appCss }");
|
|
109
|
-
expect(result.content).toContain('<link href={appCss} rel="stylesheet" />');
|
|
110
|
-
expect(result.content.indexOf('<link href={appCss}')).toBeLessThan(result.content.indexOf('<HeadContent />'));
|
|
111
|
-
});
|
|
112
|
-
it('should preserve Start metadata, non-stylesheet links, components, and providers', ()=>{
|
|
113
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
114
|
-
content: getStartRoot(),
|
|
115
|
-
kind: 'start'
|
|
116
|
-
}));
|
|
117
|
-
expect(result.content).toContain("{ charSet: 'utf-8' }");
|
|
118
|
-
expect(result.content).toContain("{ name: 'viewport', content: 'width=device-width, initial-scale=1' }");
|
|
119
|
-
expect(result.content).toContain("{ title: 'Custom title' }");
|
|
120
|
-
expect(result.content).toContain("{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }");
|
|
121
|
-
expect(result.content).toContain('notFoundComponent: NotFound');
|
|
122
|
-
expect(result.content).toContain('<meta name="theme-color" content="black" />');
|
|
123
|
-
expect(result.content).toContain('<ThemeProvider>{children}</ThemeProvider>');
|
|
124
|
-
});
|
|
125
|
-
it('should convert the official Router-only root without replacing its route component', ()=>{
|
|
126
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
127
|
-
content: getRouterOnlyRoot(),
|
|
128
|
-
kind: 'router-only'
|
|
129
|
-
}));
|
|
130
|
-
expect(result.modified).toBe(true);
|
|
131
|
-
expect(result.content).toContain("import appCss from '../styles.css?url'");
|
|
132
|
-
expect(result.content).not.toContain("import '../styles.css'");
|
|
133
|
-
expect(result.content).toContain('component: RootComponent');
|
|
134
|
-
expect(result.content).toContain('shellComponent: withPayloadRoot(RootDocument)');
|
|
135
|
-
expect(result.content).toContain('function RootComponent()');
|
|
136
|
-
expect(result.content).toContain('<AuthProvider>');
|
|
137
|
-
expect(result.content).toContain('<Outlet />');
|
|
138
|
-
expect(result.content).toContain('function RootDocument({ children }: { children: React.ReactNode })');
|
|
139
|
-
expect(result.content).toContain('<html lang="en" suppressHydrationWarning>');
|
|
140
|
-
expect(result.content).toContain('<link href={appCss} rel="stylesheet" />');
|
|
141
|
-
expect(result.content).toContain('<HeadContent />');
|
|
142
|
-
expect(result.content).toContain('{children}');
|
|
143
|
-
expect(result.content).toContain('<Scripts />');
|
|
144
|
-
});
|
|
145
|
-
it('should preserve Router-only metadata, non-stylesheet links, and route options', ()=>{
|
|
146
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
147
|
-
content: getRouterOnlyRoot(),
|
|
148
|
-
kind: 'router-only'
|
|
149
|
-
}));
|
|
150
|
-
expect(result.content).toContain("meta: [{ title: 'Router app' }]");
|
|
151
|
-
expect(result.content).toContain("links: [{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }]");
|
|
152
|
-
expect(result.content).toContain('notFoundComponent: NotFound');
|
|
153
|
-
expect(result.content).toContain('<main data-layout="custom">');
|
|
154
|
-
});
|
|
155
|
-
it.each([
|
|
156
|
-
[
|
|
157
|
-
'direct',
|
|
158
|
-
`<html lang="fr"><head><title>My Router App</title></head><body><Outlet /></body></html>`
|
|
159
|
-
],
|
|
160
|
-
[
|
|
161
|
-
'fragment-wrapped',
|
|
162
|
-
`<><html lang="fr"><head /><body><Outlet /></body></html></>`
|
|
163
|
-
],
|
|
164
|
-
[
|
|
165
|
-
'conditional',
|
|
166
|
-
`isReady ? <html lang="fr"><head /><body><Outlet /></body></html> : null`
|
|
167
|
-
]
|
|
168
|
-
])('should reject a Router-only root whose %s route component renders the document shell', (_shape, returnExpression)=>{
|
|
169
|
-
const content = getRouterOnlyDocumentRoot(returnExpression);
|
|
170
|
-
expect(transformTanStackRootRoute({
|
|
171
|
-
content,
|
|
172
|
-
kind: 'router-only'
|
|
173
|
-
})).toEqual({
|
|
174
|
-
reason: 'The Router-only route component cannot render the document shell.',
|
|
175
|
-
success: false
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
it('should reuse aliased HeadContent and Scripts imports from split declarations', ()=>{
|
|
179
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
180
|
-
content: getRouterOnlyRoot({
|
|
181
|
-
extraImports: `import { HeadContent as RouterHeadContent } from '@tanstack/react-router'
|
|
182
|
-
import { Scripts as RouterScripts } from '@tanstack/react-router'`
|
|
183
|
-
}),
|
|
184
|
-
kind: 'router-only'
|
|
185
|
-
}));
|
|
186
|
-
expect(result.content).toContain('<RouterHeadContent />');
|
|
187
|
-
expect(result.content).toContain('<RouterScripts />');
|
|
188
|
-
expect(getRouterNamedImports(result.content, [
|
|
189
|
-
'HeadContent',
|
|
190
|
-
'Scripts'
|
|
191
|
-
])).toEqual([
|
|
192
|
-
{
|
|
193
|
-
importedName: 'HeadContent',
|
|
194
|
-
localName: 'RouterHeadContent'
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
importedName: 'Scripts',
|
|
198
|
-
localName: 'RouterScripts'
|
|
199
|
-
}
|
|
200
|
-
]);
|
|
201
|
-
});
|
|
202
|
-
it('should preserve split HeadContent and Scripts imports without duplicating bindings', ()=>{
|
|
203
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
204
|
-
content: getRouterOnlyRoot({
|
|
205
|
-
extraImports: `import { HeadContent } from '@tanstack/react-router'
|
|
206
|
-
import { Scripts } from '@tanstack/react-router'`
|
|
207
|
-
}),
|
|
208
|
-
kind: 'router-only'
|
|
209
|
-
}));
|
|
210
|
-
expect(getRouterNamedImports(result.content, [
|
|
211
|
-
'HeadContent',
|
|
212
|
-
'Scripts'
|
|
213
|
-
])).toEqual([
|
|
214
|
-
{
|
|
215
|
-
importedName: 'HeadContent',
|
|
216
|
-
localName: 'HeadContent'
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
importedName: 'Scripts',
|
|
220
|
-
localName: 'Scripts'
|
|
221
|
-
}
|
|
222
|
-
]);
|
|
223
|
-
});
|
|
224
|
-
it('should not add withPayloadRoot to an unrelated type-only client import', ()=>{
|
|
225
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
226
|
-
content: getRouterOnlyRoot({
|
|
227
|
-
extraImports: `import type { ClientOptions } from '@payloadcms/tanstack-start/client'`
|
|
228
|
-
}),
|
|
229
|
-
kind: 'router-only'
|
|
230
|
-
}));
|
|
231
|
-
expect(result.content).toContain("import { withPayloadRoot } from '@payloadcms/tanstack-start/client'");
|
|
232
|
-
expect(result.content).toContain("import type { ClientOptions } from '@payloadcms/tanstack-start/client'");
|
|
233
|
-
});
|
|
234
|
-
it.each([
|
|
235
|
-
[
|
|
236
|
-
'start',
|
|
237
|
-
getStartRoot()
|
|
238
|
-
],
|
|
239
|
-
[
|
|
240
|
-
'router-only',
|
|
241
|
-
getRouterOnlyRoot()
|
|
242
|
-
]
|
|
243
|
-
])('should report an already transformed %s root as unmodified', (kind, content)=>{
|
|
244
|
-
const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
245
|
-
content,
|
|
246
|
-
kind
|
|
247
|
-
}));
|
|
248
|
-
const secondResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
249
|
-
content: firstResult.content,
|
|
250
|
-
kind
|
|
251
|
-
}));
|
|
252
|
-
expect(secondResult).toEqual({
|
|
253
|
-
content: firstResult.content,
|
|
254
|
-
modified: false,
|
|
255
|
-
success: true
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
it.each([
|
|
259
|
-
[
|
|
260
|
-
'start',
|
|
261
|
-
getStartRoot()
|
|
262
|
-
],
|
|
263
|
-
[
|
|
264
|
-
'router-only',
|
|
265
|
-
getRouterOnlyRoot()
|
|
266
|
-
]
|
|
267
|
-
])('should restore a missing withPayloadRoot import in a transformed %s root', (kind, content)=>{
|
|
268
|
-
const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
269
|
-
content,
|
|
270
|
-
kind
|
|
271
|
-
}));
|
|
272
|
-
const contentWithoutPayloadImport = firstResult.content.replace(/import \{ withPayloadRoot \} from '@payloadcms\/tanstack-start\/client';?\n/, '');
|
|
273
|
-
const result = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
274
|
-
content: contentWithoutPayloadImport,
|
|
275
|
-
kind
|
|
276
|
-
}));
|
|
277
|
-
expect(result.modified).toBe(true);
|
|
278
|
-
expect(result.content).toContain("import { withPayloadRoot } from '@payloadcms/tanstack-start/client'");
|
|
279
|
-
});
|
|
280
|
-
it.each([
|
|
281
|
-
[
|
|
282
|
-
'start',
|
|
283
|
-
getStartRoot()
|
|
284
|
-
],
|
|
285
|
-
[
|
|
286
|
-
'router-only',
|
|
287
|
-
getRouterOnlyRoot()
|
|
288
|
-
]
|
|
289
|
-
])('should validate an aliased wrapper call against its local import in a transformed %s root', (kind, content)=>{
|
|
290
|
-
const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
291
|
-
content,
|
|
292
|
-
kind
|
|
293
|
-
}));
|
|
294
|
-
const aliasedContent = firstResult.content.replace("import { withPayloadRoot } from '@payloadcms/tanstack-start/client'", "import { withPayloadRoot as payloadRoot } from '@payloadcms/tanstack-start/client'").replace('withPayloadRoot(RootDocument)', 'payloadRoot(RootDocument)');
|
|
295
|
-
const result = transformTanStackRootRoute({
|
|
296
|
-
content: aliasedContent,
|
|
297
|
-
kind
|
|
298
|
-
});
|
|
299
|
-
expect(result).toEqual({
|
|
300
|
-
content: aliasedContent,
|
|
301
|
-
modified: false,
|
|
302
|
-
success: true
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
it.each([
|
|
306
|
-
[
|
|
307
|
-
'start',
|
|
308
|
-
getStartRoot()
|
|
309
|
-
],
|
|
310
|
-
[
|
|
311
|
-
'router-only',
|
|
312
|
-
getRouterOnlyRoot()
|
|
313
|
-
]
|
|
314
|
-
])('should reject a transformed %s root whose canonical wrapper call has only an aliased import', (kind, content)=>{
|
|
315
|
-
const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
316
|
-
content,
|
|
317
|
-
kind
|
|
318
|
-
}));
|
|
319
|
-
const malformedContent = firstResult.content.replace("import { withPayloadRoot } from '@payloadcms/tanstack-start/client'", "import { withPayloadRoot as payloadRoot } from '@payloadcms/tanstack-start/client'");
|
|
320
|
-
const result = transformTanStackRootRoute({
|
|
321
|
-
content: malformedContent,
|
|
322
|
-
kind
|
|
323
|
-
});
|
|
324
|
-
expect(result).toEqual({
|
|
325
|
-
reason: 'The existing shellComponent cannot be transformed safely.',
|
|
326
|
-
success: false
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
it.each([
|
|
330
|
-
[
|
|
331
|
-
'start',
|
|
332
|
-
getStartRoot()
|
|
333
|
-
],
|
|
334
|
-
[
|
|
335
|
-
'router-only',
|
|
336
|
-
getRouterOnlyRoot()
|
|
337
|
-
]
|
|
338
|
-
])('should reject a transformed %s root with the stylesheet after HeadContent', (kind, content)=>{
|
|
339
|
-
const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
340
|
-
content,
|
|
341
|
-
kind
|
|
342
|
-
}));
|
|
343
|
-
const reorderedContent = firstResult.content.replace('<link href={appCss} rel="stylesheet" />\n <HeadContent />', '<HeadContent />\n <link href={appCss} rel="stylesheet" />');
|
|
344
|
-
const result = transformTanStackRootRoute({
|
|
345
|
-
content: reorderedContent,
|
|
346
|
-
kind
|
|
347
|
-
});
|
|
348
|
-
expect(result.success).toBe(false);
|
|
349
|
-
});
|
|
350
|
-
it('should reject an unrecognized Start shell expression', ()=>{
|
|
351
|
-
const result = transformTanStackRootRoute({
|
|
352
|
-
content: getStartRoot({
|
|
353
|
-
shellComponent: 'createShell(RootDocument)'
|
|
354
|
-
}),
|
|
355
|
-
kind: 'start'
|
|
356
|
-
});
|
|
357
|
-
expect(result).toEqual({
|
|
358
|
-
reason: 'The existing shellComponent cannot be transformed safely.',
|
|
359
|
-
success: false
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
it('should reject an existing Router-only shell component', ()=>{
|
|
363
|
-
const content = getRouterOnlyRoot().replace('component: RootComponent,', 'component: RootComponent,\n shellComponent: CustomShell,');
|
|
364
|
-
const result = transformTanStackRootRoute({
|
|
365
|
-
content,
|
|
366
|
-
kind: 'router-only'
|
|
367
|
-
});
|
|
368
|
-
expect(result).toEqual({
|
|
369
|
-
reason: 'The existing shellComponent cannot be transformed safely.',
|
|
370
|
-
success: false
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
it('should reject multiple root route declarations', ()=>{
|
|
374
|
-
const content = `${getStartRoot()}
|
|
375
|
-
export const OtherRoute = createAppRoot({ shellComponent: RootDocument })
|
|
376
|
-
`;
|
|
377
|
-
const result = transformTanStackRootRoute({
|
|
378
|
-
content,
|
|
379
|
-
kind: 'start'
|
|
380
|
-
});
|
|
381
|
-
expect(result).toEqual({
|
|
382
|
-
reason: 'Expected exactly one createRootRoute() call.',
|
|
383
|
-
success: false
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
it('should reject a Start stylesheet expression that cannot be relocated', ()=>{
|
|
387
|
-
const result = transformTanStackRootRoute({
|
|
388
|
-
content: getStartRoot({
|
|
389
|
-
appCssHref: 'getStylesheetUrl()'
|
|
390
|
-
}),
|
|
391
|
-
kind: 'start'
|
|
392
|
-
});
|
|
393
|
-
expect(result).toEqual({
|
|
394
|
-
reason: 'The app stylesheet link cannot be relocated safely.',
|
|
395
|
-
success: false
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
it('should reject a Start root with an additional side-effect stylesheet import', ()=>{
|
|
399
|
-
const result = transformTanStackRootRoute({
|
|
400
|
-
content: getStartRoot({
|
|
401
|
-
extraImports: `import '../legacy.css'`
|
|
402
|
-
}),
|
|
403
|
-
kind: 'start'
|
|
404
|
-
});
|
|
405
|
-
expect(result).toEqual({
|
|
406
|
-
reason: 'Side-effect stylesheet imports cannot be isolated from admin.',
|
|
407
|
-
success: false
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
it('should reject a transformed Router-only root retaining side-effect CSS', ()=>{
|
|
411
|
-
const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({
|
|
412
|
-
content: getRouterOnlyRoot(),
|
|
413
|
-
kind: 'router-only'
|
|
414
|
-
}));
|
|
415
|
-
const content = `${firstResult.content}\nimport '../legacy.css'\n`;
|
|
416
|
-
const result = transformTanStackRootRoute({
|
|
417
|
-
content,
|
|
418
|
-
kind: 'router-only'
|
|
419
|
-
});
|
|
420
|
-
expect(result).toEqual({
|
|
421
|
-
reason: 'Side-effect stylesheet imports cannot be isolated from admin.',
|
|
422
|
-
success: false
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
it('should reject multiple Router-only side-effect stylesheet imports', ()=>{
|
|
426
|
-
const result = transformTanStackRootRoute({
|
|
427
|
-
content: getRouterOnlyRoot({
|
|
428
|
-
stylesheetImport: `import '../base.css'\nimport '../styles.css'`
|
|
429
|
-
}),
|
|
430
|
-
kind: 'router-only'
|
|
431
|
-
});
|
|
432
|
-
expect(result).toEqual({
|
|
433
|
-
reason: 'Expected exactly one side-effect stylesheet import.',
|
|
434
|
-
success: false
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
it.each([
|
|
438
|
-
[
|
|
439
|
-
'withPayloadRoot',
|
|
440
|
-
`const withPayloadRoot = (component: unknown) => component`
|
|
441
|
-
],
|
|
442
|
-
[
|
|
443
|
-
'appCss',
|
|
444
|
-
`const appCss = '/custom.css'`
|
|
445
|
-
],
|
|
446
|
-
[
|
|
447
|
-
'RootDocument',
|
|
448
|
-
`function RootDocument() { return null }`
|
|
449
|
-
],
|
|
450
|
-
[
|
|
451
|
-
'HeadContent',
|
|
452
|
-
`const HeadContent = CustomHead`
|
|
453
|
-
],
|
|
454
|
-
[
|
|
455
|
-
'Scripts',
|
|
456
|
-
`const Scripts = CustomScripts`
|
|
457
|
-
]
|
|
458
|
-
])('should reject an incompatible Router-only %s destination binding', (name, binding)=>{
|
|
459
|
-
const result = transformTanStackRootRoute({
|
|
460
|
-
content: getRouterOnlyRoot({
|
|
461
|
-
extraImports: binding
|
|
462
|
-
}),
|
|
463
|
-
kind: 'router-only'
|
|
464
|
-
});
|
|
465
|
-
expect(result).toEqual({
|
|
466
|
-
reason: `Identifier "${name}" is already bound incompatibly.`,
|
|
467
|
-
success: false
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
it('should reject a withPayloadRoot import with the wrong provenance', ()=>{
|
|
471
|
-
const result = transformTanStackRootRoute({
|
|
472
|
-
content: getStartRoot({
|
|
473
|
-
extraImports: `import { withPayloadRoot } from 'custom-shell'`
|
|
474
|
-
}),
|
|
475
|
-
kind: 'start'
|
|
476
|
-
});
|
|
477
|
-
expect(result).toEqual({
|
|
478
|
-
reason: 'Identifier "withPayloadRoot" is already bound incompatibly.',
|
|
479
|
-
success: false
|
|
480
|
-
});
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
//# sourceMappingURL=transform-root-route.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/tanstack/transform-root-route.spec.ts"],"sourcesContent":["import { Project } from 'ts-morph'\nimport { describe, expect, it } from 'vitest'\n\nimport { transformTanStackRootRoute } from './transform-root-route.js'\n\nfunction expectSuccessfulTransform(result: ReturnType<typeof transformTanStackRootRoute>) {\n expect(result.success).toBe(true)\n\n if (!result.success) {\n throw new Error(result.reason)\n }\n\n return result\n}\n\nfunction getStartRoot({\n appCssHref = 'appCss',\n extraImports = '',\n shellComponent = 'RootDocument',\n}: {\n appCssHref?: string\n extraImports?: string\n shellComponent?: string\n} = {}) {\n return `import { createRootRoute as createAppRoot, HeadContent, Scripts } from '@tanstack/react-router'\nimport appCss from '../styles.css?url'\nimport { ThemeProvider } from './theme-provider'\n${extraImports}\n\nexport const Route = createAppRoot({\n head: () => ({\n meta: [\n { charSet: 'utf-8' },\n { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n { title: 'Custom title' },\n ],\n links: [\n { rel: 'stylesheet', href: ${appCssHref} },\n { rel: 'preconnect', href: 'https://fonts.googleapis.com' },\n ],\n }),\n notFoundComponent: NotFound,\n shellComponent: ${shellComponent},\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <head>\n <meta name=\"theme-color\" content=\"black\" />\n <HeadContent />\n </head>\n <body>\n <ThemeProvider>{children}</ThemeProvider>\n <Scripts />\n </body>\n </html>\n )\n}\n`\n}\n\nfunction getRouterOnlyRoot({\n extraImports = '',\n stylesheetImport = `import '../styles.css'`,\n}: {\n extraImports?: string\n stylesheetImport?: string\n} = {}) {\n return `import { createRootRoute as createAppRoot, Outlet } from '@tanstack/react-router'\nimport { AuthProvider } from './auth-provider'\n${stylesheetImport}\n${extraImports}\n\nexport const Route = createAppRoot({\n component: RootComponent,\n head: () => ({\n meta: [{ title: 'Router app' }],\n links: [{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }],\n }),\n notFoundComponent: NotFound,\n})\n\nfunction RootComponent() {\n return (\n <AuthProvider>\n <main data-layout=\"custom\">\n <Outlet />\n </main>\n </AuthProvider>\n )\n}\n`\n}\n\nfunction getRouterOnlyDocumentRoot(returnExpression: string) {\n return `import { Outlet, createRootRoute } from '@tanstack/react-router'\n\nimport '../styles.css'\n\nexport const Route = createRootRoute({\n component: RootComponent,\n})\n\nfunction RootComponent() {\n return (${returnExpression})\n}\n`\n}\n\nfunction getRouterNamedImports(content: string, importedNames: string[]) {\n const project = new Project({ useInMemoryFileSystem: true })\n const sourceFile = project.createSourceFile('__root.tsx', content)\n\n return sourceFile\n .getImportDeclarations()\n .filter((declaration) => declaration.getModuleSpecifierValue() === '@tanstack/react-router')\n .flatMap((declaration) =>\n declaration\n .getNamedImports()\n .filter((namedImport) => importedNames.includes(namedImport.getName()))\n .map((namedImport) => ({\n importedName: namedImport.getName(),\n localName: namedImport.getAliasNode()?.getText() ?? namedImport.getName(),\n })),\n )\n}\n\ndescribe('transformTanStackRootRoute', () => {\n it('should wrap the official Start shell and isolate its app stylesheet from admin', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: getStartRoot(), kind: 'start' }),\n )\n\n expect(result.modified).toBe(true)\n expect(result.content).toContain(\n \"import { withPayloadRoot } from '@payloadcms/tanstack-start/client'\",\n )\n expect(result.content).toContain('shellComponent: withPayloadRoot(RootDocument)')\n expect(result.content).not.toContain(\"{ rel: 'stylesheet', href: appCss }\")\n expect(result.content).toContain('<link href={appCss} rel=\"stylesheet\" />')\n expect(result.content.indexOf('<link href={appCss}')).toBeLessThan(\n result.content.indexOf('<HeadContent />'),\n )\n })\n\n it('should preserve Start metadata, non-stylesheet links, components, and providers', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: getStartRoot(), kind: 'start' }),\n )\n\n expect(result.content).toContain(\"{ charSet: 'utf-8' }\")\n expect(result.content).toContain(\n \"{ name: 'viewport', content: 'width=device-width, initial-scale=1' }\",\n )\n expect(result.content).toContain(\"{ title: 'Custom title' }\")\n expect(result.content).toContain(\"{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }\")\n expect(result.content).toContain('notFoundComponent: NotFound')\n expect(result.content).toContain('<meta name=\"theme-color\" content=\"black\" />')\n expect(result.content).toContain('<ThemeProvider>{children}</ThemeProvider>')\n })\n\n it('should convert the official Router-only root without replacing its route component', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: getRouterOnlyRoot(), kind: 'router-only' }),\n )\n\n expect(result.modified).toBe(true)\n expect(result.content).toContain(\"import appCss from '../styles.css?url'\")\n expect(result.content).not.toContain(\"import '../styles.css'\")\n expect(result.content).toContain('component: RootComponent')\n expect(result.content).toContain('shellComponent: withPayloadRoot(RootDocument)')\n expect(result.content).toContain('function RootComponent()')\n expect(result.content).toContain('<AuthProvider>')\n expect(result.content).toContain('<Outlet />')\n expect(result.content).toContain(\n 'function RootDocument({ children }: { children: React.ReactNode })',\n )\n expect(result.content).toContain('<html lang=\"en\" suppressHydrationWarning>')\n expect(result.content).toContain('<link href={appCss} rel=\"stylesheet\" />')\n expect(result.content).toContain('<HeadContent />')\n expect(result.content).toContain('{children}')\n expect(result.content).toContain('<Scripts />')\n })\n\n it('should preserve Router-only metadata, non-stylesheet links, and route options', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: getRouterOnlyRoot(), kind: 'router-only' }),\n )\n\n expect(result.content).toContain(\"meta: [{ title: 'Router app' }]\")\n expect(result.content).toContain(\n \"links: [{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }]\",\n )\n expect(result.content).toContain('notFoundComponent: NotFound')\n expect(result.content).toContain('<main data-layout=\"custom\">')\n })\n\n it.each([\n [\n 'direct',\n `<html lang=\"fr\"><head><title>My Router App</title></head><body><Outlet /></body></html>`,\n ],\n ['fragment-wrapped', `<><html lang=\"fr\"><head /><body><Outlet /></body></html></>`],\n ['conditional', `isReady ? <html lang=\"fr\"><head /><body><Outlet /></body></html> : null`],\n ])(\n 'should reject a Router-only root whose %s route component renders the document shell',\n (_shape, returnExpression) => {\n const content = getRouterOnlyDocumentRoot(returnExpression)\n\n expect(transformTanStackRootRoute({ content, kind: 'router-only' })).toEqual({\n reason: 'The Router-only route component cannot render the document shell.',\n success: false,\n })\n },\n )\n\n it('should reuse aliased HeadContent and Scripts imports from split declarations', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({\n content: getRouterOnlyRoot({\n extraImports: `import { HeadContent as RouterHeadContent } from '@tanstack/react-router'\nimport { Scripts as RouterScripts } from '@tanstack/react-router'`,\n }),\n kind: 'router-only',\n }),\n )\n\n expect(result.content).toContain('<RouterHeadContent />')\n expect(result.content).toContain('<RouterScripts />')\n expect(getRouterNamedImports(result.content, ['HeadContent', 'Scripts'])).toEqual([\n { importedName: 'HeadContent', localName: 'RouterHeadContent' },\n { importedName: 'Scripts', localName: 'RouterScripts' },\n ])\n })\n\n it('should preserve split HeadContent and Scripts imports without duplicating bindings', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({\n content: getRouterOnlyRoot({\n extraImports: `import { HeadContent } from '@tanstack/react-router'\nimport { Scripts } from '@tanstack/react-router'`,\n }),\n kind: 'router-only',\n }),\n )\n\n expect(getRouterNamedImports(result.content, ['HeadContent', 'Scripts'])).toEqual([\n { importedName: 'HeadContent', localName: 'HeadContent' },\n { importedName: 'Scripts', localName: 'Scripts' },\n ])\n })\n\n it('should not add withPayloadRoot to an unrelated type-only client import', () => {\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({\n content: getRouterOnlyRoot({\n extraImports: `import type { ClientOptions } from '@payloadcms/tanstack-start/client'`,\n }),\n kind: 'router-only',\n }),\n )\n\n expect(result.content).toContain(\n \"import { withPayloadRoot } from '@payloadcms/tanstack-start/client'\",\n )\n expect(result.content).toContain(\n \"import type { ClientOptions } from '@payloadcms/tanstack-start/client'\",\n )\n })\n\n it.each([\n ['start' as const, getStartRoot()],\n ['router-only' as const, getRouterOnlyRoot()],\n ])('should report an already transformed %s root as unmodified', (kind, content) => {\n const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({ content, kind }))\n const secondResult = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: firstResult.content, kind }),\n )\n\n expect(secondResult).toEqual({ content: firstResult.content, modified: false, success: true })\n })\n\n it.each([\n ['start' as const, getStartRoot()],\n ['router-only' as const, getRouterOnlyRoot()],\n ])(\n 'should restore a missing withPayloadRoot import in a transformed %s root',\n (kind, content) => {\n const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({ content, kind }))\n const contentWithoutPayloadImport = firstResult.content.replace(\n /import \\{ withPayloadRoot \\} from '@payloadcms\\/tanstack-start\\/client';?\\n/,\n '',\n )\n\n const result = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: contentWithoutPayloadImport, kind }),\n )\n\n expect(result.modified).toBe(true)\n expect(result.content).toContain(\n \"import { withPayloadRoot } from '@payloadcms/tanstack-start/client'\",\n )\n },\n )\n\n it.each([\n ['start' as const, getStartRoot()],\n ['router-only' as const, getRouterOnlyRoot()],\n ])(\n 'should validate an aliased wrapper call against its local import in a transformed %s root',\n (kind, content) => {\n const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({ content, kind }))\n const aliasedContent = firstResult.content\n .replace(\n \"import { withPayloadRoot } from '@payloadcms/tanstack-start/client'\",\n \"import { withPayloadRoot as payloadRoot } from '@payloadcms/tanstack-start/client'\",\n )\n .replace('withPayloadRoot(RootDocument)', 'payloadRoot(RootDocument)')\n\n const result = transformTanStackRootRoute({ content: aliasedContent, kind })\n\n expect(result).toEqual({ content: aliasedContent, modified: false, success: true })\n },\n )\n\n it.each([\n ['start' as const, getStartRoot()],\n ['router-only' as const, getRouterOnlyRoot()],\n ])(\n 'should reject a transformed %s root whose canonical wrapper call has only an aliased import',\n (kind, content) => {\n const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({ content, kind }))\n const malformedContent = firstResult.content.replace(\n \"import { withPayloadRoot } from '@payloadcms/tanstack-start/client'\",\n \"import { withPayloadRoot as payloadRoot } from '@payloadcms/tanstack-start/client'\",\n )\n\n const result = transformTanStackRootRoute({ content: malformedContent, kind })\n\n expect(result).toEqual({\n reason: 'The existing shellComponent cannot be transformed safely.',\n success: false,\n })\n },\n )\n\n it.each([\n ['start' as const, getStartRoot()],\n ['router-only' as const, getRouterOnlyRoot()],\n ])(\n 'should reject a transformed %s root with the stylesheet after HeadContent',\n (kind, content) => {\n const firstResult = expectSuccessfulTransform(transformTanStackRootRoute({ content, kind }))\n const reorderedContent = firstResult.content.replace(\n '<link href={appCss} rel=\"stylesheet\" />\\n <HeadContent />',\n '<HeadContent />\\n <link href={appCss} rel=\"stylesheet\" />',\n )\n\n const result = transformTanStackRootRoute({ content: reorderedContent, kind })\n\n expect(result.success).toBe(false)\n },\n )\n\n it('should reject an unrecognized Start shell expression', () => {\n const result = transformTanStackRootRoute({\n content: getStartRoot({ shellComponent: 'createShell(RootDocument)' }),\n kind: 'start',\n })\n\n expect(result).toEqual({\n reason: 'The existing shellComponent cannot be transformed safely.',\n success: false,\n })\n })\n\n it('should reject an existing Router-only shell component', () => {\n const content = getRouterOnlyRoot().replace(\n 'component: RootComponent,',\n 'component: RootComponent,\\n shellComponent: CustomShell,',\n )\n\n const result = transformTanStackRootRoute({ content, kind: 'router-only' })\n\n expect(result).toEqual({\n reason: 'The existing shellComponent cannot be transformed safely.',\n success: false,\n })\n })\n\n it('should reject multiple root route declarations', () => {\n const content = `${getStartRoot()}\nexport const OtherRoute = createAppRoot({ shellComponent: RootDocument })\n`\n\n const result = transformTanStackRootRoute({ content, kind: 'start' })\n\n expect(result).toEqual({\n reason: 'Expected exactly one createRootRoute() call.',\n success: false,\n })\n })\n\n it('should reject a Start stylesheet expression that cannot be relocated', () => {\n const result = transformTanStackRootRoute({\n content: getStartRoot({ appCssHref: 'getStylesheetUrl()' }),\n kind: 'start',\n })\n\n expect(result).toEqual({\n reason: 'The app stylesheet link cannot be relocated safely.',\n success: false,\n })\n })\n\n it('should reject a Start root with an additional side-effect stylesheet import', () => {\n const result = transformTanStackRootRoute({\n content: getStartRoot({ extraImports: `import '../legacy.css'` }),\n kind: 'start',\n })\n\n expect(result).toEqual({\n reason: 'Side-effect stylesheet imports cannot be isolated from admin.',\n success: false,\n })\n })\n\n it('should reject a transformed Router-only root retaining side-effect CSS', () => {\n const firstResult = expectSuccessfulTransform(\n transformTanStackRootRoute({ content: getRouterOnlyRoot(), kind: 'router-only' }),\n )\n const content = `${firstResult.content}\\nimport '../legacy.css'\\n`\n\n const result = transformTanStackRootRoute({ content, kind: 'router-only' })\n\n expect(result).toEqual({\n reason: 'Side-effect stylesheet imports cannot be isolated from admin.',\n success: false,\n })\n })\n\n it('should reject multiple Router-only side-effect stylesheet imports', () => {\n const result = transformTanStackRootRoute({\n content: getRouterOnlyRoot({\n stylesheetImport: `import '../base.css'\\nimport '../styles.css'`,\n }),\n kind: 'router-only',\n })\n\n expect(result).toEqual({\n reason: 'Expected exactly one side-effect stylesheet import.',\n success: false,\n })\n })\n\n it.each([\n ['withPayloadRoot', `const withPayloadRoot = (component: unknown) => component`],\n ['appCss', `const appCss = '/custom.css'`],\n ['RootDocument', `function RootDocument() { return null }`],\n ['HeadContent', `const HeadContent = CustomHead`],\n ['Scripts', `const Scripts = CustomScripts`],\n ])('should reject an incompatible Router-only %s destination binding', (name, binding) => {\n const result = transformTanStackRootRoute({\n content: getRouterOnlyRoot({ extraImports: binding }),\n kind: 'router-only',\n })\n\n expect(result).toEqual({\n reason: `Identifier \"${name}\" is already bound incompatibly.`,\n success: false,\n })\n })\n\n it('should reject a withPayloadRoot import with the wrong provenance', () => {\n const result = transformTanStackRootRoute({\n content: getStartRoot({\n extraImports: `import { withPayloadRoot } from 'custom-shell'`,\n }),\n kind: 'start',\n })\n\n expect(result).toEqual({\n reason: 'Identifier \"withPayloadRoot\" is already bound incompatibly.',\n success: false,\n })\n })\n})\n"],"names":["Project","describe","expect","it","transformTanStackRootRoute","expectSuccessfulTransform","result","success","toBe","Error","reason","getStartRoot","appCssHref","extraImports","shellComponent","getRouterOnlyRoot","stylesheetImport","getRouterOnlyDocumentRoot","returnExpression","getRouterNamedImports","content","importedNames","project","useInMemoryFileSystem","sourceFile","createSourceFile","getImportDeclarations","filter","declaration","getModuleSpecifierValue","flatMap","getNamedImports","namedImport","includes","getName","map","importedName","localName","getAliasNode","getText","kind","modified","toContain","not","indexOf","toBeLessThan","each","_shape","toEqual","firstResult","secondResult","contentWithoutPayloadImport","replace","aliasedContent","malformedContent","re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