@tanstack/start-plugin-core 1.121.14 → 1.121.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/package.json +7 -7
  2. package/dist/cjs/compilers.cjs +0 -416
  3. package/dist/cjs/compilers.cjs.map +0 -1
  4. package/dist/cjs/compilers.d.cts +0 -21
  5. package/dist/cjs/constants.cjs +0 -20
  6. package/dist/cjs/constants.cjs.map +0 -1
  7. package/dist/cjs/constants.d.cts +0 -6
  8. package/dist/cjs/debug.cjs +0 -5
  9. package/dist/cjs/debug.cjs.map +0 -1
  10. package/dist/cjs/debug.d.cts +0 -1
  11. package/dist/cjs/dev-server-plugin/extract-html-scripts.cjs +0 -35
  12. package/dist/cjs/dev-server-plugin/extract-html-scripts.cjs.map +0 -1
  13. package/dist/cjs/dev-server-plugin/extract-html-scripts.d.cts +0 -4
  14. package/dist/cjs/dev-server-plugin/plugin.cjs +0 -136
  15. package/dist/cjs/dev-server-plugin/plugin.cjs.map +0 -1
  16. package/dist/cjs/dev-server-plugin/plugin.d.cts +0 -5
  17. package/dist/cjs/index.cjs +0 -11
  18. package/dist/cjs/index.cjs.map +0 -1
  19. package/dist/cjs/index.d.cts +0 -3
  20. package/dist/cjs/load-env-plugin/plugin.cjs +0 -34
  21. package/dist/cjs/load-env-plugin/plugin.cjs.map +0 -1
  22. package/dist/cjs/load-env-plugin/plugin.d.cts +0 -3
  23. package/dist/cjs/nitro-plugin/build-sitemap.cjs +0 -138
  24. package/dist/cjs/nitro-plugin/build-sitemap.cjs.map +0 -1
  25. package/dist/cjs/nitro-plugin/build-sitemap.d.cts +0 -31
  26. package/dist/cjs/nitro-plugin/plugin.cjs +0 -181
  27. package/dist/cjs/nitro-plugin/plugin.cjs.map +0 -1
  28. package/dist/cjs/nitro-plugin/plugin.d.cts +0 -3
  29. package/dist/cjs/nitro-plugin/prerender.cjs +0 -174
  30. package/dist/cjs/nitro-plugin/prerender.cjs.map +0 -1
  31. package/dist/cjs/nitro-plugin/prerender.d.cts +0 -8
  32. package/dist/cjs/nitro-plugin/queue.cjs +0 -131
  33. package/dist/cjs/nitro-plugin/queue.cjs.map +0 -1
  34. package/dist/cjs/nitro-plugin/queue.d.cts +0 -32
  35. package/dist/cjs/plugin.cjs +0 -197
  36. package/dist/cjs/plugin.cjs.map +0 -1
  37. package/dist/cjs/plugin.d.cts +0 -291
  38. package/dist/cjs/resolve-virtual-entries-plugin/plugin.cjs +0 -66
  39. package/dist/cjs/resolve-virtual-entries-plugin/plugin.cjs.map +0 -1
  40. package/dist/cjs/resolve-virtual-entries-plugin/plugin.d.cts +0 -3
  41. package/dist/cjs/schema.cjs +0 -157
  42. package/dist/cjs/schema.cjs.map +0 -1
  43. package/dist/cjs/schema.d.cts +0 -8779
  44. package/dist/cjs/start-compiler-plugin.cjs +0 -74
  45. package/dist/cjs/start-compiler-plugin.cjs.map +0 -1
  46. package/dist/cjs/start-compiler-plugin.d.cts +0 -13
  47. package/dist/cjs/start-manifest-plugin/plugin.cjs +0 -182
  48. package/dist/cjs/start-manifest-plugin/plugin.cjs.map +0 -1
  49. package/dist/cjs/start-manifest-plugin/plugin.d.cts +0 -3
  50. package/dist/cjs/start-router-plugin/generator-plugins/routes-manifest-plugin.cjs +0 -39
  51. package/dist/cjs/start-router-plugin/generator-plugins/routes-manifest-plugin.cjs.map +0 -1
  52. package/dist/cjs/start-router-plugin/generator-plugins/routes-manifest-plugin.d.cts +0 -6
  53. package/dist/cjs/start-router-plugin/generator-plugins/server-routes-plugin.cjs +0 -121
  54. package/dist/cjs/start-router-plugin/generator-plugins/server-routes-plugin.cjs.map +0 -1
  55. package/dist/cjs/start-router-plugin/generator-plugins/server-routes-plugin.d.cts +0 -2
  56. package/dist/cjs/start-router-plugin/plugin.cjs +0 -21
  57. package/dist/cjs/start-router-plugin/plugin.cjs.map +0 -1
  58. package/dist/cjs/start-router-plugin/plugin.d.cts +0 -3
  59. package/dist/cjs/start-router-plugin/route-tree-client-plugin.cjs +0 -72
  60. package/dist/cjs/start-router-plugin/route-tree-client-plugin.cjs.map +0 -1
  61. package/dist/cjs/start-router-plugin/route-tree-client-plugin.d.cts +0 -6
  62. package/dist/cjs/start-router-plugin/virtual-route-tree-plugin.cjs +0 -30
  63. package/dist/cjs/start-router-plugin/virtual-route-tree-plugin.cjs.map +0 -1
  64. package/dist/cjs/start-router-plugin/virtual-route-tree-plugin.d.cts +0 -4
  65. package/dist/cjs/utils.cjs +0 -18
  66. package/dist/cjs/utils.cjs.map +0 -1
  67. package/dist/cjs/utils.d.cts +0 -8
  68. package/dist/esm/compilers.d.ts +0 -21
  69. package/dist/esm/compilers.js +0 -398
  70. package/dist/esm/compilers.js.map +0 -1
  71. package/dist/esm/constants.d.ts +0 -6
  72. package/dist/esm/constants.js +0 -20
  73. package/dist/esm/constants.js.map +0 -1
  74. package/dist/esm/debug.d.ts +0 -1
  75. package/dist/esm/debug.js +0 -5
  76. package/dist/esm/debug.js.map +0 -1
  77. package/dist/esm/dev-server-plugin/extract-html-scripts.d.ts +0 -4
  78. package/dist/esm/dev-server-plugin/extract-html-scripts.js +0 -18
  79. package/dist/esm/dev-server-plugin/extract-html-scripts.js.map +0 -1
  80. package/dist/esm/dev-server-plugin/plugin.d.ts +0 -5
  81. package/dist/esm/dev-server-plugin/plugin.js +0 -136
  82. package/dist/esm/dev-server-plugin/plugin.js.map +0 -1
  83. package/dist/esm/index.d.ts +0 -3
  84. package/dist/esm/index.js +0 -11
  85. package/dist/esm/index.js.map +0 -1
  86. package/dist/esm/load-env-plugin/plugin.d.ts +0 -3
  87. package/dist/esm/load-env-plugin/plugin.js +0 -17
  88. package/dist/esm/load-env-plugin/plugin.js.map +0 -1
  89. package/dist/esm/nitro-plugin/build-sitemap.d.ts +0 -31
  90. package/dist/esm/nitro-plugin/build-sitemap.js +0 -138
  91. package/dist/esm/nitro-plugin/build-sitemap.js.map +0 -1
  92. package/dist/esm/nitro-plugin/plugin.d.ts +0 -3
  93. package/dist/esm/nitro-plugin/plugin.js +0 -181
  94. package/dist/esm/nitro-plugin/plugin.js.map +0 -1
  95. package/dist/esm/nitro-plugin/prerender.d.ts +0 -8
  96. package/dist/esm/nitro-plugin/prerender.js +0 -174
  97. package/dist/esm/nitro-plugin/prerender.js.map +0 -1
  98. package/dist/esm/nitro-plugin/queue.d.ts +0 -32
  99. package/dist/esm/nitro-plugin/queue.js +0 -131
  100. package/dist/esm/nitro-plugin/queue.js.map +0 -1
  101. package/dist/esm/plugin.d.ts +0 -291
  102. package/dist/esm/plugin.js +0 -180
  103. package/dist/esm/plugin.js.map +0 -1
  104. package/dist/esm/resolve-virtual-entries-plugin/plugin.d.ts +0 -3
  105. package/dist/esm/resolve-virtual-entries-plugin/plugin.js +0 -49
  106. package/dist/esm/resolve-virtual-entries-plugin/plugin.js.map +0 -1
  107. package/dist/esm/schema.d.ts +0 -8779
  108. package/dist/esm/schema.js +0 -157
  109. package/dist/esm/schema.js.map +0 -1
  110. package/dist/esm/start-compiler-plugin.d.ts +0 -13
  111. package/dist/esm/start-compiler-plugin.js +0 -74
  112. package/dist/esm/start-compiler-plugin.js.map +0 -1
  113. package/dist/esm/start-manifest-plugin/plugin.d.ts +0 -3
  114. package/dist/esm/start-manifest-plugin/plugin.js +0 -182
  115. package/dist/esm/start-manifest-plugin/plugin.js.map +0 -1
  116. package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.d.ts +0 -6
  117. package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.js +0 -39
  118. package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.js.map +0 -1
  119. package/dist/esm/start-router-plugin/generator-plugins/server-routes-plugin.d.ts +0 -2
  120. package/dist/esm/start-router-plugin/generator-plugins/server-routes-plugin.js +0 -121
  121. package/dist/esm/start-router-plugin/generator-plugins/server-routes-plugin.js.map +0 -1
  122. package/dist/esm/start-router-plugin/plugin.d.ts +0 -3
  123. package/dist/esm/start-router-plugin/plugin.js +0 -21
  124. package/dist/esm/start-router-plugin/plugin.js.map +0 -1
  125. package/dist/esm/start-router-plugin/route-tree-client-plugin.d.ts +0 -6
  126. package/dist/esm/start-router-plugin/route-tree-client-plugin.js +0 -55
  127. package/dist/esm/start-router-plugin/route-tree-client-plugin.js.map +0 -1
  128. package/dist/esm/start-router-plugin/virtual-route-tree-plugin.d.ts +0 -4
  129. package/dist/esm/start-router-plugin/virtual-route-tree-plugin.js +0 -30
  130. package/dist/esm/start-router-plugin/virtual-route-tree-plugin.js.map +0 -1
  131. package/dist/esm/utils.d.ts +0 -8
  132. package/dist/esm/utils.js +0 -18
  133. package/dist/esm/utils.js.map +0 -1
@@ -1,121 +0,0 @@
1
- import { hasChildWithExport, checkRouteFullPathUniqueness, ensureStringArgument } from "@tanstack/router-generator";
2
- const EXPORT_NAME = "ServerRoute";
3
- function serverRoutesPlugin() {
4
- return {
5
- name: "server-routes-plugin",
6
- transformPlugin: {
7
- name: "server-routes-transform",
8
- exportName: EXPORT_NAME,
9
- imports: (ctx) => {
10
- const targetModule = `@tanstack/${ctx.target}-start/server`;
11
- const imports = {};
12
- if (ctx.verboseFileRoutes === false) {
13
- imports.banned = [
14
- {
15
- source: targetModule,
16
- specifiers: [{ imported: "createServerFileRoute" }]
17
- }
18
- ];
19
- } else {
20
- imports.required = [
21
- {
22
- source: targetModule,
23
- specifiers: [{ imported: "createServerFileRoute" }]
24
- }
25
- ];
26
- }
27
- return imports;
28
- },
29
- onExportFound: ({ ctx, decl }) => {
30
- var _a;
31
- let appliedChanges = false;
32
- if (((_a = decl.init) == null ? void 0 : _a.type) === "CallExpression") {
33
- let call = decl.init;
34
- let callee = call.callee;
35
- while (callee.type === "MemberExpression" && callee.object.type === "CallExpression") {
36
- call = callee.object;
37
- callee = call.callee;
38
- }
39
- if (call.callee.type === "Identifier" && call.callee.name === "createServerFileRoute") {
40
- if (!ctx.verboseFileRoutes) {
41
- if (call.arguments.length) {
42
- call.arguments = [];
43
- appliedChanges = true;
44
- }
45
- } else {
46
- appliedChanges = ensureStringArgument(
47
- call,
48
- ctx.routeId,
49
- ctx.preferredQuote
50
- );
51
- }
52
- } else {
53
- throw new Error(
54
- `Expected "createServerFileRoute" call, but got "${call.callee.type}"`
55
- );
56
- }
57
- }
58
- return appliedChanges;
59
- }
60
- },
61
- moduleAugmentation: ({ generator }) => ({
62
- module: `@tanstack/${generator.config.target}-start/server`,
63
- interfaceName: "ServerFileRoutesByPath"
64
- }),
65
- onRouteTreesChanged: ({ routeTrees, generator }) => {
66
- const tree = routeTrees.find((tree2) => tree2.exportName === EXPORT_NAME);
67
- if (tree) {
68
- checkRouteFullPathUniqueness(tree.sortedRouteNodes, generator.config);
69
- }
70
- },
71
- imports: (ctx) => {
72
- var _a;
73
- const imports = [];
74
- const targetModule = `@tanstack/${ctx.generator.config.target}-start/server`;
75
- if (ctx.generator.config.verboseFileRoutes === false) {
76
- imports.push({
77
- specifiers: [
78
- { imported: "CreateServerFileRoute" },
79
- { imported: "ServerFileRoutesByPath" }
80
- ],
81
- source: targetModule,
82
- importKind: "type"
83
- });
84
- }
85
- const hasMatchingRouteFiles = ctx.acc.routeNodes.length > 0;
86
- if (hasMatchingRouteFiles) {
87
- if (!((_a = ctx.rootRouteNode.exports) == null ? void 0 : _a.includes(EXPORT_NAME))) {
88
- imports.push({
89
- specifiers: [{ imported: "createServerRootRoute" }],
90
- source: targetModule
91
- });
92
- }
93
- }
94
- return imports;
95
- },
96
- routeModuleAugmentation: ({ routeNode }) => {
97
- if (routeNode._fsRouteType === "lazy") {
98
- return void 0;
99
- }
100
- return `const createServerFileRoute: CreateServerFileRoute<
101
- ServerFileRoutesByPath['${routeNode.routePath}']['parentRoute'],
102
- ServerFileRoutesByPath['${routeNode.routePath}']['id'],
103
- ServerFileRoutesByPath['${routeNode.routePath}']['path'],
104
- ServerFileRoutesByPath['${routeNode.routePath}']['fullPath'],
105
- ${hasChildWithExport(routeNode, "ServerRoute") ? `${routeNode.variableName}ServerRouteChildren` : "unknown"}
106
- >`;
107
- },
108
- createRootRouteCode: () => `createServerRootRoute()`,
109
- createVirtualRouteCode: ({ node }) => `createServerFileRoute('${node.routePath}')`,
110
- config: ({ sortedRouteNodes }) => {
111
- const hasMatchingRouteFiles = sortedRouteNodes.length > 0;
112
- return {
113
- virtualRootRoute: hasMatchingRouteFiles
114
- };
115
- }
116
- };
117
- }
118
- export {
119
- serverRoutesPlugin
120
- };
121
- //# sourceMappingURL=server-routes-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-routes-plugin.js","sources":["../../../../src/start-router-plugin/generator-plugins/server-routes-plugin.ts"],"sourcesContent":["import {\n checkRouteFullPathUniqueness,\n ensureStringArgument,\n hasChildWithExport,\n} from '@tanstack/router-generator'\n\nimport type {\n GeneratorPluginWithTransform,\n ImportDeclaration,\n TransformImportsConfig,\n} from '@tanstack/router-generator'\n\nconst EXPORT_NAME = 'ServerRoute'\nexport function serverRoutesPlugin(): GeneratorPluginWithTransform {\n return {\n name: 'server-routes-plugin',\n transformPlugin: {\n name: 'server-routes-transform',\n exportName: EXPORT_NAME,\n imports: (ctx) => {\n const targetModule = `@tanstack/${ctx.target}-start/server`\n const imports: TransformImportsConfig = {}\n if (ctx.verboseFileRoutes === false) {\n imports.banned = [\n {\n source: targetModule,\n specifiers: [{ imported: 'createServerFileRoute' }],\n },\n ]\n } else {\n imports.required = [\n {\n source: targetModule,\n specifiers: [{ imported: 'createServerFileRoute' }],\n },\n ]\n }\n return imports\n },\n onExportFound: ({ ctx, decl }) => {\n let appliedChanges = false\n if (decl.init?.type === 'CallExpression') {\n let call = decl.init\n let callee = call.callee\n\n while (\n callee.type === 'MemberExpression' &&\n callee.object.type === 'CallExpression'\n ) {\n call = callee.object\n callee = call.callee\n }\n if (\n call.callee.type === 'Identifier' &&\n call.callee.name === 'createServerFileRoute'\n ) {\n if (!ctx.verboseFileRoutes) {\n if (call.arguments.length) {\n call.arguments = []\n appliedChanges = true\n }\n } else {\n appliedChanges = ensureStringArgument(\n call,\n ctx.routeId,\n ctx.preferredQuote,\n )\n }\n } else {\n throw new Error(\n `Expected \"createServerFileRoute\" call, but got \"${call.callee.type}\"`,\n )\n }\n }\n return appliedChanges\n },\n },\n moduleAugmentation: ({ generator }) => ({\n module: `@tanstack/${generator.config.target}-start/server`,\n interfaceName: 'ServerFileRoutesByPath',\n }),\n onRouteTreesChanged: ({ routeTrees, generator }) => {\n const tree = routeTrees.find((tree) => tree.exportName === EXPORT_NAME)\n if (tree) {\n checkRouteFullPathUniqueness(tree.sortedRouteNodes, generator.config)\n }\n },\n imports: (ctx) => {\n const imports: Array<ImportDeclaration> = []\n\n const targetModule = `@tanstack/${ctx.generator.config.target}-start/server`\n if (ctx.generator.config.verboseFileRoutes === false) {\n imports.push({\n specifiers: [\n { imported: 'CreateServerFileRoute' },\n { imported: 'ServerFileRoutesByPath' },\n ],\n source: targetModule,\n importKind: 'type',\n })\n }\n // don't add the import if there are no server routes defined\n const hasMatchingRouteFiles = ctx.acc.routeNodes.length > 0\n if (hasMatchingRouteFiles) {\n // needs a virtual root route\n if (!ctx.rootRouteNode.exports?.includes(EXPORT_NAME)) {\n imports.push({\n specifiers: [{ imported: 'createServerRootRoute' }],\n source: targetModule,\n })\n }\n }\n return imports\n },\n routeModuleAugmentation: ({ routeNode }) => {\n // server routes don't support lazy routes\n if (routeNode._fsRouteType === 'lazy') {\n return undefined\n }\n return `const createServerFileRoute: CreateServerFileRoute<\n ServerFileRoutesByPath['${routeNode.routePath}']['parentRoute'],\n ServerFileRoutesByPath['${routeNode.routePath}']['id'],\n ServerFileRoutesByPath['${routeNode.routePath}']['path'],\n ServerFileRoutesByPath['${routeNode.routePath}']['fullPath'],\n ${hasChildWithExport(routeNode, 'ServerRoute') ? `${routeNode.variableName}ServerRouteChildren` : 'unknown'}\n >`\n },\n createRootRouteCode: () => `createServerRootRoute()`,\n createVirtualRouteCode: ({ node }) =>\n `createServerFileRoute('${node.routePath}')`,\n config: ({ sortedRouteNodes }) => {\n const hasMatchingRouteFiles = sortedRouteNodes.length > 0\n return {\n virtualRootRoute: hasMatchingRouteFiles,\n }\n },\n }\n}\n"],"names":["tree"],"mappings":"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"}
@@ -1,3 +0,0 @@
1
- import { PluginOption } from 'vite';
2
- import { Config } from '@tanstack/router-generator';
3
- export declare function tanStackStartRouter(config: Config): Array<PluginOption>;
@@ -1,21 +0,0 @@
1
- import { tanstackRouterGenerator, tanStackRouterCodeSplitter, tanstackRouterAutoImport } from "@tanstack/router-plugin/vite";
2
- import { routeTreeClientPlugin } from "./route-tree-client-plugin.js";
3
- import { virtualRouteTreePlugin } from "./virtual-route-tree-plugin.js";
4
- import { routesManifestPlugin } from "./generator-plugins/routes-manifest-plugin.js";
5
- import { serverRoutesPlugin } from "./generator-plugins/server-routes-plugin.js";
6
- function tanStackStartRouter(config) {
7
- return [
8
- tanstackRouterGenerator({
9
- ...config,
10
- plugins: [serverRoutesPlugin(), routesManifestPlugin()]
11
- }),
12
- tanStackRouterCodeSplitter(config),
13
- tanstackRouterAutoImport(config),
14
- routeTreeClientPlugin(config),
15
- virtualRouteTreePlugin(config)
16
- ];
17
- }
18
- export {
19
- tanStackStartRouter
20
- };
21
- //# sourceMappingURL=plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../src/start-router-plugin/plugin.ts"],"sourcesContent":["/*\nwhat is this plugin doing, especially compared to one already existing in the @tanstack/router-plugin package?\n\nit configures:\n1. the generator to generate both the render-route-tree as well as the server-route-tree\n2. the code-splitter plugin, so it could possibly be enabled per environment (e.g. disable on the server)\n3. the auto import plugin for both environments\n4. the route tree client plugin, which removes the server part from the generated route tree\n5. the virtual route tree plugin, which provides the route tree to the server\n*/\n\nimport {\n tanStackRouterCodeSplitter,\n tanstackRouterAutoImport,\n tanstackRouterGenerator,\n} from '@tanstack/router-plugin/vite'\nimport { routeTreeClientPlugin } from './route-tree-client-plugin'\nimport { virtualRouteTreePlugin } from './virtual-route-tree-plugin'\nimport { routesManifestPlugin } from './generator-plugins/routes-manifest-plugin'\nimport { serverRoutesPlugin } from './generator-plugins/server-routes-plugin'\nimport type { PluginOption } from 'vite'\nimport type { Config } from '@tanstack/router-generator'\n\nexport function tanStackStartRouter(config: Config): Array<PluginOption> {\n return [\n tanstackRouterGenerator({\n ...config,\n plugins: [serverRoutesPlugin(), routesManifestPlugin()],\n }),\n tanStackRouterCodeSplitter(config),\n tanstackRouterAutoImport(config),\n routeTreeClientPlugin(config),\n virtualRouteTreePlugin(config),\n ]\n}\n"],"names":[],"mappings":";;;;;AAuBO,SAAS,oBAAoB,QAAqC;AAChE,SAAA;AAAA,IACL,wBAAwB;AAAA,MACtB,GAAG;AAAA,MACH,SAAS,CAAC,mBAAmB,GAAG,qBAAsB,CAAA;AAAA,IAAA,CACvD;AAAA,IACD,2BAA2B,MAAM;AAAA,IACjC,yBAAyB,MAAM;AAAA,IAC/B,sBAAsB,MAAM;AAAA,IAC5B,uBAAuB,MAAM;AAAA,EAC/B;AACF;"}
@@ -1,6 +0,0 @@
1
- import { Plugin } from 'vite';
2
- import { Config } from '@tanstack/router-generator';
3
- /**
4
- * This removes the server part from the generated route tree so that it can be used on the client.
5
- */
6
- export declare function routeTreeClientPlugin(config: Config): Plugin;
@@ -1,55 +0,0 @@
1
- import path from "node:path";
2
- import * as t from "@babel/types";
3
- import { parseAst, generateFromAst, logDiff } from "@tanstack/router-utils";
4
- import { normalizePath } from "vite";
5
- import { deadCodeElimination } from "babel-dead-code-elimination";
6
- import { debug } from "../debug.js";
7
- function routeTreeClientPlugin(config) {
8
- const generatedRouteTreePath = normalizePath(
9
- path.resolve(config.generatedRouteTree)
10
- );
11
- return {
12
- name: "tanstack-start:route-tree-client-plugin",
13
- enforce: "pre",
14
- // only run this plugin in the client environment
15
- applyToEnvironment: (env) => env.config.consumer === "client",
16
- transform: {
17
- filter: { id: generatedRouteTreePath },
18
- handler(code, id) {
19
- if (id !== generatedRouteTreePath) {
20
- return null;
21
- }
22
- if (debug) console.info(`Compiling route tree for the client`, id);
23
- const ast = parseAst({ code, sourceFilename: id });
24
- const filteredBody = ast.program.body.filter((node) => {
25
- if (t.isExportNamedDeclaration(node)) {
26
- if (node.declaration && t.isVariableDeclaration(node.declaration) && node.declaration.declarations.length === 1 && node.declaration.declarations[0] && t.isVariableDeclarator(node.declaration.declarations[0]) && t.isIdentifier(node.declaration.declarations[0].id) && node.declaration.declarations[0].id.name === "routeTree") {
27
- return true;
28
- }
29
- return false;
30
- }
31
- if (t.isTSInterfaceDeclaration(node) || t.isTSModuleDeclaration(node)) {
32
- return false;
33
- }
34
- return true;
35
- });
36
- ast.program.body = filteredBody;
37
- deadCodeElimination(ast);
38
- const compiled = generateFromAst(ast, {
39
- sourceMaps: true,
40
- sourceFileName: id,
41
- filename: id
42
- });
43
- if (debug) {
44
- logDiff(code, compiled.code);
45
- console.log("Output:\n", compiled.code, "\n\n");
46
- }
47
- return compiled;
48
- }
49
- }
50
- };
51
- }
52
- export {
53
- routeTreeClientPlugin
54
- };
55
- //# sourceMappingURL=route-tree-client-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-tree-client-plugin.js","sources":["../../../src/start-router-plugin/route-tree-client-plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport * as t from '@babel/types'\nimport { generateFromAst, logDiff, parseAst } from '@tanstack/router-utils'\nimport { normalizePath } from 'vite'\nimport { deadCodeElimination } from 'babel-dead-code-elimination'\nimport { debug } from '../debug'\nimport type { Plugin } from 'vite'\nimport type { Config } from '@tanstack/router-generator'\n\n/**\n * This removes the server part from the generated route tree so that it can be used on the client.\n */\nexport function routeTreeClientPlugin(config: Config): Plugin {\n const generatedRouteTreePath = normalizePath(\n path.resolve(config.generatedRouteTree),\n )\n\n return {\n name: 'tanstack-start:route-tree-client-plugin',\n enforce: 'pre',\n // only run this plugin in the client environment\n applyToEnvironment: (env) => env.config.consumer === 'client',\n transform: {\n filter: { id: generatedRouteTreePath },\n handler(code, id) {\n if (id !== generatedRouteTreePath) {\n return null\n }\n if (debug) console.info(`Compiling route tree for the client`, id)\n const ast = parseAst({ code, sourceFilename: id })\n\n // only keep `export const routeTree = ... `\n const filteredBody = ast.program.body.filter((node) => {\n if (t.isExportNamedDeclaration(node)) {\n if (\n node.declaration &&\n t.isVariableDeclaration(node.declaration) &&\n node.declaration.declarations.length === 1 &&\n node.declaration.declarations[0] &&\n t.isVariableDeclarator(node.declaration.declarations[0]) &&\n t.isIdentifier(node.declaration.declarations[0].id) &&\n node.declaration.declarations[0].id.name === 'routeTree'\n ) {\n return true\n }\n return false\n }\n // strip off the typescript interface & module declarations since they also reference the server routes\n if (\n t.isTSInterfaceDeclaration(node) ||\n t.isTSModuleDeclaration(node)\n ) {\n return false\n }\n return true\n })\n\n ast.program.body = filteredBody\n\n deadCodeElimination(ast)\n\n const compiled = generateFromAst(ast, {\n sourceMaps: true,\n sourceFileName: id,\n filename: id,\n })\n if (debug) {\n logDiff(code, compiled.code)\n console.log('Output:\\n', compiled.code, '\\n\\n')\n }\n\n return compiled\n },\n },\n }\n}\n"],"names":[],"mappings":";;;;;;AAYO,SAAS,sBAAsB,QAAwB;AAC5D,QAAM,yBAAyB;AAAA,IAC7B,KAAK,QAAQ,OAAO,kBAAkB;AAAA,EACxC;AAEO,SAAA;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,IAET,oBAAoB,CAAC,QAAQ,IAAI,OAAO,aAAa;AAAA,IACrD,WAAW;AAAA,MACT,QAAQ,EAAE,IAAI,uBAAuB;AAAA,MACrC,QAAQ,MAAM,IAAI;AAChB,YAAI,OAAO,wBAAwB;AAC1B,iBAAA;AAAA,QAAA;AAET,YAAI,MAAO,SAAQ,KAAK,uCAAuC,EAAE;AACjE,cAAM,MAAM,SAAS,EAAE,MAAM,gBAAgB,IAAI;AAGjD,cAAM,eAAe,IAAI,QAAQ,KAAK,OAAO,CAAC,SAAS;AACjD,cAAA,EAAE,yBAAyB,IAAI,GAAG;AACpC,gBACE,KAAK,eACL,EAAE,sBAAsB,KAAK,WAAW,KACxC,KAAK,YAAY,aAAa,WAAW,KACzC,KAAK,YAAY,aAAa,CAAC,KAC/B,EAAE,qBAAqB,KAAK,YAAY,aAAa,CAAC,CAAC,KACvD,EAAE,aAAa,KAAK,YAAY,aAAa,CAAC,EAAE,EAAE,KAClD,KAAK,YAAY,aAAa,CAAC,EAAE,GAAG,SAAS,aAC7C;AACO,qBAAA;AAAA,YAAA;AAEF,mBAAA;AAAA,UAAA;AAGT,cACE,EAAE,yBAAyB,IAAI,KAC/B,EAAE,sBAAsB,IAAI,GAC5B;AACO,mBAAA;AAAA,UAAA;AAEF,iBAAA;AAAA,QAAA,CACR;AAED,YAAI,QAAQ,OAAO;AAEnB,4BAAoB,GAAG;AAEjB,cAAA,WAAW,gBAAgB,KAAK;AAAA,UACpC,YAAY;AAAA,UACZ,gBAAgB;AAAA,UAChB,UAAU;AAAA,QAAA,CACX;AACD,YAAI,OAAO;AACD,kBAAA,MAAM,SAAS,IAAI;AAC3B,kBAAQ,IAAI,aAAa,SAAS,MAAM,MAAM;AAAA,QAAA;AAGzC,eAAA;AAAA,MAAA;AAAA,IACT;AAAA,EAEJ;AACF;"}
@@ -1,4 +0,0 @@
1
- import { Config } from '@tanstack/router-generator';
2
- import { Plugin } from 'vite';
3
- export declare const moduleId = "tanstack-start-route-tree:v";
4
- export declare function virtualRouteTreePlugin(config: Config): Plugin;
@@ -1,30 +0,0 @@
1
- import path from "node:path";
2
- import { normalizePath } from "vite";
3
- import { debug } from "../debug.js";
4
- const moduleId = "tanstack-start-route-tree:v";
5
- function virtualRouteTreePlugin(config) {
6
- const generatedRouteTreePath = normalizePath(
7
- path.resolve(config.generatedRouteTree)
8
- );
9
- return {
10
- name: "tanstack-start:virtual-route-tree",
11
- enforce: "pre",
12
- sharedDuringBuild: true,
13
- resolveId: {
14
- filter: { id: new RegExp(moduleId) },
15
- handler(id) {
16
- let resolvedId = null;
17
- if (id === moduleId) {
18
- if (debug) console.info("resolving id", id, generatedRouteTreePath);
19
- resolvedId = generatedRouteTreePath;
20
- }
21
- return resolvedId;
22
- }
23
- }
24
- };
25
- }
26
- export {
27
- moduleId,
28
- virtualRouteTreePlugin
29
- };
30
- //# sourceMappingURL=virtual-route-tree-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"virtual-route-tree-plugin.js","sources":["../../../src/start-router-plugin/virtual-route-tree-plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { normalizePath } from 'vite'\nimport { debug } from '../debug'\nimport type { Config } from '@tanstack/router-generator'\nimport type { Plugin } from 'vite'\n\nexport const moduleId = 'tanstack-start-route-tree:v'\n\nexport function virtualRouteTreePlugin(config: Config): Plugin {\n const generatedRouteTreePath = normalizePath(\n path.resolve(config.generatedRouteTree),\n )\n\n return {\n name: 'tanstack-start:virtual-route-tree',\n enforce: 'pre',\n sharedDuringBuild: true,\n resolveId: {\n filter: { id: new RegExp(moduleId) },\n handler(id) {\n let resolvedId: string | null = null\n if (id === moduleId) {\n if (debug) console.info('resolving id', id, generatedRouteTreePath)\n resolvedId = generatedRouteTreePath\n }\n return resolvedId\n },\n },\n }\n}\n"],"names":[],"mappings":";;;AAMO,MAAM,WAAW;AAEjB,SAAS,uBAAuB,QAAwB;AAC7D,QAAM,yBAAyB;AAAA,IAC7B,KAAK,QAAQ,OAAO,kBAAkB;AAAA,EACxC;AAEO,SAAA;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,WAAW;AAAA,MACT,QAAQ,EAAE,IAAI,IAAI,OAAO,QAAQ,EAAE;AAAA,MACnC,QAAQ,IAAI;AACV,YAAI,aAA4B;AAChC,YAAI,OAAO,UAAU;AACnB,cAAI,MAAO,SAAQ,KAAK,gBAAgB,IAAI,sBAAsB;AACrD,uBAAA;AAAA,QAAA;AAER,eAAA;AAAA,MAAA;AAAA,IACT;AAAA,EAEJ;AACF;"}
@@ -1,8 +0,0 @@
1
- export declare function resolveViteId(id: string): string;
2
- export declare function createLogger(prefix: string): {
3
- log: (...args: any) => void;
4
- debug: (...args: any) => void;
5
- info: (...args: any) => void;
6
- warn: (...args: any) => void;
7
- error: (...args: any) => void;
8
- };
package/dist/esm/utils.js DELETED
@@ -1,18 +0,0 @@
1
- function resolveViteId(id) {
2
- return `\0${id}`;
3
- }
4
- function createLogger(prefix) {
5
- const label = `[${prefix}]`;
6
- return {
7
- log: (...args) => console.log(label, ...args),
8
- debug: (...args) => console.debug(label, ...args),
9
- info: (...args) => console.info(label, ...args),
10
- warn: (...args) => console.warn(label, ...args),
11
- error: (...args) => console.error(label, ...args)
12
- };
13
- }
14
- export {
15
- createLogger,
16
- resolveViteId
17
- };
18
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["export function resolveViteId(id: string) {\n return `\\0${id}`\n}\n\nexport function createLogger(prefix: string) {\n const label = `[${prefix}]`\n return {\n log: (...args: any) => console.log(label, ...args),\n debug: (...args: any) => console.debug(label, ...args),\n info: (...args: any) => console.info(label, ...args),\n warn: (...args: any) => console.warn(label, ...args),\n error: (...args: any) => console.error(label, ...args),\n }\n}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc,IAAY;AACxC,SAAO,KAAK,EAAE;AAChB;AAEO,SAAS,aAAa,QAAgB;AACrC,QAAA,QAAQ,IAAI,MAAM;AACjB,SAAA;AAAA,IACL,KAAK,IAAI,SAAc,QAAQ,IAAI,OAAO,GAAG,IAAI;AAAA,IACjD,OAAO,IAAI,SAAc,QAAQ,MAAM,OAAO,GAAG,IAAI;AAAA,IACrD,MAAM,IAAI,SAAc,QAAQ,KAAK,OAAO,GAAG,IAAI;AAAA,IACnD,MAAM,IAAI,SAAc,QAAQ,KAAK,OAAO,GAAG,IAAI;AAAA,IACnD,OAAO,IAAI,SAAc,QAAQ,MAAM,OAAO,GAAG,IAAI;AAAA,EACvD;AACF;"}