@octanejs/tanstack-start 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +52 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/package.json +149 -0
- package/src/client-only.d.ts +1 -0
- package/src/client-only.js +0 -0
- package/src/client-rpc.d.ts +1 -0
- package/src/client-rpc.js +1 -0
- package/src/client.d.ts +3 -0
- package/src/client.js +2 -0
- package/src/default-entry/client.js +12 -0
- package/src/default-entry/server.js +13 -0
- package/src/default-entry/start.js +1 -0
- package/src/default-entry-paths.d.ts +5 -0
- package/src/default-entry-paths.js +11 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +22 -0
- package/src/internal/README.md +15 -0
- package/src/internal/router-generator/config.d.ts +255 -0
- package/src/internal/router-generator/config.js +134 -0
- package/src/internal/router-generator/filesystem/physical/getRouteNodes.d.ts +53 -0
- package/src/internal/router-generator/filesystem/physical/getRouteNodes.js +335 -0
- package/src/internal/router-generator/filesystem/physical/rootPathId.d.ts +1 -0
- package/src/internal/router-generator/filesystem/physical/rootPathId.js +4 -0
- package/src/internal/router-generator/filesystem/virtual/config.d.ts +3 -0
- package/src/internal/router-generator/filesystem/virtual/config.js +36 -0
- package/src/internal/router-generator/filesystem/virtual/getRouteNodes.d.ts +31 -0
- package/src/internal/router-generator/filesystem/virtual/getRouteNodes.js +272 -0
- package/src/internal/router-generator/filesystem/virtual/loadConfigFile.d.ts +1 -0
- package/src/internal/router-generator/filesystem/virtual/loadConfigFile.js +10 -0
- package/src/internal/router-generator/generator.d.ts +119 -0
- package/src/internal/router-generator/generator.js +1080 -0
- package/src/internal/router-generator/index.d.ts +40 -0
- package/src/internal/router-generator/index.js +49 -0
- package/src/internal/router-generator/logger.d.ts +8 -0
- package/src/internal/router-generator/logger.js +30 -0
- package/src/internal/router-generator/plugin/types.d.ts +37 -0
- package/src/internal/router-generator/template.d.ts +38 -0
- package/src/internal/router-generator/template.js +220 -0
- package/src/internal/router-generator/transform/transform.d.ts +8 -0
- package/src/internal/router-generator/transform/transform.js +385 -0
- package/src/internal/router-generator/transform/types.d.ts +34 -0
- package/src/internal/router-generator/types.d.ts +73 -0
- package/src/internal/router-generator/utils.d.ts +270 -0
- package/src/internal/router-generator/utils.js +864 -0
- package/src/internal/router-generator/validate-route-params.d.ts +13 -0
- package/src/internal/router-generator/validate-route-params.js +75 -0
- package/src/internal/router-plugin/context.d.ts +2 -0
- package/src/internal/router-plugin/context.js +2 -0
- package/src/internal/router-plugin/core/code-splitter/compilers.d.ts +69 -0
- package/src/internal/router-plugin/core/code-splitter/compilers.js +1042 -0
- package/src/internal/router-plugin/core/code-splitter/framework-options.d.ts +11 -0
- package/src/internal/router-plugin/core/code-splitter/framework-options.js +41 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/framework-plugins.d.ts +12 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/framework-plugins.js +35 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/octane-hmr-split-route-components.d.ts +5 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/octane-hmr-split-route-components.js +106 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/octane-split-route-components.d.ts +8 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/octane-split-route-components.js +85 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/react-refresh-ignored-route-exports.d.ts +2 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/react-refresh-ignored-route-exports.js +55 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/react-refresh-route-components.d.ts +2 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/react-refresh-route-components.js +50 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/react-stable-hmr-split-route-components.d.ts +5 -0
- package/src/internal/router-plugin/core/code-splitter/plugins/react-stable-hmr-split-route-components.js +54 -0
- package/src/internal/router-plugin/core/code-splitter/plugins.d.ts +62 -0
- package/src/internal/router-plugin/core/code-splitter/types.d.ts +9 -0
- package/src/internal/router-plugin/core/config.d.ts +294 -0
- package/src/internal/router-plugin/core/config.js +56 -0
- package/src/internal/router-plugin/core/constants.d.ts +12 -0
- package/src/internal/router-plugin/core/constants.js +13 -0
- package/src/internal/router-plugin/core/framework-plugin-order.d.ts +8 -0
- package/src/internal/router-plugin/core/framework-plugin-order.js +78 -0
- package/src/internal/router-plugin/core/hmr/handle-route-update.d.ts +1 -0
- package/src/internal/router-plugin/core/hmr/handle-route-update.js +126 -0
- package/src/internal/router-plugin/core/hmr/index.d.ts +5 -0
- package/src/internal/router-plugin/core/hmr/select-adapter.d.ts +17 -0
- package/src/internal/router-plugin/core/hmr/select-adapter.js +24 -0
- package/src/internal/router-plugin/core/hmr/vite-adapter.d.ts +18 -0
- package/src/internal/router-plugin/core/hmr/vite-adapter.js +73 -0
- package/src/internal/router-plugin/core/hmr/webpack-adapter.d.ts +22 -0
- package/src/internal/router-plugin/core/hmr/webpack-adapter.js +78 -0
- package/src/internal/router-plugin/core/router-code-splitter-plugin.d.ts +10 -0
- package/src/internal/router-plugin/core/router-code-splitter-plugin.js +244 -0
- package/src/internal/router-plugin/core/router-composed-plugin.d.ts +5 -0
- package/src/internal/router-plugin/core/router-composed-plugin.js +62 -0
- package/src/internal/router-plugin/core/router-generator-plugin.d.ts +10 -0
- package/src/internal/router-plugin/core/router-generator-plugin.js +125 -0
- package/src/internal/router-plugin/core/router-hmr-plugin.d.ts +13 -0
- package/src/internal/router-plugin/core/router-hmr-plugin.js +101 -0
- package/src/internal/router-plugin/core/router-plugin-context.d.ts +5 -0
- package/src/internal/router-plugin/core/router-plugin-context.js +6 -0
- package/src/internal/router-plugin/core/utils.d.ts +17 -0
- package/src/internal/router-plugin/core/utils.js +47 -0
- package/src/internal/router-plugin/esbuild.d.ts +197 -0
- package/src/internal/router-plugin/esbuild.js +58 -0
- package/src/internal/router-plugin/index.d.ts +19 -0
- package/src/internal/router-plugin/index.js +17 -0
- package/src/internal/router-plugin/rspack.d.ts +61 -0
- package/src/internal/router-plugin/rspack.js +92 -0
- package/src/internal/router-plugin/vite.d.ts +201 -0
- package/src/internal/router-plugin/vite.js +62 -0
- package/src/internal/router-plugin/webpack.d.ts +50 -0
- package/src/internal/router-plugin/webpack.js +77 -0
- package/src/internal/start-plugin-core/build-sitemap.d.ts +34 -0
- package/src/internal/start-plugin-core/build-sitemap.js +125 -0
- package/src/internal/start-plugin-core/config-context.d.ts +30 -0
- package/src/internal/start-plugin-core/config-context.js +89 -0
- package/src/internal/start-plugin-core/constants.d.ts +20 -0
- package/src/internal/start-plugin-core/constants.js +24 -0
- package/src/internal/start-plugin-core/debug.d.ts +1 -0
- package/src/internal/start-plugin-core/hydrate-when-transform.d.ts +5 -0
- package/src/internal/start-plugin-core/hydrate-when-transform.js +661 -0
- package/src/internal/start-plugin-core/hydration-constants.d.ts +1 -0
- package/src/internal/start-plugin-core/hydration-constants.js +4 -0
- package/src/internal/start-plugin-core/import-protection/adapterUtils.d.ts +40 -0
- package/src/internal/start-plugin-core/import-protection/adapterUtils.js +42 -0
- package/src/internal/start-plugin-core/import-protection/analysis.d.ts +63 -0
- package/src/internal/start-plugin-core/import-protection/analysis.js +533 -0
- package/src/internal/start-plugin-core/import-protection/constants.d.ts +11 -0
- package/src/internal/start-plugin-core/import-protection/constants.js +39 -0
- package/src/internal/start-plugin-core/import-protection/defaults.d.ts +19 -0
- package/src/internal/start-plugin-core/import-protection/defaults.js +34 -0
- package/src/internal/start-plugin-core/import-protection/extensionlessAbsoluteIdResolver.d.ts +22 -0
- package/src/internal/start-plugin-core/import-protection/extensionlessAbsoluteIdResolver.js +94 -0
- package/src/internal/start-plugin-core/import-protection/matchers.d.ts +18 -0
- package/src/internal/start-plugin-core/import-protection/matchers.js +39 -0
- package/src/internal/start-plugin-core/import-protection/rewrite.d.ts +29 -0
- package/src/internal/start-plugin-core/import-protection/rewrite.js +184 -0
- package/src/internal/start-plugin-core/import-protection/sourceLocation.d.ts +170 -0
- package/src/internal/start-plugin-core/import-protection/sourceLocation.js +376 -0
- package/src/internal/start-plugin-core/import-protection/trace.d.ts +89 -0
- package/src/internal/start-plugin-core/import-protection/trace.js +186 -0
- package/src/internal/start-plugin-core/import-protection/utils.d.ts +78 -0
- package/src/internal/start-plugin-core/import-protection/utils.js +171 -0
- package/src/internal/start-plugin-core/import-protection/virtualModules.d.ts +38 -0
- package/src/internal/start-plugin-core/import-protection/virtualModules.js +241 -0
- package/src/internal/start-plugin-core/index.d.ts +8 -0
- package/src/internal/start-plugin-core/index.js +2 -0
- package/src/internal/start-plugin-core/planning.d.ts +44 -0
- package/src/internal/start-plugin-core/planning.js +98 -0
- package/src/internal/start-plugin-core/post-build.d.ts +12 -0
- package/src/internal/start-plugin-core/post-build.js +40 -0
- package/src/internal/start-plugin-core/prerender.d.ts +17 -0
- package/src/internal/start-plugin-core/prerender.js +172 -0
- package/src/internal/start-plugin-core/queue.d.ts +37 -0
- package/src/internal/start-plugin-core/queue.js +118 -0
- package/src/internal/start-plugin-core/resolve-entries.d.ts +10 -0
- package/src/internal/start-plugin-core/resolve-entries.js +32 -0
- package/src/internal/start-plugin-core/schema.d.ts +1799 -0
- package/src/internal/start-plugin-core/schema.js +252 -0
- package/src/internal/start-plugin-core/serialization-adapters-module.d.ts +18 -0
- package/src/internal/start-plugin-core/serialization-adapters-module.js +37 -0
- package/src/internal/start-plugin-core/start-compiler/compiler.d.ts +181 -0
- package/src/internal/start-plugin-core/start-compiler/compiler.js +1078 -0
- package/src/internal/start-plugin-core/start-compiler/config.d.ts +20 -0
- package/src/internal/start-plugin-core/start-compiler/config.js +84 -0
- package/src/internal/start-plugin-core/start-compiler/handleClientOnlyJSX.d.ts +24 -0
- package/src/internal/start-plugin-core/start-compiler/handleClientOnlyJSX.js +25 -0
- package/src/internal/start-plugin-core/start-compiler/handleCreateIsomorphicFn.d.ts +11 -0
- package/src/internal/start-plugin-core/start-compiler/handleCreateIsomorphicFn.js +24 -0
- package/src/internal/start-plugin-core/start-compiler/handleCreateMiddleware.d.ts +11 -0
- package/src/internal/start-plugin-core/start-compiler/handleCreateMiddleware.js +35 -0
- package/src/internal/start-plugin-core/start-compiler/handleCreateServerFn.d.ts +22 -0
- package/src/internal/start-plugin-core/start-compiler/handleCreateServerFn.js +292 -0
- package/src/internal/start-plugin-core/start-compiler/handleEnvOnly.d.ts +14 -0
- package/src/internal/start-plugin-core/start-compiler/handleEnvOnly.js +41 -0
- package/src/internal/start-plugin-core/start-compiler/host.d.ts +44 -0
- package/src/internal/start-plugin-core/start-compiler/host.js +75 -0
- package/src/internal/start-plugin-core/start-compiler/server-fn-resolver-module.d.ts +10 -0
- package/src/internal/start-plugin-core/start-compiler/server-fn-resolver-module.js +87 -0
- package/src/internal/start-plugin-core/start-compiler/types.d.ts +119 -0
- package/src/internal/start-plugin-core/start-compiler/utils.d.ts +27 -0
- package/src/internal/start-plugin-core/start-compiler/utils.js +36 -0
- package/src/internal/start-plugin-core/start-manifest-plugin/inlineCss.d.ts +16 -0
- package/src/internal/start-plugin-core/start-manifest-plugin/inlineCss.js +131 -0
- package/src/internal/start-plugin-core/start-manifest-plugin/manifestBuilder.d.ts +64 -0
- package/src/internal/start-plugin-core/start-manifest-plugin/manifestBuilder.js +441 -0
- package/src/internal/start-plugin-core/start-router-plugin/constants.d.ts +1 -0
- package/src/internal/start-plugin-core/start-router-plugin/constants.js +4 -0
- package/src/internal/start-plugin-core/start-router-plugin/generator-plugins/compose-generator-plugins.d.ts +6 -0
- package/src/internal/start-plugin-core/start-router-plugin/generator-plugins/compose-generator-plugins.js +6 -0
- package/src/internal/start-plugin-core/start-router-plugin/generator-plugins/prerender-routes-plugin.d.ts +6 -0
- package/src/internal/start-plugin-core/start-router-plugin/generator-plugins/prerender-routes-plugin.js +27 -0
- package/src/internal/start-plugin-core/start-router-plugin/generator-plugins/routes-manifest-plugin.d.ts +6 -0
- package/src/internal/start-plugin-core/start-router-plugin/generator-plugins/routes-manifest-plugin.js +34 -0
- package/src/internal/start-plugin-core/start-router-plugin/pruneServerOnlySubtrees.d.ts +11 -0
- package/src/internal/start-plugin-core/start-router-plugin/pruneServerOnlySubtrees.js +42 -0
- package/src/internal/start-plugin-core/start-router-plugin/route-tree-footer.d.ts +6 -0
- package/src/internal/start-plugin-core/start-router-plugin/route-tree-footer.js +59 -0
- package/src/internal/start-plugin-core/types.d.ts +135 -0
- package/src/internal/start-plugin-core/types.js +4 -0
- package/src/internal/start-plugin-core/utils.d.ts +13 -0
- package/src/internal/start-plugin-core/utils.js +42 -0
- package/src/internal/start-plugin-core/vite/createVirtualModule.d.ts +15 -0
- package/src/internal/start-plugin-core/vite/createVirtualModule.js +27 -0
- package/src/internal/start-plugin-core/vite/dev-server-plugin/dev-styles.d.ts +26 -0
- package/src/internal/start-plugin-core/vite/dev-server-plugin/dev-styles.js +165 -0
- package/src/internal/start-plugin-core/vite/dev-server-plugin/plugin.d.ts +11 -0
- package/src/internal/start-plugin-core/vite/dev-server-plugin/plugin.js +170 -0
- package/src/internal/start-plugin-core/vite/import-protection-plugin/plugin.d.ts +4 -0
- package/src/internal/start-plugin-core/vite/import-protection-plugin/plugin.js +1553 -0
- package/src/internal/start-plugin-core/vite/import-protection-plugin/types.d.ts +103 -0
- package/src/internal/start-plugin-core/vite/import-protection-plugin/virtualModules.d.ts +40 -0
- package/src/internal/start-plugin-core/vite/import-protection-plugin/virtualModules.js +68 -0
- package/src/internal/start-plugin-core/vite/index.d.ts +13 -0
- package/src/internal/start-plugin-core/vite/index.js +4 -0
- package/src/internal/start-plugin-core/vite/load-env-plugin/plugin.d.ts +2 -0
- package/src/internal/start-plugin-core/vite/load-env-plugin/plugin.js +13 -0
- package/src/internal/start-plugin-core/vite/output-directory.d.ts +7 -0
- package/src/internal/start-plugin-core/vite/output-directory.js +18 -0
- package/src/internal/start-plugin-core/vite/planning.d.ts +112 -0
- package/src/internal/start-plugin-core/vite/planning.js +152 -0
- package/src/internal/start-plugin-core/vite/plugin.d.ts +7 -0
- package/src/internal/start-plugin-core/vite/plugin.js +208 -0
- package/src/internal/start-plugin-core/vite/plugins.d.ts +17 -0
- package/src/internal/start-plugin-core/vite/plugins.js +72 -0
- package/src/internal/start-plugin-core/vite/post-server-build.d.ts +9 -0
- package/src/internal/start-plugin-core/vite/post-server-build.js +22 -0
- package/src/internal/start-plugin-core/vite/prerender.d.ts +9 -0
- package/src/internal/start-plugin-core/vite/prerender.js +52 -0
- package/src/internal/start-plugin-core/vite/preview-server-plugin/plugin.d.ts +2 -0
- package/src/internal/start-plugin-core/vite/preview-server-plugin/plugin.js +54 -0
- package/src/internal/start-plugin-core/vite/schema.d.ts +2423 -0
- package/src/internal/start-plugin-core/vite/schema.js +17 -0
- package/src/internal/start-plugin-core/vite/serialization-adapters-plugin.d.ts +5 -0
- package/src/internal/start-plugin-core/vite/serialization-adapters-plugin.js +63 -0
- package/src/internal/start-plugin-core/vite/start-compiler-plugin/hot-update.d.ts +5 -0
- package/src/internal/start-plugin-core/vite/start-compiler-plugin/hot-update.js +14 -0
- package/src/internal/start-plugin-core/vite/start-compiler-plugin/module-specifier.d.ts +5 -0
- package/src/internal/start-plugin-core/vite/start-compiler-plugin/module-specifier.js +25 -0
- package/src/internal/start-plugin-core/vite/start-compiler-plugin/plugin.d.ts +29 -0
- package/src/internal/start-plugin-core/vite/start-compiler-plugin/plugin.js +380 -0
- package/src/internal/start-plugin-core/vite/start-manifest-plugin/normalized-client-build.d.ts +11 -0
- package/src/internal/start-plugin-core/vite/start-manifest-plugin/normalized-client-build.js +114 -0
- package/src/internal/start-plugin-core/vite/start-manifest-plugin/plugin.d.ts +3 -0
- package/src/internal/start-plugin-core/vite/start-manifest-plugin/plugin.js +103 -0
- package/src/internal/start-plugin-core/vite/start-router-plugin/plugin.d.ts +9 -0
- package/src/internal/start-plugin-core/vite/start-router-plugin/plugin.js +143 -0
- package/src/internal/start-plugin-core/vite/types.d.ts +17 -0
- package/src/package-names.js +10 -0
- package/src/plugin-vite.d.ts +23 -0
- package/src/plugin-vite.js +62 -0
- package/src/runtime/client/StartClient.d.ts +11 -0
- package/src/runtime/client/StartClient.js +16 -0
- package/src/runtime/client/hydrateStart.d.ts +4 -0
- package/src/runtime/client/hydrateStart.js +30 -0
- package/src/runtime/server/StartServer.d.ts +10 -0
- package/src/runtime/server/StartServer.js +6 -0
- package/src/runtime/server/defaultRenderHandler.d.ts +3 -0
- package/src/runtime/server/defaultRenderHandler.js +11 -0
- package/src/runtime/server/defaultStreamHandler.d.ts +3 -0
- package/src/runtime/server/defaultStreamHandler.js +13 -0
- package/src/server-entry.d.ts +11 -0
- package/src/server-entry.js +13 -0
- package/src/server-only.d.ts +1 -0
- package/src/server-only.js +0 -0
- package/src/server-rpc.d.ts +1 -0
- package/src/server-rpc.js +1 -0
- package/src/server.d.ts +6 -0
- package/src/server.js +4 -0
- package/src/ssr-rpc.d.ts +1 -0
- package/src/ssr-rpc.js +1 -0
- package/src/use-server-fn.d.ts +3 -0
- package/src/use-server-fn.js +18 -0
- package/src/validate-options.js +7 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { configSchema, getConfig, CodeSplittingOptions, Config } from './core/config.js';
|
|
2
|
+
import { RouterPluginContext } from './core/router-plugin-context.js';
|
|
3
|
+
type RouterPluginOptions = Partial<Config | (() => Config)> | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* export default defineConfig({
|
|
8
|
+
* plugins: [tanstackRouterGenerator()],
|
|
9
|
+
* // ...
|
|
10
|
+
* })
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const tanstackRouterGenerator: (
|
|
14
|
+
options?: RouterPluginOptions,
|
|
15
|
+
routerPluginContext?: RouterPluginContext,
|
|
16
|
+
) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
17
|
+
/**
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* export default defineConfig({
|
|
21
|
+
* plugins: [tanStackRouterCodeSplitter()],
|
|
22
|
+
* // ...
|
|
23
|
+
* })
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare const tanStackRouterCodeSplitter: (
|
|
27
|
+
options?: RouterPluginOptions,
|
|
28
|
+
routerPluginContext?: RouterPluginContext,
|
|
29
|
+
) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
30
|
+
/**
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* export default defineConfig({
|
|
34
|
+
* plugins: [tanstackRouter()],
|
|
35
|
+
* // ...
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare const tanstackRouter: (
|
|
40
|
+
options?:
|
|
41
|
+
| Partial<
|
|
42
|
+
| {
|
|
43
|
+
target: 'vue' | 'react' | 'solid' | 'octane';
|
|
44
|
+
routeFileIgnorePrefix: string;
|
|
45
|
+
routesDirectory: string;
|
|
46
|
+
quoteStyle: 'single' | 'double';
|
|
47
|
+
semicolons: boolean;
|
|
48
|
+
disableLogging: boolean;
|
|
49
|
+
routeTreeFileHeader: string[];
|
|
50
|
+
indexToken:
|
|
51
|
+
| string
|
|
52
|
+
| RegExp
|
|
53
|
+
| {
|
|
54
|
+
regex: string;
|
|
55
|
+
flags?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
routeToken:
|
|
58
|
+
| string
|
|
59
|
+
| RegExp
|
|
60
|
+
| {
|
|
61
|
+
regex: string;
|
|
62
|
+
flags?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
generatedRouteTree: string;
|
|
65
|
+
disableTypes: boolean;
|
|
66
|
+
addExtensions: string | boolean;
|
|
67
|
+
enableRouteTreeFormatting: boolean;
|
|
68
|
+
tmpDir: string;
|
|
69
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
70
|
+
virtualRouteConfig?:
|
|
71
|
+
| string
|
|
72
|
+
| import('@tanstack/virtual-file-routes').VirtualRootRoute
|
|
73
|
+
| undefined;
|
|
74
|
+
routeFilePrefix?: string | undefined;
|
|
75
|
+
routeFileIgnorePattern?: string | undefined;
|
|
76
|
+
pathParamsAllowedCharacters?:
|
|
77
|
+
| (':' | '$' | ';' | '@' | '&' | '=' | '+' | ',')[]
|
|
78
|
+
| undefined;
|
|
79
|
+
routeTreeFileFooter?: string[] | (() => Array<string>) | undefined;
|
|
80
|
+
autoCodeSplitting?: boolean | undefined;
|
|
81
|
+
customScaffolding?:
|
|
82
|
+
| {
|
|
83
|
+
routeTemplate?: string | undefined;
|
|
84
|
+
lazyRouteTemplate?: string | undefined;
|
|
85
|
+
}
|
|
86
|
+
| undefined;
|
|
87
|
+
experimental?:
|
|
88
|
+
| {
|
|
89
|
+
enableCodeSplitting?: boolean | undefined;
|
|
90
|
+
}
|
|
91
|
+
| undefined;
|
|
92
|
+
plugins?: import('#tanstack-start/router-generator').GeneratorPlugin[] | undefined;
|
|
93
|
+
enableRouteGeneration?: boolean | undefined;
|
|
94
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
95
|
+
plugin?:
|
|
96
|
+
| {
|
|
97
|
+
hmr?:
|
|
98
|
+
| {
|
|
99
|
+
style?: 'vite' | 'webpack' | undefined;
|
|
100
|
+
}
|
|
101
|
+
| undefined;
|
|
102
|
+
vite?:
|
|
103
|
+
| {
|
|
104
|
+
environmentName?: string | undefined;
|
|
105
|
+
}
|
|
106
|
+
| undefined;
|
|
107
|
+
}
|
|
108
|
+
| undefined;
|
|
109
|
+
}
|
|
110
|
+
| (() => Config)
|
|
111
|
+
>
|
|
112
|
+
| undefined,
|
|
113
|
+
) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated Use `tanstackRouter` instead.
|
|
116
|
+
*/
|
|
117
|
+
declare const TanStackRouterVite: (
|
|
118
|
+
options?:
|
|
119
|
+
| Partial<
|
|
120
|
+
| {
|
|
121
|
+
target: 'vue' | 'react' | 'solid' | 'octane';
|
|
122
|
+
routeFileIgnorePrefix: string;
|
|
123
|
+
routesDirectory: string;
|
|
124
|
+
quoteStyle: 'single' | 'double';
|
|
125
|
+
semicolons: boolean;
|
|
126
|
+
disableLogging: boolean;
|
|
127
|
+
routeTreeFileHeader: string[];
|
|
128
|
+
indexToken:
|
|
129
|
+
| string
|
|
130
|
+
| RegExp
|
|
131
|
+
| {
|
|
132
|
+
regex: string;
|
|
133
|
+
flags?: string | undefined;
|
|
134
|
+
};
|
|
135
|
+
routeToken:
|
|
136
|
+
| string
|
|
137
|
+
| RegExp
|
|
138
|
+
| {
|
|
139
|
+
regex: string;
|
|
140
|
+
flags?: string | undefined;
|
|
141
|
+
};
|
|
142
|
+
generatedRouteTree: string;
|
|
143
|
+
disableTypes: boolean;
|
|
144
|
+
addExtensions: string | boolean;
|
|
145
|
+
enableRouteTreeFormatting: boolean;
|
|
146
|
+
tmpDir: string;
|
|
147
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
148
|
+
virtualRouteConfig?:
|
|
149
|
+
| string
|
|
150
|
+
| import('@tanstack/virtual-file-routes').VirtualRootRoute
|
|
151
|
+
| undefined;
|
|
152
|
+
routeFilePrefix?: string | undefined;
|
|
153
|
+
routeFileIgnorePattern?: string | undefined;
|
|
154
|
+
pathParamsAllowedCharacters?:
|
|
155
|
+
| (':' | '$' | ';' | '@' | '&' | '=' | '+' | ',')[]
|
|
156
|
+
| undefined;
|
|
157
|
+
routeTreeFileFooter?: string[] | (() => Array<string>) | undefined;
|
|
158
|
+
autoCodeSplitting?: boolean | undefined;
|
|
159
|
+
customScaffolding?:
|
|
160
|
+
| {
|
|
161
|
+
routeTemplate?: string | undefined;
|
|
162
|
+
lazyRouteTemplate?: string | undefined;
|
|
163
|
+
}
|
|
164
|
+
| undefined;
|
|
165
|
+
experimental?:
|
|
166
|
+
| {
|
|
167
|
+
enableCodeSplitting?: boolean | undefined;
|
|
168
|
+
}
|
|
169
|
+
| undefined;
|
|
170
|
+
plugins?: import('#tanstack-start/router-generator').GeneratorPlugin[] | undefined;
|
|
171
|
+
enableRouteGeneration?: boolean | undefined;
|
|
172
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
173
|
+
plugin?:
|
|
174
|
+
| {
|
|
175
|
+
hmr?:
|
|
176
|
+
| {
|
|
177
|
+
style?: 'vite' | 'webpack' | undefined;
|
|
178
|
+
}
|
|
179
|
+
| undefined;
|
|
180
|
+
vite?:
|
|
181
|
+
| {
|
|
182
|
+
environmentName?: string | undefined;
|
|
183
|
+
}
|
|
184
|
+
| undefined;
|
|
185
|
+
}
|
|
186
|
+
| undefined;
|
|
187
|
+
}
|
|
188
|
+
| (() => Config)
|
|
189
|
+
>
|
|
190
|
+
| undefined,
|
|
191
|
+
) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
192
|
+
export default tanstackRouter;
|
|
193
|
+
export {
|
|
194
|
+
configSchema,
|
|
195
|
+
getConfig,
|
|
196
|
+
tanStackRouterCodeSplitter,
|
|
197
|
+
tanstackRouterGenerator,
|
|
198
|
+
TanStackRouterVite,
|
|
199
|
+
tanstackRouter,
|
|
200
|
+
};
|
|
201
|
+
export type { Config, CodeSplittingOptions, RouterPluginContext };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { configSchema, getConfig } from './core/config.js';
|
|
2
|
+
import { createRouterPluginContext } from './core/router-plugin-context.js';
|
|
3
|
+
import { createRouterCodeSplitterPlugin } from './core/router-code-splitter-plugin.js';
|
|
4
|
+
import { createRouterGeneratorPlugin } from './core/router-generator-plugin.js';
|
|
5
|
+
import { unpluginRouterComposedFactory } from './core/router-composed-plugin.js';
|
|
6
|
+
import { createVitePlugin } from 'unplugin';
|
|
7
|
+
//#region src/vite.ts
|
|
8
|
+
var defaultRouterPluginContext = createRouterPluginContext();
|
|
9
|
+
/**
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* export default defineConfig({
|
|
13
|
+
* plugins: [tanstackRouterGenerator()],
|
|
14
|
+
* // ...
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
var tanstackRouterGenerator = (options, routerPluginContext) => {
|
|
19
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
20
|
+
return createVitePlugin((pluginOptions) =>
|
|
21
|
+
createRouterGeneratorPlugin(pluginOptions, pluginContext),
|
|
22
|
+
)(options);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* export default defineConfig({
|
|
28
|
+
* plugins: [tanStackRouterCodeSplitter()],
|
|
29
|
+
* // ...
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
var tanStackRouterCodeSplitter = (options, routerPluginContext) => {
|
|
34
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
35
|
+
return createVitePlugin((pluginOptions) =>
|
|
36
|
+
createRouterCodeSplitterPlugin(pluginOptions, pluginContext),
|
|
37
|
+
)(options);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* export default defineConfig({
|
|
43
|
+
* plugins: [tanstackRouter()],
|
|
44
|
+
* // ...
|
|
45
|
+
* })
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
var tanstackRouter = createVitePlugin(unpluginRouterComposedFactory);
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated Use `tanstackRouter` instead.
|
|
51
|
+
*/
|
|
52
|
+
var TanStackRouterVite = tanstackRouter;
|
|
53
|
+
//#endregion
|
|
54
|
+
export {
|
|
55
|
+
TanStackRouterVite,
|
|
56
|
+
configSchema,
|
|
57
|
+
tanstackRouter as default,
|
|
58
|
+
tanstackRouter,
|
|
59
|
+
getConfig,
|
|
60
|
+
tanStackRouterCodeSplitter,
|
|
61
|
+
tanstackRouterGenerator,
|
|
62
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { configSchema, CodeSplittingOptions, Config } from './core/config.js';
|
|
2
|
+
import { RouterPluginContext } from './core/router-plugin-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* export default {
|
|
7
|
+
* // ...
|
|
8
|
+
* plugins: [TanStackRouterGeneratorWebpack()],
|
|
9
|
+
* }
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
declare const TanStackRouterGeneratorWebpack: (
|
|
13
|
+
options?: Partial<Config>,
|
|
14
|
+
routerPluginContext?: RouterPluginContext,
|
|
15
|
+
) => import('unplugin').WebpackPluginInstance;
|
|
16
|
+
/**
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* export default {
|
|
20
|
+
* // ...
|
|
21
|
+
* plugins: [TanStackRouterCodeSplitterWebpack()],
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const TanStackRouterCodeSplitterWebpack: (
|
|
26
|
+
options?: Partial<Config>,
|
|
27
|
+
routerPluginContext?: RouterPluginContext,
|
|
28
|
+
) => import('unplugin').WebpackPluginInstance;
|
|
29
|
+
/**
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* export default {
|
|
33
|
+
* // ...
|
|
34
|
+
* plugins: [tanstackRouter()],
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare const TanStackRouterWebpack: (
|
|
39
|
+
options?: unknown,
|
|
40
|
+
) => import('unplugin').WebpackPluginInstance;
|
|
41
|
+
declare const tanstackRouter: (options?: unknown) => import('unplugin').WebpackPluginInstance;
|
|
42
|
+
export default TanStackRouterWebpack;
|
|
43
|
+
export {
|
|
44
|
+
configSchema,
|
|
45
|
+
TanStackRouterWebpack,
|
|
46
|
+
TanStackRouterGeneratorWebpack,
|
|
47
|
+
TanStackRouterCodeSplitterWebpack,
|
|
48
|
+
tanstackRouter,
|
|
49
|
+
};
|
|
50
|
+
export type { Config, CodeSplittingOptions, RouterPluginContext };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { configSchema } from './core/config.js';
|
|
2
|
+
import { createRouterPluginContext } from './core/router-plugin-context.js';
|
|
3
|
+
import { createRouterCodeSplitterPlugin } from './core/router-code-splitter-plugin.js';
|
|
4
|
+
import { createRouterGeneratorPlugin } from './core/router-generator-plugin.js';
|
|
5
|
+
import { unpluginRouterComposedFactory } from './core/router-composed-plugin.js';
|
|
6
|
+
import { createWebpackPlugin } from 'unplugin';
|
|
7
|
+
//#region src/webpack.ts
|
|
8
|
+
var defaultRouterPluginContext = createRouterPluginContext();
|
|
9
|
+
/**
|
|
10
|
+
* Webpack uses `module.hot` / `import.meta.webpackHot` HMR. Force
|
|
11
|
+
* `plugin.hmr.style = 'webpack'` so the router HMR adapter emits the correct
|
|
12
|
+
* accept/dispose shape regardless of user config.
|
|
13
|
+
*/
|
|
14
|
+
function withWebpackHmrStyle(options) {
|
|
15
|
+
return {
|
|
16
|
+
...options,
|
|
17
|
+
plugin: {
|
|
18
|
+
...options?.plugin,
|
|
19
|
+
hmr: {
|
|
20
|
+
...options?.plugin?.hmr,
|
|
21
|
+
style: 'webpack',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* export default {
|
|
30
|
+
* // ...
|
|
31
|
+
* plugins: [TanStackRouterGeneratorWebpack()],
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
var TanStackRouterGeneratorWebpack = (options, routerPluginContext) => {
|
|
36
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
37
|
+
return createWebpackPlugin((pluginOptions) =>
|
|
38
|
+
createRouterGeneratorPlugin(pluginOptions, pluginContext),
|
|
39
|
+
)(options);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* export default {
|
|
45
|
+
* // ...
|
|
46
|
+
* plugins: [TanStackRouterCodeSplitterWebpack()],
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
var TanStackRouterCodeSplitterWebpack = (options, routerPluginContext) => {
|
|
51
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
52
|
+
return createWebpackPlugin((pluginOptions) =>
|
|
53
|
+
createRouterCodeSplitterPlugin(withWebpackHmrStyle(pluginOptions), pluginContext),
|
|
54
|
+
)(options);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* export default {
|
|
60
|
+
* // ...
|
|
61
|
+
* plugins: [tanstackRouter()],
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
var TanStackRouterWebpack = /* @__PURE__ */ createWebpackPlugin((options, meta) =>
|
|
66
|
+
unpluginRouterComposedFactory(withWebpackHmrStyle(options), meta),
|
|
67
|
+
);
|
|
68
|
+
var tanstackRouter = TanStackRouterWebpack;
|
|
69
|
+
//#endregion
|
|
70
|
+
export {
|
|
71
|
+
TanStackRouterCodeSplitterWebpack,
|
|
72
|
+
TanStackRouterGeneratorWebpack,
|
|
73
|
+
TanStackRouterWebpack,
|
|
74
|
+
TanStackRouterWebpack as default,
|
|
75
|
+
configSchema,
|
|
76
|
+
tanstackRouter,
|
|
77
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TanStackStartOutputConfig } from './schema.js';
|
|
2
|
+
export type SitemapUrl = {
|
|
3
|
+
loc: string;
|
|
4
|
+
lastmod: string;
|
|
5
|
+
priority?: number;
|
|
6
|
+
changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
|
|
7
|
+
alternateRefs?: Array<{
|
|
8
|
+
href: string;
|
|
9
|
+
hreflang?: string;
|
|
10
|
+
}>;
|
|
11
|
+
images?: Array<{
|
|
12
|
+
loc: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
caption?: string;
|
|
15
|
+
}>;
|
|
16
|
+
news?: {
|
|
17
|
+
publication: {
|
|
18
|
+
name: string;
|
|
19
|
+
language: string;
|
|
20
|
+
};
|
|
21
|
+
publicationDate: string | Date;
|
|
22
|
+
title: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type SitemapData = {
|
|
26
|
+
urls: Array<SitemapUrl>;
|
|
27
|
+
};
|
|
28
|
+
export declare function buildSitemap({
|
|
29
|
+
startConfig,
|
|
30
|
+
publicDir,
|
|
31
|
+
}: {
|
|
32
|
+
startConfig: TanStackStartOutputConfig;
|
|
33
|
+
publicDir: string;
|
|
34
|
+
}): void;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createLogger } from './utils.js';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { writeFileSync } from 'node:fs';
|
|
4
|
+
import { create } from 'xmlbuilder2';
|
|
5
|
+
//#region src/build-sitemap.ts
|
|
6
|
+
function buildSitemapJson(pages, host) {
|
|
7
|
+
const slash = checkSlash(host);
|
|
8
|
+
return {
|
|
9
|
+
urls: pages
|
|
10
|
+
.filter((page) => {
|
|
11
|
+
return page.sitemap?.exclude !== true;
|
|
12
|
+
})
|
|
13
|
+
.map((page) => ({
|
|
14
|
+
loc: `${host}${slash}${page.path.replace(/^\/+/g, '')}`,
|
|
15
|
+
lastmod: page.sitemap?.lastmod
|
|
16
|
+
? new Date(page.sitemap.lastmod).toISOString().split('T')[0]
|
|
17
|
+
: /* @__PURE__ */ new Date().toISOString().split('T')[0],
|
|
18
|
+
priority: page.sitemap?.priority,
|
|
19
|
+
changefreq: page.sitemap?.changefreq,
|
|
20
|
+
alternateRefs: page.sitemap?.alternateRefs,
|
|
21
|
+
images: page.sitemap?.images,
|
|
22
|
+
news: page.sitemap?.news,
|
|
23
|
+
})),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function jsonToXml(sitemapData) {
|
|
27
|
+
const sitemap = createXml('urlset');
|
|
28
|
+
for (const item of sitemapData.urls) {
|
|
29
|
+
const page = sitemap.ele('url');
|
|
30
|
+
page.ele('loc').txt(item.loc);
|
|
31
|
+
page.ele('lastmod').txt(item.lastmod);
|
|
32
|
+
if (item.priority !== void 0) page.ele('priority').txt(item.priority.toString());
|
|
33
|
+
if (item.changefreq) page.ele('changefreq').txt(item.changefreq);
|
|
34
|
+
if (item.alternateRefs?.length)
|
|
35
|
+
for (const ref of item.alternateRefs) {
|
|
36
|
+
const alternateRef = page.ele('xhtml:link');
|
|
37
|
+
alternateRef.att('rel', 'alternate');
|
|
38
|
+
alternateRef.att('href', ref.href);
|
|
39
|
+
if (ref.hreflang) alternateRef.att('hreflang', ref.hreflang);
|
|
40
|
+
}
|
|
41
|
+
if (item.images?.length)
|
|
42
|
+
for (const image of item.images) {
|
|
43
|
+
const imageElement = page.ele('image:image');
|
|
44
|
+
imageElement.ele('image:loc').txt(image.loc);
|
|
45
|
+
if (image.title) imageElement.ele('image:title').txt(image.title);
|
|
46
|
+
if (image.caption) imageElement.ele('image:caption').txt(image.caption);
|
|
47
|
+
}
|
|
48
|
+
if (item.news) {
|
|
49
|
+
const newsElement = page.ele('news:news');
|
|
50
|
+
const publication = newsElement.ele('news:publication');
|
|
51
|
+
publication.ele('news:name').txt(item.news.publication.name);
|
|
52
|
+
publication.ele('news:language').txt(item.news.publication.language);
|
|
53
|
+
newsElement
|
|
54
|
+
.ele('news:publication_date')
|
|
55
|
+
.txt(new Date(item.news.publicationDate).toISOString().split('T')[0]);
|
|
56
|
+
newsElement.ele('news:title').txt(item.news.title);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return sitemap.end({ prettyPrint: true });
|
|
60
|
+
}
|
|
61
|
+
function buildSitemap({ startConfig, publicDir }) {
|
|
62
|
+
const logger = createLogger('sitemap');
|
|
63
|
+
let sitemapOptions = startConfig.sitemap;
|
|
64
|
+
if (!sitemapOptions && startConfig.pages.length)
|
|
65
|
+
sitemapOptions = {
|
|
66
|
+
enabled: true,
|
|
67
|
+
outputPath: 'sitemap.xml',
|
|
68
|
+
};
|
|
69
|
+
if (!sitemapOptions?.enabled) throw new Error('Sitemap is not enabled');
|
|
70
|
+
const { host, outputPath } = sitemapOptions;
|
|
71
|
+
if (!host) {
|
|
72
|
+
if (!startConfig.sitemap) {
|
|
73
|
+
logger.info(
|
|
74
|
+
'Hint: Pages found, but no sitemap host has been set. To enable sitemap generation, set the `sitemap.host` option.',
|
|
75
|
+
);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
throw new Error('Sitemap host is not set and required to build the sitemap.');
|
|
79
|
+
}
|
|
80
|
+
if (!outputPath) throw new Error('Sitemap output path is not set');
|
|
81
|
+
const { pages } = startConfig;
|
|
82
|
+
if (!pages.length) {
|
|
83
|
+
logger.info('No pages were found to build the sitemap. Skipping...');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
logger.info('Building Sitemap...');
|
|
87
|
+
const sitemapData = buildSitemapJson(pages, host);
|
|
88
|
+
const xmlOutputPath = path.join(publicDir, outputPath);
|
|
89
|
+
const pagesOutputPath = path.join(publicDir, 'pages.json');
|
|
90
|
+
try {
|
|
91
|
+
logger.info(`Writing sitemap XML at ${xmlOutputPath}`);
|
|
92
|
+
writeFileSync(xmlOutputPath, jsonToXml(sitemapData));
|
|
93
|
+
logger.info(`Writing pages data at ${pagesOutputPath}`);
|
|
94
|
+
writeFileSync(
|
|
95
|
+
pagesOutputPath,
|
|
96
|
+
JSON.stringify(
|
|
97
|
+
{
|
|
98
|
+
pages,
|
|
99
|
+
host,
|
|
100
|
+
lastBuilt: /* @__PURE__ */ new Date().toISOString(),
|
|
101
|
+
},
|
|
102
|
+
null,
|
|
103
|
+
2,
|
|
104
|
+
),
|
|
105
|
+
);
|
|
106
|
+
} catch (e) {
|
|
107
|
+
logger.error(`Unable to write sitemap files`, e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function createXml(elementName) {
|
|
111
|
+
return create({
|
|
112
|
+
version: '1.0',
|
|
113
|
+
encoding: 'UTF-8',
|
|
114
|
+
})
|
|
115
|
+
.ele(elementName, {
|
|
116
|
+
xmlns: 'https://www.sitemaps.org/schemas/sitemap/0.9',
|
|
117
|
+
'xmlns:xhtml': 'http://www.w3.org/1999/xhtml',
|
|
118
|
+
})
|
|
119
|
+
.com(`This file was automatically generated by TanStack Start.`);
|
|
120
|
+
}
|
|
121
|
+
function checkSlash(host) {
|
|
122
|
+
return host.slice(-1) === '/' ? '' : '/';
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { buildSitemap };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolveStartEntryPlan } from './planning.js';
|
|
2
|
+
import { TanStackStartOutputConfig } from './schema.js';
|
|
3
|
+
import { GetConfigFn, ResolvedStartConfig, TanStackStartCoreOptions } from './types.js';
|
|
4
|
+
export interface StartConfigContext {
|
|
5
|
+
resolvedStartConfig: ResolvedStartConfig;
|
|
6
|
+
getConfig: GetConfigFn;
|
|
7
|
+
resolveEntries: () => ReturnType<typeof resolveStartEntryPlan>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createStartConfigContext<TInputConfig>(opts: {
|
|
10
|
+
corePluginOpts: TanStackStartCoreOptions;
|
|
11
|
+
startPluginOpts: TInputConfig | undefined;
|
|
12
|
+
parseConfig: (
|
|
13
|
+
opts: TInputConfig | undefined,
|
|
14
|
+
core: {
|
|
15
|
+
framework: TanStackStartCoreOptions['framework'];
|
|
16
|
+
},
|
|
17
|
+
root: string,
|
|
18
|
+
) => TanStackStartOutputConfig;
|
|
19
|
+
}): StartConfigContext;
|
|
20
|
+
export declare function applyResolvedBaseAndOutput(opts: {
|
|
21
|
+
resolvedStartConfig: ResolvedStartConfig;
|
|
22
|
+
root: string;
|
|
23
|
+
publicBase: string;
|
|
24
|
+
clientOutputDirectory: string;
|
|
25
|
+
serverOutputDirectory: string;
|
|
26
|
+
}): void;
|
|
27
|
+
export declare function applyResolvedRouterBasepath(opts: {
|
|
28
|
+
resolvedStartConfig: ResolvedStartConfig;
|
|
29
|
+
startConfig: TanStackStartOutputConfig;
|
|
30
|
+
}): string;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createNormalizedBasePaths,
|
|
3
|
+
createNormalizedOutputDirectories,
|
|
4
|
+
deriveRouterBasepath,
|
|
5
|
+
resolveStartEntryPlan,
|
|
6
|
+
} from './planning.js';
|
|
7
|
+
//#region src/config-context.ts
|
|
8
|
+
function createStartConfigContext(opts) {
|
|
9
|
+
const resolvedStartConfig = {
|
|
10
|
+
root: '',
|
|
11
|
+
startFilePath: void 0,
|
|
12
|
+
routerFilePath: '',
|
|
13
|
+
srcDirectory: '',
|
|
14
|
+
basePaths: {
|
|
15
|
+
publicBase: '',
|
|
16
|
+
assetBase: {
|
|
17
|
+
dev: '',
|
|
18
|
+
build: '',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
outputDirectories: {
|
|
22
|
+
client: '',
|
|
23
|
+
server: '',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
let startConfig = null;
|
|
27
|
+
let resolvedEntryPlanCache;
|
|
28
|
+
function requireRoot() {
|
|
29
|
+
if (!resolvedStartConfig.root) throw new Error(`Cannot get config before root is resolved`);
|
|
30
|
+
return resolvedStartConfig.root;
|
|
31
|
+
}
|
|
32
|
+
function getStartConfig() {
|
|
33
|
+
if (!startConfig)
|
|
34
|
+
startConfig = opts.parseConfig(
|
|
35
|
+
opts.startPluginOpts,
|
|
36
|
+
{ framework: opts.corePluginOpts.framework },
|
|
37
|
+
requireRoot(),
|
|
38
|
+
);
|
|
39
|
+
return startConfig;
|
|
40
|
+
}
|
|
41
|
+
function getResolvedEntryPlan() {
|
|
42
|
+
if (resolvedEntryPlanCache) return resolvedEntryPlanCache;
|
|
43
|
+
resolvedEntryPlanCache = resolveStartEntryPlan({
|
|
44
|
+
root: requireRoot(),
|
|
45
|
+
startConfig: getStartConfig(),
|
|
46
|
+
defaultEntryPaths: opts.corePluginOpts.defaultEntryPaths,
|
|
47
|
+
});
|
|
48
|
+
Object.assign(resolvedStartConfig, {
|
|
49
|
+
srcDirectory: resolvedEntryPlanCache.srcDirectory,
|
|
50
|
+
startFilePath: resolvedEntryPlanCache.startFilePath,
|
|
51
|
+
routerFilePath: resolvedEntryPlanCache.routerFilePath,
|
|
52
|
+
});
|
|
53
|
+
return resolvedEntryPlanCache;
|
|
54
|
+
}
|
|
55
|
+
const getConfig = () => {
|
|
56
|
+
const startConfig = getStartConfig();
|
|
57
|
+
getResolvedEntryPlan();
|
|
58
|
+
return {
|
|
59
|
+
startConfig,
|
|
60
|
+
resolvedStartConfig,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
function resolveEntries() {
|
|
64
|
+
return getResolvedEntryPlan();
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
resolvedStartConfig,
|
|
68
|
+
getConfig,
|
|
69
|
+
resolveEntries,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function applyResolvedBaseAndOutput(opts) {
|
|
73
|
+
opts.resolvedStartConfig.root = opts.root;
|
|
74
|
+
opts.resolvedStartConfig.basePaths = createNormalizedBasePaths({ publicBase: opts.publicBase });
|
|
75
|
+
opts.resolvedStartConfig.outputDirectories = createNormalizedOutputDirectories({
|
|
76
|
+
client: opts.clientOutputDirectory,
|
|
77
|
+
server: opts.serverOutputDirectory,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function applyResolvedRouterBasepath(opts) {
|
|
81
|
+
const routerBasepath = deriveRouterBasepath({
|
|
82
|
+
configuredBasepath: opts.startConfig.router.basepath,
|
|
83
|
+
publicBase: opts.resolvedStartConfig.basePaths.publicBase,
|
|
84
|
+
});
|
|
85
|
+
opts.startConfig.router.basepath = routerBasepath;
|
|
86
|
+
return routerBasepath;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { applyResolvedBaseAndOutput, applyResolvedRouterBasepath, createStartConfigContext };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const START_ENVIRONMENT_NAMES: {
|
|
2
|
+
readonly server: 'ssr';
|
|
3
|
+
readonly client: 'client';
|
|
4
|
+
};
|
|
5
|
+
export type StartEnvironmentName =
|
|
6
|
+
(typeof START_ENVIRONMENT_NAMES)[keyof typeof START_ENVIRONMENT_NAMES];
|
|
7
|
+
export declare const VITE_ENVIRONMENT_NAMES: {
|
|
8
|
+
readonly server: 'ssr';
|
|
9
|
+
readonly client: 'client';
|
|
10
|
+
};
|
|
11
|
+
export type ViteEnvironmentNames = StartEnvironmentName;
|
|
12
|
+
export declare const ENTRY_POINTS: {
|
|
13
|
+
readonly client: 'virtual:tanstack-start-client-entry';
|
|
14
|
+
readonly server: 'virtual:tanstack-start-server-entry';
|
|
15
|
+
readonly start: '#tanstack-start-entry';
|
|
16
|
+
readonly router: '#tanstack-router-entry';
|
|
17
|
+
};
|
|
18
|
+
export declare const DEV_CLIENT_ENTRY = 'virtual:tanstack-start-dev-client-entry';
|
|
19
|
+
export declare const SERVER_FN_LOOKUP = 'server-fn-module-lookup';
|
|
20
|
+
export declare const TRANSFORM_ID_REGEX: RegExp[];
|