@tanstack/router-plugin 1.167.31 → 1.167.33
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/context.cjs +3 -0
- package/dist/cjs/context.d.cts +2 -0
- package/dist/cjs/core/code-splitter/compilers.cjs.map +1 -1
- package/dist/cjs/core/code-splitter/compilers.d.cts +1 -0
- package/dist/cjs/core/router-code-splitter-plugin.cjs +12 -3
- package/dist/cjs/core/router-code-splitter-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-code-splitter-plugin.d.cts +2 -0
- package/dist/cjs/core/router-composed-plugin.cjs +7 -6
- package/dist/cjs/core/router-composed-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-generator-plugin.cjs +7 -2
- package/dist/cjs/core/router-generator-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-generator-plugin.d.cts +2 -0
- package/dist/cjs/core/router-hmr-plugin.cjs +13 -7
- package/dist/cjs/core/router-hmr-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-hmr-plugin.d.cts +2 -0
- package/dist/cjs/core/router-plugin-context.cjs +8 -0
- package/dist/cjs/core/router-plugin-context.cjs.map +1 -0
- package/dist/cjs/core/router-plugin-context.d.cts +5 -0
- package/dist/cjs/esbuild.cjs +10 -2
- package/dist/cjs/esbuild.cjs.map +1 -1
- package/dist/cjs/esbuild.d.cts +5 -95
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/rspack.cjs +10 -2
- package/dist/cjs/rspack.cjs.map +1 -1
- package/dist/cjs/rspack.d.cts +5 -49
- package/dist/cjs/vite.cjs +11 -2
- package/dist/cjs/vite.cjs.map +1 -1
- package/dist/cjs/vite.d.cts +6 -96
- package/dist/cjs/webpack.cjs +10 -2
- package/dist/cjs/webpack.cjs.map +1 -1
- package/dist/cjs/webpack.d.cts +4 -49
- package/dist/esm/context.d.ts +2 -0
- package/dist/esm/context.js +2 -0
- package/dist/esm/core/code-splitter/compilers.d.ts +1 -0
- package/dist/esm/core/code-splitter/compilers.js.map +1 -1
- package/dist/esm/core/router-code-splitter-plugin.d.ts +2 -0
- package/dist/esm/core/router-code-splitter-plugin.js +12 -4
- package/dist/esm/core/router-code-splitter-plugin.js.map +1 -1
- package/dist/esm/core/router-composed-plugin.js +10 -9
- package/dist/esm/core/router-composed-plugin.js.map +1 -1
- package/dist/esm/core/router-generator-plugin.d.ts +2 -0
- package/dist/esm/core/router-generator-plugin.js +7 -3
- package/dist/esm/core/router-generator-plugin.js.map +1 -1
- package/dist/esm/core/router-hmr-plugin.d.ts +2 -0
- package/dist/esm/core/router-hmr-plugin.js +13 -7
- package/dist/esm/core/router-hmr-plugin.js.map +1 -1
- package/dist/esm/core/router-plugin-context.d.ts +5 -0
- package/dist/esm/core/router-plugin-context.js +8 -0
- package/dist/esm/core/router-plugin-context.js.map +1 -0
- package/dist/esm/esbuild.d.ts +5 -95
- package/dist/esm/esbuild.js +12 -4
- package/dist/esm/esbuild.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/rspack.d.ts +5 -49
- package/dist/esm/rspack.js +12 -4
- package/dist/esm/rspack.js.map +1 -1
- package/dist/esm/vite.d.ts +6 -96
- package/dist/esm/vite.js +14 -6
- package/dist/esm/vite.js.map +1 -1
- package/dist/esm/webpack.d.ts +4 -49
- package/dist/esm/webpack.js +12 -4
- package/dist/esm/webpack.js.map +1 -1
- package/package.json +13 -7
- package/src/context.ts +2 -0
- package/src/core/code-splitter/compilers.ts +1 -0
- package/src/core/router-code-splitter-plugin.ts +15 -4
- package/src/core/router-composed-plugin.ts +16 -11
- package/src/core/router-generator-plugin.ts +13 -4
- package/src/core/router-hmr-plugin.ts +22 -7
- package/src/core/router-plugin-context.ts +11 -0
- package/src/esbuild.ts +27 -9
- package/src/index.ts +2 -0
- package/src/rspack.ts +30 -12
- package/src/vite.ts +29 -9
- package/src/webpack.ts +27 -12
- package/bin/intent.js +0 -25
- package/src/global.d.ts +0 -7
package/dist/cjs/rspack.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { configSchema, CodeSplittingOptions, Config } from './core/config.cjs';
|
|
2
|
+
import { RouterPluginContext } from './core/router-plugin-context.cjs';
|
|
3
|
+
type RspackRouterPluginOptions = Partial<Config> | (() => Partial<Config>);
|
|
2
4
|
/**
|
|
3
5
|
* @example
|
|
4
6
|
* ```ts
|
|
@@ -12,53 +14,7 @@ import { configSchema, CodeSplittingOptions, Config } from './core/config.cjs';
|
|
|
12
14
|
* })
|
|
13
15
|
* ```
|
|
14
16
|
*/
|
|
15
|
-
declare const TanStackRouterGeneratorRspack: (options?:
|
|
16
|
-
target: "react" | "solid" | "vue";
|
|
17
|
-
routeFileIgnorePrefix: string;
|
|
18
|
-
routesDirectory: string;
|
|
19
|
-
quoteStyle: "single" | "double";
|
|
20
|
-
semicolons: boolean;
|
|
21
|
-
disableLogging: boolean;
|
|
22
|
-
routeTreeFileHeader: string[];
|
|
23
|
-
indexToken: string | RegExp | {
|
|
24
|
-
regex: string;
|
|
25
|
-
flags?: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
routeToken: string | RegExp | {
|
|
28
|
-
regex: string;
|
|
29
|
-
flags?: string | undefined;
|
|
30
|
-
};
|
|
31
|
-
generatedRouteTree: string;
|
|
32
|
-
disableTypes: boolean;
|
|
33
|
-
addExtensions: string | boolean;
|
|
34
|
-
enableRouteTreeFormatting: boolean;
|
|
35
|
-
tmpDir: string;
|
|
36
|
-
importRoutesUsingAbsolutePaths: boolean;
|
|
37
|
-
enableRouteGeneration?: boolean | undefined;
|
|
38
|
-
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
39
|
-
plugin?: {
|
|
40
|
-
vite?: {
|
|
41
|
-
environmentName?: string | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
hmr?: {
|
|
44
|
-
style?: "vite" | "webpack" | undefined;
|
|
45
|
-
} | undefined;
|
|
46
|
-
} | undefined;
|
|
47
|
-
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
48
|
-
routeFilePrefix?: string | undefined;
|
|
49
|
-
routeFileIgnorePattern?: string | undefined;
|
|
50
|
-
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
51
|
-
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
52
|
-
autoCodeSplitting?: boolean | undefined;
|
|
53
|
-
customScaffolding?: {
|
|
54
|
-
routeTemplate?: string | undefined;
|
|
55
|
-
lazyRouteTemplate?: string | undefined;
|
|
56
|
-
} | undefined;
|
|
57
|
-
experimental?: {
|
|
58
|
-
enableCodeSplitting?: boolean | undefined;
|
|
59
|
-
} | undefined;
|
|
60
|
-
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
61
|
-
} | (() => Config)> | undefined) => import('unplugin').RspackPluginInstance;
|
|
17
|
+
declare const TanStackRouterGeneratorRspack: (options?: RspackRouterPluginOptions, routerPluginContext?: RouterPluginContext) => import('unplugin').RspackPluginInstance;
|
|
62
18
|
/**
|
|
63
19
|
* @example
|
|
64
20
|
* ```ts
|
|
@@ -72,7 +28,7 @@ declare const TanStackRouterGeneratorRspack: (options?: Partial<{
|
|
|
72
28
|
* })
|
|
73
29
|
* ```
|
|
74
30
|
*/
|
|
75
|
-
declare const TanStackRouterCodeSplitterRspack: (options?:
|
|
31
|
+
declare const TanStackRouterCodeSplitterRspack: (options?: RspackRouterPluginOptions, routerPluginContext?: RouterPluginContext) => import('unplugin').RspackPluginInstance;
|
|
76
32
|
/**
|
|
77
33
|
* @example
|
|
78
34
|
* ```ts
|
|
@@ -90,4 +46,4 @@ declare const TanStackRouterRspack: (options?: unknown) => import('unplugin').Rs
|
|
|
90
46
|
declare const tanstackRouter: (options?: unknown) => import('unplugin').RspackPluginInstance;
|
|
91
47
|
export default TanStackRouterRspack;
|
|
92
48
|
export { configSchema, TanStackRouterRspack, TanStackRouterGeneratorRspack, TanStackRouterCodeSplitterRspack, tanstackRouter, };
|
|
93
|
-
export type { Config, CodeSplittingOptions };
|
|
49
|
+
export type { Config, CodeSplittingOptions, RouterPluginContext };
|
package/dist/cjs/vite.cjs
CHANGED
|
@@ -4,11 +4,13 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
require("./_virtual/_rolldown/runtime.cjs");
|
|
6
6
|
const require_config = require("./core/config.cjs");
|
|
7
|
+
const require_router_plugin_context = require("./core/router-plugin-context.cjs");
|
|
7
8
|
const require_router_code_splitter_plugin = require("./core/router-code-splitter-plugin.cjs");
|
|
8
9
|
const require_router_generator_plugin = require("./core/router-generator-plugin.cjs");
|
|
9
10
|
const require_router_composed_plugin = require("./core/router-composed-plugin.cjs");
|
|
10
11
|
let unplugin = require("unplugin");
|
|
11
12
|
//#region src/vite.ts
|
|
13
|
+
var defaultRouterPluginContext = require_router_plugin_context.createRouterPluginContext();
|
|
12
14
|
/**
|
|
13
15
|
* @example
|
|
14
16
|
* ```ts
|
|
@@ -18,7 +20,10 @@ let unplugin = require("unplugin");
|
|
|
18
20
|
* })
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
|
-
var tanstackRouterGenerator = (
|
|
23
|
+
var tanstackRouterGenerator = (options, routerPluginContext) => {
|
|
24
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
25
|
+
return (0, unplugin.createVitePlugin)((pluginOptions) => require_router_generator_plugin.createRouterGeneratorPlugin(pluginOptions, pluginContext))(options);
|
|
26
|
+
};
|
|
22
27
|
/**
|
|
23
28
|
* @example
|
|
24
29
|
* ```ts
|
|
@@ -28,7 +33,10 @@ var tanstackRouterGenerator = (0, unplugin.createVitePlugin)(require_router_gene
|
|
|
28
33
|
* })
|
|
29
34
|
* ```
|
|
30
35
|
*/
|
|
31
|
-
var tanStackRouterCodeSplitter = (
|
|
36
|
+
var tanStackRouterCodeSplitter = (options, routerPluginContext) => {
|
|
37
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
38
|
+
return (0, unplugin.createVitePlugin)((pluginOptions) => require_router_code_splitter_plugin.createRouterCodeSplitterPlugin(pluginOptions, pluginContext))(options);
|
|
39
|
+
};
|
|
32
40
|
/**
|
|
33
41
|
* @example
|
|
34
42
|
* ```ts
|
|
@@ -48,6 +56,7 @@ exports.TanStackRouterVite = TanStackRouterVite;
|
|
|
48
56
|
exports.configSchema = require_config.configSchema;
|
|
49
57
|
exports.default = tanstackRouter;
|
|
50
58
|
exports.tanstackRouter = tanstackRouter;
|
|
59
|
+
exports.getConfig = require_config.getConfig;
|
|
51
60
|
exports.tanStackRouterCodeSplitter = tanStackRouterCodeSplitter;
|
|
52
61
|
exports.tanstackRouterGenerator = tanstackRouterGenerator;
|
|
53
62
|
|
package/dist/cjs/vite.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.cjs","names":[],"sources":["../../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport {
|
|
1
|
+
{"version":3,"file":"vite.cjs","names":[],"sources":["../../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from 'unplugin'\n\nimport { configSchema, getConfig } from './core/config'\nimport { createRouterCodeSplitterPlugin } from './core/router-code-splitter-plugin'\nimport { createRouterGeneratorPlugin } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport { createRouterPluginContext } from './core/router-plugin-context'\nimport type { CodeSplittingOptions, Config } from './core/config'\nimport type { RouterPluginContext } from './core/router-plugin-context'\n\ntype RouterPluginOptions = Partial<Config | (() => Config)> | undefined\n\nconst defaultRouterPluginContext = createRouterPluginContext()\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanstackRouterGenerator()],\n * // ...\n * })\n * ```\n */\nconst tanstackRouterGenerator = (\n options?: RouterPluginOptions,\n routerPluginContext?: RouterPluginContext,\n) => {\n const pluginContext = routerPluginContext ?? defaultRouterPluginContext\n return createVitePlugin((pluginOptions: RouterPluginOptions) =>\n createRouterGeneratorPlugin(pluginOptions, pluginContext),\n )(options)\n}\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n * plugins: [tanStackRouterCodeSplitter()],\n * // ...\n * })\n * ```\n */\nconst tanStackRouterCodeSplitter = (\n options?: RouterPluginOptions,\n routerPluginContext?: RouterPluginContext,\n) => {\n const pluginContext = routerPluginContext ?? defaultRouterPluginContext\n return createVitePlugin((pluginOptions: RouterPluginOptions) =>\n createRouterCodeSplitterPlugin(pluginOptions, pluginContext),\n )(options)\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 tanStackRouterCodeSplitter,\n tanstackRouterGenerator,\n TanStackRouterVite,\n tanstackRouter,\n}\n\nexport type { Config, CodeSplittingOptions, RouterPluginContext }\n"],"mappings":";;;;;;;;;;;;AAYA,IAAM,6BAA6B,8BAAA,2BAA2B;;;;;;;;;;AAW9D,IAAM,2BACJ,SACA,wBACG;CACH,MAAM,gBAAgB,uBAAuB;AAC7C,SAAA,GAAA,SAAA,mBAAyB,kBACvB,gCAAA,4BAA4B,eAAe,cAAc,CAC1D,CAAC,QAAQ;;;;;;;;;;;AAYZ,IAAM,8BACJ,SACA,wBACG;CACH,MAAM,gBAAgB,uBAAuB;AAC7C,SAAA,GAAA,SAAA,mBAAyB,kBACvB,oCAAA,+BAA+B,eAAe,cAAc,CAC7D,CAAC,QAAQ;;;;;;;;;;;AAYZ,IAAM,kBAAA,GAAA,SAAA,kBAAkC,+BAAA,8BAA8B;;;;AAKtE,IAAM,qBAAqB"}
|
package/dist/cjs/vite.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { configSchema, CodeSplittingOptions, Config
|
|
1
|
+
import { configSchema, getConfig, CodeSplittingOptions, Config } from './core/config.cjs';
|
|
2
|
+
import { RouterPluginContext } from './core/router-plugin-context.cjs';
|
|
3
|
+
type RouterPluginOptions = Partial<Config | (() => Config)> | undefined;
|
|
2
4
|
/**
|
|
3
5
|
* @example
|
|
4
6
|
* ```ts
|
|
@@ -8,53 +10,7 @@ import { configSchema, CodeSplittingOptions, Config, getConfig } from './core/co
|
|
|
8
10
|
* })
|
|
9
11
|
* ```
|
|
10
12
|
*/
|
|
11
|
-
declare const tanstackRouterGenerator: (options?:
|
|
12
|
-
target: "react" | "solid" | "vue";
|
|
13
|
-
routeFileIgnorePrefix: string;
|
|
14
|
-
routesDirectory: string;
|
|
15
|
-
quoteStyle: "single" | "double";
|
|
16
|
-
semicolons: boolean;
|
|
17
|
-
disableLogging: boolean;
|
|
18
|
-
routeTreeFileHeader: string[];
|
|
19
|
-
indexToken: string | RegExp | {
|
|
20
|
-
regex: string;
|
|
21
|
-
flags?: string | undefined;
|
|
22
|
-
};
|
|
23
|
-
routeToken: string | RegExp | {
|
|
24
|
-
regex: string;
|
|
25
|
-
flags?: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
generatedRouteTree: string;
|
|
28
|
-
disableTypes: boolean;
|
|
29
|
-
addExtensions: string | boolean;
|
|
30
|
-
enableRouteTreeFormatting: boolean;
|
|
31
|
-
tmpDir: string;
|
|
32
|
-
importRoutesUsingAbsolutePaths: boolean;
|
|
33
|
-
enableRouteGeneration?: boolean | undefined;
|
|
34
|
-
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
35
|
-
plugin?: {
|
|
36
|
-
vite?: {
|
|
37
|
-
environmentName?: string | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
hmr?: {
|
|
40
|
-
style?: "vite" | "webpack" | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
44
|
-
routeFilePrefix?: string | undefined;
|
|
45
|
-
routeFileIgnorePattern?: string | undefined;
|
|
46
|
-
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
47
|
-
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
48
|
-
autoCodeSplitting?: boolean | undefined;
|
|
49
|
-
customScaffolding?: {
|
|
50
|
-
routeTemplate?: string | undefined;
|
|
51
|
-
lazyRouteTemplate?: string | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
experimental?: {
|
|
54
|
-
enableCodeSplitting?: boolean | undefined;
|
|
55
|
-
} | undefined;
|
|
56
|
-
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
57
|
-
} | (() => Config)> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
13
|
+
declare const tanstackRouterGenerator: (options?: RouterPluginOptions, routerPluginContext?: RouterPluginContext) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
58
14
|
/**
|
|
59
15
|
* @example
|
|
60
16
|
* ```ts
|
|
@@ -64,53 +20,7 @@ declare const tanstackRouterGenerator: (options?: Partial<{
|
|
|
64
20
|
* })
|
|
65
21
|
* ```
|
|
66
22
|
*/
|
|
67
|
-
declare const tanStackRouterCodeSplitter: (options?:
|
|
68
|
-
target: "react" | "solid" | "vue";
|
|
69
|
-
routeFileIgnorePrefix: string;
|
|
70
|
-
routesDirectory: string;
|
|
71
|
-
quoteStyle: "single" | "double";
|
|
72
|
-
semicolons: boolean;
|
|
73
|
-
disableLogging: boolean;
|
|
74
|
-
routeTreeFileHeader: string[];
|
|
75
|
-
indexToken: string | RegExp | {
|
|
76
|
-
regex: string;
|
|
77
|
-
flags?: string | undefined;
|
|
78
|
-
};
|
|
79
|
-
routeToken: string | RegExp | {
|
|
80
|
-
regex: string;
|
|
81
|
-
flags?: string | undefined;
|
|
82
|
-
};
|
|
83
|
-
generatedRouteTree: string;
|
|
84
|
-
disableTypes: boolean;
|
|
85
|
-
addExtensions: string | boolean;
|
|
86
|
-
enableRouteTreeFormatting: boolean;
|
|
87
|
-
tmpDir: string;
|
|
88
|
-
importRoutesUsingAbsolutePaths: boolean;
|
|
89
|
-
enableRouteGeneration?: boolean | undefined;
|
|
90
|
-
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
91
|
-
plugin?: {
|
|
92
|
-
vite?: {
|
|
93
|
-
environmentName?: string | undefined;
|
|
94
|
-
} | undefined;
|
|
95
|
-
hmr?: {
|
|
96
|
-
style?: "vite" | "webpack" | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
} | undefined;
|
|
99
|
-
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
100
|
-
routeFilePrefix?: string | undefined;
|
|
101
|
-
routeFileIgnorePattern?: string | undefined;
|
|
102
|
-
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
103
|
-
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
104
|
-
autoCodeSplitting?: boolean | undefined;
|
|
105
|
-
customScaffolding?: {
|
|
106
|
-
routeTemplate?: string | undefined;
|
|
107
|
-
lazyRouteTemplate?: string | undefined;
|
|
108
|
-
} | undefined;
|
|
109
|
-
experimental?: {
|
|
110
|
-
enableCodeSplitting?: boolean | undefined;
|
|
111
|
-
} | undefined;
|
|
112
|
-
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
113
|
-
} | (() => Config)> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
23
|
+
declare const tanStackRouterCodeSplitter: (options?: RouterPluginOptions, routerPluginContext?: RouterPluginContext) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
114
24
|
/**
|
|
115
25
|
* @example
|
|
116
26
|
* ```ts
|
|
@@ -219,4 +129,4 @@ declare const TanStackRouterVite: (options?: Partial<{
|
|
|
219
129
|
} | (() => Config)> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
220
130
|
export default tanstackRouter;
|
|
221
131
|
export { configSchema, getConfig, tanStackRouterCodeSplitter, tanstackRouterGenerator, TanStackRouterVite, tanstackRouter, };
|
|
222
|
-
export type { Config, CodeSplittingOptions };
|
|
132
|
+
export type { Config, CodeSplittingOptions, RouterPluginContext };
|
package/dist/cjs/webpack.cjs
CHANGED
|
@@ -4,11 +4,13 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
require("./_virtual/_rolldown/runtime.cjs");
|
|
6
6
|
const require_config = require("./core/config.cjs");
|
|
7
|
+
const require_router_plugin_context = require("./core/router-plugin-context.cjs");
|
|
7
8
|
const require_router_code_splitter_plugin = require("./core/router-code-splitter-plugin.cjs");
|
|
8
9
|
const require_router_generator_plugin = require("./core/router-generator-plugin.cjs");
|
|
9
10
|
const require_router_composed_plugin = require("./core/router-composed-plugin.cjs");
|
|
10
11
|
let unplugin = require("unplugin");
|
|
11
12
|
//#region src/webpack.ts
|
|
13
|
+
var defaultRouterPluginContext = require_router_plugin_context.createRouterPluginContext();
|
|
12
14
|
/**
|
|
13
15
|
* Webpack uses `module.hot` / `import.meta.webpackHot` HMR. Force
|
|
14
16
|
* `plugin.hmr.style = 'webpack'` so the router HMR adapter emits the correct
|
|
@@ -35,7 +37,10 @@ function withWebpackHmrStyle(options) {
|
|
|
35
37
|
* }
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
|
-
var TanStackRouterGeneratorWebpack =
|
|
40
|
+
var TanStackRouterGeneratorWebpack = (options, routerPluginContext) => {
|
|
41
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
42
|
+
return (0, unplugin.createWebpackPlugin)((pluginOptions) => require_router_generator_plugin.createRouterGeneratorPlugin(pluginOptions, pluginContext))(options);
|
|
43
|
+
};
|
|
39
44
|
/**
|
|
40
45
|
* @example
|
|
41
46
|
* ```ts
|
|
@@ -45,7 +50,10 @@ var TanStackRouterGeneratorWebpack = /* @__PURE__ */ (0, unplugin.createWebpackP
|
|
|
45
50
|
* }
|
|
46
51
|
* ```
|
|
47
52
|
*/
|
|
48
|
-
var TanStackRouterCodeSplitterWebpack =
|
|
53
|
+
var TanStackRouterCodeSplitterWebpack = (options, routerPluginContext) => {
|
|
54
|
+
const pluginContext = routerPluginContext ?? defaultRouterPluginContext;
|
|
55
|
+
return (0, unplugin.createWebpackPlugin)((pluginOptions) => require_router_code_splitter_plugin.createRouterCodeSplitterPlugin(withWebpackHmrStyle(pluginOptions), pluginContext))(options);
|
|
56
|
+
};
|
|
49
57
|
/**
|
|
50
58
|
* @example
|
|
51
59
|
* ```ts
|
package/dist/cjs/webpack.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.cjs","names":[],"sources":["../../src/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport {
|
|
1
|
+
{"version":3,"file":"webpack.cjs","names":[],"sources":["../../src/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { createRouterCodeSplitterPlugin } from './core/router-code-splitter-plugin'\nimport { createRouterGeneratorPlugin } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport { createRouterPluginContext } from './core/router-plugin-context'\nimport type { CodeSplittingOptions, Config } from './core/config'\nimport type { RouterPluginContext } from './core/router-plugin-context'\n\nconst defaultRouterPluginContext = createRouterPluginContext()\n\n/**\n * Webpack uses `module.hot` / `import.meta.webpackHot` HMR. Force\n * `plugin.hmr.style = 'webpack'` so the router HMR adapter emits the correct\n * accept/dispose shape regardless of user config.\n */\nfunction withWebpackHmrStyle(\n options: Partial<Config> | undefined,\n): Partial<Config> {\n return {\n ...options,\n plugin: {\n ...options?.plugin,\n hmr: {\n ...options?.plugin?.hmr,\n style: 'webpack',\n },\n },\n }\n}\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [TanStackRouterGeneratorWebpack()],\n * }\n * ```\n */\nconst TanStackRouterGeneratorWebpack = (\n options?: Partial<Config>,\n routerPluginContext?: RouterPluginContext,\n) => {\n const pluginContext = routerPluginContext ?? defaultRouterPluginContext\n return createWebpackPlugin((pluginOptions: Partial<Config> | undefined) =>\n createRouterGeneratorPlugin(pluginOptions, pluginContext),\n )(options)\n}\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [TanStackRouterCodeSplitterWebpack()],\n * }\n * ```\n */\nconst TanStackRouterCodeSplitterWebpack = (\n options?: Partial<Config>,\n routerPluginContext?: RouterPluginContext,\n) => {\n const pluginContext = routerPluginContext ?? defaultRouterPluginContext\n return createWebpackPlugin((pluginOptions: Partial<Config> | undefined) =>\n createRouterCodeSplitterPlugin(\n withWebpackHmrStyle(pluginOptions),\n pluginContext,\n ),\n )(options)\n}\n\n/**\n * @example\n * ```ts\n * export default {\n * // ...\n * plugins: [tanstackRouter()],\n * }\n * ```\n */\nconst TanStackRouterWebpack = /* #__PURE__ */ createWebpackPlugin(\n (options, meta) =>\n unpluginRouterComposedFactory(\n withWebpackHmrStyle(options as Partial<Config> | undefined),\n meta,\n ),\n)\n\nconst tanstackRouter = TanStackRouterWebpack\nexport default TanStackRouterWebpack\nexport {\n configSchema,\n TanStackRouterWebpack,\n TanStackRouterGeneratorWebpack,\n TanStackRouterCodeSplitterWebpack,\n tanstackRouter,\n}\nexport type { Config, CodeSplittingOptions, RouterPluginContext }\n"],"mappings":";;;;;;;;;;;;AAUA,IAAM,6BAA6B,8BAAA,2BAA2B;;;;;;AAO9D,SAAS,oBACP,SACiB;AACjB,QAAO;EACL,GAAG;EACH,QAAQ;GACN,GAAG,SAAS;GACZ,KAAK;IACH,GAAG,SAAS,QAAQ;IACpB,OAAO;IACR;GACF;EACF;;;;;;;;;;;AAYH,IAAM,kCACJ,SACA,wBACG;CACH,MAAM,gBAAgB,uBAAuB;AAC7C,SAAA,GAAA,SAAA,sBAA4B,kBAC1B,gCAAA,4BAA4B,eAAe,cAAc,CAC1D,CAAC,QAAQ;;;;;;;;;;;AAYZ,IAAM,qCACJ,SACA,wBACG;CACH,MAAM,gBAAgB,uBAAuB;AAC7C,SAAA,GAAA,SAAA,sBAA4B,kBAC1B,oCAAA,+BACE,oBAAoB,cAAc,EAClC,cACD,CACF,CAAC,QAAQ;;;;;;;;;;;AAYZ,IAAM,wBAAwC,iBAAA,GAAA,SAAA,sBAC3C,SAAS,SACR,+BAAA,8BACE,oBAAoB,QAAuC,EAC3D,KACD,CACJ;AAED,IAAM,iBAAiB"}
|
package/dist/cjs/webpack.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { configSchema, CodeSplittingOptions, Config } from './core/config.cjs';
|
|
2
|
+
import { RouterPluginContext } from './core/router-plugin-context.cjs';
|
|
2
3
|
/**
|
|
3
4
|
* @example
|
|
4
5
|
* ```ts
|
|
@@ -8,53 +9,7 @@ import { configSchema, CodeSplittingOptions, Config } from './core/config.cjs';
|
|
|
8
9
|
* }
|
|
9
10
|
* ```
|
|
10
11
|
*/
|
|
11
|
-
declare const TanStackRouterGeneratorWebpack: (options?: Partial<
|
|
12
|
-
target: "react" | "solid" | "vue";
|
|
13
|
-
routeFileIgnorePrefix: string;
|
|
14
|
-
routesDirectory: string;
|
|
15
|
-
quoteStyle: "single" | "double";
|
|
16
|
-
semicolons: boolean;
|
|
17
|
-
disableLogging: boolean;
|
|
18
|
-
routeTreeFileHeader: string[];
|
|
19
|
-
indexToken: string | RegExp | {
|
|
20
|
-
regex: string;
|
|
21
|
-
flags?: string | undefined;
|
|
22
|
-
};
|
|
23
|
-
routeToken: string | RegExp | {
|
|
24
|
-
regex: string;
|
|
25
|
-
flags?: string | undefined;
|
|
26
|
-
};
|
|
27
|
-
generatedRouteTree: string;
|
|
28
|
-
disableTypes: boolean;
|
|
29
|
-
addExtensions: string | boolean;
|
|
30
|
-
enableRouteTreeFormatting: boolean;
|
|
31
|
-
tmpDir: string;
|
|
32
|
-
importRoutesUsingAbsolutePaths: boolean;
|
|
33
|
-
enableRouteGeneration?: boolean | undefined;
|
|
34
|
-
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
35
|
-
plugin?: {
|
|
36
|
-
vite?: {
|
|
37
|
-
environmentName?: string | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
hmr?: {
|
|
40
|
-
style?: "vite" | "webpack" | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
44
|
-
routeFilePrefix?: string | undefined;
|
|
45
|
-
routeFileIgnorePattern?: string | undefined;
|
|
46
|
-
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
47
|
-
routeTreeFileFooter?: string[] | ((...args: unknown[]) => string[]) | undefined;
|
|
48
|
-
autoCodeSplitting?: boolean | undefined;
|
|
49
|
-
customScaffolding?: {
|
|
50
|
-
routeTemplate?: string | undefined;
|
|
51
|
-
lazyRouteTemplate?: string | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
experimental?: {
|
|
54
|
-
enableCodeSplitting?: boolean | undefined;
|
|
55
|
-
} | undefined;
|
|
56
|
-
plugins?: import('@tanstack/router-generator').GeneratorPlugin[] | undefined;
|
|
57
|
-
} | (() => Config)> | undefined) => import('unplugin').WebpackPluginInstance;
|
|
12
|
+
declare const TanStackRouterGeneratorWebpack: (options?: Partial<Config>, routerPluginContext?: RouterPluginContext) => import('unplugin').WebpackPluginInstance;
|
|
58
13
|
/**
|
|
59
14
|
* @example
|
|
60
15
|
* ```ts
|
|
@@ -64,7 +19,7 @@ declare const TanStackRouterGeneratorWebpack: (options?: Partial<{
|
|
|
64
19
|
* }
|
|
65
20
|
* ```
|
|
66
21
|
*/
|
|
67
|
-
declare const TanStackRouterCodeSplitterWebpack: (options?:
|
|
22
|
+
declare const TanStackRouterCodeSplitterWebpack: (options?: Partial<Config>, routerPluginContext?: RouterPluginContext) => import('unplugin').WebpackPluginInstance;
|
|
68
23
|
/**
|
|
69
24
|
* @example
|
|
70
25
|
* ```ts
|
|
@@ -78,4 +33,4 @@ declare const TanStackRouterWebpack: (options?: unknown) => import('unplugin').W
|
|
|
78
33
|
declare const tanstackRouter: (options?: unknown) => import('unplugin').WebpackPluginInstance;
|
|
79
34
|
export default TanStackRouterWebpack;
|
|
80
35
|
export { configSchema, TanStackRouterWebpack, TanStackRouterGeneratorWebpack, TanStackRouterCodeSplitterWebpack, tanstackRouter, };
|
|
81
|
-
export type { Config, CodeSplittingOptions };
|
|
36
|
+
export type { Config, CodeSplittingOptions, RouterPluginContext };
|