@tanstack/start-plugin-core 1.121.20 → 1.121.22

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 (137) hide show
  1. package/dist/cjs/compilers.cjs +416 -0
  2. package/dist/cjs/compilers.cjs.map +1 -0
  3. package/dist/cjs/compilers.d.cts +21 -0
  4. package/dist/cjs/constants.cjs +20 -0
  5. package/dist/cjs/constants.cjs.map +1 -0
  6. package/dist/cjs/constants.d.cts +6 -0
  7. package/dist/cjs/debug.cjs +5 -0
  8. package/dist/cjs/debug.cjs.map +1 -0
  9. package/dist/cjs/debug.d.cts +1 -0
  10. package/dist/cjs/dev-server-plugin/extract-html-scripts.cjs +35 -0
  11. package/dist/cjs/dev-server-plugin/extract-html-scripts.cjs.map +1 -0
  12. package/dist/cjs/dev-server-plugin/extract-html-scripts.d.cts +4 -0
  13. package/dist/cjs/dev-server-plugin/plugin.cjs +136 -0
  14. package/dist/cjs/dev-server-plugin/plugin.cjs.map +1 -0
  15. package/dist/cjs/dev-server-plugin/plugin.d.cts +5 -0
  16. package/dist/cjs/index.cjs +11 -0
  17. package/dist/cjs/index.cjs.map +1 -0
  18. package/dist/cjs/index.d.cts +3 -0
  19. package/dist/cjs/load-env-plugin/plugin.cjs +34 -0
  20. package/dist/cjs/load-env-plugin/plugin.cjs.map +1 -0
  21. package/dist/cjs/load-env-plugin/plugin.d.cts +3 -0
  22. package/dist/cjs/nitro-plugin/build-sitemap.cjs +138 -0
  23. package/dist/cjs/nitro-plugin/build-sitemap.cjs.map +1 -0
  24. package/dist/cjs/nitro-plugin/build-sitemap.d.cts +31 -0
  25. package/dist/cjs/nitro-plugin/plugin.cjs +181 -0
  26. package/dist/cjs/nitro-plugin/plugin.cjs.map +1 -0
  27. package/dist/cjs/nitro-plugin/plugin.d.cts +3 -0
  28. package/dist/cjs/nitro-plugin/prerender.cjs +174 -0
  29. package/dist/cjs/nitro-plugin/prerender.cjs.map +1 -0
  30. package/dist/cjs/nitro-plugin/prerender.d.cts +8 -0
  31. package/dist/cjs/nitro-plugin/queue.cjs +131 -0
  32. package/dist/cjs/nitro-plugin/queue.cjs.map +1 -0
  33. package/dist/cjs/nitro-plugin/queue.d.cts +32 -0
  34. package/dist/cjs/plugin.cjs +207 -0
  35. package/dist/cjs/plugin.cjs.map +1 -0
  36. package/dist/cjs/plugin.d.cts +291 -0
  37. package/dist/cjs/resolve-virtual-entries-plugin/plugin.cjs +66 -0
  38. package/dist/cjs/resolve-virtual-entries-plugin/plugin.cjs.map +1 -0
  39. package/dist/cjs/resolve-virtual-entries-plugin/plugin.d.cts +3 -0
  40. package/dist/cjs/schema.cjs +157 -0
  41. package/dist/cjs/schema.cjs.map +1 -0
  42. package/dist/cjs/schema.d.cts +8779 -0
  43. package/dist/cjs/start-compiler-plugin.cjs +74 -0
  44. package/dist/cjs/start-compiler-plugin.cjs.map +1 -0
  45. package/dist/cjs/start-compiler-plugin.d.cts +13 -0
  46. package/dist/cjs/start-manifest-plugin/plugin.cjs +187 -0
  47. package/dist/cjs/start-manifest-plugin/plugin.cjs.map +1 -0
  48. package/dist/cjs/start-manifest-plugin/plugin.d.cts +5 -0
  49. package/dist/cjs/start-router-plugin/generator-plugins/routes-manifest-plugin.cjs +39 -0
  50. package/dist/cjs/start-router-plugin/generator-plugins/routes-manifest-plugin.cjs.map +1 -0
  51. package/dist/cjs/start-router-plugin/generator-plugins/routes-manifest-plugin.d.cts +6 -0
  52. package/dist/cjs/start-router-plugin/generator-plugins/server-routes-plugin.cjs +121 -0
  53. package/dist/cjs/start-router-plugin/generator-plugins/server-routes-plugin.cjs.map +1 -0
  54. package/dist/cjs/start-router-plugin/generator-plugins/server-routes-plugin.d.cts +2 -0
  55. package/dist/cjs/start-router-plugin/plugin.cjs +21 -0
  56. package/dist/cjs/start-router-plugin/plugin.cjs.map +1 -0
  57. package/dist/cjs/start-router-plugin/plugin.d.cts +3 -0
  58. package/dist/cjs/start-router-plugin/route-tree-client-plugin.cjs +72 -0
  59. package/dist/cjs/start-router-plugin/route-tree-client-plugin.cjs.map +1 -0
  60. package/dist/cjs/start-router-plugin/route-tree-client-plugin.d.cts +6 -0
  61. package/dist/cjs/start-router-plugin/virtual-route-tree-plugin.cjs +30 -0
  62. package/dist/cjs/start-router-plugin/virtual-route-tree-plugin.cjs.map +1 -0
  63. package/dist/cjs/start-router-plugin/virtual-route-tree-plugin.d.cts +4 -0
  64. package/dist/cjs/utils.cjs +18 -0
  65. package/dist/cjs/utils.cjs.map +1 -0
  66. package/dist/cjs/utils.d.cts +8 -0
  67. package/dist/esm/compilers.d.ts +21 -0
  68. package/dist/esm/compilers.js +398 -0
  69. package/dist/esm/compilers.js.map +1 -0
  70. package/dist/esm/constants.d.ts +6 -0
  71. package/dist/esm/constants.js +20 -0
  72. package/dist/esm/constants.js.map +1 -0
  73. package/dist/esm/debug.d.ts +1 -0
  74. package/dist/esm/debug.js +5 -0
  75. package/dist/esm/debug.js.map +1 -0
  76. package/dist/esm/dev-server-plugin/extract-html-scripts.d.ts +4 -0
  77. package/dist/esm/dev-server-plugin/extract-html-scripts.js +18 -0
  78. package/dist/esm/dev-server-plugin/extract-html-scripts.js.map +1 -0
  79. package/dist/esm/dev-server-plugin/plugin.d.ts +5 -0
  80. package/dist/esm/dev-server-plugin/plugin.js +136 -0
  81. package/dist/esm/dev-server-plugin/plugin.js.map +1 -0
  82. package/dist/esm/index.d.ts +3 -0
  83. package/dist/esm/index.js +11 -0
  84. package/dist/esm/index.js.map +1 -0
  85. package/dist/esm/load-env-plugin/plugin.d.ts +3 -0
  86. package/dist/esm/load-env-plugin/plugin.js +17 -0
  87. package/dist/esm/load-env-plugin/plugin.js.map +1 -0
  88. package/dist/esm/nitro-plugin/build-sitemap.d.ts +31 -0
  89. package/dist/esm/nitro-plugin/build-sitemap.js +138 -0
  90. package/dist/esm/nitro-plugin/build-sitemap.js.map +1 -0
  91. package/dist/esm/nitro-plugin/plugin.d.ts +3 -0
  92. package/dist/esm/nitro-plugin/plugin.js +181 -0
  93. package/dist/esm/nitro-plugin/plugin.js.map +1 -0
  94. package/dist/esm/nitro-plugin/prerender.d.ts +8 -0
  95. package/dist/esm/nitro-plugin/prerender.js +174 -0
  96. package/dist/esm/nitro-plugin/prerender.js.map +1 -0
  97. package/dist/esm/nitro-plugin/queue.d.ts +32 -0
  98. package/dist/esm/nitro-plugin/queue.js +131 -0
  99. package/dist/esm/nitro-plugin/queue.js.map +1 -0
  100. package/dist/esm/plugin.d.ts +291 -0
  101. package/dist/esm/plugin.js +190 -0
  102. package/dist/esm/plugin.js.map +1 -0
  103. package/dist/esm/resolve-virtual-entries-plugin/plugin.d.ts +3 -0
  104. package/dist/esm/resolve-virtual-entries-plugin/plugin.js +49 -0
  105. package/dist/esm/resolve-virtual-entries-plugin/plugin.js.map +1 -0
  106. package/dist/esm/schema.d.ts +8779 -0
  107. package/dist/esm/schema.js +157 -0
  108. package/dist/esm/schema.js.map +1 -0
  109. package/dist/esm/start-compiler-plugin.d.ts +13 -0
  110. package/dist/esm/start-compiler-plugin.js +74 -0
  111. package/dist/esm/start-compiler-plugin.js.map +1 -0
  112. package/dist/esm/start-manifest-plugin/plugin.d.ts +5 -0
  113. package/dist/esm/start-manifest-plugin/plugin.js +187 -0
  114. package/dist/esm/start-manifest-plugin/plugin.js.map +1 -0
  115. package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.d.ts +6 -0
  116. package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.js +39 -0
  117. package/dist/esm/start-router-plugin/generator-plugins/routes-manifest-plugin.js.map +1 -0
  118. package/dist/esm/start-router-plugin/generator-plugins/server-routes-plugin.d.ts +2 -0
  119. package/dist/esm/start-router-plugin/generator-plugins/server-routes-plugin.js +121 -0
  120. package/dist/esm/start-router-plugin/generator-plugins/server-routes-plugin.js.map +1 -0
  121. package/dist/esm/start-router-plugin/plugin.d.ts +3 -0
  122. package/dist/esm/start-router-plugin/plugin.js +21 -0
  123. package/dist/esm/start-router-plugin/plugin.js.map +1 -0
  124. package/dist/esm/start-router-plugin/route-tree-client-plugin.d.ts +6 -0
  125. package/dist/esm/start-router-plugin/route-tree-client-plugin.js +55 -0
  126. package/dist/esm/start-router-plugin/route-tree-client-plugin.js.map +1 -0
  127. package/dist/esm/start-router-plugin/virtual-route-tree-plugin.d.ts +4 -0
  128. package/dist/esm/start-router-plugin/virtual-route-tree-plugin.js +30 -0
  129. package/dist/esm/start-router-plugin/virtual-route-tree-plugin.js.map +1 -0
  130. package/dist/esm/utils.d.ts +8 -0
  131. package/dist/esm/utils.js +18 -0
  132. package/dist/esm/utils.js.map +1 -0
  133. package/package.json +7 -7
  134. package/src/global.d.ts +2 -0
  135. package/src/plugin.ts +10 -0
  136. package/src/start-manifest-plugin/plugin.ts +93 -99
  137. package/src/start-router-plugin/generator-plugins/routes-manifest-plugin.ts +2 -2
@@ -0,0 +1,174 @@
1
+ import { promises } from "node:fs";
2
+ import { pathToFileURL } from "node:url";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { getRollupConfig } from "nitropack/rollup";
6
+ import { createNitro, build } from "nitropack";
7
+ import { withBase, joinURL, withoutBase } from "ufo";
8
+ import { VITE_ENVIRONMENT_NAMES } from "../constants.js";
9
+ import { createLogger } from "../utils.js";
10
+ import { Queue } from "./queue.js";
11
+ async function prerender({
12
+ options,
13
+ nitro,
14
+ builder
15
+ }) {
16
+ var _a;
17
+ const logger = createLogger("prerender");
18
+ logger.info("Prerendering pages...");
19
+ if (((_a = options.prerender) == null ? void 0 : _a.enabled) && !options.pages.length) {
20
+ options.pages = [
21
+ {
22
+ path: "/"
23
+ }
24
+ ];
25
+ }
26
+ const serverEnv = builder.environments[VITE_ENVIRONMENT_NAMES.server];
27
+ if (!serverEnv) {
28
+ throw new Error(
29
+ `Vite's "${VITE_ENVIRONMENT_NAMES.server}" environment not found`
30
+ );
31
+ }
32
+ const prerenderOutputDir = path.resolve(
33
+ options.root,
34
+ ".tanstack",
35
+ "start",
36
+ "build",
37
+ "prerenderer"
38
+ );
39
+ const nodeNitro = await createNitro({
40
+ ...nitro.options._config,
41
+ preset: "nitro-prerender",
42
+ logLevel: 0,
43
+ output: {
44
+ dir: prerenderOutputDir,
45
+ serverDir: path.resolve(prerenderOutputDir, "server"),
46
+ publicDir: path.resolve(prerenderOutputDir, "public")
47
+ }
48
+ });
49
+ const nodeNitroRollupOptions = getRollupConfig(nodeNitro);
50
+ const build$1 = serverEnv.config.build;
51
+ build$1.outDir = prerenderOutputDir;
52
+ build$1.rollupOptions = {
53
+ ...build$1.rollupOptions,
54
+ ...nodeNitroRollupOptions,
55
+ output: {
56
+ ...build$1.rollupOptions.output,
57
+ ...nodeNitroRollupOptions.output,
58
+ sourcemap: void 0
59
+ }
60
+ };
61
+ await build(nodeNitro);
62
+ const serverFilename = typeof nodeNitroRollupOptions.output.entryFileNames === "string" ? nodeNitroRollupOptions.output.entryFileNames : "index.mjs";
63
+ const serverEntrypoint = pathToFileURL(
64
+ path.resolve(path.join(nodeNitro.options.output.serverDir, serverFilename))
65
+ ).toString();
66
+ const { closePrerenderer, localFetch } = await import(serverEntrypoint);
67
+ try {
68
+ const pages = await prerenderPages();
69
+ logger.info(`Prerendered ${pages.length} pages:`);
70
+ pages.forEach((page) => {
71
+ logger.info(`- ${page}`);
72
+ });
73
+ } catch (error) {
74
+ logger.error(error);
75
+ } finally {
76
+ closePrerenderer();
77
+ }
78
+ function extractLinks(html) {
79
+ const linkRegex = /<a[^>]+href=["']([^"']+)["'][^>]*>/g;
80
+ const links = [];
81
+ let match;
82
+ while ((match = linkRegex.exec(html)) !== null) {
83
+ const href = match[1];
84
+ if (href && (href.startsWith("/") || href.startsWith("./"))) {
85
+ links.push(href);
86
+ }
87
+ }
88
+ return links;
89
+ }
90
+ async function prerenderPages() {
91
+ var _a2;
92
+ const seen = /* @__PURE__ */ new Set();
93
+ const retriesByPath = /* @__PURE__ */ new Map();
94
+ const concurrency = ((_a2 = options.prerender) == null ? void 0 : _a2.concurrency) ?? os.cpus().length;
95
+ logger.info(`Concurrency: ${concurrency}`);
96
+ const queue = new Queue({ concurrency });
97
+ options.pages.forEach((page) => addCrawlPageTask(page));
98
+ await queue.start();
99
+ return Array.from(seen);
100
+ function addCrawlPageTask(page) {
101
+ var _a3, _b;
102
+ if (seen.has(page.path)) return;
103
+ seen.add(page.path);
104
+ if (page.fromCrawl) {
105
+ options.pages.push(page);
106
+ }
107
+ if (!(((_a3 = page.prerender) == null ? void 0 : _a3.enabled) ?? true)) return;
108
+ if (((_b = options.prerender) == null ? void 0 : _b.filter) && !options.prerender.filter(page)) return;
109
+ const prerenderOptions = {
110
+ ...options.prerender,
111
+ ...page.prerender
112
+ };
113
+ queue.add(async () => {
114
+ var _a4;
115
+ logger.info(`Crawling: ${page.path}`);
116
+ const retries = retriesByPath.get(page.path) || 0;
117
+ try {
118
+ const encodedRoute = encodeURI(page.path);
119
+ const res = await localFetch(
120
+ withBase(encodedRoute, nodeNitro.options.baseURL),
121
+ {
122
+ headers: { "x-nitro-prerender": encodedRoute }
123
+ }
124
+ );
125
+ if (!res.ok) {
126
+ throw new Error(`Failed to fetch ${page.path}: ${res.statusText}`, {
127
+ cause: res
128
+ });
129
+ }
130
+ const cleanPagePath = (prerenderOptions.outputPath || page.path).split(/[?#]/)[0];
131
+ const contentType = res.headers.get("content-type") || "";
132
+ const isImplicitHTML = !cleanPagePath.endsWith(".html") && contentType.includes("html");
133
+ const routeWithIndex = cleanPagePath.endsWith("/") ? cleanPagePath + "index" : cleanPagePath;
134
+ const htmlPath = cleanPagePath.endsWith("/") || prerenderOptions.autoSubfolderIndex ? joinURL(cleanPagePath, "index.html") : cleanPagePath + ".html";
135
+ const filename = withoutBase(
136
+ isImplicitHTML ? htmlPath : routeWithIndex,
137
+ nitro.options.baseURL
138
+ );
139
+ const html = await res.text();
140
+ const filepath = path.join(nitro.options.output.publicDir, filename);
141
+ await promises.mkdir(path.dirname(filepath), {
142
+ recursive: true
143
+ });
144
+ await promises.writeFile(filepath, html);
145
+ const newPage = await ((_a4 = prerenderOptions.onSuccess) == null ? void 0 : _a4.call(prerenderOptions, { page, html }));
146
+ if (newPage) {
147
+ Object.assign(page, newPage);
148
+ }
149
+ if (prerenderOptions.crawlLinks ?? true) {
150
+ const links = extractLinks(html);
151
+ for (const link of links) {
152
+ addCrawlPageTask({ path: link, fromCrawl: true });
153
+ }
154
+ }
155
+ } catch (error) {
156
+ if (retries < (prerenderOptions.retryCount ?? 0)) {
157
+ logger.warn(`Encountered error, retrying: ${page.path} in 500ms`);
158
+ await new Promise(
159
+ (resolve) => setTimeout(resolve, prerenderOptions.retryDelay)
160
+ );
161
+ retriesByPath.set(page.path, retries + 1);
162
+ addCrawlPageTask(page);
163
+ } else {
164
+ throw error;
165
+ }
166
+ }
167
+ });
168
+ }
169
+ }
170
+ }
171
+ export {
172
+ prerender
173
+ };
174
+ //# sourceMappingURL=prerender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prerender.js","sources":["../../../src/nitro-plugin/prerender.ts"],"sourcesContent":["import { promises as fsp } from 'node:fs'\nimport { pathToFileURL } from 'node:url'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { getRollupConfig } from 'nitropack/rollup'\nimport { build as buildNitro, createNitro } from 'nitropack'\nimport { joinURL, withBase, withoutBase } from 'ufo'\nimport { VITE_ENVIRONMENT_NAMES } from '../constants'\nimport { createLogger } from '../utils'\nimport { Queue } from './queue'\nimport type { ViteBuilder } from 'vite'\nimport type { $Fetch, Nitro } from 'nitropack'\nimport type { TanStackStartOutputConfig } from '../plugin'\nimport type { Page } from '../schema'\n\nexport async function prerender({\n options,\n nitro,\n builder,\n}: {\n options: TanStackStartOutputConfig\n nitro: Nitro\n builder: ViteBuilder\n}) {\n const logger = createLogger('prerender')\n logger.info('Prerendering pages...')\n\n // If prerender is enabled but no pages are provided, default to prerendering the root page\n if (options.prerender?.enabled && !options.pages.length) {\n options.pages = [\n {\n path: '/',\n },\n ]\n }\n\n const serverEnv = builder.environments[VITE_ENVIRONMENT_NAMES.server]\n\n if (!serverEnv) {\n throw new Error(\n `Vite's \"${VITE_ENVIRONMENT_NAMES.server}\" environment not found`,\n )\n }\n\n const prerenderOutputDir = path.resolve(\n options.root,\n '.tanstack',\n 'start',\n 'build',\n 'prerenderer',\n )\n\n const nodeNitro = await createNitro({\n ...nitro.options._config,\n preset: 'nitro-prerender',\n logLevel: 0,\n output: {\n dir: prerenderOutputDir,\n serverDir: path.resolve(prerenderOutputDir, 'server'),\n publicDir: path.resolve(prerenderOutputDir, 'public'),\n },\n })\n\n const nodeNitroRollupOptions = getRollupConfig(nodeNitro)\n\n const build = serverEnv.config.build\n\n build.outDir = prerenderOutputDir\n\n build.rollupOptions = {\n ...build.rollupOptions,\n ...nodeNitroRollupOptions,\n output: {\n ...build.rollupOptions.output,\n ...nodeNitroRollupOptions.output,\n sourcemap: undefined,\n },\n }\n\n await buildNitro(nodeNitro)\n\n // Import renderer entry\n const serverFilename =\n typeof nodeNitroRollupOptions.output.entryFileNames === 'string'\n ? nodeNitroRollupOptions.output.entryFileNames\n : 'index.mjs'\n\n const serverEntrypoint = pathToFileURL(\n path.resolve(path.join(nodeNitro.options.output.serverDir, serverFilename)),\n ).toString()\n\n const { closePrerenderer, localFetch } = (await import(serverEntrypoint)) as {\n closePrerenderer: () => void\n localFetch: $Fetch\n }\n\n try {\n // Crawl all pages\n const pages = await prerenderPages()\n\n logger.info(`Prerendered ${pages.length} pages:`)\n pages.forEach((page) => {\n logger.info(`- ${page}`)\n })\n\n // TODO: Write the prerendered pages to the output directory\n } catch (error) {\n logger.error(error)\n } finally {\n // Ensure server is always closed\n // server.process.kill()\n closePrerenderer()\n }\n\n function extractLinks(html: string): Array<string> {\n const linkRegex = /<a[^>]+href=[\"']([^\"']+)[\"'][^>]*>/g\n const links: Array<string> = []\n let match\n\n while ((match = linkRegex.exec(html)) !== null) {\n const href = match[1]\n if (href && (href.startsWith('/') || href.startsWith('./'))) {\n links.push(href)\n }\n }\n\n return links\n }\n\n async function prerenderPages() {\n const seen = new Set<string>()\n const retriesByPath = new Map<string, number>()\n const concurrency = options.prerender?.concurrency ?? os.cpus().length\n logger.info(`Concurrency: ${concurrency}`)\n const queue = new Queue({ concurrency })\n\n options.pages.forEach((page) => addCrawlPageTask(page))\n\n await queue.start()\n\n return Array.from(seen)\n\n function addCrawlPageTask(page: Page) {\n // Was the page already seen?\n if (seen.has(page.path)) return\n\n // Add the page to the seen set\n seen.add(page.path)\n\n if (page.fromCrawl) {\n options.pages.push(page)\n }\n\n // If not enabled, skip\n if (!(page.prerender?.enabled ?? true)) return\n\n // If there is a filter link, check if the page should be prerendered\n if (options.prerender?.filter && !options.prerender.filter(page)) return\n\n // Resolve the merged default and page-specific prerender options\n const prerenderOptions = {\n ...options.prerender,\n ...page.prerender,\n }\n\n // Add the task\n queue.add(async () => {\n logger.info(`Crawling: ${page.path}`)\n const retries = retriesByPath.get(page.path) || 0\n try {\n // Fetch the route\n const encodedRoute = encodeURI(page.path)\n\n const res = await localFetch<Response>(\n withBase(encodedRoute, nodeNitro.options.baseURL),\n {\n headers: { 'x-nitro-prerender': encodedRoute },\n },\n )\n\n if (!res.ok) {\n throw new Error(`Failed to fetch ${page.path}: ${res.statusText}`, {\n cause: res,\n })\n }\n\n const cleanPagePath = (\n prerenderOptions.outputPath || page.path\n ).split(/[?#]/)[0]!\n\n // Guess route type and populate fileName\n const contentType = res.headers.get('content-type') || ''\n const isImplicitHTML =\n !cleanPagePath.endsWith('.html') && contentType.includes('html')\n // &&\n // !JsonSigRx.test(dataBuff.subarray(0, 32).toString('utf8'))\n const routeWithIndex = cleanPagePath.endsWith('/')\n ? cleanPagePath + 'index'\n : cleanPagePath\n\n const htmlPath =\n cleanPagePath.endsWith('/') || prerenderOptions.autoSubfolderIndex\n ? joinURL(cleanPagePath, 'index.html')\n : cleanPagePath + '.html'\n\n const filename = withoutBase(\n isImplicitHTML ? htmlPath : routeWithIndex,\n nitro.options.baseURL,\n )\n\n const html = await res.text()\n\n const filepath = path.join(nitro.options.output.publicDir, filename)\n\n await fsp.mkdir(path.dirname(filepath), {\n recursive: true,\n })\n\n await fsp.writeFile(filepath, html)\n\n const newPage = await prerenderOptions.onSuccess?.({ page, html })\n\n if (newPage) {\n Object.assign(page, newPage)\n }\n\n // Find new links\n if (prerenderOptions.crawlLinks ?? true) {\n const links = extractLinks(html)\n for (const link of links) {\n addCrawlPageTask({ path: link, fromCrawl: true })\n }\n }\n } catch (error) {\n if (retries < (prerenderOptions.retryCount ?? 0)) {\n logger.warn(`Encountered error, retrying: ${page.path} in 500ms`)\n await new Promise((resolve) =>\n setTimeout(resolve, prerenderOptions.retryDelay),\n )\n retriesByPath.set(page.path, retries + 1)\n addCrawlPageTask(page)\n } else {\n throw error\n }\n }\n })\n }\n }\n}\n"],"names":["build","buildNitro","_a","fsp"],"mappings":";;;;;;;;;;AAeA,eAAsB,UAAU;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAIG;;AACK,QAAA,SAAS,aAAa,WAAW;AACvC,SAAO,KAAK,uBAAuB;AAGnC,QAAI,aAAQ,cAAR,mBAAmB,YAAW,CAAC,QAAQ,MAAM,QAAQ;AACvD,YAAQ,QAAQ;AAAA,MACd;AAAA,QACE,MAAM;AAAA,MAAA;AAAA,IAEV;AAAA,EAAA;AAGF,QAAM,YAAY,QAAQ,aAAa,uBAAuB,MAAM;AAEpE,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR,WAAW,uBAAuB,MAAM;AAAA,IAC1C;AAAA,EAAA;AAGF,QAAM,qBAAqB,KAAK;AAAA,IAC9B,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEM,QAAA,YAAY,MAAM,YAAY;AAAA,IAClC,GAAG,MAAM,QAAQ;AAAA,IACjB,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,MACN,KAAK;AAAA,MACL,WAAW,KAAK,QAAQ,oBAAoB,QAAQ;AAAA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+1,32 @@
1
+ interface PoolConfig {
2
+ concurrency?: number;
3
+ started?: boolean;
4
+ tasks?: Array<() => Promise<any>>;
5
+ }
6
+ export declare class Queue<T> {
7
+ private onSettles;
8
+ private onErrors;
9
+ private onSuccesses;
10
+ private running;
11
+ private active;
12
+ private pending;
13
+ private currentConcurrency;
14
+ constructor(config?: PoolConfig);
15
+ private tick;
16
+ add(fn: () => Promise<T> | T, { priority }?: {
17
+ priority?: boolean;
18
+ }): Promise<any>;
19
+ throttle(n: number): void;
20
+ onSettled(cb: () => void): () => void;
21
+ onError(cb: (error: any, task: () => Promise<any>) => void): () => void;
22
+ onSuccess(cb: (result: any, task: () => Promise<any>) => void): () => void;
23
+ stop(): void;
24
+ start(): Promise<void>;
25
+ clear(): void;
26
+ getActive(): (() => Promise<any>)[];
27
+ getPending(): (() => Promise<any>)[];
28
+ getAll(): (() => Promise<any>)[];
29
+ isRunning(): boolean;
30
+ isSettled(): boolean;
31
+ }
32
+ export {};
@@ -0,0 +1,131 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ const defaultConfig = {
5
+ concurrency: 5,
6
+ started: false,
7
+ tasks: []
8
+ };
9
+ class Queue {
10
+ constructor(config = defaultConfig) {
11
+ __publicField(this, "onSettles", []);
12
+ __publicField(this, "onErrors", []);
13
+ __publicField(this, "onSuccesses", []);
14
+ __publicField(this, "running");
15
+ __publicField(this, "active", []);
16
+ __publicField(this, "pending");
17
+ __publicField(this, "currentConcurrency");
18
+ const { concurrency, started, tasks } = {
19
+ ...defaultConfig,
20
+ ...config
21
+ };
22
+ this.running = started;
23
+ this.pending = tasks;
24
+ this.currentConcurrency = concurrency;
25
+ }
26
+ tick() {
27
+ if (!this.running) {
28
+ return;
29
+ }
30
+ while (this.active.length < this.currentConcurrency && this.pending.length) {
31
+ const nextFn = this.pending.shift();
32
+ if (!nextFn) {
33
+ throw new Error("Found task that is not a function");
34
+ }
35
+ this.active.push(nextFn);
36
+ (async () => {
37
+ let success = false;
38
+ let res;
39
+ let error;
40
+ try {
41
+ res = await nextFn();
42
+ success = true;
43
+ } catch (e) {
44
+ error = e;
45
+ }
46
+ this.active = this.active.filter((d) => d !== nextFn);
47
+ if (success) {
48
+ this.onSuccesses.forEach((d) => d(res, nextFn));
49
+ } else {
50
+ this.onErrors.forEach((d) => d(error, nextFn));
51
+ }
52
+ this.onSettles.forEach((d) => d(res, error));
53
+ this.tick();
54
+ })();
55
+ }
56
+ }
57
+ add(fn, { priority } = {}) {
58
+ return new Promise((resolve, reject) => {
59
+ const task = () => Promise.resolve(fn()).then((res) => {
60
+ resolve(res);
61
+ return res;
62
+ }).catch((err) => {
63
+ reject(err);
64
+ throw err;
65
+ });
66
+ if (priority) {
67
+ this.pending.unshift(task);
68
+ } else {
69
+ this.pending.push(task);
70
+ }
71
+ this.tick();
72
+ });
73
+ }
74
+ throttle(n) {
75
+ this.currentConcurrency = n;
76
+ }
77
+ onSettled(cb) {
78
+ this.onSettles.push(cb);
79
+ return () => {
80
+ this.onSettles = this.onSettles.filter((d) => d !== cb);
81
+ };
82
+ }
83
+ onError(cb) {
84
+ this.onErrors.push(cb);
85
+ return () => {
86
+ this.onErrors = this.onErrors.filter((d) => d !== cb);
87
+ };
88
+ }
89
+ onSuccess(cb) {
90
+ this.onSuccesses.push(cb);
91
+ return () => {
92
+ this.onSuccesses = this.onSuccesses.filter((d) => d !== cb);
93
+ };
94
+ }
95
+ stop() {
96
+ this.running = false;
97
+ }
98
+ start() {
99
+ this.running = true;
100
+ this.tick();
101
+ return new Promise((resolve) => {
102
+ this.onSettled(() => {
103
+ if (this.isSettled()) {
104
+ resolve();
105
+ }
106
+ });
107
+ });
108
+ }
109
+ clear() {
110
+ this.pending = [];
111
+ }
112
+ getActive() {
113
+ return this.active;
114
+ }
115
+ getPending() {
116
+ return this.pending;
117
+ }
118
+ getAll() {
119
+ return [...this.active, ...this.pending];
120
+ }
121
+ isRunning() {
122
+ return this.running;
123
+ }
124
+ isSettled() {
125
+ return !this.active.length && !this.pending.length;
126
+ }
127
+ }
128
+ export {
129
+ Queue
130
+ };
131
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sources":["../../../src/nitro-plugin/queue.ts"],"sourcesContent":["interface PoolConfig {\n concurrency?: number\n started?: boolean\n tasks?: Array<() => Promise<any>>\n}\n\nconst defaultConfig: PoolConfig = {\n concurrency: 5,\n started: false,\n tasks: [],\n}\n\nexport class Queue<T> {\n private onSettles: Array<(res: any, error: any) => void> = []\n private onErrors: Array<(error: any, task: () => Promise<any>) => void> = []\n private onSuccesses: Array<(result: any, task: () => Promise<any>) => void> =\n []\n private running: boolean\n private active: Array<() => Promise<any>> = []\n private pending: Array<() => Promise<any>>\n private currentConcurrency: number\n\n constructor(config: PoolConfig = defaultConfig) {\n const { concurrency, started, tasks } = {\n ...defaultConfig,\n ...config,\n }\n this.running = started!\n this.pending = tasks as Array<() => Promise<any>>\n this.currentConcurrency = concurrency!\n }\n\n private tick() {\n if (!this.running) {\n return\n }\n while (\n this.active.length < this.currentConcurrency &&\n this.pending.length\n ) {\n const nextFn = this.pending.shift()\n if (!nextFn) {\n throw new Error('Found task that is not a function')\n }\n this.active.push(nextFn)\n ;(async () => {\n let success = false\n let res!: T\n let error: any\n try {\n res = await nextFn()\n success = true\n } catch (e) {\n error = e\n }\n this.active = this.active.filter((d) => d !== nextFn)\n if (success) {\n this.onSuccesses.forEach((d) => d(res, nextFn))\n } else {\n this.onErrors.forEach((d) => d(error, nextFn))\n }\n this.onSettles.forEach((d) => d(res, error))\n this.tick()\n })()\n }\n }\n\n add(fn: () => Promise<T> | T, { priority }: { priority?: boolean } = {}) {\n return new Promise<any>((resolve, reject) => {\n const task = () =>\n Promise.resolve(fn())\n .then((res) => {\n resolve(res)\n return res\n })\n .catch((err) => {\n reject(err)\n throw err\n })\n if (priority) {\n this.pending.unshift(task)\n } else {\n this.pending.push(task)\n }\n this.tick()\n })\n }\n\n throttle(n: number) {\n this.currentConcurrency = n\n }\n\n onSettled(cb: () => void) {\n this.onSettles.push(cb)\n return () => {\n this.onSettles = this.onSettles.filter((d) => d !== cb)\n }\n }\n\n onError(cb: (error: any, task: () => Promise<any>) => void) {\n this.onErrors.push(cb)\n return () => {\n this.onErrors = this.onErrors.filter((d) => d !== cb)\n }\n }\n\n onSuccess(cb: (result: any, task: () => Promise<any>) => void) {\n this.onSuccesses.push(cb)\n return () => {\n this.onSuccesses = this.onSuccesses.filter((d) => d !== cb)\n }\n }\n\n stop() {\n this.running = false\n }\n\n start() {\n this.running = true\n this.tick()\n return new Promise<void>((resolve) => {\n this.onSettled(() => {\n if (this.isSettled()) {\n resolve()\n }\n })\n })\n }\n\n clear() {\n this.pending = []\n }\n\n getActive() {\n return this.active\n }\n\n getPending() {\n return this.pending\n }\n\n getAll() {\n return [...this.active, ...this.pending]\n }\n\n isRunning() {\n return this.running\n }\n\n isSettled() {\n return !this.active.length && !this.pending.length\n }\n}\n"],"names":[],"mappings":";;;AAMA,MAAM,gBAA4B;AAAA,EAChC,aAAa;AAAA,EACb,SAAS;AAAA,EACT,OAAO,CAAA;AACT;AAEO,MAAM,MAAS;AAAA,EAUpB,YAAY,SAAqB,eAAe;AATxC,qCAAmD,CAAC;AACpD,oCAAkE,CAAC;AACnE,uCACN,CAAC;AACK;AACA,kCAAoC,CAAC;AACrC;AACA;AAGN,UAAM,EAAE,aAAa,SAAS,UAAU;AAAA,MACtC,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AACA,SAAK,UAAU;AACf,SAAK,UAAU;AACf,SAAK,qBAAqB;AAAA,EAAA;AAAA,EAGpB,OAAO;AACT,QAAA,CAAC,KAAK,SAAS;AACjB;AAAA,IAAA;AAEF,WACE,KAAK,OAAO,SAAS,KAAK,sBAC1B,KAAK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Y,KAAK,UAAU,OAAO,CAAC,MAAM,MAAM,EAAE;AAAA,IACxD;AAAA,EAAA;AAAA,EAGF,QAAQ,IAAoD;AACrD,SAAA,SAAS,KAAK,EAAE;AACrB,WAAO,MAAM;AACX,WAAK,WAAW,KAAK,SAAS,OAAO,CAAC,MAAM,MAAM,EAAE;AAAA,IACtD;AAAA,EAAA;AAAA,EAGF,UAAU,IAAqD;AACxD,SAAA,YAAY,KAAK,EAAE;AACxB,WAAO,MAAM;AACX,WAAK,cAAc,KAAK,YAAY,OAAO,CAAC,MAAM,MAAM,EAAE;AAAA,IAC5D;AAAA,EAAA;AAAA,EAGF,OAAO;AACL,SAAK,UAAU;AAAA,EAAA;AAAA,EAGjB,QAAQ;AACN,SAAK,UAAU;AACf,SAAK,KAAK;AACH,WAAA,IAAI,QAAc,CAAC,YAAY;AACpC,WAAK,UAAU,MAAM;AACf,YAAA,KAAK,aAAa;AACZ,kBAAA;AAAA,QAAA;AAAA,MACV,CACD;AAAA,IAAA,CACF;AAAA,EAAA;AAAA,EAGH,QAAQ;AACN,SAAK,UAAU,CAAC;AAAA,EAAA;AAAA,EAGlB,YAAY;AACV,WAAO,KAAK;AAAA,EAAA;AAAA,EAGd,aAAa;AACX,WAAO,KAAK;AAAA,EAAA;AAAA,EAGd,SAAS;AACP,WAAO,CAAC,GAAG,KAAK,QAAQ,GAAG,KAAK,OAAO;AAAA,EAAA;AAAA,EAGzC,YAAY;AACV,WAAO,KAAK;AAAA,EAAA;AAAA,EAGd,YAAY;AACV,WAAO,CAAC,KAAK,OAAO,UAAU,CAAC,KAAK,QAAQ;AAAA,EAAA;AAEhD;"}
@@ -0,0 +1,291 @@
1
+ import { createTanStackStartOptionsSchema } from './schema.js';
2
+ import { PluginOption } from 'vite';
3
+ import { z } from 'zod';
4
+ import { CompileStartFrameworkOptions } from './compilers.js';
5
+ export type TanStackStartInputConfig = z.input<ReturnType<typeof createTanStackStartOptionsSchema>>;
6
+ export declare function getTanStackStartOptions(opts?: TanStackStartInputConfig): {
7
+ tsr: {
8
+ target: "react" | "solid";
9
+ routeFileIgnorePrefix: string;
10
+ routesDirectory: string;
11
+ quoteStyle: "single" | "double";
12
+ semicolons: boolean;
13
+ disableLogging: boolean;
14
+ routeTreeFileHeader: string[];
15
+ indexToken: string;
16
+ routeToken: string;
17
+ generatedRouteTree: string;
18
+ disableTypes: boolean;
19
+ addExtensions: boolean;
20
+ enableRouteTreeFormatting: boolean;
21
+ routeTreeFileFooter: string[];
22
+ tmpDir: string;
23
+ virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
24
+ routeFilePrefix?: string | undefined;
25
+ routeFileIgnorePattern?: string | undefined;
26
+ pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
27
+ verboseFileRoutes?: boolean | undefined;
28
+ autoCodeSplitting?: boolean | undefined;
29
+ customScaffolding?: {
30
+ routeTemplate?: string | undefined;
31
+ lazyRouteTemplate?: string | undefined;
32
+ } | undefined;
33
+ experimental?: {
34
+ enableCodeSplitting?: boolean | undefined;
35
+ } | undefined;
36
+ plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
37
+ srcDirectory: string;
38
+ };
39
+ clientEntryPath: string;
40
+ serverEntryPath: string;
41
+ root: string;
42
+ client: {
43
+ base: string;
44
+ entry?: string | undefined;
45
+ };
46
+ server: {
47
+ entry?: string | undefined;
48
+ };
49
+ serverFns: {
50
+ base: string;
51
+ };
52
+ public: {
53
+ base: string;
54
+ dir: string;
55
+ };
56
+ pages: {
57
+ path: string;
58
+ prerender?: {
59
+ enabled?: boolean | undefined;
60
+ outputPath?: string | undefined;
61
+ autoSubfolderIndex?: boolean | undefined;
62
+ crawlLinks?: boolean | undefined;
63
+ retryCount?: number | undefined;
64
+ retryDelay?: number | undefined;
65
+ onSuccess?: ((args_0: {
66
+ page: {
67
+ path: string;
68
+ sitemap?: {
69
+ exclude?: boolean | undefined;
70
+ priority?: number | undefined;
71
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
72
+ lastmod?: string | Date | undefined;
73
+ alternateRefs?: {
74
+ href: string;
75
+ hreflang: string;
76
+ }[] | undefined;
77
+ images?: {
78
+ loc: string;
79
+ caption?: string | undefined;
80
+ title?: string | undefined;
81
+ }[] | undefined;
82
+ news?: {
83
+ title: string;
84
+ publication: {
85
+ name: string;
86
+ language: string;
87
+ };
88
+ publicationDate: string | Date;
89
+ } | undefined;
90
+ } | undefined;
91
+ fromCrawl?: boolean | undefined;
92
+ };
93
+ html: string;
94
+ }, ...args: unknown[]) => any) | undefined;
95
+ } | undefined;
96
+ sitemap?: {
97
+ exclude?: boolean | undefined;
98
+ priority?: number | undefined;
99
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
100
+ lastmod?: string | Date | undefined;
101
+ alternateRefs?: {
102
+ href: string;
103
+ hreflang: string;
104
+ }[] | undefined;
105
+ images?: {
106
+ loc: string;
107
+ caption?: string | undefined;
108
+ title?: string | undefined;
109
+ }[] | undefined;
110
+ news?: {
111
+ title: string;
112
+ publication: {
113
+ name: string;
114
+ language: string;
115
+ };
116
+ publicationDate: string | Date;
117
+ } | undefined;
118
+ } | undefined;
119
+ fromCrawl?: boolean | undefined;
120
+ }[];
121
+ target?: import('nitropack/presets').PresetNameInput | undefined;
122
+ prerender?: ({
123
+ filter?: ((args_0: {
124
+ path: string;
125
+ prerender?: {
126
+ enabled?: boolean | undefined;
127
+ outputPath?: string | undefined;
128
+ autoSubfolderIndex?: boolean | undefined;
129
+ crawlLinks?: boolean | undefined;
130
+ retryCount?: number | undefined;
131
+ retryDelay?: number | undefined;
132
+ onSuccess?: ((args_0: {
133
+ page: {
134
+ path: string;
135
+ sitemap?: {
136
+ exclude?: boolean | undefined;
137
+ priority?: number | undefined;
138
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
139
+ lastmod?: string | Date | undefined;
140
+ alternateRefs?: {
141
+ href: string;
142
+ hreflang: string;
143
+ }[] | undefined;
144
+ images?: {
145
+ loc: string;
146
+ caption?: string | undefined;
147
+ title?: string | undefined;
148
+ }[] | undefined;
149
+ news?: {
150
+ title: string;
151
+ publication: {
152
+ name: string;
153
+ language: string;
154
+ };
155
+ publicationDate: string | Date;
156
+ } | undefined;
157
+ } | undefined;
158
+ fromCrawl?: boolean | undefined;
159
+ };
160
+ html: string;
161
+ }, ...args: unknown[]) => any) | undefined;
162
+ } | undefined;
163
+ sitemap?: {
164
+ exclude?: boolean | undefined;
165
+ priority?: number | undefined;
166
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
167
+ lastmod?: string | Date | undefined;
168
+ alternateRefs?: {
169
+ href: string;
170
+ hreflang: string;
171
+ }[] | undefined;
172
+ images?: {
173
+ loc: string;
174
+ caption?: string | undefined;
175
+ title?: string | undefined;
176
+ }[] | undefined;
177
+ news?: {
178
+ title: string;
179
+ publication: {
180
+ name: string;
181
+ language: string;
182
+ };
183
+ publicationDate: string | Date;
184
+ } | undefined;
185
+ } | undefined;
186
+ fromCrawl?: boolean | undefined;
187
+ }, ...args: unknown[]) => any) | undefined;
188
+ enabled?: boolean | undefined;
189
+ concurrency?: number | undefined;
190
+ failOnError?: boolean | undefined;
191
+ } & {
192
+ enabled?: boolean | undefined;
193
+ outputPath?: string | undefined;
194
+ autoSubfolderIndex?: boolean | undefined;
195
+ crawlLinks?: boolean | undefined;
196
+ retryCount?: number | undefined;
197
+ retryDelay?: number | undefined;
198
+ onSuccess?: ((args_0: {
199
+ page: {
200
+ path: string;
201
+ sitemap?: {
202
+ exclude?: boolean | undefined;
203
+ priority?: number | undefined;
204
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
205
+ lastmod?: string | Date | undefined;
206
+ alternateRefs?: {
207
+ href: string;
208
+ hreflang: string;
209
+ }[] | undefined;
210
+ images?: {
211
+ loc: string;
212
+ caption?: string | undefined;
213
+ title?: string | undefined;
214
+ }[] | undefined;
215
+ news?: {
216
+ title: string;
217
+ publication: {
218
+ name: string;
219
+ language: string;
220
+ };
221
+ publicationDate: string | Date;
222
+ } | undefined;
223
+ } | undefined;
224
+ fromCrawl?: boolean | undefined;
225
+ };
226
+ html: string;
227
+ }, ...args: unknown[]) => any) | undefined;
228
+ }) | undefined;
229
+ sitemap?: {
230
+ enabled: boolean;
231
+ outputPath: string;
232
+ host?: string | undefined;
233
+ } | undefined;
234
+ spa?: {
235
+ prerender: {
236
+ enabled: boolean;
237
+ outputPath: string;
238
+ autoSubfolderIndex?: boolean | undefined;
239
+ crawlLinks: boolean;
240
+ retryCount: number;
241
+ retryDelay?: number | undefined;
242
+ onSuccess?: ((args_0: {
243
+ page: {
244
+ path: string;
245
+ sitemap?: {
246
+ exclude?: boolean | undefined;
247
+ priority?: number | undefined;
248
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" | undefined;
249
+ lastmod?: string | Date | undefined;
250
+ alternateRefs?: {
251
+ href: string;
252
+ hreflang: string;
253
+ }[] | undefined;
254
+ images?: {
255
+ loc: string;
256
+ caption?: string | undefined;
257
+ title?: string | undefined;
258
+ }[] | undefined;
259
+ news?: {
260
+ title: string;
261
+ publication: {
262
+ name: string;
263
+ language: string;
264
+ };
265
+ publicationDate: string | Date;
266
+ } | undefined;
267
+ } | undefined;
268
+ fromCrawl?: boolean | undefined;
269
+ };
270
+ html: string;
271
+ }, ...args: unknown[]) => any) | undefined;
272
+ };
273
+ enabled: boolean;
274
+ maskPath: string;
275
+ } | undefined;
276
+ };
277
+ export type TanStackStartOutputConfig = ReturnType<typeof getTanStackStartOptions>;
278
+ export interface TanStackStartVitePluginCoreOptions {
279
+ framework: CompileStartFrameworkOptions;
280
+ getVirtualServerRootHandler: (ctx: {
281
+ routerFilepath: string;
282
+ serverEntryFilepath: string;
283
+ }) => string;
284
+ getVirtualServerEntry: (ctx: {
285
+ routerFilepath: string;
286
+ }) => string;
287
+ getVirtualClientEntry: (ctx: {
288
+ routerFilepath: string;
289
+ }) => string;
290
+ }
291
+ export declare function TanStackStartVitePluginCore(opts: TanStackStartVitePluginCoreOptions, startConfig: TanStackStartOutputConfig): Array<PluginOption>;