@tanstack/router-plugin 1.132.0-alpha.9 → 1.132.2
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/dist/cjs/core/code-splitter/compilers.cjs +31 -17
- package/dist/cjs/core/code-splitter/compilers.cjs.map +1 -1
- package/dist/cjs/core/config.cjs +1 -4
- package/dist/cjs/core/config.cjs.map +1 -1
- package/dist/cjs/core/config.d.cts +11 -8
- package/dist/cjs/core/route-autoimport-plugin.cjs +17 -6
- package/dist/cjs/core/route-autoimport-plugin.cjs.map +1 -1
- package/dist/cjs/core/route-autoimport-plugin.d.cts +1 -1
- package/dist/cjs/core/router-code-splitter-plugin.cjs +14 -7
- package/dist/cjs/core/router-code-splitter-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-code-splitter-plugin.d.cts +1 -1
- package/dist/cjs/core/router-generator-plugin.cjs +14 -19
- package/dist/cjs/core/router-generator-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-generator-plugin.d.cts +1 -1
- package/dist/cjs/esbuild.cjs.map +1 -1
- package/dist/cjs/esbuild.d.cts +16 -12
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/rspack.cjs.map +1 -1
- package/dist/cjs/rspack.d.cts +16 -12
- package/dist/cjs/vite.cjs.map +1 -1
- package/dist/cjs/vite.d.cts +21 -16
- package/dist/cjs/webpack.cjs.map +1 -1
- package/dist/cjs/webpack.d.cts +16 -12
- package/dist/esm/core/code-splitter/compilers.js +31 -17
- package/dist/esm/core/code-splitter/compilers.js.map +1 -1
- package/dist/esm/core/config.d.ts +11 -8
- package/dist/esm/core/config.js +1 -4
- package/dist/esm/core/config.js.map +1 -1
- package/dist/esm/core/route-autoimport-plugin.d.ts +1 -1
- package/dist/esm/core/route-autoimport-plugin.js +15 -4
- package/dist/esm/core/route-autoimport-plugin.js.map +1 -1
- package/dist/esm/core/router-code-splitter-plugin.d.ts +1 -1
- package/dist/esm/core/router-code-splitter-plugin.js +12 -5
- package/dist/esm/core/router-code-splitter-plugin.js.map +1 -1
- package/dist/esm/core/router-generator-plugin.d.ts +1 -1
- package/dist/esm/core/router-generator-plugin.js +14 -19
- package/dist/esm/core/router-generator-plugin.js.map +1 -1
- package/dist/esm/esbuild.d.ts +16 -12
- package/dist/esm/esbuild.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/rspack.d.ts +16 -12
- package/dist/esm/rspack.js.map +1 -1
- package/dist/esm/vite.d.ts +21 -16
- package/dist/esm/vite.js.map +1 -1
- package/dist/esm/webpack.d.ts +16 -12
- package/dist/esm/webpack.js.map +1 -1
- package/package.json +6 -6
- package/src/core/code-splitter/compilers.ts +45 -23
- package/src/core/config.ts +11 -5
- package/src/core/route-autoimport-plugin.ts +16 -5
- package/src/core/router-code-splitter-plugin.ts +14 -6
- package/src/core/router-generator-plugin.ts +14 -19
- package/src/esbuild.ts +2 -2
- package/src/index.ts +7 -1
- package/src/rspack.ts +2 -2
- package/src/vite.ts +3 -2
- package/src/webpack.ts +2 -2
package/dist/esm/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configSchema, Config } from './core/config.js';
|
|
1
|
+
import { configSchema, CodeSplittingOptions, Config, getConfig } from './core/config.js';
|
|
2
2
|
declare const tanstackRouterAutoImport: (options?: Partial<{
|
|
3
3
|
target: "react" | "solid";
|
|
4
4
|
routeFileIgnorePrefix: string;
|
|
@@ -13,10 +13,10 @@ declare const tanstackRouterAutoImport: (options?: Partial<{
|
|
|
13
13
|
disableTypes: boolean;
|
|
14
14
|
addExtensions: boolean;
|
|
15
15
|
enableRouteTreeFormatting: boolean;
|
|
16
|
-
routeTreeFileFooter: string[];
|
|
17
16
|
tmpDir: string;
|
|
17
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
18
18
|
enableRouteGeneration?: boolean | undefined;
|
|
19
|
-
codeSplittingOptions?:
|
|
19
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
20
20
|
plugin?: {
|
|
21
21
|
vite?: {
|
|
22
22
|
environmentName?: string | undefined;
|
|
@@ -27,6 +27,7 @@ declare const tanstackRouterAutoImport: (options?: Partial<{
|
|
|
27
27
|
routeFileIgnorePattern?: string | undefined;
|
|
28
28
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
29
29
|
verboseFileRoutes?: boolean | undefined;
|
|
30
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
30
31
|
autoCodeSplitting?: boolean | undefined;
|
|
31
32
|
customScaffolding?: {
|
|
32
33
|
routeTemplate?: string | undefined;
|
|
@@ -36,7 +37,7 @@ declare const tanstackRouterAutoImport: (options?: Partial<{
|
|
|
36
37
|
enableCodeSplitting?: boolean | undefined;
|
|
37
38
|
} | undefined;
|
|
38
39
|
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
39
|
-
}> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
40
|
+
} | (() => Config)> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
40
41
|
/**
|
|
41
42
|
* @example
|
|
42
43
|
* ```ts
|
|
@@ -60,10 +61,10 @@ declare const tanstackRouterGenerator: (options?: Partial<{
|
|
|
60
61
|
disableTypes: boolean;
|
|
61
62
|
addExtensions: boolean;
|
|
62
63
|
enableRouteTreeFormatting: boolean;
|
|
63
|
-
routeTreeFileFooter: string[];
|
|
64
64
|
tmpDir: string;
|
|
65
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
65
66
|
enableRouteGeneration?: boolean | undefined;
|
|
66
|
-
codeSplittingOptions?:
|
|
67
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
67
68
|
plugin?: {
|
|
68
69
|
vite?: {
|
|
69
70
|
environmentName?: string | undefined;
|
|
@@ -74,6 +75,7 @@ declare const tanstackRouterGenerator: (options?: Partial<{
|
|
|
74
75
|
routeFileIgnorePattern?: string | undefined;
|
|
75
76
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
76
77
|
verboseFileRoutes?: boolean | undefined;
|
|
78
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
77
79
|
autoCodeSplitting?: boolean | undefined;
|
|
78
80
|
customScaffolding?: {
|
|
79
81
|
routeTemplate?: string | undefined;
|
|
@@ -83,7 +85,7 @@ declare const tanstackRouterGenerator: (options?: Partial<{
|
|
|
83
85
|
enableCodeSplitting?: boolean | undefined;
|
|
84
86
|
} | undefined;
|
|
85
87
|
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
86
|
-
}> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
88
|
+
} | (() => Config)> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
87
89
|
/**
|
|
88
90
|
* @example
|
|
89
91
|
* ```ts
|
|
@@ -107,10 +109,10 @@ declare const tanStackRouterCodeSplitter: (options?: Partial<{
|
|
|
107
109
|
disableTypes: boolean;
|
|
108
110
|
addExtensions: boolean;
|
|
109
111
|
enableRouteTreeFormatting: boolean;
|
|
110
|
-
routeTreeFileFooter: string[];
|
|
111
112
|
tmpDir: string;
|
|
113
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
112
114
|
enableRouteGeneration?: boolean | undefined;
|
|
113
|
-
codeSplittingOptions?:
|
|
115
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
114
116
|
plugin?: {
|
|
115
117
|
vite?: {
|
|
116
118
|
environmentName?: string | undefined;
|
|
@@ -121,6 +123,7 @@ declare const tanStackRouterCodeSplitter: (options?: Partial<{
|
|
|
121
123
|
routeFileIgnorePattern?: string | undefined;
|
|
122
124
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
123
125
|
verboseFileRoutes?: boolean | undefined;
|
|
126
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
124
127
|
autoCodeSplitting?: boolean | undefined;
|
|
125
128
|
customScaffolding?: {
|
|
126
129
|
routeTemplate?: string | undefined;
|
|
@@ -130,7 +133,7 @@ declare const tanStackRouterCodeSplitter: (options?: Partial<{
|
|
|
130
133
|
enableCodeSplitting?: boolean | undefined;
|
|
131
134
|
} | undefined;
|
|
132
135
|
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
133
|
-
}> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
136
|
+
} | (() => Config)> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
134
137
|
/**
|
|
135
138
|
* @example
|
|
136
139
|
* ```ts
|
|
@@ -154,10 +157,10 @@ declare const tanstackRouter: (options?: Partial<{
|
|
|
154
157
|
disableTypes: boolean;
|
|
155
158
|
addExtensions: boolean;
|
|
156
159
|
enableRouteTreeFormatting: boolean;
|
|
157
|
-
routeTreeFileFooter: string[];
|
|
158
160
|
tmpDir: string;
|
|
161
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
159
162
|
enableRouteGeneration?: boolean | undefined;
|
|
160
|
-
codeSplittingOptions?:
|
|
163
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
161
164
|
plugin?: {
|
|
162
165
|
vite?: {
|
|
163
166
|
environmentName?: string | undefined;
|
|
@@ -168,6 +171,7 @@ declare const tanstackRouter: (options?: Partial<{
|
|
|
168
171
|
routeFileIgnorePattern?: string | undefined;
|
|
169
172
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
170
173
|
verboseFileRoutes?: boolean | undefined;
|
|
174
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
171
175
|
autoCodeSplitting?: boolean | undefined;
|
|
172
176
|
customScaffolding?: {
|
|
173
177
|
routeTemplate?: string | undefined;
|
|
@@ -195,10 +199,10 @@ declare const TanStackRouterVite: (options?: Partial<{
|
|
|
195
199
|
disableTypes: boolean;
|
|
196
200
|
addExtensions: boolean;
|
|
197
201
|
enableRouteTreeFormatting: boolean;
|
|
198
|
-
routeTreeFileFooter: string[];
|
|
199
202
|
tmpDir: string;
|
|
203
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
200
204
|
enableRouteGeneration?: boolean | undefined;
|
|
201
|
-
codeSplittingOptions?:
|
|
205
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
202
206
|
plugin?: {
|
|
203
207
|
vite?: {
|
|
204
208
|
environmentName?: string | undefined;
|
|
@@ -209,6 +213,7 @@ declare const TanStackRouterVite: (options?: Partial<{
|
|
|
209
213
|
routeFileIgnorePattern?: string | undefined;
|
|
210
214
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
211
215
|
verboseFileRoutes?: boolean | undefined;
|
|
216
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
212
217
|
autoCodeSplitting?: boolean | undefined;
|
|
213
218
|
customScaffolding?: {
|
|
214
219
|
routeTemplate?: string | undefined;
|
|
@@ -220,5 +225,5 @@ declare const TanStackRouterVite: (options?: Partial<{
|
|
|
220
225
|
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
221
226
|
}> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
222
227
|
export default tanstackRouter;
|
|
223
|
-
export { configSchema, tanstackRouterAutoImport, tanStackRouterCodeSplitter, tanstackRouterGenerator, TanStackRouterVite, tanstackRouter, };
|
|
224
|
-
export type { Config };
|
|
228
|
+
export { configSchema, getConfig, tanstackRouterAutoImport, tanStackRouterCodeSplitter, tanstackRouterGenerator, TanStackRouterVite, tanstackRouter, };
|
|
229
|
+
export type { Config, CodeSplittingOptions };
|
package/dist/esm/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sources":["../../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport { unpluginRouteAutoImportFactory } from './core/route-autoimport-plugin'\nimport type { Config } from './core/config'\n\nconst tanstackRouterAutoImport = createVitePlugin(\n unpluginRouteAutoImportFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanstackRouterGenerator()],\n * // ...\n * })\n * ```\n */\nconst tanstackRouterGenerator = createVitePlugin(unpluginRouterGeneratorFactory)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanStackRouterCodeSplitter()],\n * // ...\n * })\n * ```\n */\nconst tanStackRouterCodeSplitter = createVitePlugin(\n unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanstackRouter()],\n * // ...\n * })\n * ```\n */\nconst tanstackRouter = createVitePlugin(unpluginRouterComposedFactory)\n\n/**\n * @deprecated Use `tanstackRouter` instead.\n */\nconst TanStackRouterVite = tanstackRouter\n\nexport default tanstackRouter\nexport {\n configSchema,\n tanstackRouterAutoImport,\n tanStackRouterCodeSplitter,\n tanstackRouterGenerator,\n TanStackRouterVite,\n tanstackRouter,\n}\n\nexport type { Config }\n"],"names":[],"mappings":";;;;;;AASA,MAAM,2BAA2B;AAAA,EAC/B;AACF;AAWA,MAAM,0BAA0B,iBAAiB,8BAA8B;AAW/E,MAAM,6BAA6B;AAAA,EACjC;AACF;AAWA,MAAM,iBAAiB,iBAAiB,6BAA6B;AAKrE,MAAM,qBAAqB;"}
|
|
1
|
+
{"version":3,"file":"vite.js","sources":["../../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport { unpluginRouteAutoImportFactory } from './core/route-autoimport-plugin'\nimport type { CodeSplittingOptions, Config, getConfig } from './core/config'\n\nconst tanstackRouterAutoImport = createVitePlugin(\n unpluginRouteAutoImportFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanstackRouterGenerator()],\n * // ...\n * })\n * ```\n */\nconst tanstackRouterGenerator = createVitePlugin(unpluginRouterGeneratorFactory)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanStackRouterCodeSplitter()],\n * // ...\n * })\n * ```\n */\nconst tanStackRouterCodeSplitter = createVitePlugin(\n unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanstackRouter()],\n * // ...\n * })\n * ```\n */\nconst tanstackRouter = createVitePlugin(unpluginRouterComposedFactory)\n\n/**\n * @deprecated Use `tanstackRouter` instead.\n */\nconst TanStackRouterVite = tanstackRouter\n\nexport default tanstackRouter\nexport {\n configSchema,\n getConfig,\n tanstackRouterAutoImport,\n tanStackRouterCodeSplitter,\n tanstackRouterGenerator,\n TanStackRouterVite,\n tanstackRouter,\n}\n\nexport type { Config, CodeSplittingOptions }\n"],"names":[],"mappings":";;;;;;AASA,MAAM,2BAA2B;AAAA,EAC/B;AACF;AAWA,MAAM,0BAA0B,iBAAiB,8BAA8B;AAW/E,MAAM,6BAA6B;AAAA,EACjC;AACF;AAWA,MAAM,iBAAiB,iBAAiB,6BAA6B;AAKrE,MAAM,qBAAqB;"}
|
package/dist/esm/webpack.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { configSchema, Config } from './core/config.js';
|
|
1
|
+
import { configSchema, CodeSplittingOptions, Config } from './core/config.js';
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* ```ts
|
|
@@ -22,10 +22,10 @@ declare const TanStackRouterGeneratorWebpack: (options?: Partial<{
|
|
|
22
22
|
disableTypes: boolean;
|
|
23
23
|
addExtensions: boolean;
|
|
24
24
|
enableRouteTreeFormatting: boolean;
|
|
25
|
-
routeTreeFileFooter: string[];
|
|
26
25
|
tmpDir: string;
|
|
26
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
27
27
|
enableRouteGeneration?: boolean | undefined;
|
|
28
|
-
codeSplittingOptions?:
|
|
28
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
29
29
|
plugin?: {
|
|
30
30
|
vite?: {
|
|
31
31
|
environmentName?: string | undefined;
|
|
@@ -36,6 +36,7 @@ declare const TanStackRouterGeneratorWebpack: (options?: Partial<{
|
|
|
36
36
|
routeFileIgnorePattern?: string | undefined;
|
|
37
37
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
38
38
|
verboseFileRoutes?: boolean | undefined;
|
|
39
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
39
40
|
autoCodeSplitting?: boolean | undefined;
|
|
40
41
|
customScaffolding?: {
|
|
41
42
|
routeTemplate?: string | undefined;
|
|
@@ -45,7 +46,7 @@ declare const TanStackRouterGeneratorWebpack: (options?: Partial<{
|
|
|
45
46
|
enableCodeSplitting?: boolean | undefined;
|
|
46
47
|
} | undefined;
|
|
47
48
|
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
48
|
-
}> | undefined) => import('unplugin').WebpackPluginInstance;
|
|
49
|
+
} | (() => Config)> | undefined) => import('unplugin').WebpackPluginInstance;
|
|
49
50
|
/**
|
|
50
51
|
* @example
|
|
51
52
|
* ```ts
|
|
@@ -69,10 +70,10 @@ declare const TanStackRouterCodeSplitterWebpack: (options?: Partial<{
|
|
|
69
70
|
disableTypes: boolean;
|
|
70
71
|
addExtensions: boolean;
|
|
71
72
|
enableRouteTreeFormatting: boolean;
|
|
72
|
-
routeTreeFileFooter: string[];
|
|
73
73
|
tmpDir: string;
|
|
74
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
74
75
|
enableRouteGeneration?: boolean | undefined;
|
|
75
|
-
codeSplittingOptions?:
|
|
76
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
76
77
|
plugin?: {
|
|
77
78
|
vite?: {
|
|
78
79
|
environmentName?: string | undefined;
|
|
@@ -83,6 +84,7 @@ declare const TanStackRouterCodeSplitterWebpack: (options?: Partial<{
|
|
|
83
84
|
routeFileIgnorePattern?: string | undefined;
|
|
84
85
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
85
86
|
verboseFileRoutes?: boolean | undefined;
|
|
87
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
86
88
|
autoCodeSplitting?: boolean | undefined;
|
|
87
89
|
customScaffolding?: {
|
|
88
90
|
routeTemplate?: string | undefined;
|
|
@@ -92,7 +94,7 @@ declare const TanStackRouterCodeSplitterWebpack: (options?: Partial<{
|
|
|
92
94
|
enableCodeSplitting?: boolean | undefined;
|
|
93
95
|
} | undefined;
|
|
94
96
|
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
95
|
-
}> | undefined) => import('unplugin').WebpackPluginInstance;
|
|
97
|
+
} | (() => Config)> | undefined) => import('unplugin').WebpackPluginInstance;
|
|
96
98
|
/**
|
|
97
99
|
* @example
|
|
98
100
|
* ```ts
|
|
@@ -116,10 +118,10 @@ declare const TanStackRouterWebpack: (options?: Partial<{
|
|
|
116
118
|
disableTypes: boolean;
|
|
117
119
|
addExtensions: boolean;
|
|
118
120
|
enableRouteTreeFormatting: boolean;
|
|
119
|
-
routeTreeFileFooter: string[];
|
|
120
121
|
tmpDir: string;
|
|
122
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
121
123
|
enableRouteGeneration?: boolean | undefined;
|
|
122
|
-
codeSplittingOptions?:
|
|
124
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
123
125
|
plugin?: {
|
|
124
126
|
vite?: {
|
|
125
127
|
environmentName?: string | undefined;
|
|
@@ -130,6 +132,7 @@ declare const TanStackRouterWebpack: (options?: Partial<{
|
|
|
130
132
|
routeFileIgnorePattern?: string | undefined;
|
|
131
133
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
132
134
|
verboseFileRoutes?: boolean | undefined;
|
|
135
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
133
136
|
autoCodeSplitting?: boolean | undefined;
|
|
134
137
|
customScaffolding?: {
|
|
135
138
|
routeTemplate?: string | undefined;
|
|
@@ -154,10 +157,10 @@ declare const tanstackRouter: (options?: Partial<{
|
|
|
154
157
|
disableTypes: boolean;
|
|
155
158
|
addExtensions: boolean;
|
|
156
159
|
enableRouteTreeFormatting: boolean;
|
|
157
|
-
routeTreeFileFooter: string[];
|
|
158
160
|
tmpDir: string;
|
|
161
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
159
162
|
enableRouteGeneration?: boolean | undefined;
|
|
160
|
-
codeSplittingOptions?:
|
|
163
|
+
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
161
164
|
plugin?: {
|
|
162
165
|
vite?: {
|
|
163
166
|
environmentName?: string | undefined;
|
|
@@ -168,6 +171,7 @@ declare const tanstackRouter: (options?: Partial<{
|
|
|
168
171
|
routeFileIgnorePattern?: string | undefined;
|
|
169
172
|
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
170
173
|
verboseFileRoutes?: boolean | undefined;
|
|
174
|
+
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
171
175
|
autoCodeSplitting?: boolean | undefined;
|
|
172
176
|
customScaffolding?: {
|
|
173
177
|
routeTemplate?: string | undefined;
|
|
@@ -180,4 +184,4 @@ declare const tanstackRouter: (options?: Partial<{
|
|
|
180
184
|
}> | undefined) => import('unplugin').WebpackPluginInstance;
|
|
181
185
|
export default TanStackRouterWebpack;
|
|
182
186
|
export { configSchema, TanStackRouterWebpack, TanStackRouterGeneratorWebpack, TanStackRouterCodeSplitterWebpack, tanstackRouter, };
|
|
183
|
-
export type { Config };
|
|
187
|
+
export type { Config, CodeSplittingOptions };
|
package/dist/esm/webpack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","sources":["../../src/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport type { Config } from './core/config'\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [TanStackRouterGeneratorWebpack()],\n * }\n * ```\n */\nconst TanStackRouterGeneratorWebpack = /* #__PURE__ */ createWebpackPlugin(\n unpluginRouterGeneratorFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [TanStackRouterCodeSplitterWebpack()],\n * }\n * ```\n */\nconst TanStackRouterCodeSplitterWebpack = /* #__PURE__ */ createWebpackPlugin(\n unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [tanstackRouter()],\n * }\n * ```\n */\nconst TanStackRouterWebpack = /* #__PURE__ */ createWebpackPlugin(\n unpluginRouterComposedFactory,\n)\n\nconst tanstackRouter = TanStackRouterWebpack\nexport default TanStackRouterWebpack\nexport {\n configSchema,\n TanStackRouterWebpack,\n TanStackRouterGeneratorWebpack,\n TanStackRouterCodeSplitterWebpack,\n tanstackRouter,\n}\nexport type { Config }\n"],"names":[],"mappings":";;;;;AAiBA,MAAM,iCAAiD;AAAA,EACrD;AACF;AAWA,MAAM,oCAAoD;AAAA,EACxD;AACF;AAWA,MAAM,wBAAwC;AAAA,EAC5C;AACF;AAEA,MAAM,iBAAiB;"}
|
|
1
|
+
{"version":3,"file":"webpack.js","sources":["../../src/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport type { CodeSplittingOptions, Config } from './core/config'\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [TanStackRouterGeneratorWebpack()],\n * }\n * ```\n */\nconst TanStackRouterGeneratorWebpack = /* #__PURE__ */ createWebpackPlugin(\n unpluginRouterGeneratorFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [TanStackRouterCodeSplitterWebpack()],\n * }\n * ```\n */\nconst TanStackRouterCodeSplitterWebpack = /* #__PURE__ */ createWebpackPlugin(\n unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [tanstackRouter()],\n * }\n * ```\n */\nconst TanStackRouterWebpack = /* #__PURE__ */ createWebpackPlugin(\n unpluginRouterComposedFactory,\n)\n\nconst tanstackRouter = TanStackRouterWebpack\nexport default TanStackRouterWebpack\nexport {\n configSchema,\n TanStackRouterWebpack,\n TanStackRouterGeneratorWebpack,\n TanStackRouterCodeSplitterWebpack,\n tanstackRouter,\n}\nexport type { Config, CodeSplittingOptions }\n"],"names":[],"mappings":";;;;;AAiBA,MAAM,iCAAiD;AAAA,EACrD;AACF;AAWA,MAAM,oCAAoD;AAAA,EACxD;AACF;AAWA,MAAM,wBAAwC;AAAA,EAC5C;AACF;AAEA,MAAM,iBAAiB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-plugin",
|
|
3
|
-
"version": "1.132.
|
|
3
|
+
"version": "1.132.2",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"chokidar": "^3.6.0",
|
|
98
98
|
"unplugin": "^2.1.2",
|
|
99
99
|
"zod": "^3.24.2",
|
|
100
|
-
"@tanstack/router-
|
|
101
|
-
"@tanstack/router-
|
|
102
|
-
"@tanstack/virtual-file-routes": "1.132.0
|
|
103
|
-
"@tanstack/router-utils": "1.132.0
|
|
100
|
+
"@tanstack/router-generator": "1.132.2",
|
|
101
|
+
"@tanstack/router-core": "1.132.2",
|
|
102
|
+
"@tanstack/virtual-file-routes": "1.132.0",
|
|
103
|
+
"@tanstack/router-utils": "1.132.0"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@types/babel__core": "^7.20.5",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"vite": ">=5.0.0 || >=6.0.0 || >=7.0.0",
|
|
113
113
|
"vite-plugin-solid": "^2.11.8",
|
|
114
114
|
"webpack": ">=5.92.0",
|
|
115
|
-
"@tanstack/react-router": "^1.132.
|
|
115
|
+
"@tanstack/react-router": "^1.132.2"
|
|
116
116
|
},
|
|
117
117
|
"peerDependenciesMeta": {
|
|
118
118
|
"@rsbuild/core": {
|
|
@@ -84,7 +84,8 @@ function addSplitSearchParamToFilename(
|
|
|
84
84
|
const params = new URLSearchParams()
|
|
85
85
|
params.append(tsrSplit, createIdentifier(grouping))
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
const result = `${bareFilename}?${params.toString()}`
|
|
88
|
+
return result
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
function removeSplitSearchParamFromFilename(filename: string) {
|
|
@@ -116,6 +117,8 @@ export function compileCodeSplitReferenceRoute(
|
|
|
116
117
|
|
|
117
118
|
const refIdents = findReferencedIdentifiers(ast)
|
|
118
119
|
|
|
120
|
+
const knownExportedIdents = new Set<string>()
|
|
121
|
+
|
|
119
122
|
function findIndexForSplitNode(str: string) {
|
|
120
123
|
return opts.codeSplitGroupings.findIndex((group) =>
|
|
121
124
|
group.includes(str as any),
|
|
@@ -251,6 +254,9 @@ export function compileCodeSplitReferenceRoute(
|
|
|
251
254
|
// since they are already being imported
|
|
252
255
|
// and need to be retained in the compiled file
|
|
253
256
|
const isExported = hasExport(ast, value)
|
|
257
|
+
if (isExported) {
|
|
258
|
+
knownExportedIdents.add(value.name)
|
|
259
|
+
}
|
|
254
260
|
shouldSplit = !isExported
|
|
255
261
|
|
|
256
262
|
if (shouldSplit) {
|
|
@@ -320,6 +326,9 @@ export function compileCodeSplitReferenceRoute(
|
|
|
320
326
|
// since they are already being imported
|
|
321
327
|
// and need to be retained in the compiled file
|
|
322
328
|
const isExported = hasExport(ast, value)
|
|
329
|
+
if (isExported) {
|
|
330
|
+
knownExportedIdents.add(value.name)
|
|
331
|
+
}
|
|
323
332
|
shouldSplit = !isExported
|
|
324
333
|
|
|
325
334
|
if (shouldSplit) {
|
|
@@ -410,6 +419,26 @@ export function compileCodeSplitReferenceRoute(
|
|
|
410
419
|
|
|
411
420
|
deadCodeElimination(ast, refIdents)
|
|
412
421
|
|
|
422
|
+
// if there are exported identifiers, then we need to add a warning
|
|
423
|
+
// to the file to let the user know that the exported identifiers
|
|
424
|
+
// will not in the split file but in the original file, therefore
|
|
425
|
+
// increasing the bundle size
|
|
426
|
+
if (knownExportedIdents.size > 0) {
|
|
427
|
+
const warningMessage = createNotExportableMessage(
|
|
428
|
+
opts.filename,
|
|
429
|
+
knownExportedIdents,
|
|
430
|
+
)
|
|
431
|
+
console.warn(warningMessage)
|
|
432
|
+
|
|
433
|
+
// append this warning to the file using a template
|
|
434
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
435
|
+
const warningTemplate = template.statement(
|
|
436
|
+
`console.warn(${JSON.stringify(warningMessage)})`,
|
|
437
|
+
)()
|
|
438
|
+
ast.program.body.unshift(warningTemplate)
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
413
442
|
return generateFromAst(ast, {
|
|
414
443
|
sourceMaps: true,
|
|
415
444
|
sourceFileName: opts.filename,
|
|
@@ -712,28 +741,6 @@ export function compileCodeSplitVirtualRoute(
|
|
|
712
741
|
|
|
713
742
|
deadCodeElimination(ast, refIdents)
|
|
714
743
|
|
|
715
|
-
// if there are exported identifiers, then we need to add a warning
|
|
716
|
-
// to the file to let the user know that the exported identifiers
|
|
717
|
-
// will not in the split file but in the original file, therefore
|
|
718
|
-
// increasing the bundle size
|
|
719
|
-
if (knownExportedIdents.size > 0) {
|
|
720
|
-
const list = Array.from(knownExportedIdents).reduce((str, ident) => {
|
|
721
|
-
str += `\n- ${ident}`
|
|
722
|
-
return str
|
|
723
|
-
}, '')
|
|
724
|
-
|
|
725
|
-
const warningMessage = `These exports from "${opts.filename}" are not being code-split and will increase your bundle size: ${list}\nThese should either have their export statements removed or be imported from another file that is not a route.`
|
|
726
|
-
console.warn(warningMessage)
|
|
727
|
-
|
|
728
|
-
// append this warning to the file using a template
|
|
729
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
730
|
-
const warningTemplate = template.statement(
|
|
731
|
-
`console.warn(${JSON.stringify(warningMessage)})`,
|
|
732
|
-
)()
|
|
733
|
-
ast.program.body.unshift(warningTemplate)
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
744
|
return generateFromAst(ast, {
|
|
738
745
|
sourceMaps: true,
|
|
739
746
|
sourceFileName: opts.filename,
|
|
@@ -837,6 +844,21 @@ export function detectCodeSplitGroupingsFromRoute(opts: ParseAstOptions): {
|
|
|
837
844
|
return { groupings: codeSplitGroupings }
|
|
838
845
|
}
|
|
839
846
|
|
|
847
|
+
function createNotExportableMessage(
|
|
848
|
+
filename: string,
|
|
849
|
+
idents: Set<string>,
|
|
850
|
+
): string {
|
|
851
|
+
const list = Array.from(idents).map((d) => `- ${d}`)
|
|
852
|
+
|
|
853
|
+
const message = [
|
|
854
|
+
`[tanstack-router] These exports from "${filename}" will not be code-split and will increase your bundle size:`,
|
|
855
|
+
...list,
|
|
856
|
+
'For the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',
|
|
857
|
+
].join('\n')
|
|
858
|
+
|
|
859
|
+
return message
|
|
860
|
+
}
|
|
861
|
+
|
|
840
862
|
function getImportSpecifierAndPathFromLocalName(
|
|
841
863
|
programPath: babel.NodePath<t.Program>,
|
|
842
864
|
name: string,
|
package/src/core/config.ts
CHANGED
|
@@ -3,7 +3,11 @@ import {
|
|
|
3
3
|
configSchema as generatorConfigSchema,
|
|
4
4
|
getConfig as getGeneratorConfig,
|
|
5
5
|
} from '@tanstack/router-generator'
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
CreateFileRoute,
|
|
8
|
+
RegisteredRouter,
|
|
9
|
+
RouteIds,
|
|
10
|
+
} from '@tanstack/router-core'
|
|
7
11
|
import type { CodeSplitGroupings } from './constants'
|
|
8
12
|
|
|
9
13
|
export const splitGroupingsSchema = z
|
|
@@ -68,15 +72,17 @@ export type CodeSplittingOptions = {
|
|
|
68
72
|
addHmr?: boolean
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
const DELETABLE_NODES = ['ssr'] as const
|
|
72
|
-
export const deletableNodesSchema = z.enum(DELETABLE_NODES)
|
|
73
75
|
const codeSplittingOptionsSchema = z.object({
|
|
74
76
|
splitBehavior: z.function().optional(),
|
|
75
77
|
defaultBehavior: splitGroupingsSchema.optional(),
|
|
76
|
-
deleteNodes: z.array(
|
|
78
|
+
deleteNodes: z.array(z.string()).optional(),
|
|
77
79
|
addHmr: z.boolean().optional().default(true),
|
|
78
80
|
})
|
|
79
|
-
|
|
81
|
+
|
|
82
|
+
type FileRouteKeys = keyof (Parameters<
|
|
83
|
+
CreateFileRoute<any, any, any, any, any>
|
|
84
|
+
>[0] & {})
|
|
85
|
+
export type DeletableNodes = FileRouteKeys | (string & {})
|
|
80
86
|
|
|
81
87
|
export const configSchema = generatorConfigSchema.extend({
|
|
82
88
|
enableRouteGeneration: z.boolean().optional(),
|
|
@@ -10,11 +10,18 @@ import type { UnpluginFactory } from 'unplugin'
|
|
|
10
10
|
* This plugin adds imports for createFileRoute and createLazyFileRoute to the file route.
|
|
11
11
|
*/
|
|
12
12
|
export const unpluginRouteAutoImportFactory: UnpluginFactory<
|
|
13
|
-
Partial<Config> | undefined
|
|
13
|
+
Partial<Config | (() => Config)> | undefined
|
|
14
14
|
> = (options = {}) => {
|
|
15
15
|
let ROOT: string = process.cwd()
|
|
16
|
-
let userConfig
|
|
16
|
+
let userConfig: Config
|
|
17
17
|
|
|
18
|
+
function initUserConfig() {
|
|
19
|
+
if (typeof options === 'function') {
|
|
20
|
+
userConfig = options()
|
|
21
|
+
} else {
|
|
22
|
+
userConfig = getConfig(options, ROOT)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
return {
|
|
19
26
|
name: 'tanstack-router:autoimport',
|
|
20
27
|
enforce: 'pre',
|
|
@@ -91,18 +98,22 @@ export const unpluginRouteAutoImportFactory: UnpluginFactory<
|
|
|
91
98
|
vite: {
|
|
92
99
|
configResolved(config) {
|
|
93
100
|
ROOT = config.root
|
|
94
|
-
|
|
101
|
+
initUserConfig()
|
|
102
|
+
},
|
|
103
|
+
// this check may only happen after config is resolved, so we use applyToEnvironment (apply is too early)
|
|
104
|
+
applyToEnvironment() {
|
|
105
|
+
return userConfig.verboseFileRoutes === false
|
|
95
106
|
},
|
|
96
107
|
},
|
|
97
108
|
|
|
98
109
|
rspack() {
|
|
99
110
|
ROOT = process.cwd()
|
|
100
|
-
|
|
111
|
+
initUserConfig()
|
|
101
112
|
},
|
|
102
113
|
|
|
103
114
|
webpack() {
|
|
104
115
|
ROOT = process.cwd()
|
|
105
|
-
|
|
116
|
+
initUserConfig()
|
|
106
117
|
},
|
|
107
118
|
}
|
|
108
119
|
}
|
|
@@ -61,11 +61,18 @@ plugins: [
|
|
|
61
61
|
const PLUGIN_NAME = 'unplugin:router-code-splitter'
|
|
62
62
|
|
|
63
63
|
export const unpluginRouterCodeSplitterFactory: UnpluginFactory<
|
|
64
|
-
Partial<Config> | undefined
|
|
64
|
+
Partial<Config | (() => Config)> | undefined
|
|
65
65
|
> = (options = {}, { framework }) => {
|
|
66
66
|
let ROOT: string = process.cwd()
|
|
67
|
-
let userConfig
|
|
67
|
+
let userConfig: Config
|
|
68
68
|
|
|
69
|
+
function initUserConfig() {
|
|
70
|
+
if (typeof options === 'function') {
|
|
71
|
+
userConfig = options()
|
|
72
|
+
} else {
|
|
73
|
+
userConfig = getConfig(options, ROOT)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
69
76
|
const isProduction = process.env.NODE_ENV === 'production'
|
|
70
77
|
|
|
71
78
|
const getGlobalCodeSplitGroupings = () => {
|
|
@@ -125,7 +132,8 @@ export const unpluginRouterCodeSplitterFactory: UnpluginFactory<
|
|
|
125
132
|
filename: id,
|
|
126
133
|
id,
|
|
127
134
|
deleteNodes: new Set(userConfig.codeSplittingOptions?.deleteNodes),
|
|
128
|
-
addHmr:
|
|
135
|
+
addHmr:
|
|
136
|
+
(userConfig.codeSplittingOptions?.addHmr ?? true) && !isProduction,
|
|
129
137
|
})
|
|
130
138
|
|
|
131
139
|
if (debug) {
|
|
@@ -219,7 +227,7 @@ export const unpluginRouterCodeSplitterFactory: UnpluginFactory<
|
|
|
219
227
|
vite: {
|
|
220
228
|
configResolved(config) {
|
|
221
229
|
ROOT = config.root
|
|
222
|
-
|
|
230
|
+
initUserConfig()
|
|
223
231
|
},
|
|
224
232
|
applyToEnvironment(environment) {
|
|
225
233
|
if (userConfig.plugin?.vite?.environmentName) {
|
|
@@ -231,12 +239,12 @@ export const unpluginRouterCodeSplitterFactory: UnpluginFactory<
|
|
|
231
239
|
|
|
232
240
|
rspack() {
|
|
233
241
|
ROOT = process.cwd()
|
|
234
|
-
|
|
242
|
+
initUserConfig()
|
|
235
243
|
},
|
|
236
244
|
|
|
237
245
|
webpack(compiler) {
|
|
238
246
|
ROOT = process.cwd()
|
|
239
|
-
|
|
247
|
+
initUserConfig()
|
|
240
248
|
|
|
241
249
|
if (compiler.options.mode === 'production') {
|
|
242
250
|
compiler.hooks.done.tap(PLUGIN_NAME, () => {
|
|
@@ -10,10 +10,10 @@ import type { Config } from './config'
|
|
|
10
10
|
const PLUGIN_NAME = 'unplugin:router-generator'
|
|
11
11
|
|
|
12
12
|
export const unpluginRouterGeneratorFactory: UnpluginFactory<
|
|
13
|
-
Partial<Config> | undefined
|
|
13
|
+
Partial<Config | (() => Config)> | undefined
|
|
14
14
|
> = (options = {}) => {
|
|
15
|
-
|
|
16
|
-
let userConfig
|
|
15
|
+
let ROOT: string = process.cwd()
|
|
16
|
+
let userConfig: Config
|
|
17
17
|
let generator: Generator
|
|
18
18
|
|
|
19
19
|
const routeGenerationDisabled = () =>
|
|
@@ -24,8 +24,15 @@ export const unpluginRouterGeneratorFactory: UnpluginFactory<
|
|
|
24
24
|
: join(ROOT, userConfig.routesDirectory)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const initConfigAndGenerator = () => {
|
|
28
|
-
|
|
27
|
+
const initConfigAndGenerator = (opts?: { root?: string }) => {
|
|
28
|
+
if (opts?.root) {
|
|
29
|
+
ROOT = opts.root
|
|
30
|
+
}
|
|
31
|
+
if (typeof options === 'function') {
|
|
32
|
+
userConfig = options()
|
|
33
|
+
} else {
|
|
34
|
+
userConfig = getConfig(options, ROOT)
|
|
35
|
+
}
|
|
29
36
|
generator = new Generator({
|
|
30
37
|
config: userConfig,
|
|
31
38
|
root: ROOT,
|
|
@@ -66,23 +73,11 @@ export const unpluginRouterGeneratorFactory: UnpluginFactory<
|
|
|
66
73
|
event,
|
|
67
74
|
})
|
|
68
75
|
},
|
|
69
|
-
async buildStart() {
|
|
70
|
-
await generate()
|
|
71
|
-
},
|
|
72
76
|
vite: {
|
|
73
|
-
configResolved() {
|
|
74
|
-
initConfigAndGenerator()
|
|
75
|
-
},
|
|
76
|
-
applyToEnvironment(environment) {
|
|
77
|
-
if (userConfig.plugin?.vite?.environmentName) {
|
|
78
|
-
return userConfig.plugin.vite.environmentName === environment.name
|
|
79
|
-
}
|
|
80
|
-
return true
|
|
81
|
-
},
|
|
82
|
-
async buildStart() {
|
|
77
|
+
async configResolved(config) {
|
|
78
|
+
initConfigAndGenerator({ root: config.root })
|
|
83
79
|
await generate()
|
|
84
80
|
},
|
|
85
|
-
sharedDuringBuild: true,
|
|
86
81
|
},
|
|
87
82
|
rspack(compiler) {
|
|
88
83
|
initConfigAndGenerator()
|
package/src/esbuild.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-p
|
|
|
5
5
|
import { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'
|
|
6
6
|
import { unpluginRouterComposedFactory } from './core/router-composed-plugin'
|
|
7
7
|
|
|
8
|
-
import type { Config } from './core/config'
|
|
8
|
+
import type { CodeSplittingOptions, Config } from './core/config'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @example
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
tanstackRouter,
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export type { Config }
|
|
57
|
+
export type { Config, CodeSplittingOptions }
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export { configSchema, getConfig } from './core/config'
|
|
2
2
|
export { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'
|
|
3
3
|
export { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'
|
|
4
|
-
export type {
|
|
4
|
+
export type {
|
|
5
|
+
Config,
|
|
6
|
+
ConfigInput,
|
|
7
|
+
ConfigOutput,
|
|
8
|
+
CodeSplittingOptions,
|
|
9
|
+
DeletableNodes,
|
|
10
|
+
} from './core/config'
|
|
5
11
|
export {
|
|
6
12
|
tsrSplit,
|
|
7
13
|
splitRouteIdentNodes,
|
package/src/rspack.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { configSchema } from './core/config'
|
|
|
4
4
|
import { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'
|
|
5
5
|
import { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'
|
|
6
6
|
import { unpluginRouterComposedFactory } from './core/router-composed-plugin'
|
|
7
|
-
import type { Config } from './core/config'
|
|
7
|
+
import type { CodeSplittingOptions, Config } from './core/config'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @example
|
|
@@ -65,4 +65,4 @@ export {
|
|
|
65
65
|
TanStackRouterCodeSplitterRspack,
|
|
66
66
|
tanstackRouter,
|
|
67
67
|
}
|
|
68
|
-
export type { Config }
|
|
68
|
+
export type { Config, CodeSplittingOptions }
|