@tanstack/cli 0.0.1

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.
@@ -0,0 +1,2734 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let ejs = require("ejs");
29
+ let node_fs_promises = require("node:fs/promises");
30
+ let node_fs = require("node:fs");
31
+ let node_path = require("node:path");
32
+ let zod = require("zod");
33
+ let ignore = require("ignore");
34
+ ignore = __toESM(ignore);
35
+ let parse_gitignore = require("parse-gitignore");
36
+ parse_gitignore = __toESM(parse_gitignore);
37
+
38
+ //#region src/engine/template.ts
39
+ /**
40
+ * Convert _dot_ prefixes to actual dots (for dotfiles)
41
+ */
42
+ function convertDotFiles(path) {
43
+ return path.split("/").map((segment) => segment.replace(/^_dot_/, ".")).join("/");
44
+ }
45
+ /**
46
+ * Strip option prefixes from filename
47
+ * e.g., __postgres__schema.prisma -> schema.prisma
48
+ */
49
+ function stripOptionPrefix(path) {
50
+ const match = path.match(/^(.+\/)?__([^_]+)__(.+)$/);
51
+ if (match) {
52
+ const [, directory, , filename] = match;
53
+ return (directory || "") + filename;
54
+ }
55
+ return path;
56
+ }
57
+ /**
58
+ * Calculate relative path between two file paths
59
+ */
60
+ function relativePath(from, to, stripExtension = false) {
61
+ const fromParts = from.split("/").slice(0, -1);
62
+ const toParts = to.split("/");
63
+ let commonLength = 0;
64
+ while (commonLength < fromParts.length && commonLength < toParts.length && fromParts[commonLength] === toParts[commonLength]) commonLength++;
65
+ const upCount = fromParts.length - commonLength;
66
+ const ups = Array(upCount).fill("..");
67
+ const remainder = toParts.slice(commonLength);
68
+ let result = [...ups, ...remainder].join("/");
69
+ if (!result.startsWith(".")) result = "./" + result;
70
+ if (stripExtension) result = result.replace(/\.[^/.]+$/, "");
71
+ return result;
72
+ }
73
+ /**
74
+ * Error thrown when ignoreFile() is called in a template
75
+ */
76
+ var IgnoreFileError = class extends Error {
77
+ constructor() {
78
+ super("ignoreFile");
79
+ this.name = "IgnoreFileError";
80
+ }
81
+ };
82
+ /**
83
+ * Create template context from compile options
84
+ */
85
+ function createTemplateContext(options, currentFile) {
86
+ const hooks = [];
87
+ for (const integration of options.chosenIntegrations) if (integration.hooks) hooks.push(...integration.hooks);
88
+ const routes = [];
89
+ for (const integration of options.chosenIntegrations) if (integration.routes) routes.push(...integration.routes);
90
+ const integrationEnabled = {};
91
+ for (const integration of options.chosenIntegrations) integrationEnabled[integration.id] = true;
92
+ const localRelativePath = (to, stripExt = false) => relativePath(currentFile, to, stripExt);
93
+ const hookImportContent = (hook) => hook.import || `import ${hook.jsName} from '${localRelativePath(hook.path || "")}'`;
94
+ const hookImportCode = (hook) => hook.code || hook.jsName || "";
95
+ return {
96
+ packageManager: options.packageManager,
97
+ projectName: options.projectName,
98
+ typescript: options.typescript,
99
+ tailwind: options.tailwind,
100
+ js: options.typescript ? "ts" : "js",
101
+ jsx: options.typescript ? "tsx" : "jsx",
102
+ fileRouter: options.mode === "file-router",
103
+ codeRouter: options.mode === "code-router",
104
+ integrationEnabled,
105
+ integrationOption: options.integrationOptions,
106
+ integrations: options.chosenIntegrations,
107
+ hooks,
108
+ routes,
109
+ getPackageManagerAddScript: (pkg, isDev = false) => {
110
+ const pm = options.packageManager;
111
+ if (pm === "npm") return `npm install ${isDev ? "-D " : ""}${pkg}`;
112
+ if (pm === "yarn") return `yarn add ${isDev ? "-D " : ""}${pkg}`;
113
+ if (pm === "pnpm") return `pnpm add ${isDev ? "-D " : ""}${pkg}`;
114
+ if (pm === "bun") return `bun add ${isDev ? "-d " : ""}${pkg}`;
115
+ if (pm === "deno") return `deno add ${pkg}`;
116
+ return `npm install ${isDev ? "-D " : ""}${pkg}`;
117
+ },
118
+ getPackageManagerRunScript: (script, args = []) => {
119
+ const pm = options.packageManager;
120
+ const argsStr = args.length ? " " + args.join(" ") : "";
121
+ if (pm === "npm") return `npm run ${script}${argsStr}`;
122
+ if (pm === "yarn") return `yarn ${script}${argsStr}`;
123
+ if (pm === "pnpm") return `pnpm ${script}${argsStr}`;
124
+ if (pm === "bun") return `bun run ${script}${argsStr}`;
125
+ if (pm === "deno") return `deno task ${script}${argsStr}`;
126
+ return `npm run ${script}${argsStr}`;
127
+ },
128
+ relativePath: localRelativePath,
129
+ hookImportContent,
130
+ hookImportCode,
131
+ ignoreFile: () => {
132
+ throw new IgnoreFileError();
133
+ }
134
+ };
135
+ }
136
+ /**
137
+ * Process a template file with EJS
138
+ */
139
+ function processTemplateFile(filePath, content, options) {
140
+ const context = createTemplateContext(options, filePath);
141
+ let processedContent = content;
142
+ let shouldIgnore = false;
143
+ if (filePath.endsWith(".ejs")) try {
144
+ processedContent = (0, ejs.render)(content, context);
145
+ } catch (error) {
146
+ if (error instanceof IgnoreFileError) shouldIgnore = true;
147
+ else throw new Error(`EJS error in file ${filePath}: ${error}`);
148
+ }
149
+ if (shouldIgnore) return null;
150
+ let outputPath = filePath;
151
+ outputPath = outputPath.replace(/\.ejs$/, "");
152
+ outputPath = convertDotFiles(outputPath);
153
+ outputPath = stripOptionPrefix(outputPath);
154
+ let append = false;
155
+ if (outputPath.endsWith(".append")) {
156
+ append = true;
157
+ outputPath = outputPath.replace(/\.append$/, "");
158
+ }
159
+ if (!options.typescript) outputPath = outputPath.replace(/\.tsx$/, ".jsx").replace(/\.ts$/, ".js");
160
+ return {
161
+ path: outputPath,
162
+ content: processedContent,
163
+ append
164
+ };
165
+ }
166
+
167
+ //#endregion
168
+ //#region src/templates/base.ts
169
+ /**
170
+ * Base TanStack Start template files
171
+ * These provide the foundation for every project
172
+ */
173
+ /**
174
+ * Collect all hooks from integrations, grouped by type
175
+ */
176
+ function collectHooks(options) {
177
+ const hooks = [];
178
+ for (const integration of options.chosenIntegrations) if (integration.hooks) for (const hook of integration.hooks) hooks.push({
179
+ ...hook,
180
+ integrationId: integration.id
181
+ });
182
+ return {
183
+ vitePlugins: hooks.filter((i) => i.type === "vite-plugin"),
184
+ rootProviders: hooks.filter((i) => i.type === "root-provider"),
185
+ devtoolsPlugins: hooks.filter((i) => i.type === "devtools"),
186
+ entryClientInits: hooks.filter((i) => i.type === "entry-client")
187
+ };
188
+ }
189
+ /**
190
+ * Generate vite.config.ts content with line attribution
191
+ */
192
+ function generateViteConfig(options, vitePlugins) {
193
+ const { tailwind } = options;
194
+ const lines = [];
195
+ lines.push({
196
+ text: `import { defineConfig } from 'vite'`,
197
+ integrationId: "base"
198
+ });
199
+ lines.push({
200
+ text: `import { tanstackStart } from '@tanstack/react-start/plugin/vite'`,
201
+ integrationId: "base"
202
+ });
203
+ lines.push({
204
+ text: `import viteReact from '@vitejs/plugin-react'`,
205
+ integrationId: "base"
206
+ });
207
+ lines.push({
208
+ text: `import viteTsConfigPaths from 'vite-tsconfig-paths'`,
209
+ integrationId: "base"
210
+ });
211
+ if (tailwind) lines.push({
212
+ text: `import tailwindcss from '@tailwindcss/vite'`,
213
+ integrationId: "base"
214
+ });
215
+ for (const plugin of vitePlugins) if (plugin.import) lines.push({
216
+ text: plugin.import,
217
+ integrationId: plugin.integrationId
218
+ });
219
+ else {
220
+ const importPath = relativePath("vite.config.ts", plugin.path || `src/integrations/${plugin.integrationId}/vite-plugin.ts`, true);
221
+ lines.push({
222
+ text: `import ${plugin.jsName} from '${importPath}'`,
223
+ integrationId: plugin.integrationId
224
+ });
225
+ }
226
+ lines.push({
227
+ text: "",
228
+ integrationId: "base"
229
+ });
230
+ lines.push({
231
+ text: `export default defineConfig({`,
232
+ integrationId: "base"
233
+ });
234
+ lines.push({
235
+ text: ` plugins: [`,
236
+ integrationId: "base"
237
+ });
238
+ lines.push({
239
+ text: ` viteTsConfigPaths({`,
240
+ integrationId: "base"
241
+ });
242
+ lines.push({
243
+ text: ` projects: ['./tsconfig.json'],`,
244
+ integrationId: "base"
245
+ });
246
+ lines.push({
247
+ text: ` }),`,
248
+ integrationId: "base"
249
+ });
250
+ if (tailwind) lines.push({
251
+ text: ` tailwindcss(),`,
252
+ integrationId: "base"
253
+ });
254
+ lines.push({
255
+ text: ` tanstackStart(),`,
256
+ integrationId: "base"
257
+ });
258
+ lines.push({
259
+ text: ` viteReact(),`,
260
+ integrationId: "base"
261
+ });
262
+ for (const plugin of vitePlugins) {
263
+ const pluginCall = plugin.code || `${plugin.jsName}()`;
264
+ lines.push({
265
+ text: ` ${pluginCall},`,
266
+ integrationId: plugin.integrationId
267
+ });
268
+ }
269
+ lines.push({
270
+ text: ` ],`,
271
+ integrationId: "base"
272
+ });
273
+ lines.push({
274
+ text: `})`,
275
+ integrationId: "base"
276
+ });
277
+ return {
278
+ content: lines.map((l) => l.text).join("\n"),
279
+ lineAttributions: lines.map((l, i) => ({
280
+ line: i + 1,
281
+ integrationId: l.integrationId
282
+ }))
283
+ };
284
+ }
285
+ /**
286
+ * Generate entry-client.tsx content with line attribution
287
+ */
288
+ function generateEntryClient(_options, entryClientInits) {
289
+ const lines = [];
290
+ lines.push({
291
+ text: `import { hydrateRoot } from 'react-dom/client'`,
292
+ integrationId: "base"
293
+ });
294
+ lines.push({
295
+ text: `import { StartClient } from '@tanstack/react-start'`,
296
+ integrationId: "base"
297
+ });
298
+ lines.push({
299
+ text: `import { getRouter } from './router'`,
300
+ integrationId: "base"
301
+ });
302
+ for (const init of entryClientInits) {
303
+ const importPath = relativePath("src/entry-client.tsx", init.path || `src/integrations/${init.integrationId}/client.ts`, true);
304
+ lines.push({
305
+ text: `import { ${init.jsName} } from '${importPath}'`,
306
+ integrationId: init.integrationId
307
+ });
308
+ }
309
+ lines.push({
310
+ text: "",
311
+ integrationId: "base"
312
+ });
313
+ if (entryClientInits.length > 0) {
314
+ lines.push({
315
+ text: `// Initialize integrations`,
316
+ integrationId: "base"
317
+ });
318
+ for (const init of entryClientInits) lines.push({
319
+ text: `${init.jsName}()`,
320
+ integrationId: init.integrationId
321
+ });
322
+ lines.push({
323
+ text: "",
324
+ integrationId: "base"
325
+ });
326
+ }
327
+ lines.push({
328
+ text: `const router = getRouter()`,
329
+ integrationId: "base"
330
+ });
331
+ lines.push({
332
+ text: "",
333
+ integrationId: "base"
334
+ });
335
+ lines.push({
336
+ text: `hydrateRoot(document.getElementById('root')!, <StartClient router={router} />)`,
337
+ integrationId: "base"
338
+ });
339
+ return {
340
+ content: lines.map((l) => l.text).join("\n"),
341
+ lineAttributions: lines.map((l, i) => ({
342
+ line: i + 1,
343
+ integrationId: l.integrationId
344
+ }))
345
+ };
346
+ }
347
+ /**
348
+ * Generate __root.tsx content with line attribution
349
+ * This generates a full document route with shellComponent for proper SSR
350
+ */
351
+ function generateRootRoute(options, rootProviders, devtoolsPlugins) {
352
+ const lines = [];
353
+ const hasHeader = options.chosenIntegrations.length > 0;
354
+ if (devtoolsPlugins.length > 0) lines.push({
355
+ text: `import React from 'react'`,
356
+ integrationId: "base"
357
+ });
358
+ lines.push({
359
+ text: `import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'`,
360
+ integrationId: "base"
361
+ });
362
+ lines.push({
363
+ text: `import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'`,
364
+ integrationId: "base"
365
+ });
366
+ lines.push({
367
+ text: `import appCss from '../styles.css?url'`,
368
+ integrationId: "base"
369
+ });
370
+ if (hasHeader) lines.push({
371
+ text: `import { Header } from '../components/Header'`,
372
+ integrationId: "base"
373
+ });
374
+ for (const provider of rootProviders) {
375
+ const importPath = relativePath("src/routes/__root.tsx", provider.path || `src/integrations/${provider.integrationId}/provider.tsx`, true);
376
+ lines.push({
377
+ text: `import { ${provider.jsName} } from '${importPath}'`,
378
+ integrationId: provider.integrationId
379
+ });
380
+ }
381
+ for (const devtools of devtoolsPlugins) {
382
+ const importPath = relativePath("src/routes/__root.tsx", devtools.path || `src/integrations/${devtools.integrationId}/devtools.tsx`, true);
383
+ lines.push({
384
+ text: `import { ${devtools.jsName} } from '${importPath}'`,
385
+ integrationId: devtools.integrationId
386
+ });
387
+ }
388
+ if (devtoolsPlugins.length > 0) {
389
+ lines.push({
390
+ text: "",
391
+ integrationId: "base"
392
+ });
393
+ lines.push({
394
+ text: `const devtoolsPlugins = [`,
395
+ integrationId: "base"
396
+ });
397
+ for (const devtools of devtoolsPlugins) lines.push({
398
+ text: ` ${devtools.jsName},`,
399
+ integrationId: devtools.integrationId
400
+ });
401
+ lines.push({
402
+ text: `]`,
403
+ integrationId: "base"
404
+ });
405
+ }
406
+ lines.push({
407
+ text: "",
408
+ integrationId: "base"
409
+ });
410
+ lines.push({
411
+ text: `export const Route = createRootRoute({`,
412
+ integrationId: "base"
413
+ });
414
+ lines.push({
415
+ text: ` head: () => ({`,
416
+ integrationId: "base"
417
+ });
418
+ lines.push({
419
+ text: ` meta: [`,
420
+ integrationId: "base"
421
+ });
422
+ lines.push({
423
+ text: ` { charSet: 'utf-8' },`,
424
+ integrationId: "base"
425
+ });
426
+ lines.push({
427
+ text: ` { name: 'viewport', content: 'width=device-width, initial-scale=1' },`,
428
+ integrationId: "base"
429
+ });
430
+ lines.push({
431
+ text: ` { title: 'TanStack Start Starter' },`,
432
+ integrationId: "base"
433
+ });
434
+ lines.push({
435
+ text: ` ],`,
436
+ integrationId: "base"
437
+ });
438
+ lines.push({
439
+ text: ` links: [{ rel: 'stylesheet', href: appCss }],`,
440
+ integrationId: "base"
441
+ });
442
+ lines.push({
443
+ text: ` }),`,
444
+ integrationId: "base"
445
+ });
446
+ lines.push({
447
+ text: ` shellComponent: RootDocument,`,
448
+ integrationId: "base"
449
+ });
450
+ lines.push({
451
+ text: `})`,
452
+ integrationId: "base"
453
+ });
454
+ lines.push({
455
+ text: "",
456
+ integrationId: "base"
457
+ });
458
+ lines.push({
459
+ text: `function RootDocument({ children }: { children: React.ReactNode }) {`,
460
+ integrationId: "base"
461
+ });
462
+ lines.push({
463
+ text: ` return (`,
464
+ integrationId: "base"
465
+ });
466
+ lines.push({
467
+ text: ` <html lang="en">`,
468
+ integrationId: "base"
469
+ });
470
+ lines.push({
471
+ text: ` <head>`,
472
+ integrationId: "base"
473
+ });
474
+ lines.push({
475
+ text: ` <HeadContent />`,
476
+ integrationId: "base"
477
+ });
478
+ lines.push({
479
+ text: ` </head>`,
480
+ integrationId: "base"
481
+ });
482
+ lines.push({
483
+ text: ` <body>`,
484
+ integrationId: "base"
485
+ });
486
+ let currentIndent = " ";
487
+ for (const provider of rootProviders) {
488
+ lines.push({
489
+ text: `${currentIndent}<${provider.jsName}>`,
490
+ integrationId: provider.integrationId
491
+ });
492
+ currentIndent += " ";
493
+ }
494
+ if (hasHeader) lines.push({
495
+ text: `${currentIndent}<Header />`,
496
+ integrationId: "base"
497
+ });
498
+ lines.push({
499
+ text: `${currentIndent}{children}`,
500
+ integrationId: "base"
501
+ });
502
+ lines.push({
503
+ text: `${currentIndent}<TanStackRouterDevtools />`,
504
+ integrationId: "base"
505
+ });
506
+ if (devtoolsPlugins.length > 0) {
507
+ lines.push({
508
+ text: `${currentIndent}{devtoolsPlugins.map((plugin, i) => (`,
509
+ integrationId: "base"
510
+ });
511
+ lines.push({
512
+ text: `${currentIndent} <React.Fragment key={i}>{plugin.render}</React.Fragment>`,
513
+ integrationId: "base"
514
+ });
515
+ lines.push({
516
+ text: `${currentIndent}))}`,
517
+ integrationId: "base"
518
+ });
519
+ }
520
+ for (const provider of [...rootProviders].reverse()) {
521
+ currentIndent = currentIndent.slice(0, -2);
522
+ lines.push({
523
+ text: `${currentIndent}</${provider.jsName}>`,
524
+ integrationId: provider.integrationId
525
+ });
526
+ }
527
+ lines.push({
528
+ text: ` <Scripts />`,
529
+ integrationId: "base"
530
+ });
531
+ lines.push({
532
+ text: ` </body>`,
533
+ integrationId: "base"
534
+ });
535
+ lines.push({
536
+ text: ` </html>`,
537
+ integrationId: "base"
538
+ });
539
+ lines.push({
540
+ text: ` )`,
541
+ integrationId: "base"
542
+ });
543
+ lines.push({
544
+ text: `}`,
545
+ integrationId: "base"
546
+ });
547
+ return {
548
+ content: lines.map((l) => l.text).join("\n"),
549
+ lineAttributions: lines.map((l, i) => ({
550
+ line: i + 1,
551
+ integrationId: l.integrationId
552
+ }))
553
+ };
554
+ }
555
+ /**
556
+ * Collect routes from integrations for navigation
557
+ */
558
+ function collectRoutes(options) {
559
+ const routes = [];
560
+ for (const integration of options.chosenIntegrations) if (integration.routes) {
561
+ for (const route of integration.routes) if (route.url && route.name) routes.push({
562
+ url: route.url,
563
+ name: route.name,
564
+ icon: route.icon || "Globe"
565
+ });
566
+ }
567
+ return routes;
568
+ }
569
+ /**
570
+ * Generate Header component with slide-out drawer navigation
571
+ */
572
+ function generateHeader(options) {
573
+ const lines = [];
574
+ const routes = collectRoutes(options);
575
+ const icons = new Set([
576
+ "Menu",
577
+ "X",
578
+ "Home"
579
+ ]);
580
+ for (const route of routes) icons.add(route.icon);
581
+ lines.push({
582
+ text: `import { useState } from 'react'`,
583
+ integrationId: "base"
584
+ });
585
+ lines.push({
586
+ text: `import { Link } from '@tanstack/react-router'`,
587
+ integrationId: "base"
588
+ });
589
+ lines.push({
590
+ text: `import { ${Array.from(icons).sort().join(", ")} } from 'lucide-react'`,
591
+ integrationId: "base"
592
+ });
593
+ lines.push({
594
+ text: "",
595
+ integrationId: "base"
596
+ });
597
+ lines.push({
598
+ text: `export function Header() {`,
599
+ integrationId: "base"
600
+ });
601
+ lines.push({
602
+ text: ` const [isOpen, setIsOpen] = useState(false)`,
603
+ integrationId: "base"
604
+ });
605
+ lines.push({
606
+ text: "",
607
+ integrationId: "base"
608
+ });
609
+ lines.push({
610
+ text: ` return (`,
611
+ integrationId: "base"
612
+ });
613
+ lines.push({
614
+ text: ` <>`,
615
+ integrationId: "base"
616
+ });
617
+ lines.push({
618
+ text: ` <header className="p-4 flex items-center bg-gray-800 text-white shadow-lg">`,
619
+ integrationId: "base"
620
+ });
621
+ lines.push({
622
+ text: ` <button`,
623
+ integrationId: "base"
624
+ });
625
+ lines.push({
626
+ text: ` onClick={() => setIsOpen(true)}`,
627
+ integrationId: "base"
628
+ });
629
+ lines.push({
630
+ text: ` className="p-2 hover:bg-gray-700 rounded-lg transition-colors"`,
631
+ integrationId: "base"
632
+ });
633
+ lines.push({
634
+ text: ` aria-label="Open menu"`,
635
+ integrationId: "base"
636
+ });
637
+ lines.push({
638
+ text: ` >`,
639
+ integrationId: "base"
640
+ });
641
+ lines.push({
642
+ text: ` <Menu size={24} />`,
643
+ integrationId: "base"
644
+ });
645
+ lines.push({
646
+ text: ` </button>`,
647
+ integrationId: "base"
648
+ });
649
+ lines.push({
650
+ text: ` <h1 className="ml-4 text-xl font-semibold">`,
651
+ integrationId: "base"
652
+ });
653
+ lines.push({
654
+ text: ` <Link to="/">`,
655
+ integrationId: "base"
656
+ });
657
+ lines.push({
658
+ text: ` <img`,
659
+ integrationId: "base"
660
+ });
661
+ lines.push({
662
+ text: ` src="/tanstack-logo-light.svg"`,
663
+ integrationId: "base"
664
+ });
665
+ lines.push({
666
+ text: ` alt="TanStack Logo"`,
667
+ integrationId: "base"
668
+ });
669
+ lines.push({
670
+ text: ` className="h-10"`,
671
+ integrationId: "base"
672
+ });
673
+ lines.push({
674
+ text: ` />`,
675
+ integrationId: "base"
676
+ });
677
+ lines.push({
678
+ text: ` </Link>`,
679
+ integrationId: "base"
680
+ });
681
+ lines.push({
682
+ text: ` </h1>`,
683
+ integrationId: "base"
684
+ });
685
+ lines.push({
686
+ text: ` </header>`,
687
+ integrationId: "base"
688
+ });
689
+ lines.push({
690
+ text: "",
691
+ integrationId: "base"
692
+ });
693
+ lines.push({
694
+ text: ` <aside`,
695
+ integrationId: "base"
696
+ });
697
+ lines.push({
698
+ 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 \${`,
699
+ integrationId: "base"
700
+ });
701
+ lines.push({
702
+ text: ` isOpen ? 'translate-x-0' : '-translate-x-full'`,
703
+ integrationId: "base"
704
+ });
705
+ lines.push({
706
+ text: ` }\`}`,
707
+ integrationId: "base"
708
+ });
709
+ lines.push({
710
+ text: ` >`,
711
+ integrationId: "base"
712
+ });
713
+ lines.push({
714
+ text: ` <div className="flex items-center justify-between p-4 border-b border-gray-700">`,
715
+ integrationId: "base"
716
+ });
717
+ lines.push({
718
+ text: ` <h2 className="text-xl font-bold">Navigation</h2>`,
719
+ integrationId: "base"
720
+ });
721
+ lines.push({
722
+ text: ` <button`,
723
+ integrationId: "base"
724
+ });
725
+ lines.push({
726
+ text: ` onClick={() => setIsOpen(false)}`,
727
+ integrationId: "base"
728
+ });
729
+ lines.push({
730
+ text: ` className="p-2 hover:bg-gray-800 rounded-lg transition-colors"`,
731
+ integrationId: "base"
732
+ });
733
+ lines.push({
734
+ text: ` aria-label="Close menu"`,
735
+ integrationId: "base"
736
+ });
737
+ lines.push({
738
+ text: ` >`,
739
+ integrationId: "base"
740
+ });
741
+ lines.push({
742
+ text: ` <X size={24} />`,
743
+ integrationId: "base"
744
+ });
745
+ lines.push({
746
+ text: ` </button>`,
747
+ integrationId: "base"
748
+ });
749
+ lines.push({
750
+ text: ` </div>`,
751
+ integrationId: "base"
752
+ });
753
+ lines.push({
754
+ text: "",
755
+ integrationId: "base"
756
+ });
757
+ lines.push({
758
+ text: ` <nav className="flex-1 p-4 overflow-y-auto">`,
759
+ integrationId: "base"
760
+ });
761
+ lines.push({
762
+ text: ` <Link`,
763
+ integrationId: "base"
764
+ });
765
+ lines.push({
766
+ text: ` to="/"`,
767
+ integrationId: "base"
768
+ });
769
+ lines.push({
770
+ text: ` onClick={() => setIsOpen(false)}`,
771
+ integrationId: "base"
772
+ });
773
+ lines.push({
774
+ text: ` className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"`,
775
+ integrationId: "base"
776
+ });
777
+ lines.push({
778
+ text: ` activeProps={{`,
779
+ integrationId: "base"
780
+ });
781
+ lines.push({
782
+ text: ` className: 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',`,
783
+ integrationId: "base"
784
+ });
785
+ lines.push({
786
+ text: ` }}`,
787
+ integrationId: "base"
788
+ });
789
+ lines.push({
790
+ text: ` >`,
791
+ integrationId: "base"
792
+ });
793
+ lines.push({
794
+ text: ` <Home size={20} />`,
795
+ integrationId: "base"
796
+ });
797
+ lines.push({
798
+ text: ` <span className="font-medium">Home</span>`,
799
+ integrationId: "base"
800
+ });
801
+ lines.push({
802
+ text: ` </Link>`,
803
+ integrationId: "base"
804
+ });
805
+ for (const route of routes) {
806
+ const integrationId = options.chosenIntegrations.find((i) => i.routes?.some((r) => r.url === route.url))?.id || "base";
807
+ lines.push({
808
+ text: "",
809
+ integrationId
810
+ });
811
+ lines.push({
812
+ text: ` <Link`,
813
+ integrationId
814
+ });
815
+ lines.push({
816
+ text: ` to="${route.url}"`,
817
+ integrationId
818
+ });
819
+ lines.push({
820
+ text: ` onClick={() => setIsOpen(false)}`,
821
+ integrationId
822
+ });
823
+ lines.push({
824
+ text: ` className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"`,
825
+ integrationId
826
+ });
827
+ lines.push({
828
+ text: ` activeProps={{`,
829
+ integrationId
830
+ });
831
+ lines.push({
832
+ text: ` className: 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',`,
833
+ integrationId
834
+ });
835
+ lines.push({
836
+ text: ` }}`,
837
+ integrationId
838
+ });
839
+ lines.push({
840
+ text: ` >`,
841
+ integrationId
842
+ });
843
+ lines.push({
844
+ text: ` <${route.icon} size={20} />`,
845
+ integrationId
846
+ });
847
+ lines.push({
848
+ text: ` <span className="font-medium">${route.name}</span>`,
849
+ integrationId
850
+ });
851
+ lines.push({
852
+ text: ` </Link>`,
853
+ integrationId
854
+ });
855
+ }
856
+ lines.push({
857
+ text: ` </nav>`,
858
+ integrationId: "base"
859
+ });
860
+ lines.push({
861
+ text: ` </aside>`,
862
+ integrationId: "base"
863
+ });
864
+ lines.push({
865
+ text: "",
866
+ integrationId: "base"
867
+ });
868
+ lines.push({
869
+ text: ` {isOpen && (`,
870
+ integrationId: "base"
871
+ });
872
+ lines.push({
873
+ text: ` <div`,
874
+ integrationId: "base"
875
+ });
876
+ lines.push({
877
+ text: ` className="fixed inset-0 bg-black/50 z-40"`,
878
+ integrationId: "base"
879
+ });
880
+ lines.push({
881
+ text: ` onClick={() => setIsOpen(false)}`,
882
+ integrationId: "base"
883
+ });
884
+ lines.push({
885
+ text: ` />`,
886
+ integrationId: "base"
887
+ });
888
+ lines.push({
889
+ text: ` )}`,
890
+ integrationId: "base"
891
+ });
892
+ lines.push({
893
+ text: ` </>`,
894
+ integrationId: "base"
895
+ });
896
+ lines.push({
897
+ text: ` )`,
898
+ integrationId: "base"
899
+ });
900
+ lines.push({
901
+ text: `}`,
902
+ integrationId: "base"
903
+ });
904
+ return {
905
+ content: lines.map((l) => l.text).join("\n"),
906
+ lineAttributions: lines.map((l, i) => ({
907
+ line: i + 1,
908
+ integrationId: l.integrationId
909
+ }))
910
+ };
911
+ }
912
+ /**
913
+ * Generate .gitignore content with line attribution
914
+ */
915
+ function generateGitignore(integrationPatterns) {
916
+ const lines = [];
917
+ lines.push({
918
+ text: "# Dependencies",
919
+ integrationId: "base"
920
+ });
921
+ lines.push({
922
+ text: "node_modules/",
923
+ integrationId: "base"
924
+ });
925
+ lines.push({
926
+ text: ".pnpm-store/",
927
+ integrationId: "base"
928
+ });
929
+ lines.push({
930
+ text: "",
931
+ integrationId: "base"
932
+ });
933
+ lines.push({
934
+ text: "# Build outputs",
935
+ integrationId: "base"
936
+ });
937
+ lines.push({
938
+ text: "dist/",
939
+ integrationId: "base"
940
+ });
941
+ lines.push({
942
+ text: ".output/",
943
+ integrationId: "base"
944
+ });
945
+ lines.push({
946
+ text: ".vinxi/",
947
+ integrationId: "base"
948
+ });
949
+ lines.push({
950
+ text: ".vercel/",
951
+ integrationId: "base"
952
+ });
953
+ lines.push({
954
+ text: ".netlify/",
955
+ integrationId: "base"
956
+ });
957
+ lines.push({
958
+ text: "",
959
+ integrationId: "base"
960
+ });
961
+ lines.push({
962
+ text: "# Environment",
963
+ integrationId: "base"
964
+ });
965
+ lines.push({
966
+ text: ".env",
967
+ integrationId: "base"
968
+ });
969
+ lines.push({
970
+ text: ".env.*",
971
+ integrationId: "base"
972
+ });
973
+ lines.push({
974
+ text: "!.env.example",
975
+ integrationId: "base"
976
+ });
977
+ lines.push({
978
+ text: "",
979
+ integrationId: "base"
980
+ });
981
+ lines.push({
982
+ text: "# IDE",
983
+ integrationId: "base"
984
+ });
985
+ lines.push({
986
+ text: ".idea/",
987
+ integrationId: "base"
988
+ });
989
+ lines.push({
990
+ text: ".vscode/",
991
+ integrationId: "base"
992
+ });
993
+ lines.push({
994
+ text: "*.swp",
995
+ integrationId: "base"
996
+ });
997
+ lines.push({
998
+ text: "*.swo",
999
+ integrationId: "base"
1000
+ });
1001
+ lines.push({
1002
+ text: "",
1003
+ integrationId: "base"
1004
+ });
1005
+ lines.push({
1006
+ text: "# OS",
1007
+ integrationId: "base"
1008
+ });
1009
+ lines.push({
1010
+ text: ".DS_Store",
1011
+ integrationId: "base"
1012
+ });
1013
+ lines.push({
1014
+ text: "Thumbs.db",
1015
+ integrationId: "base"
1016
+ });
1017
+ lines.push({
1018
+ text: "",
1019
+ integrationId: "base"
1020
+ });
1021
+ lines.push({
1022
+ text: "# Logs",
1023
+ integrationId: "base"
1024
+ });
1025
+ lines.push({
1026
+ text: "*.log",
1027
+ integrationId: "base"
1028
+ });
1029
+ lines.push({
1030
+ text: "npm-debug.log*",
1031
+ integrationId: "base"
1032
+ });
1033
+ lines.push({
1034
+ text: "pnpm-debug.log*",
1035
+ integrationId: "base"
1036
+ });
1037
+ lines.push({
1038
+ text: "",
1039
+ integrationId: "base"
1040
+ });
1041
+ lines.push({
1042
+ text: "# Generated",
1043
+ integrationId: "base"
1044
+ });
1045
+ lines.push({
1046
+ text: "src/routeTree.gen.ts",
1047
+ integrationId: "base"
1048
+ });
1049
+ if (integrationPatterns.length > 0) {
1050
+ lines.push({
1051
+ text: "",
1052
+ integrationId: "base"
1053
+ });
1054
+ lines.push({
1055
+ text: "# Integration-specific",
1056
+ integrationId: "base"
1057
+ });
1058
+ for (const { pattern, integrationId } of integrationPatterns) lines.push({
1059
+ text: pattern,
1060
+ integrationId
1061
+ });
1062
+ }
1063
+ return {
1064
+ content: lines.map((l) => l.text).join("\n"),
1065
+ lineAttributions: lines.map((l, i) => ({
1066
+ line: i + 1,
1067
+ integrationId: l.integrationId
1068
+ }))
1069
+ };
1070
+ }
1071
+ /**
1072
+ * Get base template files (static files without hook injection)
1073
+ */
1074
+ function getBaseFiles(options) {
1075
+ const { projectName, typescript, tailwind, packageManager } = options;
1076
+ const files = {};
1077
+ const { vitePlugins, rootProviders, devtoolsPlugins, entryClientInits } = collectHooks(options);
1078
+ if (typescript) files["tsconfig.json"] = JSON.stringify({
1079
+ compilerOptions: {
1080
+ target: "ES2022",
1081
+ lib: [
1082
+ "ES2022",
1083
+ "DOM",
1084
+ "DOM.Iterable"
1085
+ ],
1086
+ module: "ESNext",
1087
+ skipLibCheck: true,
1088
+ moduleResolution: "bundler",
1089
+ allowImportingTsExtensions: true,
1090
+ resolveJsonModule: true,
1091
+ isolatedModules: true,
1092
+ moduleDetection: "force",
1093
+ noEmit: true,
1094
+ jsx: "react-jsx",
1095
+ strict: true,
1096
+ noUnusedLocals: true,
1097
+ noUnusedParameters: true,
1098
+ noFallthroughCasesInSwitch: true,
1099
+ noUncheckedIndexedAccess: true,
1100
+ paths: { "~/*": ["./src/*"] }
1101
+ },
1102
+ include: ["src"]
1103
+ }, null, 2);
1104
+ files[typescript ? "vite.config.ts" : "vite.config.js"] = generateViteConfig(options, vitePlugins).content;
1105
+ if (entryClientInits.length > 0) files[`src/entry-client.${typescript ? "tsx" : "jsx"}`] = generateEntryClient(options, entryClientInits).content;
1106
+ files[`src/router.${typescript ? "tsx" : "jsx"}`] = `import { createRouter as createTanStackRouter } from '@tanstack/react-router'
1107
+ import { routeTree } from './routeTree.gen'
1108
+
1109
+ export function getRouter() {
1110
+ const router = createTanStackRouter({
1111
+ routeTree,
1112
+ defaultPreload: 'intent',
1113
+ scrollRestoration: true,
1114
+ })
1115
+
1116
+ return router
1117
+ }
1118
+
1119
+ declare module '@tanstack/react-router' {
1120
+ interface Register {
1121
+ router: ReturnType<typeof getRouter>
1122
+ }
1123
+ }
1124
+ `;
1125
+ files[`src/routes/__root.${typescript ? "tsx" : "jsx"}`] = generateRootRoute(options, rootProviders, devtoolsPlugins).content;
1126
+ const hasHeader = options.chosenIntegrations.length > 0;
1127
+ if (hasHeader && tailwind) files[`src/components/Header.${typescript ? "tsx" : "jsx"}`] = generateHeader(options).content;
1128
+ const indexRouteWithHeader = `import { createFileRoute } from '@tanstack/react-router'
1129
+
1130
+ export const Route = createFileRoute('/')({
1131
+ component: Home,
1132
+ })
1133
+
1134
+ function Home() {
1135
+ return (
1136
+ <div className="min-h-[calc(100vh-72px)] bg-gradient-to-br from-gray-900 to-gray-800 flex items-center justify-center">
1137
+ <div className="text-center px-4">
1138
+ <img
1139
+ src="/tanstack-logo-dark.svg"
1140
+ alt="TanStack Logo"
1141
+ className="h-24 mx-auto mb-8"
1142
+ />
1143
+ <h1 className="text-5xl font-bold text-white mb-4">
1144
+ Welcome to TanStack Start
1145
+ </h1>
1146
+ <p className="text-xl text-gray-300 mb-8">
1147
+ Full-stack React framework powered by TanStack Router
1148
+ </p>
1149
+ <div className="flex gap-4 justify-center flex-wrap">
1150
+ <a
1151
+ href="https://tanstack.com/start"
1152
+ target="_blank"
1153
+ rel="noopener noreferrer"
1154
+ className="px-6 py-3 bg-cyan-500 text-white rounded-lg font-medium hover:bg-cyan-600 transition-colors"
1155
+ >
1156
+ Documentation
1157
+ </a>
1158
+ <a
1159
+ href="https://github.com/tanstack/router"
1160
+ target="_blank"
1161
+ rel="noopener noreferrer"
1162
+ className="px-6 py-3 bg-gray-700 text-white rounded-lg font-medium hover:bg-gray-600 transition-colors"
1163
+ >
1164
+ GitHub
1165
+ </a>
1166
+ </div>
1167
+ </div>
1168
+ </div>
1169
+ )
1170
+ }
1171
+ `;
1172
+ const indexRouteNoHeader = `import { createFileRoute } from '@tanstack/react-router'
1173
+
1174
+ export const Route = createFileRoute('/')({
1175
+ component: Home,
1176
+ })
1177
+
1178
+ function Home() {
1179
+ return (
1180
+ <div className="min-h-screen bg-gradient-to-br from-gray-900 to-gray-800 flex items-center justify-center">
1181
+ <div className="text-center px-4">
1182
+ <img
1183
+ src="/tanstack-logo-dark.svg"
1184
+ alt="TanStack Logo"
1185
+ className="h-24 mx-auto mb-8"
1186
+ />
1187
+ <h1 className="text-5xl font-bold text-white mb-4">
1188
+ Welcome to TanStack Start
1189
+ </h1>
1190
+ <p className="text-xl text-gray-300 mb-8">
1191
+ Full-stack React framework powered by TanStack Router
1192
+ </p>
1193
+ <div className="flex gap-4 justify-center flex-wrap">
1194
+ <a
1195
+ href="https://tanstack.com/start"
1196
+ target="_blank"
1197
+ rel="noopener noreferrer"
1198
+ className="px-6 py-3 bg-cyan-500 text-white rounded-lg font-medium hover:bg-cyan-600 transition-colors"
1199
+ >
1200
+ Documentation
1201
+ </a>
1202
+ <a
1203
+ href="https://github.com/tanstack/router"
1204
+ target="_blank"
1205
+ rel="noopener noreferrer"
1206
+ className="px-6 py-3 bg-gray-700 text-white rounded-lg font-medium hover:bg-gray-600 transition-colors"
1207
+ >
1208
+ GitHub
1209
+ </a>
1210
+ </div>
1211
+ </div>
1212
+ </div>
1213
+ )
1214
+ }
1215
+ `;
1216
+ const indexRouteNoTailwind = `import { createFileRoute } from '@tanstack/react-router'
1217
+
1218
+ export const Route = createFileRoute('/')({
1219
+ component: Home,
1220
+ })
1221
+
1222
+ function Home() {
1223
+ return (
1224
+ <div style={styles.container}>
1225
+ <div style={styles.content}>
1226
+ <img
1227
+ src="/tanstack-logo-dark.svg"
1228
+ alt="TanStack Logo"
1229
+ style={styles.logo}
1230
+ />
1231
+ <h1 style={styles.title}>Welcome to TanStack Start</h1>
1232
+ <p style={styles.subtitle}>
1233
+ Full-stack React framework powered by TanStack Router
1234
+ </p>
1235
+ <div style={styles.buttons}>
1236
+ <a
1237
+ href="https://tanstack.com/start"
1238
+ target="_blank"
1239
+ rel="noopener noreferrer"
1240
+ style={styles.primaryButton}
1241
+ >
1242
+ Documentation
1243
+ </a>
1244
+ <a
1245
+ href="https://github.com/tanstack/router"
1246
+ target="_blank"
1247
+ rel="noopener noreferrer"
1248
+ style={styles.secondaryButton}
1249
+ >
1250
+ GitHub
1251
+ </a>
1252
+ </div>
1253
+ </div>
1254
+ </div>
1255
+ )
1256
+ }
1257
+
1258
+ const styles = {
1259
+ container: {
1260
+ minHeight: '100vh',
1261
+ background: 'linear-gradient(to bottom right, #111827, #1f2937)',
1262
+ display: 'flex',
1263
+ alignItems: 'center',
1264
+ justifyContent: 'center',
1265
+ },
1266
+ content: {
1267
+ textAlign: 'center' as const,
1268
+ padding: '0 1rem',
1269
+ },
1270
+ logo: {
1271
+ height: '6rem',
1272
+ marginBottom: '2rem',
1273
+ },
1274
+ title: {
1275
+ fontSize: '3rem',
1276
+ fontWeight: 'bold',
1277
+ color: 'white',
1278
+ marginBottom: '1rem',
1279
+ },
1280
+ subtitle: {
1281
+ fontSize: '1.25rem',
1282
+ color: '#d1d5db',
1283
+ marginBottom: '2rem',
1284
+ },
1285
+ buttons: {
1286
+ display: 'flex',
1287
+ gap: '1rem',
1288
+ justifyContent: 'center',
1289
+ flexWrap: 'wrap' as const,
1290
+ },
1291
+ primaryButton: {
1292
+ padding: '0.75rem 1.5rem',
1293
+ backgroundColor: '#06b6d4',
1294
+ color: 'white',
1295
+ borderRadius: '0.5rem',
1296
+ fontWeight: 500,
1297
+ textDecoration: 'none',
1298
+ },
1299
+ secondaryButton: {
1300
+ padding: '0.75rem 1.5rem',
1301
+ backgroundColor: '#374151',
1302
+ color: 'white',
1303
+ borderRadius: '0.5rem',
1304
+ fontWeight: 500,
1305
+ textDecoration: 'none',
1306
+ },
1307
+ }
1308
+ `;
1309
+ if (tailwind) files[`src/routes/index.${typescript ? "tsx" : "jsx"}`] = hasHeader ? indexRouteWithHeader : indexRouteNoHeader;
1310
+ else files[`src/routes/index.${typescript ? "tsx" : "jsx"}`] = indexRouteNoTailwind;
1311
+ if (tailwind) files["src/styles.css"] = `@import 'tailwindcss';
1312
+
1313
+ body {
1314
+ @apply m-0;
1315
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
1316
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
1317
+ sans-serif;
1318
+ -webkit-font-smoothing: antialiased;
1319
+ -moz-osx-font-smoothing: grayscale;
1320
+ }
1321
+
1322
+ code {
1323
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1324
+ monospace;
1325
+ }
1326
+ `;
1327
+ else files["src/styles.css"] = `* {
1328
+ box-sizing: border-box;
1329
+ margin: 0;
1330
+ padding: 0;
1331
+ }
1332
+
1333
+ body {
1334
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
1335
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
1336
+ sans-serif;
1337
+ -webkit-font-smoothing: antialiased;
1338
+ -moz-osx-font-smoothing: grayscale;
1339
+ line-height: 1.5;
1340
+ }
1341
+
1342
+ code {
1343
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1344
+ monospace;
1345
+ }
1346
+ `;
1347
+ 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>`;
1348
+ 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>`;
1349
+ const gitignorePatterns = [];
1350
+ for (const integration of options.chosenIntegrations) if (integration.gitignorePatterns) for (const pattern of integration.gitignorePatterns) gitignorePatterns.push({
1351
+ pattern,
1352
+ integrationId: integration.id
1353
+ });
1354
+ files[".gitignore"] = generateGitignore(gitignorePatterns).content;
1355
+ files[".env.example"] = `# Add your environment variables here
1356
+ # Copy this file to .env.local and fill in your values
1357
+
1358
+ # Example:
1359
+ # DATABASE_URL=postgresql://user:password@localhost:5432/db
1360
+ `;
1361
+ files["README.md"] = `# ${projectName}
1362
+
1363
+ A full-stack React application built with [TanStack Start](https://tanstack.com/start).
1364
+
1365
+ ## Getting Started
1366
+
1367
+ \`\`\`bash
1368
+ # Install dependencies
1369
+ ${packageManager} install
1370
+
1371
+ # Start development server
1372
+ ${packageManager}${packageManager === "npm" ? " run" : ""} dev
1373
+ \`\`\`
1374
+
1375
+ ## Scripts
1376
+
1377
+ - \`dev\` - Start development server
1378
+ - \`build\` - Build for production
1379
+ - \`start\` - Start production server
1380
+
1381
+ ## Learn More
1382
+
1383
+ - [TanStack Start Documentation](https://tanstack.com/start)
1384
+ - [TanStack Router Documentation](https://tanstack.com/router)
1385
+ `;
1386
+ return files;
1387
+ }
1388
+ /**
1389
+ * Get base files WITH line-by-line attribution for files that have hooks
1390
+ */
1391
+ function getBaseFilesWithAttribution(options) {
1392
+ const { typescript } = options;
1393
+ const files = getBaseFiles(options);
1394
+ const attributions = {};
1395
+ const { vitePlugins, rootProviders, devtoolsPlugins, entryClientInits } = collectHooks(options);
1396
+ attributions[typescript ? "vite.config.ts" : "vite.config.js"] = generateViteConfig(options, vitePlugins).lineAttributions;
1397
+ if (entryClientInits.length > 0) attributions[`src/entry-client.${typescript ? "tsx" : "jsx"}`] = generateEntryClient(options, entryClientInits).lineAttributions;
1398
+ attributions[`src/routes/__root.${typescript ? "tsx" : "jsx"}`] = generateRootRoute(options, rootProviders, devtoolsPlugins).lineAttributions;
1399
+ const gitignorePatterns = [];
1400
+ for (const integration of options.chosenIntegrations) if (integration.gitignorePatterns) for (const pattern of integration.gitignorePatterns) gitignorePatterns.push({
1401
+ pattern,
1402
+ integrationId: integration.id
1403
+ });
1404
+ attributions[".gitignore"] = generateGitignore(gitignorePatterns).lineAttributions;
1405
+ return {
1406
+ files,
1407
+ attributions
1408
+ };
1409
+ }
1410
+
1411
+ //#endregion
1412
+ //#region src/engine/compile.ts
1413
+ /**
1414
+ * Merge package contributions from integrations
1415
+ */
1416
+ function mergePackages(target, source) {
1417
+ if (!source) return;
1418
+ if (source.dependencies) target.dependencies = {
1419
+ ...target.dependencies,
1420
+ ...source.dependencies
1421
+ };
1422
+ if (source.devDependencies) target.devDependencies = {
1423
+ ...target.devDependencies,
1424
+ ...source.devDependencies
1425
+ };
1426
+ if (source.scripts) target.scripts = {
1427
+ ...target.scripts,
1428
+ ...source.scripts
1429
+ };
1430
+ }
1431
+ function mergePackagesWithAttribution(target, source, integrationId, attribution) {
1432
+ if (!source) return;
1433
+ if (source.dependencies) {
1434
+ for (const pkg of Object.keys(source.dependencies)) attribution.dependencies.set(pkg, integrationId);
1435
+ target.dependencies = {
1436
+ ...target.dependencies,
1437
+ ...source.dependencies
1438
+ };
1439
+ }
1440
+ if (source.devDependencies) {
1441
+ for (const pkg of Object.keys(source.devDependencies)) attribution.devDependencies.set(pkg, integrationId);
1442
+ target.devDependencies = {
1443
+ ...target.devDependencies,
1444
+ ...source.devDependencies
1445
+ };
1446
+ }
1447
+ if (source.scripts) {
1448
+ for (const script of Object.keys(source.scripts)) attribution.scripts.set(script, integrationId);
1449
+ target.scripts = {
1450
+ ...target.scripts,
1451
+ ...source.scripts
1452
+ };
1453
+ }
1454
+ }
1455
+ /**
1456
+ * Process all files from an integration
1457
+ */
1458
+ function processIntegrationFiles(integration, options, files, appendFiles) {
1459
+ for (const [filePath, content] of Object.entries(integration.files)) {
1460
+ const processed = processTemplateFile(filePath, content, options);
1461
+ if (!processed) continue;
1462
+ if (processed.append) {
1463
+ if (!appendFiles.has(processed.path)) appendFiles.set(processed.path, []);
1464
+ appendFiles.get(processed.path).push({
1465
+ content: processed.content,
1466
+ integrationId: integration.id
1467
+ });
1468
+ } else files.set(processed.path, {
1469
+ content: processed.content,
1470
+ integrationId: integration.id
1471
+ });
1472
+ }
1473
+ }
1474
+ /**
1475
+ * Build the package.json content
1476
+ */
1477
+ function buildPackageJson(options, packages) {
1478
+ const hasHeader = options.chosenIntegrations.length > 0 && options.tailwind;
1479
+ const pkg = {
1480
+ name: options.projectName,
1481
+ private: true,
1482
+ type: "module",
1483
+ scripts: {
1484
+ dev: "vite dev --port 3000",
1485
+ build: "vite build",
1486
+ start: "node .output/server/index.mjs",
1487
+ ...packages.scripts
1488
+ },
1489
+ dependencies: {
1490
+ "@tanstack/react-router": "^1.132.0",
1491
+ "@tanstack/react-router-devtools": "^1.132.0",
1492
+ "@tanstack/react-start": "^1.132.0",
1493
+ react: "^19.0.0",
1494
+ "react-dom": "^19.0.0",
1495
+ "vite-tsconfig-paths": "^5.1.4",
1496
+ ...hasHeader ? { "lucide-react": "^0.468.0" } : {},
1497
+ ...packages.dependencies
1498
+ },
1499
+ devDependencies: {
1500
+ "@vitejs/plugin-react": "^4.4.1",
1501
+ vite: "^7.0.0",
1502
+ ...options.typescript ? {
1503
+ "@types/react": "^19.0.0",
1504
+ "@types/react-dom": "^19.0.0",
1505
+ typescript: "^5.7.0"
1506
+ } : {},
1507
+ ...options.tailwind ? {
1508
+ "@tailwindcss/vite": "^4.0.0",
1509
+ tailwindcss: "^4.0.0"
1510
+ } : {},
1511
+ ...packages.devDependencies
1512
+ }
1513
+ };
1514
+ return JSON.stringify(pkg, null, 2);
1515
+ }
1516
+ /**
1517
+ * Compile a project from options
1518
+ */
1519
+ function compile(options) {
1520
+ const files = /* @__PURE__ */ new Map();
1521
+ const appendFiles = /* @__PURE__ */ new Map();
1522
+ const packages = {
1523
+ dependencies: {},
1524
+ devDependencies: {},
1525
+ scripts: {}
1526
+ };
1527
+ const envVars = [];
1528
+ const warnings = [];
1529
+ const baseFiles = getBaseFiles(options);
1530
+ for (const [path, content] of Object.entries(baseFiles)) files.set(path, {
1531
+ content,
1532
+ integrationId: "base"
1533
+ });
1534
+ const sortedIntegrations = [...options.chosenIntegrations].sort((a, b) => {
1535
+ const phaseOrder = {
1536
+ setup: 0,
1537
+ integration: 1,
1538
+ example: 2
1539
+ };
1540
+ const phaseA = phaseOrder[a.phase];
1541
+ const phaseB = phaseOrder[b.phase];
1542
+ if (phaseA !== phaseB) return phaseA - phaseB;
1543
+ return (a.priority ?? 100) - (b.priority ?? 100);
1544
+ });
1545
+ for (const integration of sortedIntegrations) {
1546
+ processIntegrationFiles(integration, options, files, appendFiles);
1547
+ mergePackages(packages, integration.packageAdditions);
1548
+ if (integration.envVars) envVars.push(...integration.envVars);
1549
+ if (integration.warning) warnings.push(`${integration.name}: ${integration.warning}`);
1550
+ }
1551
+ for (const [path, appends] of appendFiles) {
1552
+ const existing = files.get(path);
1553
+ if (existing) {
1554
+ const appendContent = appends.map((a) => a.content).join("\n");
1555
+ existing.content = existing.content + "\n" + appendContent;
1556
+ } else files.set(path, {
1557
+ content: appends.map((a) => a.content).join("\n"),
1558
+ integrationId: appends[0]?.integrationId ?? "base"
1559
+ });
1560
+ }
1561
+ const outputFiles = {};
1562
+ for (const [path, { content }] of files) outputFiles[path] = content;
1563
+ outputFiles["package.json"] = buildPackageJson(options, packages);
1564
+ const seenEnvVars = /* @__PURE__ */ new Set();
1565
+ return {
1566
+ files: outputFiles,
1567
+ packages,
1568
+ envVars: envVars.filter((v) => {
1569
+ if (seenEnvVars.has(v.name)) return false;
1570
+ seenEnvVars.add(v.name);
1571
+ return true;
1572
+ }),
1573
+ warnings
1574
+ };
1575
+ }
1576
+ /**
1577
+ * Compile with line-by-line attribution tracking
1578
+ */
1579
+ function compileWithAttribution(options) {
1580
+ const files = /* @__PURE__ */ new Map();
1581
+ const appendFiles = /* @__PURE__ */ new Map();
1582
+ const packages = {
1583
+ dependencies: {},
1584
+ devDependencies: {},
1585
+ scripts: {}
1586
+ };
1587
+ const packageAttribution = {
1588
+ dependencies: /* @__PURE__ */ new Map(),
1589
+ devDependencies: /* @__PURE__ */ new Map(),
1590
+ scripts: /* @__PURE__ */ new Map()
1591
+ };
1592
+ const envVars = [];
1593
+ const warnings = [];
1594
+ const fileOwnership = /* @__PURE__ */ new Map();
1595
+ const { files: baseFiles, attributions: baseAttributions } = getBaseFilesWithAttribution(options);
1596
+ for (const [path, content] of Object.entries(baseFiles)) {
1597
+ files.set(path, {
1598
+ content,
1599
+ integrationId: "base"
1600
+ });
1601
+ fileOwnership.set(path, "base");
1602
+ }
1603
+ const hookAttributions = /* @__PURE__ */ new Map();
1604
+ for (const [path, attrs] of Object.entries(baseAttributions)) hookAttributions.set(path, attrs);
1605
+ const sortedIntegrations = [...options.chosenIntegrations].sort((a, b) => {
1606
+ const phaseOrder = {
1607
+ setup: 0,
1608
+ integration: 1,
1609
+ example: 2
1610
+ };
1611
+ const phaseA = phaseOrder[a.phase];
1612
+ const phaseB = phaseOrder[b.phase];
1613
+ if (phaseA !== phaseB) return phaseA - phaseB;
1614
+ return (a.priority ?? 100) - (b.priority ?? 100);
1615
+ });
1616
+ const integrationNames = /* @__PURE__ */ new Map();
1617
+ integrationNames.set("base", "Base Template");
1618
+ if (options.customTemplate) integrationNames.set(options.customTemplate.id, options.customTemplate.name);
1619
+ for (const integration of sortedIntegrations) integrationNames.set(integration.id, integration.name);
1620
+ for (const integration of sortedIntegrations) {
1621
+ for (const [filePath, content] of Object.entries(integration.files)) {
1622
+ const processed = processTemplateFile(filePath, content, options);
1623
+ if (!processed) continue;
1624
+ if (processed.append) {
1625
+ if (!appendFiles.has(processed.path)) appendFiles.set(processed.path, []);
1626
+ appendFiles.get(processed.path).push({
1627
+ content: processed.content,
1628
+ integrationId: integration.id
1629
+ });
1630
+ } else {
1631
+ files.set(processed.path, {
1632
+ content: processed.content,
1633
+ integrationId: integration.id
1634
+ });
1635
+ fileOwnership.set(processed.path, integration.id);
1636
+ }
1637
+ }
1638
+ mergePackagesWithAttribution(packages, integration.packageAdditions, integration.id, packageAttribution);
1639
+ if (integration.envVars) for (const envVar of integration.envVars) envVars.push({
1640
+ ...envVar,
1641
+ integrationId: integration.id
1642
+ });
1643
+ if (integration.warning) warnings.push(`${integration.name}: ${integration.warning}`);
1644
+ }
1645
+ const appendOwnership = /* @__PURE__ */ new Map();
1646
+ for (const [path, appends] of appendFiles) {
1647
+ const existing = files.get(path);
1648
+ if (existing) {
1649
+ const existingLines = existing.content.split("\n").length;
1650
+ const lineMap = /* @__PURE__ */ new Map();
1651
+ let currentLine = existingLines + 1;
1652
+ for (const append of appends) {
1653
+ const appendLines = append.content.split("\n").length;
1654
+ for (let i = 0; i < appendLines; i++) lineMap.set(currentLine + i, append.integrationId);
1655
+ currentLine += appendLines + 1;
1656
+ }
1657
+ appendOwnership.set(path, lineMap);
1658
+ const appendContent = appends.map((a) => a.content).join("\n");
1659
+ existing.content = existing.content + "\n" + appendContent;
1660
+ } else {
1661
+ files.set(path, {
1662
+ content: appends.map((a) => a.content).join("\n"),
1663
+ integrationId: appends[0]?.integrationId ?? "base"
1664
+ });
1665
+ fileOwnership.set(path, appends[0]?.integrationId ?? "base");
1666
+ }
1667
+ }
1668
+ const outputFiles = {};
1669
+ const attributedFiles = {};
1670
+ for (const [path, { content, integrationId }] of files) {
1671
+ outputFiles[path] = content;
1672
+ const lines = content.split("\n");
1673
+ const attributions = [];
1674
+ const appendLineMap = appendOwnership.get(path);
1675
+ const hookAttrMap = hookAttributions.get(path);
1676
+ for (let i = 0; i < lines.length; i++) {
1677
+ const lineNumber = i + 1;
1678
+ let owningIntegrationId = integrationId;
1679
+ const appendIntegrationId = appendLineMap?.get(lineNumber);
1680
+ const hookAttr = hookAttrMap?.find((a) => a.line === lineNumber);
1681
+ if (appendIntegrationId) owningIntegrationId = appendIntegrationId;
1682
+ else if (hookAttr) owningIntegrationId = hookAttr.integrationId;
1683
+ attributions.push({
1684
+ lineNumber,
1685
+ featureId: owningIntegrationId,
1686
+ featureName: integrationNames.get(owningIntegrationId) || owningIntegrationId
1687
+ });
1688
+ }
1689
+ attributedFiles[path] = {
1690
+ path,
1691
+ content,
1692
+ attributions
1693
+ };
1694
+ }
1695
+ outputFiles["package.json"] = buildPackageJson(options, packages);
1696
+ const pkgJsonLines = outputFiles["package.json"].split("\n");
1697
+ const pkgJsonAttributions = [];
1698
+ for (let i = 0; i < pkgJsonLines.length; i++) {
1699
+ const line = pkgJsonLines[i];
1700
+ const lineNumber = i + 1;
1701
+ let integrationId = "base";
1702
+ const match = line.match(/^\s*"([^"]+)":\s*"[^"]+"/);
1703
+ if (match) {
1704
+ const pkgName = match[1];
1705
+ const depIntegration = packageAttribution.dependencies.get(pkgName);
1706
+ const devDepIntegration = packageAttribution.devDependencies.get(pkgName);
1707
+ const scriptIntegration = packageAttribution.scripts.get(pkgName);
1708
+ if (depIntegration) integrationId = depIntegration;
1709
+ else if (devDepIntegration) integrationId = devDepIntegration;
1710
+ else if (scriptIntegration) integrationId = scriptIntegration;
1711
+ }
1712
+ pkgJsonAttributions.push({
1713
+ lineNumber,
1714
+ featureId: integrationId,
1715
+ featureName: integrationNames.get(integrationId) || integrationId
1716
+ });
1717
+ }
1718
+ attributedFiles["package.json"] = {
1719
+ path: "package.json",
1720
+ content: outputFiles["package.json"],
1721
+ attributions: pkgJsonAttributions
1722
+ };
1723
+ const seenEnvVars = /* @__PURE__ */ new Set();
1724
+ const uniqueEnvVars = envVars.filter((v) => {
1725
+ if (seenEnvVars.has(v.name)) return false;
1726
+ seenEnvVars.add(v.name);
1727
+ return true;
1728
+ });
1729
+ if (uniqueEnvVars.length > 0) {
1730
+ const envLines = [];
1731
+ envLines.push({
1732
+ text: "# Environment Variables",
1733
+ integrationId: "base"
1734
+ });
1735
+ envLines.push({
1736
+ text: "# Copy this file to .env.local and fill in your values",
1737
+ integrationId: "base"
1738
+ });
1739
+ envLines.push({
1740
+ text: "",
1741
+ integrationId: "base"
1742
+ });
1743
+ const envByIntegration = /* @__PURE__ */ new Map();
1744
+ for (const envVar of uniqueEnvVars) {
1745
+ const id = envVar.integrationId;
1746
+ if (!envByIntegration.has(id)) envByIntegration.set(id, []);
1747
+ envByIntegration.get(id).push(envVar);
1748
+ }
1749
+ for (const [integrationId, vars] of envByIntegration) {
1750
+ const integrationName = integrationNames.get(integrationId) || integrationId;
1751
+ envLines.push({
1752
+ text: `# ${integrationName}`,
1753
+ integrationId
1754
+ });
1755
+ for (const v of vars) {
1756
+ envLines.push({
1757
+ text: `# ${v.description}${v.required ? " (required)" : ""}`,
1758
+ integrationId
1759
+ });
1760
+ envLines.push({
1761
+ text: `${v.name}=${v.example || ""}`,
1762
+ integrationId
1763
+ });
1764
+ }
1765
+ envLines.push({
1766
+ text: "",
1767
+ integrationId: "base"
1768
+ });
1769
+ }
1770
+ const envContent = envLines.map((l) => l.text).join("\n");
1771
+ outputFiles[".env.example"] = envContent;
1772
+ attributedFiles[".env.example"] = {
1773
+ path: ".env.example",
1774
+ content: envContent,
1775
+ attributions: envLines.map((l, i) => ({
1776
+ lineNumber: i + 1,
1777
+ featureId: l.integrationId,
1778
+ featureName: integrationNames.get(l.integrationId) || l.integrationId
1779
+ }))
1780
+ };
1781
+ }
1782
+ return {
1783
+ files: outputFiles,
1784
+ packages,
1785
+ envVars: uniqueEnvVars.map(({ integrationId, ...rest }) => rest),
1786
+ warnings,
1787
+ attributedFiles
1788
+ };
1789
+ }
1790
+
1791
+ //#endregion
1792
+ //#region src/engine/config-file.ts
1793
+ const CONFIG_FILE = ".tanstack.json";
1794
+ function createPersistedOptions(options) {
1795
+ return {
1796
+ version: 1,
1797
+ projectName: options.projectName,
1798
+ framework: options.framework,
1799
+ mode: options.mode,
1800
+ typescript: options.typescript,
1801
+ tailwind: options.tailwind,
1802
+ packageManager: options.packageManager,
1803
+ chosenIntegrations: options.chosenIntegrations.map((integration) => integration.id),
1804
+ customTemplate: options.customTemplate?.id
1805
+ };
1806
+ }
1807
+ async function writeConfigFile(targetDir, options) {
1808
+ await (0, node_fs_promises.writeFile)((0, node_path.resolve)(targetDir, CONFIG_FILE), JSON.stringify(createPersistedOptions(options), null, 2));
1809
+ }
1810
+ async function readConfigFile(targetDir) {
1811
+ const configPath = (0, node_path.resolve)(targetDir, CONFIG_FILE);
1812
+ if (!(0, node_fs.existsSync)(configPath)) return null;
1813
+ try {
1814
+ const content = await (0, node_fs_promises.readFile)(configPath, "utf-8");
1815
+ return JSON.parse(content);
1816
+ } catch {
1817
+ return null;
1818
+ }
1819
+ }
1820
+
1821
+ //#endregion
1822
+ //#region src/engine/types.ts
1823
+ const CategorySchema = zod.z.enum([
1824
+ "tanstack",
1825
+ "database",
1826
+ "orm",
1827
+ "auth",
1828
+ "deploy",
1829
+ "tooling",
1830
+ "monitoring",
1831
+ "api",
1832
+ "i18n",
1833
+ "cms",
1834
+ "other"
1835
+ ]);
1836
+ const IntegrationTypeSchema = zod.z.enum([
1837
+ "integration",
1838
+ "example",
1839
+ "toolchain",
1840
+ "deployment"
1841
+ ]);
1842
+ const IntegrationPhaseSchema = zod.z.enum([
1843
+ "setup",
1844
+ "integration",
1845
+ "example"
1846
+ ]);
1847
+ const RouterModeSchema = zod.z.enum(["file-router", "code-router"]);
1848
+ const SelectOptionSchema = zod.z.object({
1849
+ type: zod.z.literal("select"),
1850
+ label: zod.z.string(),
1851
+ description: zod.z.string().optional(),
1852
+ default: zod.z.string(),
1853
+ options: zod.z.array(zod.z.object({
1854
+ value: zod.z.string(),
1855
+ label: zod.z.string()
1856
+ }))
1857
+ });
1858
+ const BooleanOptionSchema = zod.z.object({
1859
+ type: zod.z.literal("boolean"),
1860
+ label: zod.z.string(),
1861
+ description: zod.z.string().optional(),
1862
+ default: zod.z.boolean()
1863
+ });
1864
+ const StringOptionSchema = zod.z.object({
1865
+ type: zod.z.literal("string"),
1866
+ label: zod.z.string(),
1867
+ description: zod.z.string().optional(),
1868
+ default: zod.z.string()
1869
+ });
1870
+ const IntegrationOptionSchema = zod.z.discriminatedUnion("type", [
1871
+ SelectOptionSchema,
1872
+ BooleanOptionSchema,
1873
+ StringOptionSchema
1874
+ ]);
1875
+ const IntegrationOptionsSchema = zod.z.record(zod.z.string(), IntegrationOptionSchema);
1876
+ const HookTypeSchema = zod.z.enum([
1877
+ "header-user",
1878
+ "provider",
1879
+ "root-provider",
1880
+ "layout",
1881
+ "vite-plugin",
1882
+ "devtools",
1883
+ "entry-client"
1884
+ ]);
1885
+ const HookSchema = zod.z.object({
1886
+ type: HookTypeSchema.optional(),
1887
+ path: zod.z.string().optional(),
1888
+ jsName: zod.z.string().optional(),
1889
+ import: zod.z.string().optional(),
1890
+ code: zod.z.string().optional()
1891
+ });
1892
+ const RouteSchema = zod.z.object({
1893
+ url: zod.z.string().optional(),
1894
+ name: zod.z.string().optional(),
1895
+ icon: zod.z.string().optional(),
1896
+ path: zod.z.string(),
1897
+ jsName: zod.z.string(),
1898
+ children: zod.z.array(zod.z.lazy(() => RouteSchema)).optional()
1899
+ });
1900
+ const EnvVarSchema = zod.z.object({
1901
+ name: zod.z.string(),
1902
+ description: zod.z.string(),
1903
+ required: zod.z.boolean().optional(),
1904
+ example: zod.z.string().optional()
1905
+ });
1906
+ const CommandSchema = zod.z.object({
1907
+ command: zod.z.string(),
1908
+ args: zod.z.array(zod.z.string()).optional()
1909
+ });
1910
+ const IntegrationInfoSchema = zod.z.object({
1911
+ id: zod.z.string().optional(),
1912
+ name: zod.z.string(),
1913
+ description: zod.z.string(),
1914
+ author: zod.z.string().optional(),
1915
+ version: zod.z.string().optional(),
1916
+ link: zod.z.string().optional(),
1917
+ license: zod.z.string().optional(),
1918
+ warning: zod.z.string().optional(),
1919
+ type: IntegrationTypeSchema,
1920
+ phase: IntegrationPhaseSchema,
1921
+ category: CategorySchema.optional(),
1922
+ modes: zod.z.array(RouterModeSchema),
1923
+ priority: zod.z.number().optional(),
1924
+ default: zod.z.boolean().optional(),
1925
+ requiresTailwind: zod.z.boolean().optional(),
1926
+ demoRequiresTailwind: zod.z.boolean().optional(),
1927
+ dependsOn: zod.z.array(zod.z.string()).optional(),
1928
+ conflicts: zod.z.array(zod.z.string()).optional(),
1929
+ partnerId: zod.z.string().optional(),
1930
+ options: IntegrationOptionsSchema.optional(),
1931
+ hooks: zod.z.array(HookSchema).optional(),
1932
+ routes: zod.z.array(RouteSchema).optional(),
1933
+ packageAdditions: zod.z.object({
1934
+ dependencies: zod.z.record(zod.z.string(), zod.z.string()).optional(),
1935
+ devDependencies: zod.z.record(zod.z.string(), zod.z.string()).optional(),
1936
+ scripts: zod.z.record(zod.z.string(), zod.z.string()).optional()
1937
+ }).optional(),
1938
+ shadcnComponents: zod.z.array(zod.z.string()).optional(),
1939
+ gitignorePatterns: zod.z.array(zod.z.string()).optional(),
1940
+ envVars: zod.z.array(EnvVarSchema).optional(),
1941
+ command: CommandSchema.optional(),
1942
+ integrationSpecialSteps: zod.z.array(zod.z.string()).optional(),
1943
+ createSpecialSteps: zod.z.array(zod.z.string()).optional(),
1944
+ postInitSpecialSteps: zod.z.array(zod.z.string()).optional(),
1945
+ smallLogo: zod.z.string().optional(),
1946
+ logo: zod.z.string().optional(),
1947
+ readme: zod.z.string().optional()
1948
+ });
1949
+ const IntegrationCompiledSchema = IntegrationInfoSchema.extend({
1950
+ id: zod.z.string(),
1951
+ files: zod.z.record(zod.z.string(), zod.z.string()),
1952
+ deletedFiles: zod.z.array(zod.z.string()).optional()
1953
+ });
1954
+ const CustomTemplateInfoSchema = zod.z.object({
1955
+ id: zod.z.string().optional(),
1956
+ name: zod.z.string(),
1957
+ description: zod.z.string(),
1958
+ framework: zod.z.string(),
1959
+ mode: RouterModeSchema,
1960
+ typescript: zod.z.boolean(),
1961
+ tailwind: zod.z.boolean(),
1962
+ integrations: zod.z.array(zod.z.string()),
1963
+ integrationOptions: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())).optional(),
1964
+ banner: zod.z.string().optional()
1965
+ });
1966
+ const CustomTemplateCompiledSchema = CustomTemplateInfoSchema.extend({ id: zod.z.string() });
1967
+ const ManifestIntegrationSchema = zod.z.object({
1968
+ id: zod.z.string(),
1969
+ name: zod.z.string(),
1970
+ description: zod.z.string(),
1971
+ type: IntegrationTypeSchema,
1972
+ category: CategorySchema.optional(),
1973
+ modes: zod.z.array(RouterModeSchema),
1974
+ dependsOn: zod.z.array(zod.z.string()).optional(),
1975
+ conflicts: zod.z.array(zod.z.string()).optional(),
1976
+ partnerId: zod.z.string().optional(),
1977
+ hasOptions: zod.z.boolean().optional(),
1978
+ link: zod.z.string().optional(),
1979
+ color: zod.z.string().optional(),
1980
+ requiresTailwind: zod.z.boolean().optional(),
1981
+ demoRequiresTailwind: zod.z.boolean().optional()
1982
+ });
1983
+ const ManifestCustomTemplateSchema = zod.z.object({
1984
+ id: zod.z.string(),
1985
+ name: zod.z.string(),
1986
+ description: zod.z.string(),
1987
+ banner: zod.z.string().optional(),
1988
+ icon: zod.z.string().optional(),
1989
+ features: zod.z.array(zod.z.string()).optional()
1990
+ });
1991
+ const ManifestSchema = zod.z.object({
1992
+ version: zod.z.string(),
1993
+ generated: zod.z.string(),
1994
+ integrations: zod.z.array(ManifestIntegrationSchema),
1995
+ customTemplates: zod.z.array(ManifestCustomTemplateSchema).optional()
1996
+ });
1997
+
1998
+ //#endregion
1999
+ //#region src/api/fetch.ts
2000
+ const GITHUB_RAW_BASE = "https://raw.githubusercontent.com/TanStack/cli/main/integrations";
2001
+ /**
2002
+ * Check if a path is a local directory
2003
+ */
2004
+ function isLocalPath(path) {
2005
+ return path.startsWith("/") || path.startsWith("./") || path.startsWith("..");
2006
+ }
2007
+ /**
2008
+ * Fetch the integration manifest from GitHub or local path
2009
+ */
2010
+ async function fetchManifest(baseUrl = GITHUB_RAW_BASE) {
2011
+ if (isLocalPath(baseUrl)) {
2012
+ const manifestPath = (0, node_path.join)(baseUrl, "manifest.json");
2013
+ if (!(0, node_fs.existsSync)(manifestPath)) throw new Error(`Manifest not found at ${manifestPath}`);
2014
+ const data$1 = JSON.parse((0, node_fs.readFileSync)(manifestPath, "utf-8"));
2015
+ return ManifestSchema.parse(data$1);
2016
+ }
2017
+ const url = `${baseUrl}/manifest.json`;
2018
+ const response = await fetch(url);
2019
+ if (!response.ok) throw new Error(`Failed to fetch manifest: ${response.statusText}`);
2020
+ const data = await response.json();
2021
+ return ManifestSchema.parse(data);
2022
+ }
2023
+ /**
2024
+ * Fetch integration info.json from GitHub or local path
2025
+ */
2026
+ async function fetchIntegrationInfo(integrationId, baseUrl = GITHUB_RAW_BASE) {
2027
+ if (isLocalPath(baseUrl)) {
2028
+ const infoPath = (0, node_path.join)(baseUrl, integrationId, "info.json");
2029
+ if (!(0, node_fs.existsSync)(infoPath)) throw new Error(`Integration info not found at ${infoPath}`);
2030
+ const data$1 = JSON.parse((0, node_fs.readFileSync)(infoPath, "utf-8"));
2031
+ return IntegrationInfoSchema.parse(data$1);
2032
+ }
2033
+ const url = `${baseUrl}/${integrationId}/info.json`;
2034
+ const response = await fetch(url);
2035
+ if (!response.ok) throw new Error(`Failed to fetch integration ${integrationId}: ${response.statusText}`);
2036
+ const data = await response.json();
2037
+ return IntegrationInfoSchema.parse(data);
2038
+ }
2039
+ /**
2040
+ * Recursively read all files from a directory
2041
+ */
2042
+ function readDirRecursive(dir, basePath = "") {
2043
+ const files = {};
2044
+ if (!(0, node_fs.existsSync)(dir)) return files;
2045
+ for (const entry of (0, node_fs.readdirSync)(dir)) {
2046
+ const fullPath = (0, node_path.join)(dir, entry);
2047
+ const relativePath$1 = basePath ? `${basePath}/${entry}` : entry;
2048
+ if ((0, node_fs.statSync)(fullPath).isDirectory()) Object.assign(files, readDirRecursive(fullPath, relativePath$1));
2049
+ else files[relativePath$1] = (0, node_fs.readFileSync)(fullPath, "utf-8");
2050
+ }
2051
+ return files;
2052
+ }
2053
+ /**
2054
+ * Fetch all files for an integration from GitHub or local path
2055
+ */
2056
+ async function fetchIntegrationFiles(integrationId, baseUrl = GITHUB_RAW_BASE) {
2057
+ if (isLocalPath(baseUrl)) return readDirRecursive((0, node_path.join)(baseUrl, integrationId, "assets"));
2058
+ const filesUrl = `${baseUrl}/${integrationId}/files.json`;
2059
+ const response = await fetch(filesUrl);
2060
+ if (!response.ok) return {};
2061
+ const fileList = await response.json();
2062
+ const files = {};
2063
+ await Promise.all(fileList.map(async (filePath) => {
2064
+ const fileUrl = `${baseUrl}/${integrationId}/assets/${filePath}`;
2065
+ const fileResponse = await fetch(fileUrl);
2066
+ if (fileResponse.ok) files[filePath] = await fileResponse.text();
2067
+ }));
2068
+ return files;
2069
+ }
2070
+ /**
2071
+ * Fetch integration package.json if it exists
2072
+ */
2073
+ async function fetchIntegrationPackageJson(integrationId, baseUrl) {
2074
+ if (isLocalPath(baseUrl)) {
2075
+ const pkgPath = (0, node_path.join)(baseUrl, integrationId, "package.json");
2076
+ if ((0, node_fs.existsSync)(pkgPath)) return JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf-8"));
2077
+ return null;
2078
+ }
2079
+ const url = `${baseUrl}/${integrationId}/package.json`;
2080
+ const response = await fetch(url);
2081
+ if (!response.ok) return null;
2082
+ return response.json();
2083
+ }
2084
+ /**
2085
+ * Fetch a complete compiled integration from GitHub
2086
+ */
2087
+ async function fetchIntegration(integrationId, baseUrl = GITHUB_RAW_BASE) {
2088
+ const [info, files, pkgJson] = await Promise.all([
2089
+ fetchIntegrationInfo(integrationId, baseUrl),
2090
+ fetchIntegrationFiles(integrationId, baseUrl),
2091
+ fetchIntegrationPackageJson(integrationId, baseUrl)
2092
+ ]);
2093
+ const packageAdditions = info.packageAdditions ?? {};
2094
+ if (pkgJson) {
2095
+ if (pkgJson.dependencies) packageAdditions.dependencies = {
2096
+ ...packageAdditions.dependencies,
2097
+ ...pkgJson.dependencies
2098
+ };
2099
+ if (pkgJson.devDependencies) packageAdditions.devDependencies = {
2100
+ ...packageAdditions.devDependencies,
2101
+ ...pkgJson.devDependencies
2102
+ };
2103
+ if (pkgJson.scripts) packageAdditions.scripts = {
2104
+ ...packageAdditions.scripts,
2105
+ ...pkgJson.scripts
2106
+ };
2107
+ }
2108
+ return IntegrationCompiledSchema.parse({
2109
+ ...info,
2110
+ id: integrationId,
2111
+ files,
2112
+ packageAdditions: Object.keys(packageAdditions).length > 0 ? packageAdditions : void 0,
2113
+ deletedFiles: []
2114
+ });
2115
+ }
2116
+ /**
2117
+ * Fetch multiple integrations in parallel
2118
+ */
2119
+ async function fetchIntegrations(integrationIds, baseUrl = GITHUB_RAW_BASE) {
2120
+ return Promise.all(integrationIds.map((id) => fetchIntegration(id, baseUrl)));
2121
+ }
2122
+
2123
+ //#endregion
2124
+ //#region src/engine/custom-addons/shared.ts
2125
+ /**
2126
+ * Shared utilities for custom integration/template creation
2127
+ * Based on Jack's implementation in create-tsrouter-app
2128
+ */
2129
+ const IGNORE_FILES = [
2130
+ ".template",
2131
+ ".integration",
2132
+ ".tanstack.json",
2133
+ ".git",
2134
+ "integration-info.json",
2135
+ "integration.json",
2136
+ "build",
2137
+ "bun.lock",
2138
+ "bun.lockb",
2139
+ "deno.lock",
2140
+ "dist",
2141
+ "node_modules",
2142
+ "package-lock.json",
2143
+ "pnpm-lock.yaml",
2144
+ "template.json",
2145
+ "template-info.json",
2146
+ "yarn.lock"
2147
+ ];
2148
+ const PROJECT_FILES = ["package.json"];
2149
+ const BINARY_EXTENSIONS = [
2150
+ ".png",
2151
+ ".jpg",
2152
+ ".jpeg",
2153
+ ".gif",
2154
+ ".svg",
2155
+ ".ico"
2156
+ ];
2157
+ /**
2158
+ * Check if a file is binary based on extension
2159
+ */
2160
+ function isBinaryFile(path) {
2161
+ return BINARY_EXTENSIONS.includes((0, node_path.extname)(path));
2162
+ }
2163
+ /**
2164
+ * Read file contents, handling binary files with base64 encoding
2165
+ */
2166
+ function readFileHelper(path) {
2167
+ if (isBinaryFile(path)) return `base64::${(0, node_fs.readFileSync)(path).toString("base64")}`;
2168
+ return (0, node_fs.readFileSync)(path, "utf-8");
2169
+ }
2170
+ /**
2171
+ * Create an ignore function that respects .gitignore and standard ignore patterns
2172
+ * Ported from Jack's createIgnore in file-helpers.ts
2173
+ */
2174
+ function createIgnore(path, includeProjectFiles = true) {
2175
+ const gitignorePath = (0, node_path.resolve)(path, ".gitignore");
2176
+ const ignoreList = (0, node_fs.existsSync)(gitignorePath) ? (0, parse_gitignore.default)((0, node_fs.readFileSync)(gitignorePath)).patterns : [];
2177
+ const ig = (0, ignore.default)().add(ignoreList);
2178
+ return (filePath) => {
2179
+ const fileName = (0, node_path.basename)(filePath);
2180
+ if (IGNORE_FILES.includes(fileName) || includeProjectFiles && PROJECT_FILES.includes(fileName)) return true;
2181
+ const nameWithoutDotSlash = fileName.replace(/^\.\//, "");
2182
+ return ig.ignores(nameWithoutDotSlash);
2183
+ };
2184
+ }
2185
+ /**
2186
+ * Create package.json additions by comparing original and current
2187
+ * Ported from Jack's createPackageAdditions
2188
+ */
2189
+ function createPackageAdditions(originalPackageJson, currentPackageJson) {
2190
+ const packageAdditions = {};
2191
+ const origScripts = originalPackageJson.scripts || {};
2192
+ const currScripts = currentPackageJson.scripts || {};
2193
+ const scripts = {};
2194
+ for (const script of Object.keys(currScripts)) {
2195
+ const currValue = currScripts[script];
2196
+ if (currValue && origScripts[script] !== currValue) scripts[script] = currValue;
2197
+ }
2198
+ if (Object.keys(scripts).length) packageAdditions.scripts = scripts;
2199
+ const origDeps = originalPackageJson.dependencies || {};
2200
+ const currDeps = currentPackageJson.dependencies || {};
2201
+ const dependencies = {};
2202
+ for (const dep of Object.keys(currDeps)) {
2203
+ const currValue = currDeps[dep];
2204
+ if (currValue && origDeps[dep] !== currValue) dependencies[dep] = currValue;
2205
+ }
2206
+ if (Object.keys(dependencies).length) packageAdditions.dependencies = dependencies;
2207
+ const origDevDeps = originalPackageJson.devDependencies || {};
2208
+ const currDevDeps = currentPackageJson.devDependencies || {};
2209
+ const devDependencies = {};
2210
+ for (const dep of Object.keys(currDevDeps)) {
2211
+ const currValue = currDevDeps[dep];
2212
+ if (currValue && origDevDeps[dep] !== currValue) devDependencies[dep] = currValue;
2213
+ }
2214
+ if (Object.keys(devDependencies).length) packageAdditions.devDependencies = devDependencies;
2215
+ return packageAdditions;
2216
+ }
2217
+ async function createCompileOptionsFromPersisted(persisted, integrationsPath) {
2218
+ let chosenIntegrations = [];
2219
+ if (persisted.chosenIntegrations.length > 0) chosenIntegrations = await fetchIntegrations(persisted.chosenIntegrations, integrationsPath);
2220
+ return {
2221
+ projectName: persisted.projectName,
2222
+ framework: persisted.framework,
2223
+ mode: persisted.mode,
2224
+ typescript: persisted.typescript,
2225
+ tailwind: persisted.tailwind,
2226
+ packageManager: persisted.packageManager,
2227
+ chosenIntegrations,
2228
+ integrationOptions: {},
2229
+ customTemplate: void 0
2230
+ };
2231
+ }
2232
+ function runCompile(options) {
2233
+ return compile(options);
2234
+ }
2235
+ /**
2236
+ * Compare files recursively between current project and original output
2237
+ * Ported from Jack's compareFilesRecursively
2238
+ */
2239
+ async function compareFilesRecursively(basePath, ignoreFn, original, changedFiles) {
2240
+ await compareFilesRecursivelyHelper(basePath, ".", ignoreFn, original, changedFiles);
2241
+ }
2242
+ async function compareFilesRecursivelyHelper(basePath, relativePath$1, ignoreFn, original, changedFiles) {
2243
+ const entries = await (0, node_fs_promises.readdir)((0, node_path.resolve)(basePath, relativePath$1), { withFileTypes: true });
2244
+ for (const entry of entries) {
2245
+ const entryRelativePath = relativePath$1 === "." ? entry.name : `${relativePath$1}/${entry.name}`;
2246
+ const entryFullPath = (0, node_path.resolve)(basePath, entryRelativePath);
2247
+ if (ignoreFn(entry.name)) continue;
2248
+ if (entry.isDirectory()) await compareFilesRecursivelyHelper(basePath, entryRelativePath, ignoreFn, original, changedFiles);
2249
+ else {
2250
+ const contents = readFileHelper(entryFullPath);
2251
+ const originalKey = entryRelativePath;
2252
+ if (!original[originalKey] || original[originalKey] !== contents) changedFiles[entryRelativePath] = contents;
2253
+ }
2254
+ }
2255
+ }
2256
+ async function readCurrentProjectOptions(targetDir) {
2257
+ const persisted = await readConfigFile(targetDir);
2258
+ 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.`);
2259
+ return persisted;
2260
+ }
2261
+ /**
2262
+ * Recursively gather files from a directory
2263
+ * Ported from Jack's recursivelyGatherFiles
2264
+ */
2265
+ async function recursivelyGatherFiles(path, includeProjectFiles = true) {
2266
+ const ignoreFn = createIgnore(path, includeProjectFiles);
2267
+ const files = {};
2268
+ if (!(0, node_fs.existsSync)(path)) return files;
2269
+ await gatherFilesHelper(path, ".", files, ignoreFn);
2270
+ return files;
2271
+ }
2272
+ async function gatherFilesHelper(basePath, relativePath$1, files, ignoreFn) {
2273
+ const entries = await (0, node_fs_promises.readdir)((0, node_path.resolve)(basePath, relativePath$1), { withFileTypes: true });
2274
+ for (const entry of entries) {
2275
+ if (ignoreFn(entry.name)) continue;
2276
+ const entryRelativePath = relativePath$1 === "." ? entry.name : `${relativePath$1}/${entry.name}`;
2277
+ const entryFullPath = (0, node_path.resolve)(basePath, entryRelativePath);
2278
+ if (entry.isDirectory()) await gatherFilesHelper(basePath, entryRelativePath, files, ignoreFn);
2279
+ else files[entryRelativePath] = readFileHelper(entryFullPath);
2280
+ }
2281
+ }
2282
+
2283
+ //#endregion
2284
+ //#region src/engine/custom-addons/integration.ts
2285
+ const INTEGRATION_DIR = ".integration";
2286
+ const INFO_FILE$1 = ".integration/info.json";
2287
+ const COMPILED_FILE$1 = "integration.json";
2288
+ const ASSETS_DIR = "assets";
2289
+ const INTEGRATION_IGNORE_FILES = [
2290
+ "main.jsx",
2291
+ "App.jsx",
2292
+ "main.tsx",
2293
+ "App.tsx",
2294
+ "routeTree.gen.ts"
2295
+ ];
2296
+ function camelCase(str) {
2297
+ return str.split(/(\.|-|\/)/).filter((part) => /^[a-zA-Z]+$/.test(part)).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
2298
+ }
2299
+ function templatize(routeCode, routeFile) {
2300
+ let code = routeCode;
2301
+ code = code.replace(/import { createFileRoute } from ['"]@tanstack\/react-router['"]/g, `import { <% if (fileRouter) { %>createFileRoute<% } else { %>createRoute<% } %> } from '@tanstack/react-router'`);
2302
+ const routeMatch = code.match(/export\s+const\s+Route\s*=\s*createFileRoute\(['"]([^'"]+)['"]\)\s*\(\{([^}]+)\}\)/);
2303
+ let path = "";
2304
+ if (routeMatch) {
2305
+ const fullMatch = routeMatch[0];
2306
+ path = routeMatch[1];
2307
+ const routeDefinition = routeMatch[2];
2308
+ code = code.replace(fullMatch, `<% if (codeRouter) { %>
2309
+ import type { RootRoute } from '@tanstack/react-router'
2310
+ <% } else { %>
2311
+ export const Route = createFileRoute('${path}')({${routeDefinition}})
2312
+ <% } %>`);
2313
+ code += `
2314
+ <% if (codeRouter) { %>
2315
+ export default (parentRoute: RootRoute) => createRoute({
2316
+ path: '${path}',
2317
+ ${routeDefinition}
2318
+ getParentRoute: () => parentRoute,
2319
+ })
2320
+ <% } %>
2321
+ `;
2322
+ } else console.warn(`No route found in the file: ${routeFile}`);
2323
+ const name = (0, node_path.basename)(path).replace(".tsx", "").replace(/^demo/, "").replace(".", " ").trim();
2324
+ const jsName = camelCase((0, node_path.basename)(path));
2325
+ return {
2326
+ url: path,
2327
+ code,
2328
+ name,
2329
+ jsName
2330
+ };
2331
+ }
2332
+ async function validateIntegrationSetup(targetDir) {
2333
+ const options = await readCurrentProjectOptions(targetDir);
2334
+ 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.");
2335
+ 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.");
2336
+ if (!options.typescript) throw new Error("This project is not using TypeScript.\nTo create an integration, the project must be created with TypeScript.");
2337
+ }
2338
+ async function readOrGenerateIntegrationInfo(options, targetDir) {
2339
+ const infoPath = (0, node_path.resolve)(targetDir, INFO_FILE$1);
2340
+ if ((0, node_fs.existsSync)(infoPath)) {
2341
+ const content = await (0, node_fs_promises.readFile)(infoPath, "utf-8");
2342
+ return JSON.parse(content);
2343
+ }
2344
+ return {
2345
+ id: `${options.projectName}-integration`,
2346
+ name: `${options.projectName} Integration`,
2347
+ description: "Custom integration",
2348
+ author: "Author <author@example.com>",
2349
+ version: "0.0.1",
2350
+ license: "MIT",
2351
+ link: `https://github.com/example/${options.projectName}-integration`,
2352
+ type: "integration",
2353
+ phase: "integration",
2354
+ modes: [options.mode],
2355
+ requiresTailwind: options.tailwind || void 0,
2356
+ dependsOn: options.chosenIntegrations.length > 0 ? options.chosenIntegrations : void 0,
2357
+ routes: [],
2358
+ packageAdditions: {
2359
+ scripts: {},
2360
+ dependencies: {},
2361
+ devDependencies: {}
2362
+ }
2363
+ };
2364
+ }
2365
+ async function generateBaseProject(persistedOptions, targetDir, integrationsPath) {
2366
+ return {
2367
+ info: await readOrGenerateIntegrationInfo(persistedOptions, targetDir),
2368
+ output: runCompile(await createCompileOptionsFromPersisted(persistedOptions, integrationsPath))
2369
+ };
2370
+ }
2371
+ async function buildAssetsDirectory(targetDir, output, info) {
2372
+ const assetsDir = (0, node_path.resolve)(targetDir, INTEGRATION_DIR, ASSETS_DIR);
2373
+ if ((0, node_fs.existsSync)(assetsDir)) return;
2374
+ const ignoreFn = createIgnore(targetDir);
2375
+ const changedFiles = {};
2376
+ await compareFilesRecursively(targetDir, ignoreFn, output.files, changedFiles);
2377
+ for (const file of Object.keys(changedFiles)) {
2378
+ if (INTEGRATION_IGNORE_FILES.includes((0, node_path.basename)(file))) continue;
2379
+ const targetPath = (0, node_path.resolve)(assetsDir, file);
2380
+ (0, node_fs.mkdirSync)((0, node_path.dirname)(targetPath), { recursive: true });
2381
+ const fileContent = changedFiles[file];
2382
+ if (file.includes("/routes/")) {
2383
+ const { url, code, name, jsName } = templatize(fileContent, file);
2384
+ info.routes ||= [];
2385
+ if (!info.routes.find((r) => r.url === url)) info.routes.push({
2386
+ url,
2387
+ name,
2388
+ jsName,
2389
+ path: file
2390
+ });
2391
+ (0, node_fs.writeFileSync)(`${targetPath}.ejs`, code);
2392
+ } else (0, node_fs.writeFileSync)(targetPath, fileContent);
2393
+ }
2394
+ }
2395
+ async function updateIntegrationInfo(targetDir, integrationsPath) {
2396
+ const { info, output } = await generateBaseProject(await readCurrentProjectOptions(targetDir), targetDir, integrationsPath);
2397
+ info.packageAdditions = createPackageAdditions(JSON.parse(output.files["package.json"]), JSON.parse(await (0, node_fs_promises.readFile)((0, node_path.resolve)(targetDir, "package.json"), "utf-8")));
2398
+ await buildAssetsDirectory(targetDir, output, info);
2399
+ await (0, node_fs_promises.mkdir)((0, node_path.resolve)(targetDir, (0, node_path.dirname)(INFO_FILE$1)), { recursive: true });
2400
+ await (0, node_fs_promises.writeFile)((0, node_path.resolve)(targetDir, INFO_FILE$1), JSON.stringify(info, null, 2));
2401
+ }
2402
+ async function compileIntegration(targetDir, _integrationsPath) {
2403
+ const persistedOptions = await readCurrentProjectOptions(targetDir);
2404
+ const info = await readOrGenerateIntegrationInfo(persistedOptions, targetDir);
2405
+ const assetsDir = (0, node_path.resolve)(targetDir, INTEGRATION_DIR, ASSETS_DIR);
2406
+ const compiledInfo = {
2407
+ ...info,
2408
+ id: info.id || `${persistedOptions.projectName}-integration`,
2409
+ files: await recursivelyGatherFiles(assetsDir),
2410
+ deletedFiles: []
2411
+ };
2412
+ await (0, node_fs_promises.writeFile)((0, node_path.resolve)(targetDir, COMPILED_FILE$1), JSON.stringify(compiledInfo, null, 2));
2413
+ console.log(`Compiled integration written to ${COMPILED_FILE$1}`);
2414
+ }
2415
+ async function initIntegration(targetDir, integrationsPath) {
2416
+ await validateIntegrationSetup(targetDir);
2417
+ await updateIntegrationInfo(targetDir, integrationsPath);
2418
+ await compileIntegration(targetDir, integrationsPath);
2419
+ console.log(`
2420
+ Integration initialized successfully!
2421
+
2422
+ Files created:
2423
+ ${INFO_FILE$1} - Integration metadata (edit this to customize)
2424
+ ${INTEGRATION_DIR}/${ASSETS_DIR}/ - Integration asset files
2425
+ ${COMPILED_FILE$1} - Compiled integration (distribute this)
2426
+
2427
+ Next steps:
2428
+ 1. Edit ${INFO_FILE$1} to customize your integration metadata
2429
+ 2. Run 'tanstack integration compile' to rebuild after changes
2430
+ 3. Share ${COMPILED_FILE$1} or host it publicly
2431
+ `);
2432
+ }
2433
+ /**
2434
+ * Load a remote integration from a URL
2435
+ */
2436
+ async function loadRemoteIntegration(url) {
2437
+ const response = await fetch(url);
2438
+ if (!response.ok) throw new Error(`Failed to fetch integration from ${url}: ${response.statusText}`);
2439
+ const jsonContent = await response.json();
2440
+ const result = IntegrationCompiledSchema.safeParse(jsonContent);
2441
+ if (!result.success) throw new Error(`Invalid integration at ${url}: ${result.error.message}`);
2442
+ const integration = result.data;
2443
+ if (!integration.id) integration.id = url;
2444
+ return integration;
2445
+ }
2446
+
2447
+ //#endregion
2448
+ //#region src/engine/custom-addons/template.ts
2449
+ const INFO_FILE = "template-info.json";
2450
+ const COMPILED_FILE = "template.json";
2451
+ /**
2452
+ * Generate default template info from project options
2453
+ * Custom templates are just integration presets - they capture which integrations are selected
2454
+ */
2455
+ async function readOrGenerateTemplateInfo(options, targetDir) {
2456
+ const infoPath = (0, node_path.resolve)(targetDir, INFO_FILE);
2457
+ if ((0, node_fs.existsSync)(infoPath)) {
2458
+ const content = await (0, node_fs_promises.readFile)(infoPath, "utf-8");
2459
+ return JSON.parse(content);
2460
+ }
2461
+ return {
2462
+ id: `${options.projectName}-template`,
2463
+ name: `${options.projectName} Template`,
2464
+ description: "A curated project template",
2465
+ framework: options.framework,
2466
+ mode: options.mode,
2467
+ typescript: options.typescript,
2468
+ tailwind: options.tailwind,
2469
+ integrations: options.chosenIntegrations
2470
+ };
2471
+ }
2472
+ /**
2473
+ * Compile a custom template from the current project
2474
+ * Custom templates are just integration presets - they specify project defaults and which integrations to include
2475
+ */
2476
+ async function compileTemplate(targetDir) {
2477
+ const persistedOptions = await readCurrentProjectOptions(targetDir);
2478
+ const info = await readOrGenerateTemplateInfo(persistedOptions, targetDir);
2479
+ const compiledInfo = {
2480
+ ...info,
2481
+ id: info.id || `${persistedOptions.projectName}-template`
2482
+ };
2483
+ await (0, node_fs_promises.writeFile)((0, node_path.resolve)(targetDir, COMPILED_FILE), JSON.stringify(compiledInfo, null, 2));
2484
+ console.log(`Compiled template written to ${COMPILED_FILE}`);
2485
+ console.log(`\nIncluded integrations: ${compiledInfo.integrations.length > 0 ? compiledInfo.integrations.join(", ") : "(none)"}`);
2486
+ }
2487
+ async function initTemplate(targetDir) {
2488
+ const info = await readOrGenerateTemplateInfo(await readCurrentProjectOptions(targetDir), targetDir);
2489
+ await (0, node_fs_promises.writeFile)((0, node_path.resolve)(targetDir, INFO_FILE), JSON.stringify(info, null, 2));
2490
+ await compileTemplate(targetDir);
2491
+ console.log(`
2492
+ Custom template initialized successfully!
2493
+
2494
+ Files created:
2495
+ ${INFO_FILE} - Template metadata (edit this to customize)
2496
+ ${COMPILED_FILE} - Compiled template (distribute this)
2497
+
2498
+ Custom templates are integration presets. They capture:
2499
+ - Project defaults (framework, mode, typescript, tailwind)
2500
+ - Which integrations to include
2501
+ - Preset integration options (if any)
2502
+
2503
+ Next steps:
2504
+ 1. Edit ${INFO_FILE} to customize name, description, and integrations
2505
+ 2. Run 'tanstack template compile' to rebuild after changes
2506
+ 3. Share ${COMPILED_FILE} or host it publicly
2507
+ 4. Users can use: tanstack create --template <url-to-template.json>
2508
+ `);
2509
+ }
2510
+ /**
2511
+ * Load a remote custom template from a URL
2512
+ */
2513
+ async function loadTemplate(url) {
2514
+ const response = await fetch(url);
2515
+ if (!response.ok) throw new Error(`Failed to fetch template from ${url}: ${response.statusText}`);
2516
+ const jsonContent = await response.json();
2517
+ const result = CustomTemplateCompiledSchema.safeParse(jsonContent);
2518
+ if (!result.success) throw new Error(`Invalid template at ${url}: ${result.error.message}`);
2519
+ const template = result.data;
2520
+ if (!template.id) template.id = url;
2521
+ return template;
2522
+ }
2523
+
2524
+ //#endregion
2525
+ Object.defineProperty(exports, 'CONFIG_FILE', {
2526
+ enumerable: true,
2527
+ get: function () {
2528
+ return CONFIG_FILE;
2529
+ }
2530
+ });
2531
+ Object.defineProperty(exports, 'CategorySchema', {
2532
+ enumerable: true,
2533
+ get: function () {
2534
+ return CategorySchema;
2535
+ }
2536
+ });
2537
+ Object.defineProperty(exports, 'CommandSchema', {
2538
+ enumerable: true,
2539
+ get: function () {
2540
+ return CommandSchema;
2541
+ }
2542
+ });
2543
+ Object.defineProperty(exports, 'CustomTemplateCompiledSchema', {
2544
+ enumerable: true,
2545
+ get: function () {
2546
+ return CustomTemplateCompiledSchema;
2547
+ }
2548
+ });
2549
+ Object.defineProperty(exports, 'CustomTemplateInfoSchema', {
2550
+ enumerable: true,
2551
+ get: function () {
2552
+ return CustomTemplateInfoSchema;
2553
+ }
2554
+ });
2555
+ Object.defineProperty(exports, 'EnvVarSchema', {
2556
+ enumerable: true,
2557
+ get: function () {
2558
+ return EnvVarSchema;
2559
+ }
2560
+ });
2561
+ Object.defineProperty(exports, 'HookSchema', {
2562
+ enumerable: true,
2563
+ get: function () {
2564
+ return HookSchema;
2565
+ }
2566
+ });
2567
+ Object.defineProperty(exports, 'IntegrationCompiledSchema', {
2568
+ enumerable: true,
2569
+ get: function () {
2570
+ return IntegrationCompiledSchema;
2571
+ }
2572
+ });
2573
+ Object.defineProperty(exports, 'IntegrationInfoSchema', {
2574
+ enumerable: true,
2575
+ get: function () {
2576
+ return IntegrationInfoSchema;
2577
+ }
2578
+ });
2579
+ Object.defineProperty(exports, 'IntegrationOptionSchema', {
2580
+ enumerable: true,
2581
+ get: function () {
2582
+ return IntegrationOptionSchema;
2583
+ }
2584
+ });
2585
+ Object.defineProperty(exports, 'IntegrationOptionsSchema', {
2586
+ enumerable: true,
2587
+ get: function () {
2588
+ return IntegrationOptionsSchema;
2589
+ }
2590
+ });
2591
+ Object.defineProperty(exports, 'IntegrationPhaseSchema', {
2592
+ enumerable: true,
2593
+ get: function () {
2594
+ return IntegrationPhaseSchema;
2595
+ }
2596
+ });
2597
+ Object.defineProperty(exports, 'IntegrationTypeSchema', {
2598
+ enumerable: true,
2599
+ get: function () {
2600
+ return IntegrationTypeSchema;
2601
+ }
2602
+ });
2603
+ Object.defineProperty(exports, 'ManifestIntegrationSchema', {
2604
+ enumerable: true,
2605
+ get: function () {
2606
+ return ManifestIntegrationSchema;
2607
+ }
2608
+ });
2609
+ Object.defineProperty(exports, 'ManifestSchema', {
2610
+ enumerable: true,
2611
+ get: function () {
2612
+ return ManifestSchema;
2613
+ }
2614
+ });
2615
+ Object.defineProperty(exports, 'RouteSchema', {
2616
+ enumerable: true,
2617
+ get: function () {
2618
+ return RouteSchema;
2619
+ }
2620
+ });
2621
+ Object.defineProperty(exports, 'RouterModeSchema', {
2622
+ enumerable: true,
2623
+ get: function () {
2624
+ return RouterModeSchema;
2625
+ }
2626
+ });
2627
+ Object.defineProperty(exports, '__toESM', {
2628
+ enumerable: true,
2629
+ get: function () {
2630
+ return __toESM;
2631
+ }
2632
+ });
2633
+ Object.defineProperty(exports, 'compile', {
2634
+ enumerable: true,
2635
+ get: function () {
2636
+ return compile;
2637
+ }
2638
+ });
2639
+ Object.defineProperty(exports, 'compileIntegration', {
2640
+ enumerable: true,
2641
+ get: function () {
2642
+ return compileIntegration;
2643
+ }
2644
+ });
2645
+ Object.defineProperty(exports, 'compileTemplate', {
2646
+ enumerable: true,
2647
+ get: function () {
2648
+ return compileTemplate;
2649
+ }
2650
+ });
2651
+ Object.defineProperty(exports, 'compileWithAttribution', {
2652
+ enumerable: true,
2653
+ get: function () {
2654
+ return compileWithAttribution;
2655
+ }
2656
+ });
2657
+ Object.defineProperty(exports, 'fetchIntegration', {
2658
+ enumerable: true,
2659
+ get: function () {
2660
+ return fetchIntegration;
2661
+ }
2662
+ });
2663
+ Object.defineProperty(exports, 'fetchIntegrationFiles', {
2664
+ enumerable: true,
2665
+ get: function () {
2666
+ return fetchIntegrationFiles;
2667
+ }
2668
+ });
2669
+ Object.defineProperty(exports, 'fetchIntegrationInfo', {
2670
+ enumerable: true,
2671
+ get: function () {
2672
+ return fetchIntegrationInfo;
2673
+ }
2674
+ });
2675
+ Object.defineProperty(exports, 'fetchIntegrations', {
2676
+ enumerable: true,
2677
+ get: function () {
2678
+ return fetchIntegrations;
2679
+ }
2680
+ });
2681
+ Object.defineProperty(exports, 'fetchManifest', {
2682
+ enumerable: true,
2683
+ get: function () {
2684
+ return fetchManifest;
2685
+ }
2686
+ });
2687
+ Object.defineProperty(exports, 'initIntegration', {
2688
+ enumerable: true,
2689
+ get: function () {
2690
+ return initIntegration;
2691
+ }
2692
+ });
2693
+ Object.defineProperty(exports, 'initTemplate', {
2694
+ enumerable: true,
2695
+ get: function () {
2696
+ return initTemplate;
2697
+ }
2698
+ });
2699
+ Object.defineProperty(exports, 'loadRemoteIntegration', {
2700
+ enumerable: true,
2701
+ get: function () {
2702
+ return loadRemoteIntegration;
2703
+ }
2704
+ });
2705
+ Object.defineProperty(exports, 'loadTemplate', {
2706
+ enumerable: true,
2707
+ get: function () {
2708
+ return loadTemplate;
2709
+ }
2710
+ });
2711
+ Object.defineProperty(exports, 'processTemplateFile', {
2712
+ enumerable: true,
2713
+ get: function () {
2714
+ return processTemplateFile;
2715
+ }
2716
+ });
2717
+ Object.defineProperty(exports, 'readConfigFile', {
2718
+ enumerable: true,
2719
+ get: function () {
2720
+ return readConfigFile;
2721
+ }
2722
+ });
2723
+ Object.defineProperty(exports, 'relativePath', {
2724
+ enumerable: true,
2725
+ get: function () {
2726
+ return relativePath;
2727
+ }
2728
+ });
2729
+ Object.defineProperty(exports, 'writeConfigFile', {
2730
+ enumerable: true,
2731
+ get: function () {
2732
+ return writeConfigFile;
2733
+ }
2734
+ });