@tanstack/cli 0.0.8 → 0.48.3

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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin.js +7 -0
  3. package/dist/cli.js +481 -0
  4. package/dist/command-line.js +174 -0
  5. package/dist/dev-watch.js +290 -0
  6. package/dist/file-syncer.js +148 -0
  7. package/dist/index.js +1 -0
  8. package/dist/mcp/api.js +31 -0
  9. package/dist/mcp/tools.js +250 -0
  10. package/dist/mcp/types.js +37 -0
  11. package/dist/mcp.js +121 -0
  12. package/dist/options.js +162 -0
  13. package/dist/types/bin.d.ts +2 -0
  14. package/dist/types/cli.d.ts +16 -0
  15. package/dist/types/command-line.d.ts +10 -0
  16. package/dist/types/dev-watch.d.ts +27 -0
  17. package/dist/types/file-syncer.d.ts +18 -0
  18. package/dist/types/index.d.ts +1 -0
  19. package/dist/types/mcp/api.d.ts +4 -0
  20. package/dist/types/mcp/tools.d.ts +2 -0
  21. package/dist/types/mcp/types.d.ts +217 -0
  22. package/dist/types/mcp.d.ts +6 -0
  23. package/dist/types/options.d.ts +8 -0
  24. package/dist/types/types.d.ts +25 -0
  25. package/dist/types/ui-environment.d.ts +2 -0
  26. package/dist/types/ui-prompts.d.ts +12 -0
  27. package/dist/types/utils.d.ts +8 -0
  28. package/dist/types.js +1 -0
  29. package/dist/ui-environment.js +52 -0
  30. package/dist/ui-prompts.js +244 -0
  31. package/dist/utils.js +30 -0
  32. package/package.json +46 -47
  33. package/src/bin.ts +6 -93
  34. package/src/cli.ts +692 -0
  35. package/src/command-line.ts +236 -0
  36. package/src/dev-watch.ts +430 -0
  37. package/src/file-syncer.ts +205 -0
  38. package/src/index.ts +1 -85
  39. package/src/mcp.ts +190 -0
  40. package/src/options.ts +260 -0
  41. package/src/types.ts +27 -0
  42. package/src/ui-environment.ts +74 -0
  43. package/src/ui-prompts.ts +322 -0
  44. package/src/utils.ts +38 -0
  45. package/tests/command-line.test.ts +304 -0
  46. package/tests/index.test.ts +9 -0
  47. package/tests/mcp.test.ts +225 -0
  48. package/tests/options.test.ts +304 -0
  49. package/tests/setupVitest.ts +6 -0
  50. package/tests/ui-environment.test.ts +97 -0
  51. package/tests/ui-prompts.test.ts +238 -0
  52. package/tsconfig.json +17 -0
  53. package/vitest.config.js +7 -0
  54. package/dist/bin.cjs +0 -769
  55. package/dist/bin.d.cts +0 -1
  56. package/dist/bin.d.mts +0 -1
  57. package/dist/bin.mjs +0 -768
  58. package/dist/fetch-CbFFGJEw.cjs +0 -3
  59. package/dist/fetch-DG5dLrsb.cjs +0 -522
  60. package/dist/fetch-DhlVXS6S.mjs +0 -390
  61. package/dist/fetch-I_OVg8JX.mjs +0 -3
  62. package/dist/index.cjs +0 -37
  63. package/dist/index.d.cts +0 -1172
  64. package/dist/index.d.mts +0 -1172
  65. package/dist/index.mjs +0 -4
  66. package/dist/template-Szi7-AZJ.mjs +0 -2202
  67. package/dist/template-lWrIZhCQ.cjs +0 -2314
  68. package/src/api/fetch.test.ts +0 -114
  69. package/src/api/fetch.ts +0 -278
  70. package/src/cache/index.ts +0 -89
  71. package/src/commands/create.ts +0 -470
  72. package/src/commands/mcp.test.ts +0 -152
  73. package/src/commands/mcp.ts +0 -211
  74. package/src/engine/compile-with-addons.test.ts +0 -302
  75. package/src/engine/compile.test.ts +0 -404
  76. package/src/engine/compile.ts +0 -569
  77. package/src/engine/config-file.test.ts +0 -118
  78. package/src/engine/config-file.ts +0 -61
  79. package/src/engine/custom-addons/integration.ts +0 -323
  80. package/src/engine/custom-addons/shared.test.ts +0 -98
  81. package/src/engine/custom-addons/shared.ts +0 -281
  82. package/src/engine/custom-addons/template.test.ts +0 -288
  83. package/src/engine/custom-addons/template.ts +0 -124
  84. package/src/engine/template.test.ts +0 -256
  85. package/src/engine/template.ts +0 -269
  86. package/src/engine/types.ts +0 -336
  87. package/src/parse-gitignore.d.ts +0 -5
  88. package/src/templates/base.ts +0 -883
@@ -1,2202 +0,0 @@
1
- import { a as fetchIntegrations, l as CustomTemplateCompiledSchema, p as IntegrationCompiledSchema } from "./fetch-DhlVXS6S.mjs";
2
- import { render } from "ejs";
3
- import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
4
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
- import { basename, dirname, extname, resolve } from "node:path";
6
- import ignore from "ignore";
7
- import parseGitignore from "parse-gitignore";
8
-
9
- //#region src/engine/template.ts
10
- /**
11
- * Convert _dot_ prefixes to actual dots (for dotfiles)
12
- */
13
- function convertDotFiles(path) {
14
- return path.split("/").map((segment) => segment.replace(/^_dot_/, ".")).join("/");
15
- }
16
- /**
17
- * Strip option prefixes from filename
18
- * e.g., __postgres__schema.prisma -> schema.prisma
19
- */
20
- function stripOptionPrefix(path) {
21
- const match = path.match(/^(.+\/)?__([^_]+)__(.+)$/);
22
- if (match) {
23
- const [, directory, , filename] = match;
24
- return (directory || "") + filename;
25
- }
26
- return path;
27
- }
28
- /**
29
- * Calculate relative path between two file paths
30
- */
31
- function relativePath(from, to, stripExtension = false) {
32
- const fromParts = from.split("/").slice(0, -1);
33
- const toParts = to.split("/");
34
- let commonLength = 0;
35
- while (commonLength < fromParts.length && commonLength < toParts.length && fromParts[commonLength] === toParts[commonLength]) commonLength++;
36
- const upCount = fromParts.length - commonLength;
37
- const ups = Array(upCount).fill("..");
38
- const remainder = toParts.slice(commonLength);
39
- let result = [...ups, ...remainder].join("/");
40
- if (!result.startsWith(".")) result = "./" + result;
41
- if (stripExtension) result = result.replace(/\.[^/.]+$/, "");
42
- return result;
43
- }
44
- /**
45
- * Error thrown when ignoreFile() is called in a template
46
- */
47
- var IgnoreFileError = class extends Error {
48
- constructor() {
49
- super("ignoreFile");
50
- this.name = "IgnoreFileError";
51
- }
52
- };
53
- /**
54
- * Create template context from compile options
55
- */
56
- function createTemplateContext(options, currentFile) {
57
- const hooks = [];
58
- for (const integration of options.chosenIntegrations) if (integration.hooks) hooks.push(...integration.hooks);
59
- const routes = [];
60
- for (const integration of options.chosenIntegrations) if (integration.routes) routes.push(...integration.routes);
61
- const integrationEnabled = {};
62
- for (const integration of options.chosenIntegrations) integrationEnabled[integration.id] = true;
63
- const localRelativePath = (to, stripExt = false) => relativePath(currentFile, to, stripExt);
64
- const hookImportContent = (hook) => hook.import || `import ${hook.jsName} from '${localRelativePath(hook.path || "")}'`;
65
- const hookImportCode = (hook) => hook.code || hook.jsName || "";
66
- return {
67
- packageManager: options.packageManager,
68
- projectName: options.projectName,
69
- typescript: options.typescript,
70
- tailwind: options.tailwind,
71
- js: options.typescript ? "ts" : "js",
72
- jsx: options.typescript ? "tsx" : "jsx",
73
- fileRouter: options.mode === "file-router",
74
- codeRouter: options.mode === "code-router",
75
- integrationEnabled,
76
- integrationOption: options.integrationOptions,
77
- integrations: options.chosenIntegrations,
78
- hooks,
79
- routes,
80
- getPackageManagerAddScript: (pkg, isDev = false) => {
81
- const pm = options.packageManager;
82
- if (pm === "npm") return `npm install ${isDev ? "-D " : ""}${pkg}`;
83
- if (pm === "yarn") return `yarn add ${isDev ? "-D " : ""}${pkg}`;
84
- if (pm === "pnpm") return `pnpm add ${isDev ? "-D " : ""}${pkg}`;
85
- if (pm === "bun") return `bun add ${isDev ? "-d " : ""}${pkg}`;
86
- if (pm === "deno") return `deno add ${pkg}`;
87
- return `npm install ${isDev ? "-D " : ""}${pkg}`;
88
- },
89
- getPackageManagerRunScript: (script, args = []) => {
90
- const pm = options.packageManager;
91
- const argsStr = args.length ? " " + args.join(" ") : "";
92
- if (pm === "npm") return `npm run ${script}${argsStr}`;
93
- if (pm === "yarn") return `yarn ${script}${argsStr}`;
94
- if (pm === "pnpm") return `pnpm ${script}${argsStr}`;
95
- if (pm === "bun") return `bun run ${script}${argsStr}`;
96
- if (pm === "deno") return `deno task ${script}${argsStr}`;
97
- return `npm run ${script}${argsStr}`;
98
- },
99
- relativePath: localRelativePath,
100
- hookImportContent,
101
- hookImportCode,
102
- ignoreFile: () => {
103
- throw new IgnoreFileError();
104
- }
105
- };
106
- }
107
- /**
108
- * Process a template file with EJS
109
- */
110
- function processTemplateFile(filePath, content, options) {
111
- const context = createTemplateContext(options, filePath);
112
- let processedContent = content;
113
- let shouldIgnore = false;
114
- if (filePath.endsWith(".ejs")) try {
115
- processedContent = render(content, context);
116
- } catch (error) {
117
- if (error instanceof IgnoreFileError) shouldIgnore = true;
118
- else throw new Error(`EJS error in file ${filePath}: ${error}`);
119
- }
120
- if (shouldIgnore) return null;
121
- let outputPath = filePath;
122
- outputPath = outputPath.replace(/\.ejs$/, "");
123
- outputPath = convertDotFiles(outputPath);
124
- outputPath = stripOptionPrefix(outputPath);
125
- let append = false;
126
- if (outputPath.endsWith(".append")) {
127
- append = true;
128
- outputPath = outputPath.replace(/\.append$/, "");
129
- }
130
- if (!options.typescript) outputPath = outputPath.replace(/\.tsx$/, ".jsx").replace(/\.ts$/, ".js");
131
- return {
132
- path: outputPath,
133
- content: processedContent,
134
- append
135
- };
136
- }
137
-
138
- //#endregion
139
- //#region src/templates/base.ts
140
- /**
141
- * Base TanStack Start template files
142
- * These provide the foundation for every project
143
- */
144
- /**
145
- * Collect all hooks from integrations, grouped by type
146
- */
147
- function collectHooks(options) {
148
- const hooks = [];
149
- for (const integration of options.chosenIntegrations) if (integration.hooks) for (const hook of integration.hooks) hooks.push({
150
- ...hook,
151
- integrationId: integration.id
152
- });
153
- return {
154
- vitePlugins: hooks.filter((i) => i.type === "vite-plugin"),
155
- rootProviders: hooks.filter((i) => i.type === "root-provider"),
156
- devtoolsPlugins: hooks.filter((i) => i.type === "devtools"),
157
- entryClientInits: hooks.filter((i) => i.type === "entry-client")
158
- };
159
- }
160
- /**
161
- * Generate vite.config.ts content with line attribution
162
- */
163
- function generateViteConfig(options, vitePlugins) {
164
- const { tailwind } = options;
165
- const lines = [];
166
- lines.push({
167
- text: `import { defineConfig } from 'vite'`,
168
- integrationId: "base"
169
- });
170
- lines.push({
171
- text: `import { tanstackStart } from '@tanstack/react-start/plugin/vite'`,
172
- integrationId: "base"
173
- });
174
- lines.push({
175
- text: `import viteReact from '@vitejs/plugin-react'`,
176
- integrationId: "base"
177
- });
178
- lines.push({
179
- text: `import viteTsConfigPaths from 'vite-tsconfig-paths'`,
180
- integrationId: "base"
181
- });
182
- if (tailwind) lines.push({
183
- text: `import tailwindcss from '@tailwindcss/vite'`,
184
- integrationId: "base"
185
- });
186
- for (const plugin of vitePlugins) if (plugin.import) lines.push({
187
- text: plugin.import,
188
- integrationId: plugin.integrationId
189
- });
190
- else {
191
- const importPath = relativePath("vite.config.ts", plugin.path || `src/integrations/${plugin.integrationId}/vite-plugin.ts`, true);
192
- lines.push({
193
- text: `import ${plugin.jsName} from '${importPath}'`,
194
- integrationId: plugin.integrationId
195
- });
196
- }
197
- lines.push({
198
- text: "",
199
- integrationId: "base"
200
- });
201
- lines.push({
202
- text: `export default defineConfig({`,
203
- integrationId: "base"
204
- });
205
- lines.push({
206
- text: ` plugins: [`,
207
- integrationId: "base"
208
- });
209
- lines.push({
210
- text: ` viteTsConfigPaths({`,
211
- integrationId: "base"
212
- });
213
- lines.push({
214
- text: ` projects: ['./tsconfig.json'],`,
215
- integrationId: "base"
216
- });
217
- lines.push({
218
- text: ` }),`,
219
- integrationId: "base"
220
- });
221
- if (tailwind) lines.push({
222
- text: ` tailwindcss(),`,
223
- integrationId: "base"
224
- });
225
- lines.push({
226
- text: ` tanstackStart(),`,
227
- integrationId: "base"
228
- });
229
- lines.push({
230
- text: ` viteReact(),`,
231
- integrationId: "base"
232
- });
233
- for (const plugin of vitePlugins) {
234
- const pluginCall = plugin.code || `${plugin.jsName}()`;
235
- lines.push({
236
- text: ` ${pluginCall},`,
237
- integrationId: plugin.integrationId
238
- });
239
- }
240
- lines.push({
241
- text: ` ],`,
242
- integrationId: "base"
243
- });
244
- lines.push({
245
- text: `})`,
246
- integrationId: "base"
247
- });
248
- return {
249
- content: lines.map((l) => l.text).join("\n"),
250
- lineAttributions: lines.map((l, i) => ({
251
- line: i + 1,
252
- integrationId: l.integrationId
253
- }))
254
- };
255
- }
256
- /**
257
- * Generate entry-client.tsx content with line attribution
258
- */
259
- function generateEntryClient(_options, entryClientInits) {
260
- const lines = [];
261
- lines.push({
262
- text: `import { hydrateRoot } from 'react-dom/client'`,
263
- integrationId: "base"
264
- });
265
- lines.push({
266
- text: `import { StartClient } from '@tanstack/react-start'`,
267
- integrationId: "base"
268
- });
269
- lines.push({
270
- text: `import { getRouter } from './router'`,
271
- integrationId: "base"
272
- });
273
- for (const init of entryClientInits) {
274
- const importPath = relativePath("src/entry-client.tsx", init.path || `src/integrations/${init.integrationId}/client.ts`, true);
275
- lines.push({
276
- text: `import { ${init.jsName} } from '${importPath}'`,
277
- integrationId: init.integrationId
278
- });
279
- }
280
- lines.push({
281
- text: "",
282
- integrationId: "base"
283
- });
284
- if (entryClientInits.length > 0) {
285
- lines.push({
286
- text: `// Initialize integrations`,
287
- integrationId: "base"
288
- });
289
- for (const init of entryClientInits) lines.push({
290
- text: `${init.jsName}()`,
291
- integrationId: init.integrationId
292
- });
293
- lines.push({
294
- text: "",
295
- integrationId: "base"
296
- });
297
- }
298
- lines.push({
299
- text: `const router = getRouter()`,
300
- integrationId: "base"
301
- });
302
- lines.push({
303
- text: "",
304
- integrationId: "base"
305
- });
306
- lines.push({
307
- text: `hydrateRoot(document.getElementById('root')!, <StartClient router={router} />)`,
308
- integrationId: "base"
309
- });
310
- return {
311
- content: lines.map((l) => l.text).join("\n"),
312
- lineAttributions: lines.map((l, i) => ({
313
- line: i + 1,
314
- integrationId: l.integrationId
315
- }))
316
- };
317
- }
318
- /**
319
- * Generate __root.tsx content with line attribution
320
- * This generates a full document route with shellComponent for proper SSR
321
- */
322
- function generateRootRoute(options, rootProviders, devtoolsPlugins) {
323
- const lines = [];
324
- const hasHeader = options.chosenIntegrations.length > 0;
325
- lines.push({
326
- text: `import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'`,
327
- integrationId: "base"
328
- });
329
- lines.push({
330
- text: `import { TanStackDevtools } from '@tanstack/react-devtools'`,
331
- integrationId: "base"
332
- });
333
- lines.push({
334
- text: `import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'`,
335
- integrationId: "base"
336
- });
337
- lines.push({
338
- text: `import appCss from '../styles.css?url'`,
339
- integrationId: "base"
340
- });
341
- if (hasHeader) lines.push({
342
- text: `import { Header } from '../components/Header'`,
343
- integrationId: "base"
344
- });
345
- for (const provider of rootProviders) {
346
- const importPath = relativePath("src/routes/__root.tsx", provider.path || `src/integrations/${provider.integrationId}/provider.tsx`, true);
347
- lines.push({
348
- text: `import { ${provider.jsName} } from '${importPath}'`,
349
- integrationId: provider.integrationId
350
- });
351
- }
352
- for (const devtools of devtoolsPlugins) {
353
- const importPath = relativePath("src/routes/__root.tsx", devtools.path || `src/integrations/${devtools.integrationId}/devtools.tsx`, true);
354
- lines.push({
355
- text: `import { ${devtools.jsName} } from '${importPath}'`,
356
- integrationId: devtools.integrationId
357
- });
358
- }
359
- lines.push({
360
- text: "",
361
- integrationId: "base"
362
- });
363
- lines.push({
364
- text: `export const Route = createRootRoute({`,
365
- integrationId: "base"
366
- });
367
- lines.push({
368
- text: ` head: () => ({`,
369
- integrationId: "base"
370
- });
371
- lines.push({
372
- text: ` meta: [`,
373
- integrationId: "base"
374
- });
375
- lines.push({
376
- text: ` { charSet: 'utf-8' },`,
377
- integrationId: "base"
378
- });
379
- lines.push({
380
- text: ` { name: 'viewport', content: 'width=device-width, initial-scale=1' },`,
381
- integrationId: "base"
382
- });
383
- lines.push({
384
- text: ` { title: 'TanStack Start Starter' },`,
385
- integrationId: "base"
386
- });
387
- lines.push({
388
- text: ` ],`,
389
- integrationId: "base"
390
- });
391
- lines.push({
392
- text: ` links: [{ rel: 'stylesheet', href: appCss }],`,
393
- integrationId: "base"
394
- });
395
- lines.push({
396
- text: ` }),`,
397
- integrationId: "base"
398
- });
399
- lines.push({
400
- text: ` shellComponent: RootDocument,`,
401
- integrationId: "base"
402
- });
403
- lines.push({
404
- text: `})`,
405
- integrationId: "base"
406
- });
407
- lines.push({
408
- text: "",
409
- integrationId: "base"
410
- });
411
- lines.push({
412
- text: `function RootDocument({ children }: { children: React.ReactNode }) {`,
413
- integrationId: "base"
414
- });
415
- lines.push({
416
- text: ` return (`,
417
- integrationId: "base"
418
- });
419
- lines.push({
420
- text: ` <html lang="en">`,
421
- integrationId: "base"
422
- });
423
- lines.push({
424
- text: ` <head>`,
425
- integrationId: "base"
426
- });
427
- lines.push({
428
- text: ` <HeadContent />`,
429
- integrationId: "base"
430
- });
431
- lines.push({
432
- text: ` </head>`,
433
- integrationId: "base"
434
- });
435
- lines.push({
436
- text: ` <body>`,
437
- integrationId: "base"
438
- });
439
- let currentIndent = " ";
440
- for (const provider of rootProviders) {
441
- lines.push({
442
- text: `${currentIndent}<${provider.jsName}>`,
443
- integrationId: provider.integrationId
444
- });
445
- currentIndent += " ";
446
- }
447
- if (hasHeader) lines.push({
448
- text: `${currentIndent}<Header />`,
449
- integrationId: "base"
450
- });
451
- lines.push({
452
- text: `${currentIndent}{children}`,
453
- integrationId: "base"
454
- });
455
- lines.push({
456
- text: `${currentIndent}<TanStackDevtools`,
457
- integrationId: "base"
458
- });
459
- lines.push({
460
- text: `${currentIndent} config={{ position: 'bottom-right' }}`,
461
- integrationId: "base"
462
- });
463
- lines.push({
464
- text: `${currentIndent} plugins={[`,
465
- integrationId: "base"
466
- });
467
- lines.push({
468
- text: `${currentIndent} { name: 'TanStack Router', render: <TanStackRouterDevtoolsPanel /> },`,
469
- integrationId: "base"
470
- });
471
- for (const devtools of devtoolsPlugins) lines.push({
472
- text: `${currentIndent} ${devtools.jsName},`,
473
- integrationId: devtools.integrationId
474
- });
475
- lines.push({
476
- text: `${currentIndent} ]}`,
477
- integrationId: "base"
478
- });
479
- lines.push({
480
- text: `${currentIndent}/>`,
481
- integrationId: "base"
482
- });
483
- for (const provider of [...rootProviders].reverse()) {
484
- currentIndent = currentIndent.slice(0, -2);
485
- lines.push({
486
- text: `${currentIndent}</${provider.jsName}>`,
487
- integrationId: provider.integrationId
488
- });
489
- }
490
- lines.push({
491
- text: ` <Scripts />`,
492
- integrationId: "base"
493
- });
494
- lines.push({
495
- text: ` </body>`,
496
- integrationId: "base"
497
- });
498
- lines.push({
499
- text: ` </html>`,
500
- integrationId: "base"
501
- });
502
- lines.push({
503
- text: ` )`,
504
- integrationId: "base"
505
- });
506
- lines.push({
507
- text: `}`,
508
- integrationId: "base"
509
- });
510
- return {
511
- content: lines.map((l) => l.text).join("\n"),
512
- lineAttributions: lines.map((l, i) => ({
513
- line: i + 1,
514
- integrationId: l.integrationId
515
- }))
516
- };
517
- }
518
- /**
519
- * Collect routes from integrations for navigation
520
- */
521
- function collectRoutes(options) {
522
- const routes = [];
523
- for (const integration of options.chosenIntegrations) if (integration.routes) {
524
- for (const route of integration.routes) if (route.url && route.name) routes.push({
525
- url: route.url,
526
- name: route.name,
527
- icon: route.icon || "Globe"
528
- });
529
- }
530
- return routes;
531
- }
532
- /**
533
- * Generate Header component with slide-out drawer navigation
534
- */
535
- function generateHeader(options) {
536
- const lines = [];
537
- const routes = collectRoutes(options);
538
- const icons = new Set([
539
- "Menu",
540
- "X",
541
- "Home"
542
- ]);
543
- for (const route of routes) icons.add(route.icon);
544
- lines.push({
545
- text: `import { useState } from 'react'`,
546
- integrationId: "base"
547
- });
548
- lines.push({
549
- text: `import { Link } from '@tanstack/react-router'`,
550
- integrationId: "base"
551
- });
552
- lines.push({
553
- text: `import { ${Array.from(icons).sort().join(", ")} } from 'lucide-react'`,
554
- integrationId: "base"
555
- });
556
- lines.push({
557
- text: "",
558
- integrationId: "base"
559
- });
560
- lines.push({
561
- text: `export function Header() {`,
562
- integrationId: "base"
563
- });
564
- lines.push({
565
- text: ` const [isOpen, setIsOpen] = useState(false)`,
566
- integrationId: "base"
567
- });
568
- lines.push({
569
- text: "",
570
- integrationId: "base"
571
- });
572
- lines.push({
573
- text: ` return (`,
574
- integrationId: "base"
575
- });
576
- lines.push({
577
- text: ` <>`,
578
- integrationId: "base"
579
- });
580
- lines.push({
581
- text: ` <header className="p-4 flex items-center bg-gray-800 text-white shadow-lg">`,
582
- integrationId: "base"
583
- });
584
- lines.push({
585
- text: ` <button`,
586
- integrationId: "base"
587
- });
588
- lines.push({
589
- text: ` onClick={() => setIsOpen(true)}`,
590
- integrationId: "base"
591
- });
592
- lines.push({
593
- text: ` className="p-2 hover:bg-gray-700 rounded-lg transition-colors"`,
594
- integrationId: "base"
595
- });
596
- lines.push({
597
- text: ` aria-label="Open menu"`,
598
- integrationId: "base"
599
- });
600
- lines.push({
601
- text: ` >`,
602
- integrationId: "base"
603
- });
604
- lines.push({
605
- text: ` <Menu size={24} />`,
606
- integrationId: "base"
607
- });
608
- lines.push({
609
- text: ` </button>`,
610
- integrationId: "base"
611
- });
612
- lines.push({
613
- text: ` <h1 className="ml-4 text-xl font-semibold">`,
614
- integrationId: "base"
615
- });
616
- lines.push({
617
- text: ` <Link to="/">`,
618
- integrationId: "base"
619
- });
620
- lines.push({
621
- text: ` <img`,
622
- integrationId: "base"
623
- });
624
- lines.push({
625
- text: ` src="/tanstack-logo-light.svg"`,
626
- integrationId: "base"
627
- });
628
- lines.push({
629
- text: ` alt="TanStack Logo"`,
630
- integrationId: "base"
631
- });
632
- lines.push({
633
- text: ` className="h-10"`,
634
- integrationId: "base"
635
- });
636
- lines.push({
637
- text: ` />`,
638
- integrationId: "base"
639
- });
640
- lines.push({
641
- text: ` </Link>`,
642
- integrationId: "base"
643
- });
644
- lines.push({
645
- text: ` </h1>`,
646
- integrationId: "base"
647
- });
648
- lines.push({
649
- text: ` </header>`,
650
- integrationId: "base"
651
- });
652
- lines.push({
653
- text: "",
654
- integrationId: "base"
655
- });
656
- lines.push({
657
- text: ` <aside`,
658
- integrationId: "base"
659
- });
660
- lines.push({
661
- text: ` className={\`fixed top-0 left-0 h-full w-80 bg-gray-900 text-white shadow-2xl z-50 transform transition-transform duration-300 ease-in-out flex flex-col \${`,
662
- integrationId: "base"
663
- });
664
- lines.push({
665
- text: ` isOpen ? 'translate-x-0' : '-translate-x-full'`,
666
- integrationId: "base"
667
- });
668
- lines.push({
669
- text: ` }\`}`,
670
- integrationId: "base"
671
- });
672
- lines.push({
673
- text: ` >`,
674
- integrationId: "base"
675
- });
676
- lines.push({
677
- text: ` <div className="flex items-center justify-between p-4 border-b border-gray-700">`,
678
- integrationId: "base"
679
- });
680
- lines.push({
681
- text: ` <h2 className="text-xl font-bold">Navigation</h2>`,
682
- integrationId: "base"
683
- });
684
- lines.push({
685
- text: ` <button`,
686
- integrationId: "base"
687
- });
688
- lines.push({
689
- text: ` onClick={() => setIsOpen(false)}`,
690
- integrationId: "base"
691
- });
692
- lines.push({
693
- text: ` className="p-2 hover:bg-gray-800 rounded-lg transition-colors"`,
694
- integrationId: "base"
695
- });
696
- lines.push({
697
- text: ` aria-label="Close menu"`,
698
- integrationId: "base"
699
- });
700
- lines.push({
701
- text: ` >`,
702
- integrationId: "base"
703
- });
704
- lines.push({
705
- text: ` <X size={24} />`,
706
- integrationId: "base"
707
- });
708
- lines.push({
709
- text: ` </button>`,
710
- integrationId: "base"
711
- });
712
- lines.push({
713
- text: ` </div>`,
714
- integrationId: "base"
715
- });
716
- lines.push({
717
- text: "",
718
- integrationId: "base"
719
- });
720
- lines.push({
721
- text: ` <nav className="flex-1 p-4 overflow-y-auto">`,
722
- integrationId: "base"
723
- });
724
- lines.push({
725
- text: ` <Link`,
726
- integrationId: "base"
727
- });
728
- lines.push({
729
- text: ` to="/"`,
730
- integrationId: "base"
731
- });
732
- lines.push({
733
- text: ` onClick={() => setIsOpen(false)}`,
734
- integrationId: "base"
735
- });
736
- lines.push({
737
- text: ` className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"`,
738
- integrationId: "base"
739
- });
740
- lines.push({
741
- text: ` activeProps={{`,
742
- integrationId: "base"
743
- });
744
- lines.push({
745
- text: ` className: 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',`,
746
- integrationId: "base"
747
- });
748
- lines.push({
749
- text: ` }}`,
750
- integrationId: "base"
751
- });
752
- lines.push({
753
- text: ` >`,
754
- integrationId: "base"
755
- });
756
- lines.push({
757
- text: ` <Home size={20} />`,
758
- integrationId: "base"
759
- });
760
- lines.push({
761
- text: ` <span className="font-medium">Home</span>`,
762
- integrationId: "base"
763
- });
764
- lines.push({
765
- text: ` </Link>`,
766
- integrationId: "base"
767
- });
768
- for (const route of routes) {
769
- const integrationId = options.chosenIntegrations.find((i) => i.routes?.some((r) => r.url === route.url))?.id || "base";
770
- lines.push({
771
- text: "",
772
- integrationId
773
- });
774
- lines.push({
775
- text: ` <Link`,
776
- integrationId
777
- });
778
- lines.push({
779
- text: ` to="${route.url}"`,
780
- integrationId
781
- });
782
- lines.push({
783
- text: ` onClick={() => setIsOpen(false)}`,
784
- integrationId
785
- });
786
- lines.push({
787
- text: ` className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"`,
788
- integrationId
789
- });
790
- lines.push({
791
- text: ` activeProps={{`,
792
- integrationId
793
- });
794
- lines.push({
795
- text: ` className: 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',`,
796
- integrationId
797
- });
798
- lines.push({
799
- text: ` }}`,
800
- integrationId
801
- });
802
- lines.push({
803
- text: ` >`,
804
- integrationId
805
- });
806
- lines.push({
807
- text: ` <${route.icon} size={20} />`,
808
- integrationId
809
- });
810
- lines.push({
811
- text: ` <span className="font-medium">${route.name}</span>`,
812
- integrationId
813
- });
814
- lines.push({
815
- text: ` </Link>`,
816
- integrationId
817
- });
818
- }
819
- lines.push({
820
- text: ` </nav>`,
821
- integrationId: "base"
822
- });
823
- lines.push({
824
- text: ` </aside>`,
825
- integrationId: "base"
826
- });
827
- lines.push({
828
- text: "",
829
- integrationId: "base"
830
- });
831
- lines.push({
832
- text: ` {isOpen && (`,
833
- integrationId: "base"
834
- });
835
- lines.push({
836
- text: ` <div`,
837
- integrationId: "base"
838
- });
839
- lines.push({
840
- text: ` className="fixed inset-0 bg-black/50 z-40"`,
841
- integrationId: "base"
842
- });
843
- lines.push({
844
- text: ` onClick={() => setIsOpen(false)}`,
845
- integrationId: "base"
846
- });
847
- lines.push({
848
- text: ` />`,
849
- integrationId: "base"
850
- });
851
- lines.push({
852
- text: ` )}`,
853
- integrationId: "base"
854
- });
855
- lines.push({
856
- text: ` </>`,
857
- integrationId: "base"
858
- });
859
- lines.push({
860
- text: ` )`,
861
- integrationId: "base"
862
- });
863
- lines.push({
864
- text: `}`,
865
- integrationId: "base"
866
- });
867
- return {
868
- content: lines.map((l) => l.text).join("\n"),
869
- lineAttributions: lines.map((l, i) => ({
870
- line: i + 1,
871
- integrationId: l.integrationId
872
- }))
873
- };
874
- }
875
- /**
876
- * Generate .gitignore content with line attribution
877
- */
878
- function generateGitignore(integrationPatterns) {
879
- const lines = [];
880
- lines.push({
881
- text: "# Dependencies",
882
- integrationId: "base"
883
- });
884
- lines.push({
885
- text: "node_modules/",
886
- integrationId: "base"
887
- });
888
- lines.push({
889
- text: ".pnpm-store/",
890
- integrationId: "base"
891
- });
892
- lines.push({
893
- text: "",
894
- integrationId: "base"
895
- });
896
- lines.push({
897
- text: "# Build outputs",
898
- integrationId: "base"
899
- });
900
- lines.push({
901
- text: "dist/",
902
- integrationId: "base"
903
- });
904
- lines.push({
905
- text: ".output/",
906
- integrationId: "base"
907
- });
908
- lines.push({
909
- text: ".vinxi/",
910
- integrationId: "base"
911
- });
912
- lines.push({
913
- text: ".vercel/",
914
- integrationId: "base"
915
- });
916
- lines.push({
917
- text: ".netlify/",
918
- integrationId: "base"
919
- });
920
- lines.push({
921
- text: "",
922
- integrationId: "base"
923
- });
924
- lines.push({
925
- text: "# Environment",
926
- integrationId: "base"
927
- });
928
- lines.push({
929
- text: ".env",
930
- integrationId: "base"
931
- });
932
- lines.push({
933
- text: ".env.*",
934
- integrationId: "base"
935
- });
936
- lines.push({
937
- text: "!.env.example",
938
- integrationId: "base"
939
- });
940
- lines.push({
941
- text: "",
942
- integrationId: "base"
943
- });
944
- lines.push({
945
- text: "# IDE",
946
- integrationId: "base"
947
- });
948
- lines.push({
949
- text: ".idea/",
950
- integrationId: "base"
951
- });
952
- lines.push({
953
- text: ".vscode/",
954
- integrationId: "base"
955
- });
956
- lines.push({
957
- text: "*.swp",
958
- integrationId: "base"
959
- });
960
- lines.push({
961
- text: "*.swo",
962
- integrationId: "base"
963
- });
964
- lines.push({
965
- text: "",
966
- integrationId: "base"
967
- });
968
- lines.push({
969
- text: "# OS",
970
- integrationId: "base"
971
- });
972
- lines.push({
973
- text: ".DS_Store",
974
- integrationId: "base"
975
- });
976
- lines.push({
977
- text: "Thumbs.db",
978
- integrationId: "base"
979
- });
980
- lines.push({
981
- text: "",
982
- integrationId: "base"
983
- });
984
- lines.push({
985
- text: "# Logs",
986
- integrationId: "base"
987
- });
988
- lines.push({
989
- text: "*.log",
990
- integrationId: "base"
991
- });
992
- lines.push({
993
- text: "npm-debug.log*",
994
- integrationId: "base"
995
- });
996
- lines.push({
997
- text: "pnpm-debug.log*",
998
- integrationId: "base"
999
- });
1000
- lines.push({
1001
- text: "",
1002
- integrationId: "base"
1003
- });
1004
- lines.push({
1005
- text: "# Generated",
1006
- integrationId: "base"
1007
- });
1008
- lines.push({
1009
- text: "src/routeTree.gen.ts",
1010
- integrationId: "base"
1011
- });
1012
- if (integrationPatterns.length > 0) {
1013
- lines.push({
1014
- text: "",
1015
- integrationId: "base"
1016
- });
1017
- lines.push({
1018
- text: "# Integration-specific",
1019
- integrationId: "base"
1020
- });
1021
- for (const { pattern, integrationId } of integrationPatterns) lines.push({
1022
- text: pattern,
1023
- integrationId
1024
- });
1025
- }
1026
- return {
1027
- content: lines.map((l) => l.text).join("\n"),
1028
- lineAttributions: lines.map((l, i) => ({
1029
- line: i + 1,
1030
- integrationId: l.integrationId
1031
- }))
1032
- };
1033
- }
1034
- /**
1035
- * Get base template files (static files without hook injection)
1036
- */
1037
- function getBaseFiles(options) {
1038
- const { projectName, typescript, tailwind, packageManager } = options;
1039
- const files = {};
1040
- const { vitePlugins, rootProviders, devtoolsPlugins, entryClientInits } = collectHooks(options);
1041
- if (typescript) files["tsconfig.json"] = JSON.stringify({
1042
- compilerOptions: {
1043
- target: "ES2022",
1044
- lib: [
1045
- "ES2022",
1046
- "DOM",
1047
- "DOM.Iterable"
1048
- ],
1049
- module: "ESNext",
1050
- skipLibCheck: true,
1051
- moduleResolution: "bundler",
1052
- allowImportingTsExtensions: true,
1053
- resolveJsonModule: true,
1054
- isolatedModules: true,
1055
- moduleDetection: "force",
1056
- noEmit: true,
1057
- jsx: "react-jsx",
1058
- strict: true,
1059
- noUnusedLocals: true,
1060
- noUnusedParameters: true,
1061
- noFallthroughCasesInSwitch: true,
1062
- noUncheckedIndexedAccess: true,
1063
- paths: { "~/*": ["./src/*"] }
1064
- },
1065
- include: ["src"]
1066
- }, null, 2);
1067
- files[typescript ? "vite.config.ts" : "vite.config.js"] = generateViteConfig(options, vitePlugins).content;
1068
- if (entryClientInits.length > 0) files[`src/entry-client.${typescript ? "tsx" : "jsx"}`] = generateEntryClient(options, entryClientInits).content;
1069
- files[`src/router.${typescript ? "tsx" : "jsx"}`] = `import { createRouter as createTanStackRouter } from '@tanstack/react-router'
1070
- import { routeTree } from './routeTree.gen'
1071
-
1072
- export function getRouter() {
1073
- const router = createTanStackRouter({
1074
- routeTree,
1075
- defaultPreload: 'intent',
1076
- scrollRestoration: true,
1077
- })
1078
-
1079
- return router
1080
- }
1081
-
1082
- declare module '@tanstack/react-router' {
1083
- interface Register {
1084
- router: ReturnType<typeof getRouter>
1085
- }
1086
- }
1087
- `;
1088
- files[`src/routes/__root.${typescript ? "tsx" : "jsx"}`] = generateRootRoute(options, rootProviders, devtoolsPlugins).content;
1089
- const hasHeader = options.chosenIntegrations.length > 0;
1090
- if (hasHeader && tailwind) files[`src/components/Header.${typescript ? "tsx" : "jsx"}`] = generateHeader(options).content;
1091
- const indexRouteWithHeader = `import { createFileRoute } from '@tanstack/react-router'
1092
-
1093
- export const Route = createFileRoute('/')({
1094
- component: Home,
1095
- })
1096
-
1097
- function Home() {
1098
- return (
1099
- <div className="min-h-[calc(100vh-72px)] bg-gradient-to-br from-gray-900 to-gray-800 flex items-center justify-center">
1100
- <div className="text-center px-4">
1101
- <img
1102
- src="/tanstack-logo-dark.svg"
1103
- alt="TanStack Logo"
1104
- className="h-24 mx-auto mb-8"
1105
- />
1106
- <h1 className="text-5xl font-bold text-white mb-4">
1107
- Welcome to TanStack Start
1108
- </h1>
1109
- <p className="text-xl text-gray-300 mb-8">
1110
- Full-stack React framework powered by TanStack Router
1111
- </p>
1112
- <div className="flex gap-4 justify-center flex-wrap">
1113
- <a
1114
- href="https://tanstack.com/start"
1115
- target="_blank"
1116
- rel="noopener noreferrer"
1117
- className="px-6 py-3 bg-cyan-500 text-white rounded-lg font-medium hover:bg-cyan-600 transition-colors"
1118
- >
1119
- Documentation
1120
- </a>
1121
- <a
1122
- href="https://github.com/tanstack/router"
1123
- target="_blank"
1124
- rel="noopener noreferrer"
1125
- className="px-6 py-3 bg-gray-700 text-white rounded-lg font-medium hover:bg-gray-600 transition-colors"
1126
- >
1127
- GitHub
1128
- </a>
1129
- </div>
1130
- </div>
1131
- </div>
1132
- )
1133
- }
1134
- `;
1135
- const indexRouteNoHeader = `import { createFileRoute } from '@tanstack/react-router'
1136
-
1137
- export const Route = createFileRoute('/')({
1138
- component: Home,
1139
- })
1140
-
1141
- function Home() {
1142
- return (
1143
- <div className="min-h-screen bg-gradient-to-br from-gray-900 to-gray-800 flex items-center justify-center">
1144
- <div className="text-center px-4">
1145
- <img
1146
- src="/tanstack-logo-dark.svg"
1147
- alt="TanStack Logo"
1148
- className="h-24 mx-auto mb-8"
1149
- />
1150
- <h1 className="text-5xl font-bold text-white mb-4">
1151
- Welcome to TanStack Start
1152
- </h1>
1153
- <p className="text-xl text-gray-300 mb-8">
1154
- Full-stack React framework powered by TanStack Router
1155
- </p>
1156
- <div className="flex gap-4 justify-center flex-wrap">
1157
- <a
1158
- href="https://tanstack.com/start"
1159
- target="_blank"
1160
- rel="noopener noreferrer"
1161
- className="px-6 py-3 bg-cyan-500 text-white rounded-lg font-medium hover:bg-cyan-600 transition-colors"
1162
- >
1163
- Documentation
1164
- </a>
1165
- <a
1166
- href="https://github.com/tanstack/router"
1167
- target="_blank"
1168
- rel="noopener noreferrer"
1169
- className="px-6 py-3 bg-gray-700 text-white rounded-lg font-medium hover:bg-gray-600 transition-colors"
1170
- >
1171
- GitHub
1172
- </a>
1173
- </div>
1174
- </div>
1175
- </div>
1176
- )
1177
- }
1178
- `;
1179
- const indexRouteNoTailwind = `import { createFileRoute } from '@tanstack/react-router'
1180
-
1181
- export const Route = createFileRoute('/')({
1182
- component: Home,
1183
- })
1184
-
1185
- function Home() {
1186
- return (
1187
- <div style={styles.container}>
1188
- <div style={styles.content}>
1189
- <img
1190
- src="/tanstack-logo-dark.svg"
1191
- alt="TanStack Logo"
1192
- style={styles.logo}
1193
- />
1194
- <h1 style={styles.title}>Welcome to TanStack Start</h1>
1195
- <p style={styles.subtitle}>
1196
- Full-stack React framework powered by TanStack Router
1197
- </p>
1198
- <div style={styles.buttons}>
1199
- <a
1200
- href="https://tanstack.com/start"
1201
- target="_blank"
1202
- rel="noopener noreferrer"
1203
- style={styles.primaryButton}
1204
- >
1205
- Documentation
1206
- </a>
1207
- <a
1208
- href="https://github.com/tanstack/router"
1209
- target="_blank"
1210
- rel="noopener noreferrer"
1211
- style={styles.secondaryButton}
1212
- >
1213
- GitHub
1214
- </a>
1215
- </div>
1216
- </div>
1217
- </div>
1218
- )
1219
- }
1220
-
1221
- const styles = {
1222
- container: {
1223
- minHeight: '100vh',
1224
- background: 'linear-gradient(to bottom right, #111827, #1f2937)',
1225
- display: 'flex',
1226
- alignItems: 'center',
1227
- justifyContent: 'center',
1228
- },
1229
- content: {
1230
- textAlign: 'center' as const,
1231
- padding: '0 1rem',
1232
- },
1233
- logo: {
1234
- height: '6rem',
1235
- marginBottom: '2rem',
1236
- },
1237
- title: {
1238
- fontSize: '3rem',
1239
- fontWeight: 'bold',
1240
- color: 'white',
1241
- marginBottom: '1rem',
1242
- },
1243
- subtitle: {
1244
- fontSize: '1.25rem',
1245
- color: '#d1d5db',
1246
- marginBottom: '2rem',
1247
- },
1248
- buttons: {
1249
- display: 'flex',
1250
- gap: '1rem',
1251
- justifyContent: 'center',
1252
- flexWrap: 'wrap' as const,
1253
- },
1254
- primaryButton: {
1255
- padding: '0.75rem 1.5rem',
1256
- backgroundColor: '#06b6d4',
1257
- color: 'white',
1258
- borderRadius: '0.5rem',
1259
- fontWeight: 500,
1260
- textDecoration: 'none',
1261
- },
1262
- secondaryButton: {
1263
- padding: '0.75rem 1.5rem',
1264
- backgroundColor: '#374151',
1265
- color: 'white',
1266
- borderRadius: '0.5rem',
1267
- fontWeight: 500,
1268
- textDecoration: 'none',
1269
- },
1270
- }
1271
- `;
1272
- if (tailwind) files[`src/routes/index.${typescript ? "tsx" : "jsx"}`] = hasHeader ? indexRouteWithHeader : indexRouteNoHeader;
1273
- else files[`src/routes/index.${typescript ? "tsx" : "jsx"}`] = indexRouteNoTailwind;
1274
- if (tailwind) files["src/styles.css"] = `@import 'tailwindcss';
1275
-
1276
- body {
1277
- @apply m-0;
1278
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
1279
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
1280
- sans-serif;
1281
- -webkit-font-smoothing: antialiased;
1282
- -moz-osx-font-smoothing: grayscale;
1283
- }
1284
-
1285
- code {
1286
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1287
- monospace;
1288
- }
1289
- `;
1290
- else files["src/styles.css"] = `* {
1291
- box-sizing: border-box;
1292
- margin: 0;
1293
- padding: 0;
1294
- }
1295
-
1296
- body {
1297
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
1298
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
1299
- sans-serif;
1300
- -webkit-font-smoothing: antialiased;
1301
- -moz-osx-font-smoothing: grayscale;
1302
- line-height: 1.5;
1303
- }
1304
-
1305
- code {
1306
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1307
- monospace;
1308
- }
1309
- `;
1310
- files["public/tanstack-logo-light.svg"] = `<svg height="660" viewBox="0 0 663 660" width="663" xmlns="http://www.w3.org/2000/svg"><path d="m305.114318.62443771c8.717817-1.14462121 17.926803-.36545135 26.712694-.36545135 32.548987 0 64.505987 5.05339923 95.64868 14.63098274 39.74418 12.2236582 76.762804 31.7666864 109.435876 57.477568 40.046637 31.5132839 73.228974 72.8472109 94.520714 119.2362609 39.836383 86.790386 39.544267 191.973146-1.268422 278.398081-26.388695 55.880442-68.724007 102.650458-119.964986 136.75724-41.808813 27.828603-90.706831 44.862601-140.45707 50.89341-63.325458 7.677926-131.784923-3.541603-188.712259-32.729444-106.868873-54.795293-179.52309291-165.076271-180.9604082-285.932068-.27660564-23.300971.08616998-46.74071 4.69884909-69.814998 7.51316071-37.57857 20.61272131-73.903917 40.28618971-106.877282 21.2814003-35.670293 48.7704861-67.1473767 81.6882804-92.5255597 38.602429-29.7610135 83.467691-51.1674988 130.978372-62.05777669 11.473831-2.62966514 22.9946-4.0869914 34.57273-5.4964306l3.658171-.44480576c3.050084-.37153079 6.104217-.74794222 9.162589-1.14972654zm-110.555861 549.44131429c-14.716752 1.577863-30.238964 4.25635-42.869928 12.522173 2.84343.683658 6.102369.004954 9.068638 0 7.124652-.011559 14.317732-.279903 21.434964.032202 17.817402.781913 36.381729 3.63214 53.58741 8.350042 22.029372 6.040631 41.432961 17.928687 62.656049 25.945156 22.389644 8.456554 44.67706 11.084675 68.427 11.084675 11.96813 0 23.845573-.035504 35.450133-3.302696-6.056202-3.225083-14.72582-2.619864-21.434964-3.963236-14.556814-2.915455-28.868774-6.474936-42.869928-11.470264-10.304996-3.676672-20.230803-8.214291-30.11097-12.848661l-6.348531-2.985046c-9.1705-4.309263-18.363277-8.560752-27.845391-12.142608-24.932161-9.418465-52.560181-14.071964-79.144482-11.221737zm22.259385-62.614168c-29.163917 0-58.660076 5.137344-84.915434 18.369597-6.361238 3.206092-12.407546 7.02566-18.137277 11.258891-1.746125 1.290529-4.841829 2.948483-5.487351 5.191839-.654591 2.275558 1.685942 4.182039 3.014086 5.637703 6.562396-3.497556 12.797498-7.199878 19.78612-9.855246 45.19892-17.169893 99.992458-13.570779 145.098218 2.172348 22.494346 7.851335 43.219483 19.592421 65.129314 28.800338 24.503461 10.297807 49.53043 16.975034 75.846795 20.399104 31.04195 4.037546 66.433549.7654 94.808495-13.242161 9.970556-4.921843 23.814245-12.422267 28.030337-23.320339-5.207047.454947-9.892236 2.685918-14.83959 4.224149-7.866632 2.445646-15.827248 4.51974-23.908229 6.138887-27.388113 5.486604-56.512458 6.619429-84.091013 1.639788-25.991939-4.693152-50.142596-14.119246-74.179513-24.03502l-3.068058-1.268177c-2.045137-.846788-4.089983-1.695816-6.135603-2.544467l-3.069142-1.272366c-12.279956-5.085721-24.606928-10.110797-37.210937-14.51024-24.485325-8.546552-50.726667-13.784628-76.671218-13.784628zm51.114145-447.9909432c-34.959602 7.7225298-66.276908 22.7605319-96.457338 41.7180089-17.521434 11.0054099-34.281927 22.2799893-49.465301 36.4444283-22.5792616 21.065423-39.8360564 46.668751-54.8866988 73.411509-15.507372 27.55357-25.4498976 59.665686-30.2554517 90.824149-4.7140432 30.568106-5.4906485 62.70747-.0906864 93.301172 6.7503648 38.248526 19.5989769 74.140579 39.8896436 107.337631 6.8187918-3.184625 11.659796-10.445603 17.3128555-15.336896 11.4149428-9.875888 23.3995608-19.029311 36.2745548-26.928535 4.765981-2.923712 9.662222-5.194315 14.83959-7.275014 1.953055-.785216 5.14604-1.502727 6.06527-3.647828 1.460876-3.406732-1.240754-9.335897-1.704904-12.865654-1.324845-10.095517-2.124534-20.362774-1.874735-30.549941.725492-29.668947 6.269727-59.751557 16.825623-87.521453 7.954845-20.924233 20.10682-39.922168 34.502872-56.971512 4.884699-5.785498 10.077731-11.170545 15.437296-16.512656 3.167428-3.157378 7.098271-5.858983 9.068639-9.908915-10.336599.006606-20.674847 2.987289-30.503603 6.013385-21.174447 6.519522-41.801477 16.19312-59.358362 29.841512-8.008432 6.226409-13.873368 14.387371-21.44733 20.939921-2.32322 2.010516-6.484901 4.704691-9.695199 3.187928-4.8500728-2.29042-4.1014979-11.835213-4.6571581-16.222019-2.1369011-16.873476 4.2548401-38.216325 12.3778671-52.843142 13.039878-23.479694 37.150915-43.528712 65.467327-42.82854 12.228647.302197 22.934587 4.551115 34.625711 7.324555-2.964621-4.211764-6.939158-7.28162-10.717482-10.733763-9.257431-8.459031-19.382979-16.184864-30.503603-22.028985-4.474136-2.350694-9.291232-3.77911-14.015169-5.506421-2.375159-.867783-5.36616-2.062533-6.259834-4.702213-1.654614-4.888817 7.148561-9.416813 10.381943-11.478522 12.499882-7.969406 27.826705-14.525258 42.869928-14.894334 23.509209-.577147 46.479246 12.467678 56.162903 34.665926 3.404469 7.803171 4.411273 16.054969 5.079109 24.382907l.121749 1.56229.174325 2.345587c.01913.260708.038244.521433.057403.782164l.11601 1.56437.120128 1.563971c7.38352-6.019164 12.576553-14.876995 19.78612-21.323859 16.861073-15.07846 39.936636-21.7722 61.831627-14.984333 19.786945 6.133107 36.984382 19.788105 47.105807 37.959541 2.648042 4.754231 10.035685 16.373942 4.698379 21.109183-4.177345 3.707277-9.475079.818243-13.880788-.719162-3.33605-1.16376-6.782939-1.90214-10.241828-2.585698l-1.887262-.369639c-.629089-.122886-1.257979-.246187-1.886079-.372129-11.980496-2.401886-25.91652-2.152533-37.923398-.041284-7.762754 1.364839-15.349083 4.127545-23.083807 5.271929v1.651348c21.149714.175043 41.608563 12.240618 52.043268 30.549941 4.323267 7.585468 6.482428 16.267431 8.138691 24.770223 2.047864 10.50918.608423 21.958802-2.263037 32.201289-.962925 3.433979-2.710699 9.255807-6.817143 10.046802-2.902789.558982-5.36781-2.330878-7.024898-4.279468-4.343878-5.10762-8.475879-9.96341-13.573278-14.374161-12.895604-11.157333-26.530715-21.449361-40.396663-31.373138-7.362086-5.269452-15.425755-12.12007-23.908229-15.340199 2.385052 5.745041 4.721463 11.086326 5.532694 17.339156 2.385876 18.392716-5.314223 35.704625-16.87179 49.540445-3.526876 4.222498-7.29943 8.475545-11.744712 11.755948-1.843407 1.360711-4.156734 3.137561-6.595373 2.752797-7.645687-1.207961-8.555849-12.73272-9.728176-18.637115-3.970415-19.998652-2.375984-39.861068 3.132802-59.448534-4.901187 2.485279-8.443727 7.923994-11.521293 12.385111-6.770975 9.816439-12.645804 20.199291-16.858599 31.375615-16.777806 44.519521-16.616219 96.664142 5.118834 139.523233 2.427098 4.786433 6.110614 4.144058 10.894733 4.144058.720854 0 1.44257-.004515 2.164851-.010924l2.168232-.022283c4.338648-.045438 8.686803-.064635 12.979772.508795 2.227588.297243 5.320818.032202 7.084256 1.673642 2.111344 1.966755.986008 5.338808.4996 7.758859-1.358647 6.765574-1.812904 12.914369-1.812904 19.816178 9.02412-1.398692 11.525415-15.866153 14.724172-23.118874 3.624982-8.216283 7.313444-16.440823 10.667192-24.770223 1.648843-4.093692 3.854171-8.671229 3.275427-13.210785-.649644-5.10184-4.335633-10.510831-6.904531-14.862134-4.86244-8.234447-10.389363-16.70834-13.969002-25.595896-2.861567-7.104926-.197036-15.983399 7.871579-18.521521 4.450228-1.400344 9.198073 1.345848 12.094266 4.562675 6.07269 6.74328 9.992815 16.777697 14.401823 24.692609l34.394873 61.925556c2.920926 5.243856 5.848447 10.481933 8.836976 15.687808 1.165732 2.031158 2.352075 5.167068 4.740424 6.0332 2.127008.77118 5.033095-.325315 7.148561-.748886 5.492297-1.099798 10.97635-2.287117 16.488434-3.28288 6.605266-1.193099 16.673928-.969342 21.434964-6.129805-6.963066-2.205375-15.011895-2.074919-22.259386-1.577863-4.352947.298894-9.178287 1.856116-13.178381-.686135-5.953149-3.783239-9.910373-12.522173-13.552668-18.377854-8.980425-14.439388-17.441465-29.095929-26.041008-43.760726l-1.376261-2.335014-2.765943-4.665258c-1.380597-2.334387-2.750786-4.67476-4.079753-7.036188-1.02723-1.826391-2.549937-4.233231-1.078344-6.24705 1.545791-2.114476 4.91472-2.239146 7.956473-2.243117l.603351.000261c1.195428.001526 2.315572.002427 3.222811-.11692 12.27399-1.615019 24.718635-2.952611 37.098976-2.952611-.963749-3.352237-3.719791-7.141255-2.838484-10.73046 1.972017-8.030506 13.526287-10.543033 18.899867-4.780653 3.60767 3.868283 5.704174 9.192229 8.051303 13.859765 3.097352 6.162006 6.624228 12.118418 9.940876 18.16483 5.805578 10.585967 12.146205 20.881297 18.116667 31.375615.49237.865561.999687 1.726685 1.512269 2.587098l.771613 1.290552c2.577138 4.303168 5.164895 8.635123 6.553094 13.461506-20.735854-.9487-36.30176-25.018751-45.343193-41.283704-.721369 2.604176.450959 4.928448 1.388326 7.431066 1.948109 5.197619 4.276275 10.147535 7.20627 14.862134 4.184765 6.732546 8.982075 13.665732 15.313633 18.553722 11.236043 8.673707 26.05255 8.721596 39.572241 7.794364 8.669619-.595311 19.50252-4.542034 28.030338-1.864372 8.513803 2.673532 11.940924 12.063098 6.884745 19.276187-3.787393 5.403211-8.842747 7.443452-15.128962 8.257566 4.445282 9.53571 10.268996 18.385285 14.490036 28.072919 1.758491 4.035895 3.59118 10.22102 7.8048 12.350433 2.805507 1.416857 6.824562.09743 9.85761.034678-3.043765-8.053625-8.742992-14.887729-11.541904-23.118874 8.533589.390544 16.786875 4.843404 24.732651 7.685374 15.630376 5.590144 31.063836 11.701854 46.475333 17.86913l7.112077 2.848685c6.338978 2.538947 12.71588 5.052299 18.961699 7.812528 2.285297 1.009799 5.449427 3.370401 7.975455 1.917215 2.061054-1.186494 3.394144-4.015253 4.665403-5.931643 3.55573-5.361927 6.775921-10.928622 9.965609-16.513481 12.774414-22.36586 22.143967-46.872692 28.402976-71.833646 20.645168-82.323009 2.934117-173.156241-46.677107-241.922507-19.061454-26.420745-43.033164-49.262193-69.46165-68.1783861-66.13923-47.336721-152.911262-66.294198-232.486917-48.7172481zm135.205158 410.5292842c-17.532977 4.570931-35.601827 8.714164-53.58741 11.040088 2.365265 8.052799 8.145286 15.885969 12.376218 23.118874 1.635653 2.796558 3.3859 6.541816 6.618457 7.755557 3.651364 1.370619 8.063669-.853747 11.508927-1.975838-1.595256-4.364513-4.279573-8.292245-6.476657-12.385112-.905215-1.687677-2.305907-3.685809-1.559805-5.68972 1.410585-3.786541 7.266452-3.563609 10.509727-4.221671 8.54678-1.733916 17.004522-3.898008 25.557073-5.611281 3.150939-.631641 7.538512-2.342438 10.705115-1.285575 2.371037.791232 3.800147 2.744743 5.152304 4.781948l.606196.918752c.80912 1.222827 1.637246 2.41754 2.671212 3.351165 3.457625 3.121874 8.628398 3.60159 13.017619 4.453686-2.678546-6.027421-7.130424-11.301001-9.984571-17.339156-1.659561-3.511592-3.023155-8.677834-6.656381-10.707341-5.005064-2.795733-15.341663 2.461334-20.458024 3.795624zm-110.472507-40.151706c-.825246 10.467897-4.036369 18.984725-9.068639 28.072919 5.76683.729896 11.649079.989984 17.312856 2.39363 4.244947 1.051908 8.156828 3.058296 12.366325 4.211763-2.250671-6.157877-6.426367-11.651913-9.661398-17.339156-3.266358-5.740912-6.189758-12.717032-10.949144-17.339156z" fill="#fff" transform="translate(.9778)"/></svg>`;
1311
- files["public/tanstack-logo-dark.svg"] = `<svg height="660" viewBox="0 0 663 660" width="663" xmlns="http://www.w3.org/2000/svg"><path d="m305.114318.62443771c8.717817-1.14462121 17.926803-.36545135 26.712694-.36545135 32.548987 0 64.505987 5.05339923 95.64868 14.63098274 39.74418 12.2236582 76.762804 31.7666864 109.435876 57.477568 40.046637 31.5132839 73.228974 72.8472109 94.520714 119.2362609 39.836383 86.790386 39.544267 191.973146-1.268422 278.398081-26.388695 55.880442-68.724007 102.650458-119.964986 136.75724-41.808813 27.828603-90.706831 44.862601-140.45707 50.89341-63.325458 7.677926-131.784923-3.541603-188.712259-32.729444-106.868873-54.795293-179.52309291-165.076271-180.9604082-285.932068-.27660564-23.300971.08616998-46.74071 4.69884909-69.814998 7.51316071-37.57857 20.61272131-73.903917 40.28618971-106.877282 21.2814003-35.670293 48.7704861-67.1473767 81.6882804-92.5255597 38.602429-29.7610135 83.467691-51.1674988 130.978372-62.05777669 11.473831-2.62966514 22.9946-4.0869914 34.57273-5.4964306l3.658171-.44480576c3.050084-.37153079 6.104217-.74794222 9.162589-1.14972654zm-110.555861 549.44131429c-14.716752 1.577863-30.238964 4.25635-42.869928 12.522173 2.84343.683658 6.102369.004954 9.068638 0 7.124652-.011559 14.317732-.279903 21.434964.032202 17.817402.781913 36.381729 3.63214 53.58741 8.350042 22.029372 6.040631 41.432961 17.928687 62.656049 25.945156 22.389644 8.456554 44.67706 11.084675 68.427 11.084675 11.96813 0 23.845573-.035504 35.450133-3.302696-6.056202-3.225083-14.72582-2.619864-21.434964-3.963236-14.556814-2.915455-28.868774-6.474936-42.869928-11.470264-10.304996-3.676672-20.230803-8.214291-30.11097-12.848661l-6.348531-2.985046c-9.1705-4.309263-18.363277-8.560752-27.845391-12.142608-24.932161-9.418465-52.560181-14.071964-79.144482-11.221737zm22.259385-62.614168c-29.163917 0-58.660076 5.137344-84.915434 18.369597-6.361238 3.206092-12.407546 7.02566-18.137277 11.258891-1.746125 1.290529-4.841829 2.948483-5.487351 5.191839-.654591 2.275558 1.685942 4.182039 3.014086 5.637703 6.562396-3.497556 12.797498-7.199878 19.78612-9.855246 45.19892-17.169893 99.992458-13.570779 145.098218 2.172348 22.494346 7.851335 43.219483 19.592421 65.129314 28.800338 24.503461 10.297807 49.53043 16.975034 75.846795 20.399104 31.04195 4.037546 66.433549.7654 94.808495-13.242161 9.970556-4.921843 23.814245-12.422267 28.030337-23.320339-5.207047.454947-9.892236 2.685918-14.83959 4.224149-7.866632 2.445646-15.827248 4.51974-23.908229 6.138887-27.388113 5.486604-56.512458 6.619429-84.091013 1.639788-25.991939-4.693152-50.142596-14.119246-74.179513-24.03502l-3.068058-1.268177c-2.045137-.846788-4.089983-1.695816-6.135603-2.544467l-3.069142-1.272366c-12.279956-5.085721-24.606928-10.110797-37.210937-14.51024-24.485325-8.546552-50.726667-13.784628-76.671218-13.784628zm51.114145-447.9909432c-34.959602 7.7225298-66.276908 22.7605319-96.457338 41.7180089-17.521434 11.0054099-34.281927 22.2799893-49.465301 36.4444283-22.5792616 21.065423-39.8360564 46.668751-54.8866988 73.411509-15.507372 27.55357-25.4498976 59.665686-30.2554517 90.824149-4.7140432 30.568106-5.4906485 62.70747-.0906864 93.301172 6.7503648 38.248526 19.5989769 74.140579 39.8896436 107.337631 6.8187918-3.184625 11.659796-10.445603 17.3128555-15.336896 11.4149428-9.875888 23.3995608-19.029311 36.2745548-26.928535 4.765981-2.923712 9.662222-5.194315 14.83959-7.275014 1.953055-.785216 5.14604-1.502727 6.06527-3.647828 1.460876-3.406732-1.240754-9.335897-1.704904-12.865654-1.324845-10.095517-2.124534-20.362774-1.874735-30.549941.725492-29.668947 6.269727-59.751557 16.825623-87.521453 7.954845-20.924233 20.10682-39.922168 34.502872-56.971512 4.884699-5.785498 10.077731-11.170545 15.437296-16.512656 3.167428-3.157378 7.098271-5.858983 9.068639-9.908915-10.336599.006606-20.674847 2.987289-30.503603 6.013385-21.174447 6.519522-41.801477 16.19312-59.358362 29.841512-8.008432 6.226409-13.873368 14.387371-21.44733 20.939921-2.32322 2.010516-6.484901 4.704691-9.695199 3.187928-4.8500728-2.29042-4.1014979-11.835213-4.6571581-16.222019-2.1369011-16.873476 4.2548401-38.216325 12.3778671-52.843142 13.039878-23.479694 37.150915-43.528712 65.467327-42.82854 12.228647.302197 22.934587 4.551115 34.625711 7.324555-2.964621-4.211764-6.939158-7.28162-10.717482-10.733763-9.257431-8.459031-19.382979-16.184864-30.503603-22.028985-4.474136-2.350694-9.291232-3.77911-14.015169-5.506421-2.375159-.867783-5.36616-2.062533-6.259834-4.702213-1.654614-4.888817 7.148561-9.416813 10.381943-11.478522 12.499882-7.969406 27.826705-14.525258 42.869928-14.894334 23.509209-.577147 46.479246 12.467678 56.162903 34.665926 3.404469 7.803171 4.411273 16.054969 5.079109 24.382907l.121749 1.56229.174325 2.345587c.01913.260708.038244.521433.057403.782164l.11601 1.56437.120128 1.563971c7.38352-6.019164 12.576553-14.876995 19.78612-21.323859 16.861073-15.07846 39.936636-21.7722 61.831627-14.984333 19.786945 6.133107 36.984382 19.788105 47.105807 37.959541 2.648042 4.754231 10.035685 16.373942 4.698379 21.109183-4.177345 3.707277-9.475079.818243-13.880788-.719162-3.33605-1.16376-6.782939-1.90214-10.241828-2.585698l-1.887262-.369639c-.629089-.122886-1.257979-.246187-1.886079-.372129-11.980496-2.401886-25.91652-2.152533-37.923398-.041284-7.762754 1.364839-15.349083 4.127545-23.083807 5.271929v1.651348c21.149714.175043 41.608563 12.240618 52.043268 30.549941 4.323267 7.585468 6.482428 16.267431 8.138691 24.770223 2.047864 10.50918.608423 21.958802-2.263037 32.201289-.962925 3.433979-2.710699 9.255807-6.817143 10.046802-2.902789.558982-5.36781-2.330878-7.024898-4.279468-4.343878-5.10762-8.475879-9.96341-13.573278-14.374161-12.895604-11.157333-26.530715-21.449361-40.396663-31.373138-7.362086-5.269452-15.425755-12.12007-23.908229-15.340199 2.385052 5.745041 4.721463 11.086326 5.532694 17.339156 2.385876 18.392716-5.314223 35.704625-16.87179 49.540445-3.526876 4.222498-7.29943 8.475545-11.744712 11.755948-1.843407 1.360711-4.156734 3.137561-6.595373 2.752797-7.645687-1.207961-8.555849-12.73272-9.728176-18.637115-3.970415-19.998652-2.375984-39.861068 3.132802-59.448534-4.901187 2.485279-8.443727 7.923994-11.521293 12.385111-6.770975 9.816439-12.645804 20.199291-16.858599 31.375615-16.777806 44.519521-16.616219 96.664142 5.118834 139.523233 2.427098 4.786433 6.110614 4.144058 10.894733 4.144058.720854 0 1.44257-.004515 2.164851-.010924l2.168232-.022283c4.338648-.045438 8.686803-.064635 12.979772.508795 2.227588.297243 5.320818.032202 7.084256 1.673642 2.111344 1.966755.986008 5.338808.4996 7.758859-1.358647 6.765574-1.812904 12.914369-1.812904 19.816178 9.02412-1.398692 11.525415-15.866153 14.724172-23.118874 3.624982-8.216283 7.313444-16.440823 10.667192-24.770223 1.648843-4.093692 3.854171-8.671229 3.275427-13.210785-.649644-5.10184-4.335633-10.510831-6.904531-14.862134-4.86244-8.234447-10.389363-16.70834-13.969002-25.595896-2.861567-7.104926-.197036-15.983399 7.871579-18.521521 4.450228-1.400344 9.198073 1.345848 12.094266 4.562675 6.07269 6.74328 9.992815 16.777697 14.401823 24.692609l34.394873 61.925556c2.920926 5.243856 5.848447 10.481933 8.836976 15.687808 1.165732 2.031158 2.352075 5.167068 4.740424 6.0332 2.127008.77118 5.033095-.325315 7.148561-.748886 5.492297-1.099798 10.97635-2.287117 16.488434-3.28288 6.605266-1.193099 16.673928-.969342 21.434964-6.129805-6.963066-2.205375-15.011895-2.074919-22.259386-1.577863-4.352947.298894-9.178287 1.856116-13.178381-.686135-5.953149-3.783239-9.910373-12.522173-13.552668-18.377854-8.980425-14.439388-17.441465-29.095929-26.041008-43.760726l-1.376261-2.335014-2.765943-4.665258c-1.380597-2.334387-2.750786-4.67476-4.079753-7.036188-1.02723-1.826391-2.549937-4.233231-1.078344-6.24705 1.545791-2.114476 4.91472-2.239146 7.956473-2.243117l.603351.000261c1.195428.001526 2.315572.002427 3.222811-.11692 12.27399-1.615019 24.718635-2.952611 37.098976-2.952611-.963749-3.352237-3.719791-7.141255-2.838484-10.73046 1.972017-8.030506 13.526287-10.543033 18.899867-4.780653 3.60767 3.868283 5.704174 9.192229 8.051303 13.859765 3.097352 6.162006 6.624228 12.118418 9.940876 18.16483 5.805578 10.585967 12.146205 20.881297 18.116667 31.375615.49237.865561.999687 1.726685 1.512269 2.587098l.771613 1.290552c2.577138 4.303168 5.164895 8.635123 6.553094 13.461506-20.735854-.9487-36.30176-25.018751-45.343193-41.283704-.721369 2.604176.450959 4.928448 1.388326 7.431066 1.948109 5.197619 4.276275 10.147535 7.20627 14.862134 4.184765 6.732546 8.982075 13.665732 15.313633 18.553722 11.236043 8.673707 26.05255 8.721596 39.572241 7.794364 8.669619-.595311 19.50252-4.542034 28.030338-1.864372 8.513803 2.673532 11.940924 12.063098 6.884745 19.276187-3.787393 5.403211-8.842747 7.443452-15.128962 8.257566 4.445282 9.53571 10.268996 18.385285 14.490036 28.072919 1.758491 4.035895 3.59118 10.22102 7.8048 12.350433 2.805507 1.416857 6.824562.09743 9.85761.034678-3.043765-8.053625-8.742992-14.887729-11.541904-23.118874 8.533589.390544 16.786875 4.843404 24.732651 7.685374 15.630376 5.590144 31.063836 11.701854 46.475333 17.86913l7.112077 2.848685c6.338978 2.538947 12.71588 5.052299 18.961699 7.812528 2.285297 1.009799 5.449427 3.370401 7.975455 1.917215 2.061054-1.186494 3.394144-4.015253 4.665403-5.931643 3.55573-5.361927 6.775921-10.928622 9.965609-16.513481 12.774414-22.36586 22.143967-46.872692 28.402976-71.833646 20.645168-82.323009 2.934117-173.156241-46.677107-241.922507-19.061454-26.420745-43.033164-49.262193-69.46165-68.1783861-66.13923-47.336721-152.911262-66.294198-232.486917-48.7172481zm135.205158 410.5292842c-17.532977 4.570931-35.601827 8.714164-53.58741 11.040088 2.365265 8.052799 8.145286 15.885969 12.376218 23.118874 1.635653 2.796558 3.3859 6.541816 6.618457 7.755557 3.651364 1.370619 8.063669-.853747 11.508927-1.975838-1.595256-4.364513-4.279573-8.292245-6.476657-12.385112-.905215-1.687677-2.305907-3.685809-1.559805-5.68972 1.410585-3.786541 7.266452-3.563609 10.509727-4.221671 8.54678-1.733916 17.004522-3.898008 25.557073-5.611281 3.150939-.631641 7.538512-2.342438 10.705115-1.285575 2.371037.791232 3.800147 2.744743 5.152304 4.781948l.606196.918752c.80912 1.222827 1.637246 2.41754 2.671212 3.351165 3.457625 3.121874 8.628398 3.60159 13.017619 4.453686-2.678546-6.027421-7.130424-11.301001-9.984571-17.339156-1.659561-3.511592-3.023155-8.677834-6.656381-10.707341-5.005064-2.795733-15.341663 2.461334-20.458024 3.795624zm-110.472507-40.151706c-.825246 10.467897-4.036369 18.984725-9.068639 28.072919 5.76683.729896 11.649079.989984 17.312856 2.39363 4.244947 1.051908 8.156828 3.058296 12.366325 4.211763-2.250671-6.157877-6.426367-11.651913-9.661398-17.339156-3.266358-5.740912-6.189758-12.717032-10.949144-17.339156z" fill="#1f2937" transform="translate(.9778)"/></svg>`;
1312
- const gitignorePatterns = [];
1313
- for (const integration of options.chosenIntegrations) if (integration.gitignorePatterns) for (const pattern of integration.gitignorePatterns) gitignorePatterns.push({
1314
- pattern,
1315
- integrationId: integration.id
1316
- });
1317
- files[".gitignore"] = generateGitignore(gitignorePatterns).content;
1318
- files[".env.example"] = `# Add your environment variables here
1319
- # Copy this file to .env.local and fill in your values
1320
-
1321
- # Example:
1322
- # DATABASE_URL=postgresql://user:password@localhost:5432/db
1323
- `;
1324
- files["README.md"] = `# ${projectName}
1325
-
1326
- A full-stack React application built with [TanStack Start](https://tanstack.com/start).
1327
-
1328
- ## Getting Started
1329
-
1330
- \`\`\`bash
1331
- # Install dependencies
1332
- ${packageManager} install
1333
-
1334
- # Start development server
1335
- ${packageManager}${packageManager === "npm" ? " run" : ""} dev
1336
- \`\`\`
1337
-
1338
- ## Scripts
1339
-
1340
- - \`dev\` - Start development server
1341
- - \`build\` - Build for production
1342
- - \`start\` - Start production server
1343
-
1344
- ## Learn More
1345
-
1346
- - [TanStack Start Documentation](https://tanstack.com/start)
1347
- - [TanStack Router Documentation](https://tanstack.com/router)
1348
- `;
1349
- files[".nvmrc"] = "22.12.0";
1350
- return files;
1351
- }
1352
- /**
1353
- * Get base files WITH line-by-line attribution for files that have hooks
1354
- */
1355
- function getBaseFilesWithAttribution(options) {
1356
- const { typescript } = options;
1357
- const files = getBaseFiles(options);
1358
- const attributions = {};
1359
- const { vitePlugins, rootProviders, devtoolsPlugins, entryClientInits } = collectHooks(options);
1360
- attributions[typescript ? "vite.config.ts" : "vite.config.js"] = generateViteConfig(options, vitePlugins).lineAttributions;
1361
- if (entryClientInits.length > 0) attributions[`src/entry-client.${typescript ? "tsx" : "jsx"}`] = generateEntryClient(options, entryClientInits).lineAttributions;
1362
- attributions[`src/routes/__root.${typescript ? "tsx" : "jsx"}`] = generateRootRoute(options, rootProviders, devtoolsPlugins).lineAttributions;
1363
- const gitignorePatterns = [];
1364
- for (const integration of options.chosenIntegrations) if (integration.gitignorePatterns) for (const pattern of integration.gitignorePatterns) gitignorePatterns.push({
1365
- pattern,
1366
- integrationId: integration.id
1367
- });
1368
- attributions[".gitignore"] = generateGitignore(gitignorePatterns).lineAttributions;
1369
- return {
1370
- files,
1371
- attributions
1372
- };
1373
- }
1374
-
1375
- //#endregion
1376
- //#region src/engine/compile.ts
1377
- /**
1378
- * Merge package contributions from integrations
1379
- */
1380
- function mergePackages(target, source) {
1381
- if (!source) return;
1382
- if (source.dependencies) target.dependencies = {
1383
- ...target.dependencies,
1384
- ...source.dependencies
1385
- };
1386
- if (source.devDependencies) target.devDependencies = {
1387
- ...target.devDependencies,
1388
- ...source.devDependencies
1389
- };
1390
- if (source.scripts) target.scripts = {
1391
- ...target.scripts,
1392
- ...source.scripts
1393
- };
1394
- }
1395
- function mergePackagesWithAttribution(target, source, integrationId, attribution) {
1396
- if (!source) return;
1397
- if (source.dependencies) {
1398
- for (const pkg of Object.keys(source.dependencies)) attribution.dependencies.set(pkg, integrationId);
1399
- target.dependencies = {
1400
- ...target.dependencies,
1401
- ...source.dependencies
1402
- };
1403
- }
1404
- if (source.devDependencies) {
1405
- for (const pkg of Object.keys(source.devDependencies)) attribution.devDependencies.set(pkg, integrationId);
1406
- target.devDependencies = {
1407
- ...target.devDependencies,
1408
- ...source.devDependencies
1409
- };
1410
- }
1411
- if (source.scripts) {
1412
- for (const script of Object.keys(source.scripts)) attribution.scripts.set(script, integrationId);
1413
- target.scripts = {
1414
- ...target.scripts,
1415
- ...source.scripts
1416
- };
1417
- }
1418
- }
1419
- /**
1420
- * Process all files from an integration
1421
- */
1422
- function processIntegrationFiles(integration, options, files, appendFiles) {
1423
- for (const [filePath, content] of Object.entries(integration.files)) {
1424
- const processed = processTemplateFile(filePath, content, options);
1425
- if (!processed) continue;
1426
- if (processed.append) {
1427
- if (!appendFiles.has(processed.path)) appendFiles.set(processed.path, []);
1428
- appendFiles.get(processed.path).push({
1429
- content: processed.content,
1430
- integrationId: integration.id
1431
- });
1432
- } else files.set(processed.path, {
1433
- content: processed.content,
1434
- integrationId: integration.id
1435
- });
1436
- }
1437
- }
1438
- /**
1439
- * Build the package.json content
1440
- */
1441
- function buildPackageJson(options, packages) {
1442
- const hasHeader = options.chosenIntegrations.length > 0 && options.tailwind;
1443
- const pkg = {
1444
- name: options.projectName,
1445
- private: true,
1446
- type: "module",
1447
- scripts: {
1448
- dev: "vite dev --port 3000",
1449
- build: "vite build",
1450
- start: "node .output/server/index.mjs",
1451
- ...packages.scripts
1452
- },
1453
- dependencies: {
1454
- "@tanstack/react-router": "^1.132.0",
1455
- "@tanstack/react-router-devtools": "^1.132.0",
1456
- "@tanstack/react-devtools": "^0.9.2",
1457
- "@tanstack/react-start": "^1.132.0",
1458
- react: "^19.2.0",
1459
- "react-dom": "^19.2.0",
1460
- "vite-tsconfig-paths": "^5.1.4",
1461
- ...hasHeader ? { "lucide-react": "^0.468.0" } : {},
1462
- ...packages.dependencies
1463
- },
1464
- devDependencies: {
1465
- "@vitejs/plugin-react": "^4.4.1",
1466
- vite: "^7.0.0",
1467
- ...options.typescript ? {
1468
- "@types/react": "^19.2.0",
1469
- "@types/react-dom": "^19.2.0",
1470
- typescript: "^5.7.0"
1471
- } : {},
1472
- ...options.tailwind ? {
1473
- "@tailwindcss/vite": "^4.0.0",
1474
- tailwindcss: "^4.0.0"
1475
- } : {},
1476
- ...packages.devDependencies
1477
- }
1478
- };
1479
- return JSON.stringify(pkg, null, 2);
1480
- }
1481
- /**
1482
- * Compile a project from options
1483
- */
1484
- function compile(options) {
1485
- const files = /* @__PURE__ */ new Map();
1486
- const appendFiles = /* @__PURE__ */ new Map();
1487
- const packages = {
1488
- dependencies: {},
1489
- devDependencies: {},
1490
- scripts: {}
1491
- };
1492
- const envVars = [];
1493
- const warnings = [];
1494
- const baseFiles = getBaseFiles(options);
1495
- for (const [path, content] of Object.entries(baseFiles)) files.set(path, {
1496
- content,
1497
- integrationId: "base"
1498
- });
1499
- const sortedIntegrations = [...options.chosenIntegrations].sort((a, b) => {
1500
- const phaseOrder = {
1501
- setup: 0,
1502
- integration: 1,
1503
- example: 2
1504
- };
1505
- const phaseA = phaseOrder[a.phase];
1506
- const phaseB = phaseOrder[b.phase];
1507
- if (phaseA !== phaseB) return phaseA - phaseB;
1508
- return (a.priority ?? 100) - (b.priority ?? 100);
1509
- });
1510
- for (const integration of sortedIntegrations) {
1511
- processIntegrationFiles(integration, options, files, appendFiles);
1512
- mergePackages(packages, integration.packageAdditions);
1513
- if (integration.envVars) envVars.push(...integration.envVars);
1514
- if (integration.warning) warnings.push(`${integration.name}: ${integration.warning}`);
1515
- }
1516
- for (const [path, appends] of appendFiles) {
1517
- const existing = files.get(path);
1518
- if (existing) {
1519
- const appendContent = appends.map((a) => a.content).join("\n");
1520
- existing.content = existing.content + "\n" + appendContent;
1521
- } else files.set(path, {
1522
- content: appends.map((a) => a.content).join("\n"),
1523
- integrationId: appends[0]?.integrationId ?? "base"
1524
- });
1525
- }
1526
- const outputFiles = {};
1527
- for (const [path, { content }] of files) outputFiles[path] = content;
1528
- outputFiles["package.json"] = buildPackageJson(options, packages);
1529
- const seenEnvVars = /* @__PURE__ */ new Set();
1530
- const uniqueEnvVars = envVars.filter((v) => {
1531
- if (seenEnvVars.has(v.name)) return false;
1532
- seenEnvVars.add(v.name);
1533
- return true;
1534
- });
1535
- if (uniqueEnvVars.length > 0) {
1536
- const envLines = [
1537
- "# Environment Variables",
1538
- "# Copy this file to .env.local and fill in your values",
1539
- ""
1540
- ];
1541
- for (const v of uniqueEnvVars) {
1542
- envLines.push(`# ${v.description}${v.required ? " (required)" : ""}`);
1543
- envLines.push(`${v.name}=${v.example || ""}`);
1544
- envLines.push("");
1545
- }
1546
- outputFiles[".env.example"] = envLines.join("\n");
1547
- }
1548
- return {
1549
- files: outputFiles,
1550
- packages,
1551
- envVars: uniqueEnvVars,
1552
- warnings
1553
- };
1554
- }
1555
- /**
1556
- * Compile with line-by-line attribution tracking
1557
- */
1558
- function compileWithAttribution(options) {
1559
- const files = /* @__PURE__ */ new Map();
1560
- const appendFiles = /* @__PURE__ */ new Map();
1561
- const packages = {
1562
- dependencies: {},
1563
- devDependencies: {},
1564
- scripts: {}
1565
- };
1566
- const packageAttribution = {
1567
- dependencies: /* @__PURE__ */ new Map(),
1568
- devDependencies: /* @__PURE__ */ new Map(),
1569
- scripts: /* @__PURE__ */ new Map()
1570
- };
1571
- const envVars = [];
1572
- const warnings = [];
1573
- const fileOwnership = /* @__PURE__ */ new Map();
1574
- const { files: baseFiles, attributions: baseAttributions } = getBaseFilesWithAttribution(options);
1575
- for (const [path, content] of Object.entries(baseFiles)) {
1576
- files.set(path, {
1577
- content,
1578
- integrationId: "base"
1579
- });
1580
- fileOwnership.set(path, "base");
1581
- }
1582
- const hookAttributions = /* @__PURE__ */ new Map();
1583
- for (const [path, attrs] of Object.entries(baseAttributions)) hookAttributions.set(path, attrs);
1584
- const sortedIntegrations = [...options.chosenIntegrations].sort((a, b) => {
1585
- const phaseOrder = {
1586
- setup: 0,
1587
- integration: 1,
1588
- example: 2
1589
- };
1590
- const phaseA = phaseOrder[a.phase];
1591
- const phaseB = phaseOrder[b.phase];
1592
- if (phaseA !== phaseB) return phaseA - phaseB;
1593
- return (a.priority ?? 100) - (b.priority ?? 100);
1594
- });
1595
- const integrationNames = /* @__PURE__ */ new Map();
1596
- integrationNames.set("base", "Base Template");
1597
- if (options.customTemplate) integrationNames.set(options.customTemplate.id, options.customTemplate.name);
1598
- for (const integration of sortedIntegrations) integrationNames.set(integration.id, integration.name);
1599
- for (const integration of sortedIntegrations) {
1600
- for (const [filePath, content] of Object.entries(integration.files)) {
1601
- const processed = processTemplateFile(filePath, content, options);
1602
- if (!processed) continue;
1603
- if (processed.append) {
1604
- if (!appendFiles.has(processed.path)) appendFiles.set(processed.path, []);
1605
- appendFiles.get(processed.path).push({
1606
- content: processed.content,
1607
- integrationId: integration.id
1608
- });
1609
- } else {
1610
- files.set(processed.path, {
1611
- content: processed.content,
1612
- integrationId: integration.id
1613
- });
1614
- fileOwnership.set(processed.path, integration.id);
1615
- }
1616
- }
1617
- mergePackagesWithAttribution(packages, integration.packageAdditions, integration.id, packageAttribution);
1618
- if (integration.envVars) for (const envVar of integration.envVars) envVars.push({
1619
- ...envVar,
1620
- integrationId: integration.id
1621
- });
1622
- if (integration.warning) warnings.push(`${integration.name}: ${integration.warning}`);
1623
- }
1624
- const appendOwnership = /* @__PURE__ */ new Map();
1625
- for (const [path, appends] of appendFiles) {
1626
- const existing = files.get(path);
1627
- if (existing) {
1628
- const existingLines = existing.content.split("\n").length;
1629
- const lineMap = /* @__PURE__ */ new Map();
1630
- let currentLine = existingLines + 1;
1631
- for (const append of appends) {
1632
- const appendLines = append.content.split("\n").length;
1633
- for (let i = 0; i < appendLines; i++) lineMap.set(currentLine + i, append.integrationId);
1634
- currentLine += appendLines + 1;
1635
- }
1636
- appendOwnership.set(path, lineMap);
1637
- const appendContent = appends.map((a) => a.content).join("\n");
1638
- existing.content = existing.content + "\n" + appendContent;
1639
- } else {
1640
- files.set(path, {
1641
- content: appends.map((a) => a.content).join("\n"),
1642
- integrationId: appends[0]?.integrationId ?? "base"
1643
- });
1644
- fileOwnership.set(path, appends[0]?.integrationId ?? "base");
1645
- }
1646
- }
1647
- const outputFiles = {};
1648
- const attributedFiles = {};
1649
- for (const [path, { content, integrationId }] of files) {
1650
- outputFiles[path] = content;
1651
- const lines = content.split("\n");
1652
- const attributions = [];
1653
- const appendLineMap = appendOwnership.get(path);
1654
- const hookAttrMap = hookAttributions.get(path);
1655
- for (let i = 0; i < lines.length; i++) {
1656
- const lineNumber = i + 1;
1657
- let owningIntegrationId = integrationId;
1658
- const appendIntegrationId = appendLineMap?.get(lineNumber);
1659
- const hookAttr = hookAttrMap?.find((a) => a.line === lineNumber);
1660
- if (appendIntegrationId) owningIntegrationId = appendIntegrationId;
1661
- else if (hookAttr) owningIntegrationId = hookAttr.integrationId;
1662
- attributions.push({
1663
- lineNumber,
1664
- featureId: owningIntegrationId,
1665
- featureName: integrationNames.get(owningIntegrationId) || owningIntegrationId
1666
- });
1667
- }
1668
- attributedFiles[path] = {
1669
- path,
1670
- content,
1671
- attributions
1672
- };
1673
- }
1674
- outputFiles["package.json"] = buildPackageJson(options, packages);
1675
- const pkgJsonLines = outputFiles["package.json"].split("\n");
1676
- const pkgJsonAttributions = [];
1677
- for (let i = 0; i < pkgJsonLines.length; i++) {
1678
- const line = pkgJsonLines[i];
1679
- const lineNumber = i + 1;
1680
- let integrationId = "base";
1681
- const match = line.match(/^\s*"([^"]+)":\s*"[^"]+"/);
1682
- if (match) {
1683
- const pkgName = match[1];
1684
- const depIntegration = packageAttribution.dependencies.get(pkgName);
1685
- const devDepIntegration = packageAttribution.devDependencies.get(pkgName);
1686
- const scriptIntegration = packageAttribution.scripts.get(pkgName);
1687
- if (depIntegration) integrationId = depIntegration;
1688
- else if (devDepIntegration) integrationId = devDepIntegration;
1689
- else if (scriptIntegration) integrationId = scriptIntegration;
1690
- }
1691
- pkgJsonAttributions.push({
1692
- lineNumber,
1693
- featureId: integrationId,
1694
- featureName: integrationNames.get(integrationId) || integrationId
1695
- });
1696
- }
1697
- attributedFiles["package.json"] = {
1698
- path: "package.json",
1699
- content: outputFiles["package.json"],
1700
- attributions: pkgJsonAttributions
1701
- };
1702
- const seenEnvVars = /* @__PURE__ */ new Set();
1703
- const uniqueEnvVars = envVars.filter((v) => {
1704
- if (seenEnvVars.has(v.name)) return false;
1705
- seenEnvVars.add(v.name);
1706
- return true;
1707
- });
1708
- if (uniqueEnvVars.length > 0) {
1709
- const envLines = [];
1710
- envLines.push({
1711
- text: "# Environment Variables",
1712
- integrationId: "base"
1713
- });
1714
- envLines.push({
1715
- text: "# Copy this file to .env.local and fill in your values",
1716
- integrationId: "base"
1717
- });
1718
- envLines.push({
1719
- text: "",
1720
- integrationId: "base"
1721
- });
1722
- const envByIntegration = /* @__PURE__ */ new Map();
1723
- for (const envVar of uniqueEnvVars) {
1724
- const id = envVar.integrationId;
1725
- if (!envByIntegration.has(id)) envByIntegration.set(id, []);
1726
- envByIntegration.get(id).push(envVar);
1727
- }
1728
- for (const [integrationId, vars] of envByIntegration) {
1729
- const integrationName = integrationNames.get(integrationId) || integrationId;
1730
- envLines.push({
1731
- text: `# ${integrationName}`,
1732
- integrationId
1733
- });
1734
- for (const v of vars) {
1735
- envLines.push({
1736
- text: `# ${v.description}${v.required ? " (required)" : ""}`,
1737
- integrationId
1738
- });
1739
- envLines.push({
1740
- text: `${v.name}=${v.example || ""}`,
1741
- integrationId
1742
- });
1743
- }
1744
- envLines.push({
1745
- text: "",
1746
- integrationId: "base"
1747
- });
1748
- }
1749
- const envContent = envLines.map((l) => l.text).join("\n");
1750
- outputFiles[".env.example"] = envContent;
1751
- attributedFiles[".env.example"] = {
1752
- path: ".env.example",
1753
- content: envContent,
1754
- attributions: envLines.map((l, i) => ({
1755
- lineNumber: i + 1,
1756
- featureId: l.integrationId,
1757
- featureName: integrationNames.get(l.integrationId) || l.integrationId
1758
- }))
1759
- };
1760
- }
1761
- return {
1762
- files: outputFiles,
1763
- packages,
1764
- envVars: uniqueEnvVars.map(({ integrationId, ...rest }) => rest),
1765
- warnings,
1766
- attributedFiles
1767
- };
1768
- }
1769
-
1770
- //#endregion
1771
- //#region src/engine/config-file.ts
1772
- const CONFIG_FILE = ".tanstack.json";
1773
- function createPersistedOptions(options) {
1774
- return {
1775
- version: 1,
1776
- projectName: options.projectName,
1777
- framework: options.framework,
1778
- mode: options.mode,
1779
- typescript: options.typescript,
1780
- tailwind: options.tailwind,
1781
- packageManager: options.packageManager,
1782
- chosenIntegrations: options.chosenIntegrations.map((integration) => integration.id),
1783
- customTemplate: options.customTemplate?.id
1784
- };
1785
- }
1786
- async function writeConfigFile(targetDir, options) {
1787
- await writeFile(resolve(targetDir, CONFIG_FILE), JSON.stringify(createPersistedOptions(options), null, 2));
1788
- }
1789
- async function readConfigFile(targetDir) {
1790
- const configPath = resolve(targetDir, CONFIG_FILE);
1791
- if (!existsSync(configPath)) return null;
1792
- try {
1793
- const content = await readFile(configPath, "utf-8");
1794
- return JSON.parse(content);
1795
- } catch {
1796
- return null;
1797
- }
1798
- }
1799
-
1800
- //#endregion
1801
- //#region src/engine/custom-addons/shared.ts
1802
- /**
1803
- * Shared utilities for custom integration/template creation
1804
- * Based on Jack's implementation in create-tsrouter-app
1805
- */
1806
- const IGNORE_FILES = [
1807
- ".template",
1808
- ".integration",
1809
- ".tanstack.json",
1810
- ".git",
1811
- "integration-info.json",
1812
- "integration.json",
1813
- "build",
1814
- "bun.lock",
1815
- "bun.lockb",
1816
- "deno.lock",
1817
- "dist",
1818
- "node_modules",
1819
- "package-lock.json",
1820
- "pnpm-lock.yaml",
1821
- "template.json",
1822
- "template-info.json",
1823
- "yarn.lock"
1824
- ];
1825
- const PROJECT_FILES = ["package.json"];
1826
- const BINARY_EXTENSIONS = [
1827
- ".png",
1828
- ".jpg",
1829
- ".jpeg",
1830
- ".gif",
1831
- ".svg",
1832
- ".ico"
1833
- ];
1834
- /**
1835
- * Check if a file is binary based on extension
1836
- */
1837
- function isBinaryFile(path) {
1838
- return BINARY_EXTENSIONS.includes(extname(path));
1839
- }
1840
- /**
1841
- * Read file contents, handling binary files with base64 encoding
1842
- */
1843
- function readFileHelper(path) {
1844
- if (isBinaryFile(path)) return `base64::${readFileSync(path).toString("base64")}`;
1845
- return readFileSync(path, "utf-8");
1846
- }
1847
- /**
1848
- * Create an ignore function that respects .gitignore and standard ignore patterns
1849
- * Ported from Jack's createIgnore in file-helpers.ts
1850
- */
1851
- function createIgnore(path, includeProjectFiles = true) {
1852
- const gitignorePath = resolve(path, ".gitignore");
1853
- const ignoreList = existsSync(gitignorePath) ? parseGitignore(readFileSync(gitignorePath)).patterns : [];
1854
- const ig = ignore().add(ignoreList);
1855
- return (filePath) => {
1856
- const fileName = basename(filePath);
1857
- if (IGNORE_FILES.includes(fileName) || includeProjectFiles && PROJECT_FILES.includes(fileName)) return true;
1858
- const nameWithoutDotSlash = fileName.replace(/^\.\//, "");
1859
- return ig.ignores(nameWithoutDotSlash);
1860
- };
1861
- }
1862
- /**
1863
- * Create package.json additions by comparing original and current
1864
- * Ported from Jack's createPackageAdditions
1865
- */
1866
- function createPackageAdditions(originalPackageJson, currentPackageJson) {
1867
- const packageAdditions = {};
1868
- const origScripts = originalPackageJson.scripts || {};
1869
- const currScripts = currentPackageJson.scripts || {};
1870
- const scripts = {};
1871
- for (const script of Object.keys(currScripts)) {
1872
- const currValue = currScripts[script];
1873
- if (currValue && origScripts[script] !== currValue) scripts[script] = currValue;
1874
- }
1875
- if (Object.keys(scripts).length) packageAdditions.scripts = scripts;
1876
- const origDeps = originalPackageJson.dependencies || {};
1877
- const currDeps = currentPackageJson.dependencies || {};
1878
- const dependencies = {};
1879
- for (const dep of Object.keys(currDeps)) {
1880
- const currValue = currDeps[dep];
1881
- if (currValue && origDeps[dep] !== currValue) dependencies[dep] = currValue;
1882
- }
1883
- if (Object.keys(dependencies).length) packageAdditions.dependencies = dependencies;
1884
- const origDevDeps = originalPackageJson.devDependencies || {};
1885
- const currDevDeps = currentPackageJson.devDependencies || {};
1886
- const devDependencies = {};
1887
- for (const dep of Object.keys(currDevDeps)) {
1888
- const currValue = currDevDeps[dep];
1889
- if (currValue && origDevDeps[dep] !== currValue) devDependencies[dep] = currValue;
1890
- }
1891
- if (Object.keys(devDependencies).length) packageAdditions.devDependencies = devDependencies;
1892
- return packageAdditions;
1893
- }
1894
- async function createCompileOptionsFromPersisted(persisted, integrationsPath) {
1895
- let chosenIntegrations = [];
1896
- if (persisted.chosenIntegrations.length > 0) chosenIntegrations = await fetchIntegrations(persisted.chosenIntegrations, integrationsPath);
1897
- return {
1898
- projectName: persisted.projectName,
1899
- framework: persisted.framework,
1900
- mode: persisted.mode,
1901
- typescript: persisted.typescript,
1902
- tailwind: persisted.tailwind,
1903
- packageManager: persisted.packageManager,
1904
- chosenIntegrations,
1905
- integrationOptions: {},
1906
- customTemplate: void 0
1907
- };
1908
- }
1909
- function runCompile(options) {
1910
- return compile(options);
1911
- }
1912
- /**
1913
- * Compare files recursively between current project and original output
1914
- * Ported from Jack's compareFilesRecursively
1915
- */
1916
- async function compareFilesRecursively(basePath, ignoreFn, original, changedFiles) {
1917
- await compareFilesRecursivelyHelper(basePath, ".", ignoreFn, original, changedFiles);
1918
- }
1919
- async function compareFilesRecursivelyHelper(basePath, relativePath$1, ignoreFn, original, changedFiles) {
1920
- const entries = await readdir(resolve(basePath, relativePath$1), { withFileTypes: true });
1921
- for (const entry of entries) {
1922
- const entryRelativePath = relativePath$1 === "." ? entry.name : `${relativePath$1}/${entry.name}`;
1923
- const entryFullPath = resolve(basePath, entryRelativePath);
1924
- if (ignoreFn(entry.name)) continue;
1925
- if (entry.isDirectory()) await compareFilesRecursivelyHelper(basePath, entryRelativePath, ignoreFn, original, changedFiles);
1926
- else {
1927
- const contents = readFileHelper(entryFullPath);
1928
- const originalKey = entryRelativePath;
1929
- if (!original[originalKey] || original[originalKey] !== contents) changedFiles[entryRelativePath] = contents;
1930
- }
1931
- }
1932
- }
1933
- async function readCurrentProjectOptions(targetDir) {
1934
- const persisted = await readConfigFile(targetDir);
1935
- if (!persisted) throw new Error(`No .tanstack.json file found in ${targetDir}.\nThis project may have been created with an older version of the CLI, or was not created with the TanStack CLI.`);
1936
- return persisted;
1937
- }
1938
- /**
1939
- * Recursively gather files from a directory
1940
- * Ported from Jack's recursivelyGatherFiles
1941
- */
1942
- async function recursivelyGatherFiles(path, includeProjectFiles = true) {
1943
- const ignoreFn = createIgnore(path, includeProjectFiles);
1944
- const files = {};
1945
- if (!existsSync(path)) return files;
1946
- await gatherFilesHelper(path, ".", files, ignoreFn);
1947
- return files;
1948
- }
1949
- async function gatherFilesHelper(basePath, relativePath$1, files, ignoreFn) {
1950
- const entries = await readdir(resolve(basePath, relativePath$1), { withFileTypes: true });
1951
- for (const entry of entries) {
1952
- if (ignoreFn(entry.name)) continue;
1953
- const entryRelativePath = relativePath$1 === "." ? entry.name : `${relativePath$1}/${entry.name}`;
1954
- const entryFullPath = resolve(basePath, entryRelativePath);
1955
- if (entry.isDirectory()) await gatherFilesHelper(basePath, entryRelativePath, files, ignoreFn);
1956
- else files[entryRelativePath] = readFileHelper(entryFullPath);
1957
- }
1958
- }
1959
-
1960
- //#endregion
1961
- //#region src/engine/custom-addons/integration.ts
1962
- const INTEGRATION_DIR = ".integration";
1963
- const INFO_FILE$1 = ".integration/info.json";
1964
- const COMPILED_FILE$1 = "integration.json";
1965
- const ASSETS_DIR = "assets";
1966
- const INTEGRATION_IGNORE_FILES = [
1967
- "main.jsx",
1968
- "App.jsx",
1969
- "main.tsx",
1970
- "App.tsx",
1971
- "routeTree.gen.ts"
1972
- ];
1973
- function camelCase(str) {
1974
- return str.split(/(\.|-|\/)/).filter((part) => /^[a-zA-Z]+$/.test(part)).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
1975
- }
1976
- function templatize(routeCode, routeFile) {
1977
- let code = routeCode;
1978
- code = code.replace(/import { createFileRoute } from ['"]@tanstack\/react-router['"]/g, `import { <% if (fileRouter) { %>createFileRoute<% } else { %>createRoute<% } %> } from '@tanstack/react-router'`);
1979
- const routeMatch = code.match(/export\s+const\s+Route\s*=\s*createFileRoute\(['"]([^'"]+)['"]\)\s*\(\{([^}]+)\}\)/);
1980
- let path = "";
1981
- if (routeMatch) {
1982
- const fullMatch = routeMatch[0];
1983
- path = routeMatch[1];
1984
- const routeDefinition = routeMatch[2];
1985
- code = code.replace(fullMatch, `<% if (codeRouter) { %>
1986
- import type { RootRoute } from '@tanstack/react-router'
1987
- <% } else { %>
1988
- export const Route = createFileRoute('${path}')({${routeDefinition}})
1989
- <% } %>`);
1990
- code += `
1991
- <% if (codeRouter) { %>
1992
- export default (parentRoute: RootRoute) => createRoute({
1993
- path: '${path}',
1994
- ${routeDefinition}
1995
- getParentRoute: () => parentRoute,
1996
- })
1997
- <% } %>
1998
- `;
1999
- } else console.warn(`No route found in the file: ${routeFile}`);
2000
- const name = basename(path).replace(".tsx", "").replace(/^demo/, "").replace(".", " ").trim();
2001
- const jsName = camelCase(basename(path));
2002
- return {
2003
- url: path,
2004
- code,
2005
- name,
2006
- jsName
2007
- };
2008
- }
2009
- async function validateIntegrationSetup(targetDir) {
2010
- const options = await readCurrentProjectOptions(targetDir);
2011
- if (options.mode === "code-router") throw new Error("This project is using code-router mode.\nTo create an integration, the project must use file-router mode.");
2012
- if (!options.tailwind) throw new Error("This project is not using Tailwind CSS.\nTo create an integration, the project must be created with Tailwind CSS.");
2013
- if (!options.typescript) throw new Error("This project is not using TypeScript.\nTo create an integration, the project must be created with TypeScript.");
2014
- }
2015
- async function readOrGenerateIntegrationInfo(options, targetDir) {
2016
- const infoPath = resolve(targetDir, INFO_FILE$1);
2017
- if (existsSync(infoPath)) {
2018
- const content = await readFile(infoPath, "utf-8");
2019
- return JSON.parse(content);
2020
- }
2021
- return {
2022
- id: `${options.projectName}-integration`,
2023
- name: `${options.projectName} Integration`,
2024
- description: "Custom integration",
2025
- author: "Author <author@example.com>",
2026
- version: "0.0.1",
2027
- license: "MIT",
2028
- link: `https://github.com/example/${options.projectName}-integration`,
2029
- type: "integration",
2030
- phase: "integration",
2031
- modes: [options.mode],
2032
- requiresTailwind: options.tailwind || void 0,
2033
- dependsOn: options.chosenIntegrations.length > 0 ? options.chosenIntegrations : void 0,
2034
- routes: [],
2035
- packageAdditions: {
2036
- scripts: {},
2037
- dependencies: {},
2038
- devDependencies: {}
2039
- }
2040
- };
2041
- }
2042
- async function generateBaseProject(persistedOptions, targetDir, integrationsPath) {
2043
- return {
2044
- info: await readOrGenerateIntegrationInfo(persistedOptions, targetDir),
2045
- output: runCompile(await createCompileOptionsFromPersisted(persistedOptions, integrationsPath))
2046
- };
2047
- }
2048
- async function buildAssetsDirectory(targetDir, output, info) {
2049
- const assetsDir = resolve(targetDir, INTEGRATION_DIR, ASSETS_DIR);
2050
- if (existsSync(assetsDir)) return;
2051
- const ignoreFn = createIgnore(targetDir);
2052
- const changedFiles = {};
2053
- await compareFilesRecursively(targetDir, ignoreFn, output.files, changedFiles);
2054
- for (const file of Object.keys(changedFiles)) {
2055
- if (INTEGRATION_IGNORE_FILES.includes(basename(file))) continue;
2056
- const targetPath = resolve(assetsDir, file);
2057
- mkdirSync(dirname(targetPath), { recursive: true });
2058
- const fileContent = changedFiles[file];
2059
- if (file.includes("/routes/")) {
2060
- const { url, code, name, jsName } = templatize(fileContent, file);
2061
- info.routes ||= [];
2062
- if (!info.routes.find((r) => r.url === url)) info.routes.push({
2063
- url,
2064
- name,
2065
- jsName,
2066
- path: file
2067
- });
2068
- writeFileSync(`${targetPath}.ejs`, code);
2069
- } else writeFileSync(targetPath, fileContent);
2070
- }
2071
- }
2072
- async function updateIntegrationInfo(targetDir, integrationsPath) {
2073
- const { info, output } = await generateBaseProject(await readCurrentProjectOptions(targetDir), targetDir, integrationsPath);
2074
- info.packageAdditions = createPackageAdditions(JSON.parse(output.files["package.json"]), JSON.parse(await readFile(resolve(targetDir, "package.json"), "utf-8")));
2075
- await buildAssetsDirectory(targetDir, output, info);
2076
- await mkdir(resolve(targetDir, dirname(INFO_FILE$1)), { recursive: true });
2077
- await writeFile(resolve(targetDir, INFO_FILE$1), JSON.stringify(info, null, 2));
2078
- }
2079
- async function compileIntegration(targetDir, _integrationsPath) {
2080
- const persistedOptions = await readCurrentProjectOptions(targetDir);
2081
- const info = await readOrGenerateIntegrationInfo(persistedOptions, targetDir);
2082
- const assetsDir = resolve(targetDir, INTEGRATION_DIR, ASSETS_DIR);
2083
- const compiledInfo = {
2084
- ...info,
2085
- id: info.id || `${persistedOptions.projectName}-integration`,
2086
- files: await recursivelyGatherFiles(assetsDir),
2087
- deletedFiles: []
2088
- };
2089
- await writeFile(resolve(targetDir, COMPILED_FILE$1), JSON.stringify(compiledInfo, null, 2));
2090
- console.log(`Compiled integration written to ${COMPILED_FILE$1}`);
2091
- }
2092
- async function initIntegration(targetDir, integrationsPath) {
2093
- await validateIntegrationSetup(targetDir);
2094
- await updateIntegrationInfo(targetDir, integrationsPath);
2095
- await compileIntegration(targetDir, integrationsPath);
2096
- console.log(`
2097
- Integration initialized successfully!
2098
-
2099
- Files created:
2100
- ${INFO_FILE$1} - Integration metadata (edit this to customize)
2101
- ${INTEGRATION_DIR}/${ASSETS_DIR}/ - Integration asset files
2102
- ${COMPILED_FILE$1} - Compiled integration (distribute this)
2103
-
2104
- Next steps:
2105
- 1. Edit ${INFO_FILE$1} to customize your integration metadata
2106
- 2. Run 'tanstack integration compile' to rebuild after changes
2107
- 3. Share ${COMPILED_FILE$1} or host it publicly
2108
- `);
2109
- }
2110
- /**
2111
- * Load a remote integration from a URL
2112
- */
2113
- async function loadRemoteIntegration(url) {
2114
- const response = await fetch(url);
2115
- if (!response.ok) throw new Error(`Failed to fetch integration from ${url}: ${response.statusText}`);
2116
- const jsonContent = await response.json();
2117
- const result = IntegrationCompiledSchema.safeParse(jsonContent);
2118
- if (!result.success) throw new Error(`Invalid integration at ${url}: ${result.error.message}`);
2119
- const integration = result.data;
2120
- if (!integration.id) integration.id = url;
2121
- return integration;
2122
- }
2123
-
2124
- //#endregion
2125
- //#region src/engine/custom-addons/template.ts
2126
- const INFO_FILE = "template-info.json";
2127
- const COMPILED_FILE = "template.json";
2128
- /**
2129
- * Generate default template info from project options
2130
- * Custom templates are just integration presets - they capture which integrations are selected
2131
- */
2132
- async function readOrGenerateTemplateInfo(options, targetDir) {
2133
- const infoPath = resolve(targetDir, INFO_FILE);
2134
- if (existsSync(infoPath)) {
2135
- const content = await readFile(infoPath, "utf-8");
2136
- return JSON.parse(content);
2137
- }
2138
- return {
2139
- id: `${options.projectName}-template`,
2140
- name: `${options.projectName} Template`,
2141
- description: "A curated project template",
2142
- framework: options.framework,
2143
- mode: options.mode,
2144
- typescript: options.typescript,
2145
- tailwind: options.tailwind,
2146
- integrations: options.chosenIntegrations
2147
- };
2148
- }
2149
- /**
2150
- * Compile a custom template from the current project
2151
- * Custom templates are just integration presets - they specify project defaults and which integrations to include
2152
- */
2153
- async function compileTemplate(targetDir) {
2154
- const persistedOptions = await readCurrentProjectOptions(targetDir);
2155
- const info = await readOrGenerateTemplateInfo(persistedOptions, targetDir);
2156
- const compiledInfo = {
2157
- ...info,
2158
- id: info.id || `${persistedOptions.projectName}-template`
2159
- };
2160
- await writeFile(resolve(targetDir, COMPILED_FILE), JSON.stringify(compiledInfo, null, 2));
2161
- console.log(`Compiled template written to ${COMPILED_FILE}`);
2162
- console.log(`\nIncluded integrations: ${compiledInfo.integrations.length > 0 ? compiledInfo.integrations.join(", ") : "(none)"}`);
2163
- }
2164
- async function initTemplate(targetDir) {
2165
- const info = await readOrGenerateTemplateInfo(await readCurrentProjectOptions(targetDir), targetDir);
2166
- await writeFile(resolve(targetDir, INFO_FILE), JSON.stringify(info, null, 2));
2167
- await compileTemplate(targetDir);
2168
- console.log(`
2169
- Custom template initialized successfully!
2170
-
2171
- Files created:
2172
- ${INFO_FILE} - Template metadata (edit this to customize)
2173
- ${COMPILED_FILE} - Compiled template (distribute this)
2174
-
2175
- Custom templates are integration presets. They capture:
2176
- - Project defaults (framework, mode, typescript, tailwind)
2177
- - Which integrations to include
2178
- - Preset integration options (if any)
2179
-
2180
- Next steps:
2181
- 1. Edit ${INFO_FILE} to customize name, description, and integrations
2182
- 2. Run 'tanstack template compile' to rebuild after changes
2183
- 3. Share ${COMPILED_FILE} or host it publicly
2184
- 4. Users can use: tanstack create --template <url-to-template.json>
2185
- `);
2186
- }
2187
- /**
2188
- * Load a remote custom template from a URL
2189
- */
2190
- async function loadTemplate(url) {
2191
- const response = await fetch(url);
2192
- if (!response.ok) throw new Error(`Failed to fetch template from ${url}: ${response.statusText}`);
2193
- const jsonContent = await response.json();
2194
- const result = CustomTemplateCompiledSchema.safeParse(jsonContent);
2195
- if (!result.success) throw new Error(`Invalid template at ${url}: ${result.error.message}`);
2196
- const template = result.data;
2197
- if (!template.id) template.id = url;
2198
- return template;
2199
- }
2200
-
2201
- //#endregion
2202
- export { initIntegration as a, readConfigFile as c, compileWithAttribution as d, processTemplateFile as f, compileIntegration as i, writeConfigFile as l, initTemplate as n, loadRemoteIntegration as o, relativePath as p, loadTemplate as r, CONFIG_FILE as s, compileTemplate as t, compile as u };