@tanstack/router-plugin 1.120.4-alpha.19 → 1.120.4
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 +21 -39
- package/dist/cjs/core/code-splitter/compilers.cjs.map +1 -1
- package/dist/cjs/core/code-splitter/compilers.d.cts +0 -3
- package/dist/cjs/core/code-splitter/framework-options.cjs +8 -4
- package/dist/cjs/core/code-splitter/framework-options.cjs.map +1 -1
- package/dist/cjs/core/code-splitter/framework-options.d.cts +2 -0
- package/dist/cjs/core/config.d.cts +40 -31
- package/dist/cjs/core/router-code-splitter-plugin.cjs +20 -11
- package/dist/cjs/core/router-code-splitter-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-composed-plugin.cjs +5 -19
- package/dist/cjs/core/router-composed-plugin.cjs.map +1 -1
- package/dist/cjs/core/router-generator-plugin.cjs +2 -8
- package/dist/cjs/core/router-generator-plugin.cjs.map +1 -1
- package/dist/cjs/esbuild.d.cts +27 -21
- package/dist/cjs/rspack.d.cts +27 -21
- package/dist/cjs/vite.cjs +0 -2
- package/dist/cjs/vite.cjs.map +1 -1
- package/dist/cjs/vite.d.cts +26 -52
- package/dist/cjs/webpack.d.cts +27 -21
- package/dist/esm/core/code-splitter/compilers.d.ts +0 -3
- package/dist/esm/core/code-splitter/compilers.js +21 -39
- package/dist/esm/core/code-splitter/compilers.js.map +1 -1
- package/dist/esm/core/code-splitter/framework-options.d.ts +2 -0
- package/dist/esm/core/code-splitter/framework-options.js +8 -4
- package/dist/esm/core/code-splitter/framework-options.js.map +1 -1
- package/dist/esm/core/config.d.ts +40 -31
- package/dist/esm/core/router-code-splitter-plugin.js +14 -5
- package/dist/esm/core/router-code-splitter-plugin.js.map +1 -1
- package/dist/esm/core/router-composed-plugin.js +5 -19
- package/dist/esm/core/router-composed-plugin.js.map +1 -1
- package/dist/esm/core/router-generator-plugin.js +2 -8
- package/dist/esm/core/router-generator-plugin.js.map +1 -1
- package/dist/esm/esbuild.d.ts +27 -21
- package/dist/esm/rspack.d.ts +27 -21
- package/dist/esm/vite.d.ts +26 -52
- package/dist/esm/vite.js +1 -3
- package/dist/esm/vite.js.map +1 -1
- package/dist/esm/webpack.d.ts +27 -21
- package/package.json +6 -6
- package/src/core/code-splitter/compilers.ts +27 -54
- package/src/core/code-splitter/framework-options.ts +6 -0
- package/src/core/router-code-splitter-plugin.ts +23 -3
- package/src/core/router-composed-plugin.ts +10 -20
- package/src/core/router-generator-plugin.ts +1 -12
- package/src/vite.ts +0 -3
- package/dist/cjs/core/route-autoimport-plugin.cjs +0 -98
- package/dist/cjs/core/route-autoimport-plugin.cjs.map +0 -1
- package/dist/cjs/core/route-autoimport-plugin.d.cts +0 -6
- package/dist/cjs/core/route-hmr-statement.cjs +0 -33
- package/dist/cjs/core/route-hmr-statement.cjs.map +0 -1
- package/dist/cjs/core/route-hmr-statement.d.cts +0 -1
- package/dist/cjs/core/router-hmr-plugin.cjs +0 -51
- package/dist/cjs/core/router-hmr-plugin.cjs.map +0 -1
- package/dist/cjs/core/router-hmr-plugin.d.cts +0 -8
- package/dist/cjs/core/utils.cjs +0 -12
- package/dist/cjs/core/utils.cjs.map +0 -1
- package/dist/cjs/core/utils.d.cts +0 -2
- package/dist/esm/core/route-autoimport-plugin.d.ts +0 -6
- package/dist/esm/core/route-autoimport-plugin.js +0 -81
- package/dist/esm/core/route-autoimport-plugin.js.map +0 -1
- package/dist/esm/core/route-hmr-statement.d.ts +0 -1
- package/dist/esm/core/route-hmr-statement.js +0 -16
- package/dist/esm/core/route-hmr-statement.js.map +0 -1
- package/dist/esm/core/router-hmr-plugin.d.ts +0 -8
- package/dist/esm/core/router-hmr-plugin.js +0 -51
- package/dist/esm/core/router-hmr-plugin.js.map +0 -1
- package/dist/esm/core/utils.d.ts +0 -2
- package/dist/esm/core/utils.js +0 -12
- package/dist/esm/core/utils.js.map +0 -1
- package/src/core/route-autoimport-plugin.ts +0 -102
- package/src/core/route-hmr-statement.ts +0 -13
- package/src/core/router-hmr-plugin.ts +0 -65
- package/src/core/utils.ts +0 -18
package/dist/cjs/vite.d.cts
CHANGED
|
@@ -12,29 +12,31 @@ declare const TanStackRouterGeneratorVite: (options?: Partial<{
|
|
|
12
12
|
target: "react" | "solid";
|
|
13
13
|
routeFileIgnorePrefix: string;
|
|
14
14
|
routesDirectory: string;
|
|
15
|
+
generatedRouteTree: string;
|
|
15
16
|
quoteStyle: "single" | "double";
|
|
16
17
|
semicolons: boolean;
|
|
17
|
-
disableLogging: boolean;
|
|
18
|
-
routeTreeFileHeader: string[];
|
|
19
|
-
indexToken: string;
|
|
20
|
-
routeToken: string;
|
|
21
|
-
generatedRouteTree: string;
|
|
22
18
|
disableTypes: boolean;
|
|
23
19
|
addExtensions: boolean;
|
|
20
|
+
disableLogging: boolean;
|
|
24
21
|
disableManifestGeneration: boolean;
|
|
25
22
|
enableRouteTreeFormatting: boolean;
|
|
23
|
+
apiBase: string;
|
|
24
|
+
routeTreeFileHeader: string[];
|
|
26
25
|
routeTreeFileFooter: string[];
|
|
26
|
+
indexToken: string;
|
|
27
|
+
routeToken: string;
|
|
27
28
|
enableRouteGeneration?: boolean | undefined;
|
|
28
29
|
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
29
30
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
30
31
|
routeFilePrefix?: string | undefined;
|
|
31
32
|
routeFileIgnorePattern?: string | undefined;
|
|
32
|
-
|
|
33
|
-
verboseFileRoutes?: boolean | undefined;
|
|
33
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
34
34
|
autoCodeSplitting?: boolean | undefined;
|
|
35
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
35
36
|
customScaffolding?: {
|
|
36
37
|
routeTemplate?: string | undefined;
|
|
37
38
|
lazyRouteTemplate?: string | undefined;
|
|
39
|
+
apiTemplate?: string | undefined;
|
|
38
40
|
} | undefined;
|
|
39
41
|
experimental?: {
|
|
40
42
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -53,29 +55,31 @@ declare const TanStackRouterCodeSplitterVite: (options?: Partial<{
|
|
|
53
55
|
target: "react" | "solid";
|
|
54
56
|
routeFileIgnorePrefix: string;
|
|
55
57
|
routesDirectory: string;
|
|
58
|
+
generatedRouteTree: string;
|
|
56
59
|
quoteStyle: "single" | "double";
|
|
57
60
|
semicolons: boolean;
|
|
58
|
-
disableLogging: boolean;
|
|
59
|
-
routeTreeFileHeader: string[];
|
|
60
|
-
indexToken: string;
|
|
61
|
-
routeToken: string;
|
|
62
|
-
generatedRouteTree: string;
|
|
63
61
|
disableTypes: boolean;
|
|
64
62
|
addExtensions: boolean;
|
|
63
|
+
disableLogging: boolean;
|
|
65
64
|
disableManifestGeneration: boolean;
|
|
66
65
|
enableRouteTreeFormatting: boolean;
|
|
66
|
+
apiBase: string;
|
|
67
|
+
routeTreeFileHeader: string[];
|
|
67
68
|
routeTreeFileFooter: string[];
|
|
69
|
+
indexToken: string;
|
|
70
|
+
routeToken: string;
|
|
68
71
|
enableRouteGeneration?: boolean | undefined;
|
|
69
72
|
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
70
73
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
71
74
|
routeFilePrefix?: string | undefined;
|
|
72
75
|
routeFileIgnorePattern?: string | undefined;
|
|
73
|
-
|
|
74
|
-
verboseFileRoutes?: boolean | undefined;
|
|
76
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
75
77
|
autoCodeSplitting?: boolean | undefined;
|
|
78
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
76
79
|
customScaffolding?: {
|
|
77
80
|
routeTemplate?: string | undefined;
|
|
78
81
|
lazyRouteTemplate?: string | undefined;
|
|
82
|
+
apiTemplate?: string | undefined;
|
|
79
83
|
} | undefined;
|
|
80
84
|
experimental?: {
|
|
81
85
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -94,66 +98,36 @@ declare const TanStackRouterVite: (options?: Partial<{
|
|
|
94
98
|
target: "react" | "solid";
|
|
95
99
|
routeFileIgnorePrefix: string;
|
|
96
100
|
routesDirectory: string;
|
|
101
|
+
generatedRouteTree: string;
|
|
97
102
|
quoteStyle: "single" | "double";
|
|
98
103
|
semicolons: boolean;
|
|
99
|
-
disableLogging: boolean;
|
|
100
|
-
routeTreeFileHeader: string[];
|
|
101
|
-
indexToken: string;
|
|
102
|
-
routeToken: string;
|
|
103
|
-
generatedRouteTree: string;
|
|
104
104
|
disableTypes: boolean;
|
|
105
105
|
addExtensions: boolean;
|
|
106
|
+
disableLogging: boolean;
|
|
106
107
|
disableManifestGeneration: boolean;
|
|
107
108
|
enableRouteTreeFormatting: boolean;
|
|
108
|
-
|
|
109
|
-
enableRouteGeneration?: boolean | undefined;
|
|
110
|
-
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
111
|
-
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
112
|
-
routeFilePrefix?: string | undefined;
|
|
113
|
-
routeFileIgnorePattern?: string | undefined;
|
|
114
|
-
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
115
|
-
verboseFileRoutes?: boolean | undefined;
|
|
116
|
-
autoCodeSplitting?: boolean | undefined;
|
|
117
|
-
customScaffolding?: {
|
|
118
|
-
routeTemplate?: string | undefined;
|
|
119
|
-
lazyRouteTemplate?: string | undefined;
|
|
120
|
-
} | undefined;
|
|
121
|
-
experimental?: {
|
|
122
|
-
enableCodeSplitting?: boolean | undefined;
|
|
123
|
-
} | undefined;
|
|
124
|
-
}> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
125
|
-
declare const tanstackRouter: (options?: Partial<{
|
|
126
|
-
target: "react" | "solid";
|
|
127
|
-
routeFileIgnorePrefix: string;
|
|
128
|
-
routesDirectory: string;
|
|
129
|
-
quoteStyle: "single" | "double";
|
|
130
|
-
semicolons: boolean;
|
|
131
|
-
disableLogging: boolean;
|
|
109
|
+
apiBase: string;
|
|
132
110
|
routeTreeFileHeader: string[];
|
|
111
|
+
routeTreeFileFooter: string[];
|
|
133
112
|
indexToken: string;
|
|
134
113
|
routeToken: string;
|
|
135
|
-
generatedRouteTree: string;
|
|
136
|
-
disableTypes: boolean;
|
|
137
|
-
addExtensions: boolean;
|
|
138
|
-
disableManifestGeneration: boolean;
|
|
139
|
-
enableRouteTreeFormatting: boolean;
|
|
140
|
-
routeTreeFileFooter: string[];
|
|
141
114
|
enableRouteGeneration?: boolean | undefined;
|
|
142
115
|
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
143
116
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
144
117
|
routeFilePrefix?: string | undefined;
|
|
145
118
|
routeFileIgnorePattern?: string | undefined;
|
|
146
|
-
|
|
147
|
-
verboseFileRoutes?: boolean | undefined;
|
|
119
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
148
120
|
autoCodeSplitting?: boolean | undefined;
|
|
121
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
149
122
|
customScaffolding?: {
|
|
150
123
|
routeTemplate?: string | undefined;
|
|
151
124
|
lazyRouteTemplate?: string | undefined;
|
|
125
|
+
apiTemplate?: string | undefined;
|
|
152
126
|
} | undefined;
|
|
153
127
|
experimental?: {
|
|
154
128
|
enableCodeSplitting?: boolean | undefined;
|
|
155
129
|
} | undefined;
|
|
156
130
|
}> | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
|
|
157
131
|
export default TanStackRouterVite;
|
|
158
|
-
export { configSchema, TanStackRouterGeneratorVite, TanStackRouterCodeSplitterVite, TanStackRouterVite,
|
|
132
|
+
export { configSchema, TanStackRouterGeneratorVite, TanStackRouterCodeSplitterVite, TanStackRouterVite, };
|
|
159
133
|
export type { Config };
|
package/dist/cjs/webpack.d.cts
CHANGED
|
@@ -12,29 +12,31 @@ declare const TanStackRouterGeneratorWebpack: (options?: Partial<{
|
|
|
12
12
|
target: "react" | "solid";
|
|
13
13
|
routeFileIgnorePrefix: string;
|
|
14
14
|
routesDirectory: string;
|
|
15
|
+
generatedRouteTree: string;
|
|
15
16
|
quoteStyle: "single" | "double";
|
|
16
17
|
semicolons: boolean;
|
|
17
|
-
disableLogging: boolean;
|
|
18
|
-
routeTreeFileHeader: string[];
|
|
19
|
-
indexToken: string;
|
|
20
|
-
routeToken: string;
|
|
21
|
-
generatedRouteTree: string;
|
|
22
18
|
disableTypes: boolean;
|
|
23
19
|
addExtensions: boolean;
|
|
20
|
+
disableLogging: boolean;
|
|
24
21
|
disableManifestGeneration: boolean;
|
|
25
22
|
enableRouteTreeFormatting: boolean;
|
|
23
|
+
apiBase: string;
|
|
24
|
+
routeTreeFileHeader: string[];
|
|
26
25
|
routeTreeFileFooter: string[];
|
|
26
|
+
indexToken: string;
|
|
27
|
+
routeToken: string;
|
|
27
28
|
enableRouteGeneration?: boolean | undefined;
|
|
28
29
|
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
29
30
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
30
31
|
routeFilePrefix?: string | undefined;
|
|
31
32
|
routeFileIgnorePattern?: string | undefined;
|
|
32
|
-
|
|
33
|
-
verboseFileRoutes?: boolean | undefined;
|
|
33
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
34
34
|
autoCodeSplitting?: boolean | undefined;
|
|
35
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
35
36
|
customScaffolding?: {
|
|
36
37
|
routeTemplate?: string | undefined;
|
|
37
38
|
lazyRouteTemplate?: string | undefined;
|
|
39
|
+
apiTemplate?: string | undefined;
|
|
38
40
|
} | undefined;
|
|
39
41
|
experimental?: {
|
|
40
42
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -53,29 +55,31 @@ declare const TanStackRouterCodeSplitterWebpack: (options?: Partial<{
|
|
|
53
55
|
target: "react" | "solid";
|
|
54
56
|
routeFileIgnorePrefix: string;
|
|
55
57
|
routesDirectory: string;
|
|
58
|
+
generatedRouteTree: string;
|
|
56
59
|
quoteStyle: "single" | "double";
|
|
57
60
|
semicolons: boolean;
|
|
58
|
-
disableLogging: boolean;
|
|
59
|
-
routeTreeFileHeader: string[];
|
|
60
|
-
indexToken: string;
|
|
61
|
-
routeToken: string;
|
|
62
|
-
generatedRouteTree: string;
|
|
63
61
|
disableTypes: boolean;
|
|
64
62
|
addExtensions: boolean;
|
|
63
|
+
disableLogging: boolean;
|
|
65
64
|
disableManifestGeneration: boolean;
|
|
66
65
|
enableRouteTreeFormatting: boolean;
|
|
66
|
+
apiBase: string;
|
|
67
|
+
routeTreeFileHeader: string[];
|
|
67
68
|
routeTreeFileFooter: string[];
|
|
69
|
+
indexToken: string;
|
|
70
|
+
routeToken: string;
|
|
68
71
|
enableRouteGeneration?: boolean | undefined;
|
|
69
72
|
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
70
73
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
71
74
|
routeFilePrefix?: string | undefined;
|
|
72
75
|
routeFileIgnorePattern?: string | undefined;
|
|
73
|
-
|
|
74
|
-
verboseFileRoutes?: boolean | undefined;
|
|
76
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
75
77
|
autoCodeSplitting?: boolean | undefined;
|
|
78
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
76
79
|
customScaffolding?: {
|
|
77
80
|
routeTemplate?: string | undefined;
|
|
78
81
|
lazyRouteTemplate?: string | undefined;
|
|
82
|
+
apiTemplate?: string | undefined;
|
|
79
83
|
} | undefined;
|
|
80
84
|
experimental?: {
|
|
81
85
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -94,29 +98,31 @@ declare const TanStackRouterWebpack: (options?: Partial<{
|
|
|
94
98
|
target: "react" | "solid";
|
|
95
99
|
routeFileIgnorePrefix: string;
|
|
96
100
|
routesDirectory: string;
|
|
101
|
+
generatedRouteTree: string;
|
|
97
102
|
quoteStyle: "single" | "double";
|
|
98
103
|
semicolons: boolean;
|
|
99
|
-
disableLogging: boolean;
|
|
100
|
-
routeTreeFileHeader: string[];
|
|
101
|
-
indexToken: string;
|
|
102
|
-
routeToken: string;
|
|
103
|
-
generatedRouteTree: string;
|
|
104
104
|
disableTypes: boolean;
|
|
105
105
|
addExtensions: boolean;
|
|
106
|
+
disableLogging: boolean;
|
|
106
107
|
disableManifestGeneration: boolean;
|
|
107
108
|
enableRouteTreeFormatting: boolean;
|
|
109
|
+
apiBase: string;
|
|
110
|
+
routeTreeFileHeader: string[];
|
|
108
111
|
routeTreeFileFooter: string[];
|
|
112
|
+
indexToken: string;
|
|
113
|
+
routeToken: string;
|
|
109
114
|
enableRouteGeneration?: boolean | undefined;
|
|
110
115
|
codeSplittingOptions?: import('./core/config.cjs').CodeSplittingOptions | undefined;
|
|
111
116
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
112
117
|
routeFilePrefix?: string | undefined;
|
|
113
118
|
routeFileIgnorePattern?: string | undefined;
|
|
114
|
-
|
|
115
|
-
verboseFileRoutes?: boolean | undefined;
|
|
119
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
116
120
|
autoCodeSplitting?: boolean | undefined;
|
|
121
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
117
122
|
customScaffolding?: {
|
|
118
123
|
routeTemplate?: string | undefined;
|
|
119
124
|
lazyRouteTemplate?: string | undefined;
|
|
125
|
+
apiTemplate?: string | undefined;
|
|
120
126
|
} | undefined;
|
|
121
127
|
experimental?: {
|
|
122
128
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -5,12 +5,9 @@ export declare function compileCodeSplitReferenceRoute(opts: ParseAstOptions & {
|
|
|
5
5
|
runtimeEnv: 'dev' | 'prod';
|
|
6
6
|
codeSplitGroupings: CodeSplitGroupings;
|
|
7
7
|
targetFramework: Config['target'];
|
|
8
|
-
filename: string;
|
|
9
|
-
id: string;
|
|
10
8
|
}): GeneratorResult;
|
|
11
9
|
export declare function compileCodeSplitVirtualRoute(opts: ParseAstOptions & {
|
|
12
10
|
splitTargets: Array<SplitRouteIdentNodes>;
|
|
13
|
-
filename: string;
|
|
14
11
|
}): GeneratorResult;
|
|
15
12
|
/**
|
|
16
13
|
* This function should read get the options from by searching for the key `codeSplitGroupings`
|
|
@@ -4,7 +4,6 @@ import * as template from "@babel/template";
|
|
|
4
4
|
import { findReferencedIdentifiers, deadCodeElimination } from "babel-dead-code-elimination";
|
|
5
5
|
import { parseAst, generateFromAst } from "@tanstack/router-utils";
|
|
6
6
|
import { tsrSplit } from "../constants.js";
|
|
7
|
-
import { routeHmrStatement } from "../route-hmr-statement.js";
|
|
8
7
|
import { createIdentifier } from "./path-ids.js";
|
|
9
8
|
import { getFrameworkOptions } from "./framework-options.js";
|
|
10
9
|
process.env.TSR_VITE_DEBUG;
|
|
@@ -112,12 +111,16 @@ function compileCodeSplitReferenceRoute(opts) {
|
|
|
112
111
|
if (!(path.node.callee.name === "createRoute" || path.node.callee.name === "createFileRoute")) {
|
|
113
112
|
return;
|
|
114
113
|
}
|
|
115
|
-
|
|
114
|
+
if (t.isCallExpression(path.parentPath.node)) {
|
|
115
|
+
const options = resolveIdentifier(
|
|
116
|
+
path,
|
|
117
|
+
path.parentPath.node.arguments[0]
|
|
118
|
+
);
|
|
116
119
|
const hasImportedOrDefinedIdentifier = (name) => {
|
|
117
120
|
return programPath.scope.hasBinding(name);
|
|
118
121
|
};
|
|
119
|
-
if (t.isObjectExpression(
|
|
120
|
-
|
|
122
|
+
if (t.isObjectExpression(options)) {
|
|
123
|
+
options.properties.forEach((prop) => {
|
|
121
124
|
if (t.isObjectProperty(prop)) {
|
|
122
125
|
if (t.isIdentifier(prop.key)) {
|
|
123
126
|
const codeSplitGroupingByKey = findIndexForSplitNode(
|
|
@@ -192,8 +195,15 @@ function compileCodeSplitReferenceRoute(opts) {
|
|
|
192
195
|
`${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`
|
|
193
196
|
)();
|
|
194
197
|
}
|
|
195
|
-
if (opts.runtimeEnv !== "prod"
|
|
196
|
-
|
|
198
|
+
if (opts.runtimeEnv !== "prod" && // only in development
|
|
199
|
+
!hasImportedOrDefinedIdentifier(
|
|
200
|
+
frameworkOptions.idents.dummyHMRComponent
|
|
201
|
+
)) {
|
|
202
|
+
programPath.pushContainer("body", [
|
|
203
|
+
template.statement(
|
|
204
|
+
frameworkOptions.dummyHMRComponent
|
|
205
|
+
)()
|
|
206
|
+
]);
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
209
|
if (splitNodeMeta.splitStrategy === "lazyFn") {
|
|
@@ -243,22 +253,6 @@ function compileCodeSplitReferenceRoute(opts) {
|
|
|
243
253
|
});
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
|
-
if (t.isCallExpression(path.parentPath.node)) {
|
|
247
|
-
const options = resolveIdentifier(
|
|
248
|
-
path,
|
|
249
|
-
path.parentPath.node.arguments[0]
|
|
250
|
-
);
|
|
251
|
-
babelHandleReference(options);
|
|
252
|
-
} else if (t.isVariableDeclarator(path.parentPath.node)) {
|
|
253
|
-
const caller = resolveIdentifier(
|
|
254
|
-
path,
|
|
255
|
-
path.parentPath.node.init
|
|
256
|
-
);
|
|
257
|
-
if (t.isCallExpression(caller)) {
|
|
258
|
-
const options = resolveIdentifier(path, caller.arguments[0]);
|
|
259
|
-
babelHandleReference(options);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
256
|
}
|
|
263
257
|
},
|
|
264
258
|
state
|
|
@@ -308,7 +302,11 @@ function compileCodeSplitVirtualRoute(opts) {
|
|
|
308
302
|
if (!(path.node.callee.name === "createRoute" || path.node.callee.name === "createFileRoute")) {
|
|
309
303
|
return;
|
|
310
304
|
}
|
|
311
|
-
|
|
305
|
+
if (t.isCallExpression(path.parentPath.node)) {
|
|
306
|
+
const options = resolveIdentifier(
|
|
307
|
+
path,
|
|
308
|
+
path.parentPath.node.arguments[0]
|
|
309
|
+
);
|
|
312
310
|
if (t.isObjectExpression(options)) {
|
|
313
311
|
options.properties.forEach((prop) => {
|
|
314
312
|
if (t.isObjectProperty(prop)) {
|
|
@@ -339,22 +337,6 @@ function compileCodeSplitVirtualRoute(opts) {
|
|
|
339
337
|
options.properties = [];
|
|
340
338
|
}
|
|
341
339
|
}
|
|
342
|
-
if (t.isCallExpression(path.parentPath.node)) {
|
|
343
|
-
const options = resolveIdentifier(
|
|
344
|
-
path,
|
|
345
|
-
path.parentPath.node.arguments[0]
|
|
346
|
-
);
|
|
347
|
-
babelHandleVirtual(options);
|
|
348
|
-
} else if (t.isVariableDeclarator(path.parentPath.node)) {
|
|
349
|
-
const caller = resolveIdentifier(
|
|
350
|
-
path,
|
|
351
|
-
path.parentPath.node.init
|
|
352
|
-
);
|
|
353
|
-
if (t.isCallExpression(caller)) {
|
|
354
|
-
const options = resolveIdentifier(path, caller.arguments[0]);
|
|
355
|
-
babelHandleVirtual(options);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
340
|
}
|
|
359
341
|
},
|
|
360
342
|
state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilers.js","sources":["../../../../src/core/code-splitter/compilers.ts"],"sourcesContent":["import * as t from '@babel/types'\nimport babel from '@babel/core'\nimport * as template from '@babel/template'\nimport {\n deadCodeElimination,\n findReferencedIdentifiers,\n} from 'babel-dead-code-elimination'\nimport { generateFromAst, parseAst } from '@tanstack/router-utils'\nimport { tsrSplit } from '../constants'\nimport { routeHmrStatement } from '../route-hmr-statement'\nimport { createIdentifier } from './path-ids'\nimport { getFrameworkOptions } from './framework-options'\nimport type { GeneratorResult, ParseAstOptions } from '@tanstack/router-utils'\nimport type { CodeSplitGroupings, SplitRouteIdentNodes } from '../constants'\nimport type { Config } from '../config'\n\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst debug = process.env.TSR_VITE_DEBUG\n\ntype SplitModulesById = Record<\n string,\n { id: string; node: t.FunctionExpression }\n>\n\ninterface State {\n filename: string\n opts: {\n minify: boolean\n root: string\n }\n imported: Record<string, boolean>\n refs: Set<any>\n serverIndex: number\n splitIndex: number\n splitModulesById: SplitModulesById\n}\n\ntype SplitNodeMeta = {\n routeIdent: SplitRouteIdentNodes\n splitStrategy: 'lazyFn' | 'lazyRouteComponent'\n localImporterIdent: string\n exporterIdent: string\n localExporterIdent: string\n}\nconst SPLIT_NODES_CONFIG = new Map<SplitRouteIdentNodes, SplitNodeMeta>([\n [\n 'loader',\n {\n routeIdent: 'loader',\n localImporterIdent: '$$splitLoaderImporter', // const $$splitLoaderImporter = () => import('...')\n splitStrategy: 'lazyFn',\n localExporterIdent: 'SplitLoader', // const SplitLoader = ...\n exporterIdent: 'loader', // export { SplitLoader as loader }\n },\n ],\n [\n 'component',\n {\n routeIdent: 'component',\n localImporterIdent: '$$splitComponentImporter', // const $$splitComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitComponent', // const SplitComponent = ...\n exporterIdent: 'component', // export { SplitComponent as component }\n },\n ],\n [\n 'pendingComponent',\n {\n routeIdent: 'pendingComponent',\n localImporterIdent: '$$splitPendingComponentImporter', // const $$splitPendingComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitPendingComponent', // const SplitPendingComponent = ...\n exporterIdent: 'pendingComponent', // export { SplitPendingComponent as pendingComponent }\n },\n ],\n [\n 'errorComponent',\n {\n routeIdent: 'errorComponent',\n localImporterIdent: '$$splitErrorComponentImporter', // const $$splitErrorComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitErrorComponent', // const SplitErrorComponent = ...\n exporterIdent: 'errorComponent', // export { SplitErrorComponent as errorComponent }\n },\n ],\n [\n 'notFoundComponent',\n {\n routeIdent: 'notFoundComponent',\n localImporterIdent: '$$splitNotFoundComponentImporter', // const $$splitNotFoundComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitNotFoundComponent', // const SplitNotFoundComponent = ...\n exporterIdent: 'notFoundComponent', // export { SplitNotFoundComponent as notFoundComponent }\n },\n ],\n])\nconst KNOWN_SPLIT_ROUTE_IDENTS = [...SPLIT_NODES_CONFIG.keys()] as const\n\nfunction addSplitSearchParamToFilename(\n filename: string,\n grouping: Array<string>,\n) {\n const [bareFilename] = filename.split('?')\n\n const params = new URLSearchParams()\n params.append(tsrSplit, createIdentifier(grouping))\n\n return `${bareFilename}?${params.toString()}`\n}\n\nfunction removeSplitSearchParamFromFilename(filename: string) {\n const [bareFilename] = filename.split('?')\n return bareFilename!\n}\n\nexport function compileCodeSplitReferenceRoute(\n opts: ParseAstOptions & {\n runtimeEnv: 'dev' | 'prod'\n codeSplitGroupings: CodeSplitGroupings\n targetFramework: Config['target']\n filename: string\n id: string\n },\n): GeneratorResult {\n const ast = parseAst(opts)\n\n const refIdents = findReferencedIdentifiers(ast)\n\n function findIndexForSplitNode(str: string) {\n return opts.codeSplitGroupings.findIndex((group) =>\n group.includes(str as any),\n )\n }\n\n const frameworkOptions = getFrameworkOptions(opts.targetFramework)\n const PACKAGE = frameworkOptions.package\n const LAZY_ROUTE_COMPONENT_IDENT = frameworkOptions.idents.lazyRouteComponent\n const LAZY_FN_IDENT = frameworkOptions.idents.lazyFn\n\n babel.traverse(ast, {\n Program: {\n enter(programPath, programState) {\n const state = programState as unknown as State\n\n /**\n * If the component for the route is being imported from\n * another file, this is to track the path to that file\n * the path itself doesn't matter, we just need to keep\n * track of it so that we can remove it from the imports\n * list if it's not being used like:\n *\n * `import '../shared/imported'`\n */\n const removableImportPaths = new Set<string>([])\n\n programPath.traverse(\n {\n CallExpression: (path) => {\n if (!t.isIdentifier(path.node.callee)) {\n return\n }\n\n if (\n !(\n path.node.callee.name === 'createRoute' ||\n path.node.callee.name === 'createFileRoute'\n )\n ) {\n return\n }\n\n function babelHandleReference(routeOptions: t.Node | undefined) {\n const hasImportedOrDefinedIdentifier = (name: string) => {\n return programPath.scope.hasBinding(name)\n }\n\n if (t.isObjectExpression(routeOptions)) {\n routeOptions.properties.forEach((prop) => {\n if (t.isObjectProperty(prop)) {\n if (t.isIdentifier(prop.key)) {\n // If the user has not specified a split grouping for this key\n // then we should not split it\n const codeSplitGroupingByKey = findIndexForSplitNode(\n prop.key.name,\n )\n if (codeSplitGroupingByKey === -1) {\n return\n }\n const codeSplitGroup = [\n ...new Set(\n opts.codeSplitGroupings[codeSplitGroupingByKey],\n ),\n ]\n\n const key = prop.key.name\n // find key in nodeSplitConfig\n const isNodeConfigAvailable = SPLIT_NODES_CONFIG.has(\n key as any,\n )\n\n if (!isNodeConfigAvailable) {\n return\n }\n\n const splitNodeMeta = SPLIT_NODES_CONFIG.get(\n key as any,\n )!\n\n // We need to extract the existing search params from the filename, if any\n // and add the relevant codesplitPrefix to them, then write them back to the filename\n const splitUrl = addSplitSearchParamToFilename(\n opts.filename,\n codeSplitGroup,\n )\n\n if (\n splitNodeMeta.splitStrategy === 'lazyRouteComponent'\n ) {\n const value = prop.value\n\n let shouldSplit = true\n\n if (t.isIdentifier(value)) {\n const existingImportPath =\n getImportSpecifierAndPathFromLocalName(\n programPath,\n value.name,\n ).path\n if (existingImportPath) {\n removableImportPaths.add(existingImportPath)\n }\n\n // exported identifiers should not be split\n // since they are already being imported\n // and need to be retained in the compiled file\n const isExported = hasExport(ast, value)\n shouldSplit = !isExported\n\n if (shouldSplit) {\n removeIdentifierLiteral(path, value)\n }\n }\n\n if (!shouldSplit) {\n return\n }\n\n // Prepend the import statement to the program along with the importer function\n // Check to see if lazyRouteComponent is already imported before attempting\n // to import it again\n\n if (\n !hasImportedOrDefinedIdentifier(\n LAZY_ROUTE_COMPONENT_IDENT,\n )\n ) {\n programPath.unshiftContainer('body', [\n template.statement(\n `import { ${LAZY_ROUTE_COMPONENT_IDENT} } from '${PACKAGE}'`,\n )(),\n ])\n }\n\n // Check to see if the importer function is already defined\n // If not, define it with the dynamic import statement\n if (\n !hasImportedOrDefinedIdentifier(\n splitNodeMeta.localImporterIdent,\n )\n ) {\n programPath.unshiftContainer('body', [\n template.statement(\n `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,\n )(),\n ])\n }\n\n // If it's a component, we need to pass the function to check the Route.ssr value\n if (key === 'component') {\n prop.value = template.expression(\n `${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}', () => Route.ssr)`,\n )()\n } else {\n prop.value = template.expression(\n `${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`,\n )()\n }\n\n // add HMR handling\n if (opts.runtimeEnv !== 'prod') {\n programPath.pushContainer('body', routeHmrStatement)\n }\n }\n\n if (splitNodeMeta.splitStrategy === 'lazyFn') {\n const value = prop.value\n\n let shouldSplit = true\n\n if (t.isIdentifier(value)) {\n const existingImportPath =\n getImportSpecifierAndPathFromLocalName(\n programPath,\n value.name,\n ).path\n if (existingImportPath) {\n removableImportPaths.add(existingImportPath)\n }\n\n // exported identifiers should not be split\n // since they are already being imported\n // and need to be retained in the compiled file\n const isExported = hasExport(ast, value)\n shouldSplit = !isExported\n\n if (shouldSplit) {\n removeIdentifierLiteral(path, value)\n }\n }\n\n if (!shouldSplit) {\n return\n }\n\n // Prepend the import statement to the program along with the importer function\n if (!hasImportedOrDefinedIdentifier(LAZY_FN_IDENT)) {\n programPath.unshiftContainer(\n 'body',\n template.smart(\n `import { ${LAZY_FN_IDENT} } from '${PACKAGE}'`,\n )(),\n )\n }\n\n // Check to see if the importer function is already defined\n // If not, define it with the dynamic import statement\n if (\n !hasImportedOrDefinedIdentifier(\n splitNodeMeta.localImporterIdent,\n )\n ) {\n programPath.unshiftContainer('body', [\n template.statement(\n `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,\n )(),\n ])\n }\n\n // Add the lazyFn call with the dynamic import to the prop value\n prop.value = template.expression(\n `${LAZY_FN_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`,\n )()\n }\n }\n }\n\n programPath.scope.crawl()\n })\n }\n }\n\n if (t.isCallExpression(path.parentPath.node)) {\n // createFileRoute('/')({ ... })\n const options = resolveIdentifier(\n path,\n path.parentPath.node.arguments[0],\n )\n\n babelHandleReference(options)\n } else if (t.isVariableDeclarator(path.parentPath.node)) {\n // createFileRoute({ ... })\n const caller = resolveIdentifier(\n path,\n path.parentPath.node.init,\n )\n\n if (t.isCallExpression(caller)) {\n const options = resolveIdentifier(path, caller.arguments[0])\n babelHandleReference(options)\n }\n }\n },\n },\n state,\n )\n\n /**\n * If the component for the route is being imported,\n * and it's not being used, remove the import statement\n * from the program, by checking that the import has no\n * specifiers\n */\n if (removableImportPaths.size > 0) {\n programPath.traverse({\n ImportDeclaration(path) {\n if (path.node.specifiers.length > 0) return\n if (removableImportPaths.has(path.node.source.value)) {\n path.remove()\n }\n },\n })\n }\n },\n },\n })\n\n deadCodeElimination(ast, refIdents)\n\n return generateFromAst(ast, {\n sourceMaps: true,\n sourceFileName: opts.filename,\n filename: opts.filename,\n })\n}\n\nexport function compileCodeSplitVirtualRoute(\n opts: ParseAstOptions & {\n splitTargets: Array<SplitRouteIdentNodes>\n filename: string\n },\n): GeneratorResult {\n const ast = parseAst(opts)\n const refIdents = findReferencedIdentifiers(ast)\n\n const intendedSplitNodes = new Set(opts.splitTargets)\n\n const knownExportedIdents = new Set<string>()\n\n babel.traverse(ast, {\n Program: {\n enter(programPath, programState) {\n const state = programState as unknown as State\n\n const trackedNodesToSplitByType: Record<\n SplitRouteIdentNodes,\n { node: t.Node | undefined; meta: SplitNodeMeta } | undefined\n > = {\n component: undefined,\n loader: undefined,\n pendingComponent: undefined,\n errorComponent: undefined,\n notFoundComponent: undefined,\n }\n\n // Find and track all the known split-able nodes\n programPath.traverse(\n {\n CallExpression: (path) => {\n if (!t.isIdentifier(path.node.callee)) {\n return\n }\n\n if (\n !(\n path.node.callee.name === 'createRoute' ||\n path.node.callee.name === 'createFileRoute'\n )\n ) {\n return\n }\n\n function babelHandleVirtual(options: t.Node | undefined) {\n if (t.isObjectExpression(options)) {\n options.properties.forEach((prop) => {\n if (t.isObjectProperty(prop)) {\n // do not use `intendedSplitNodes` here\n // since we have special considerations that need\n // to be accounted for like (not splitting exported identifiers)\n KNOWN_SPLIT_ROUTE_IDENTS.forEach((splitType) => {\n if (\n !t.isIdentifier(prop.key) ||\n prop.key.name !== splitType\n ) {\n return\n }\n\n const value = prop.value\n\n let isExported = false\n if (t.isIdentifier(value)) {\n isExported = hasExport(ast, value)\n if (isExported) {\n knownExportedIdents.add(value.name)\n }\n }\n\n // If the node is exported, we need to remove\n // the export from the split file\n if (isExported && t.isIdentifier(value)) {\n removeExports(ast, value)\n } else {\n const meta = SPLIT_NODES_CONFIG.get(splitType)!\n trackedNodesToSplitByType[splitType] = {\n node: prop.value,\n meta,\n }\n }\n })\n }\n })\n\n // Remove all of the options\n options.properties = []\n }\n }\n\n if (t.isCallExpression(path.parentPath.node)) {\n // createFileRoute('/')({ ... })\n const options = resolveIdentifier(\n path,\n path.parentPath.node.arguments[0],\n )\n\n babelHandleVirtual(options)\n } else if (t.isVariableDeclarator(path.parentPath.node)) {\n // createFileRoute({ ... })\n const caller = resolveIdentifier(\n path,\n path.parentPath.node.init,\n )\n\n if (t.isCallExpression(caller)) {\n const options = resolveIdentifier(path, caller.arguments[0])\n babelHandleVirtual(options)\n }\n }\n },\n },\n state,\n )\n\n // Start the transformation to only exported the intended split nodes\n intendedSplitNodes.forEach((SPLIT_TYPE) => {\n const splitKey = trackedNodesToSplitByType[SPLIT_TYPE]\n\n if (!splitKey) {\n return\n }\n\n let splitNode = splitKey.node\n const splitMeta = splitKey.meta\n\n while (t.isIdentifier(splitNode)) {\n const binding = programPath.scope.getBinding(splitNode.name)\n splitNode = binding?.path.node\n }\n\n // Add the node to the program\n if (splitNode) {\n if (t.isFunctionDeclaration(splitNode)) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n t.functionExpression(\n splitNode.id || null, // Anonymize the function expression\n splitNode.params,\n splitNode.body,\n splitNode.generator,\n splitNode.async,\n ),\n ),\n ]),\n )\n } else if (\n t.isFunctionExpression(splitNode) ||\n t.isArrowFunctionExpression(splitNode)\n ) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode as any,\n ),\n ]),\n )\n } else if (\n t.isImportSpecifier(splitNode) ||\n t.isImportDefaultSpecifier(splitNode)\n ) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode.local,\n ),\n ]),\n )\n } else if (t.isVariableDeclarator(splitNode)) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode.init,\n ),\n ]),\n )\n } else if (t.isCallExpression(splitNode)) {\n const outputSplitNodeCode = generateFromAst(splitNode).code\n const splitNodeAst = babel.parse(outputSplitNodeCode)\n\n if (!splitNodeAst) {\n throw new Error(\n `Failed to parse the generated code for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\"`,\n )\n }\n\n const statement = splitNodeAst.program.body[0]\n\n if (!statement) {\n throw new Error(\n `Failed to parse the generated code for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\" as no statement was found in the program body`,\n )\n }\n\n if (t.isExpressionStatement(statement)) {\n const expression = statement.expression\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n expression,\n ),\n ]),\n )\n } else {\n throw new Error(\n `Unexpected expression type encounter for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\"`,\n )\n }\n } else if (t.isConditionalExpression(splitNode)) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode,\n ),\n ]),\n )\n } else if (t.isTSAsExpression(splitNode)) {\n // remove the type assertion\n splitNode = splitNode.expression\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode,\n ),\n ]),\n )\n } else {\n console.info('Unexpected splitNode type:', splitNode)\n throw new Error(`Unexpected splitNode type ☝️: ${splitNode.type}`)\n }\n }\n\n // If the splitNode exists at the top of the program\n // then we need to remove that copy\n programPath.node.body = programPath.node.body.filter((node) => {\n return node !== splitNode\n })\n\n // Export the node\n programPath.pushContainer('body', [\n t.exportNamedDeclaration(null, [\n t.exportSpecifier(\n t.identifier(splitMeta.localExporterIdent), // local variable name\n t.identifier(splitMeta.exporterIdent), // as what name it should be exported as\n ),\n ]),\n ])\n })\n\n // convert exports to imports from the original file\n programPath.traverse({\n ExportNamedDeclaration(path) {\n // e.g. export const x = 1 or export { x }\n // becomes\n // import { x } from '${opts.id}'\n\n if (path.node.declaration) {\n if (t.isVariableDeclaration(path.node.declaration)) {\n path.replaceWith(\n t.importDeclaration(\n path.node.declaration.declarations.map((decl) =>\n t.importSpecifier(\n t.identifier((decl.id as any).name),\n t.identifier((decl.id as any).name),\n ),\n ),\n t.stringLiteral(\n removeSplitSearchParamFromFilename(opts.filename),\n ),\n ),\n )\n }\n }\n },\n })\n },\n },\n })\n\n deadCodeElimination(ast, refIdents)\n\n // if there are exported identifiers, then we need to add a warning\n // to the file to let the user know that the exported identifiers\n // will not in the split file but in the original file, therefore\n // increasing the bundle size\n if (knownExportedIdents.size > 0) {\n const list = Array.from(knownExportedIdents).reduce((str, ident) => {\n str += `\\n- ${ident}`\n return str\n }, '')\n\n 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.`\n console.warn(warningMessage)\n\n // append this warning to the file using a template\n if (process.env.NODE_ENV !== 'production') {\n const warningTemplate = template.statement(\n `console.warn(${JSON.stringify(warningMessage)})`,\n )()\n ast.program.body.unshift(warningTemplate)\n }\n }\n\n return generateFromAst(ast, {\n sourceMaps: true,\n sourceFileName: opts.filename,\n filename: opts.filename,\n })\n}\n\n/**\n * This function should read get the options from by searching for the key `codeSplitGroupings`\n * on createFileRoute and return it's values if it exists, else return undefined\n */\nexport function detectCodeSplitGroupingsFromRoute(opts: ParseAstOptions): {\n groupings: CodeSplitGroupings | undefined\n routeId: string\n} {\n const ast = parseAst(opts)\n\n let routeId = ''\n\n let codeSplitGroupings: CodeSplitGroupings | undefined = undefined\n\n babel.traverse(ast, {\n Program: {\n enter(programPath) {\n programPath.traverse({\n CallExpression(path) {\n if (!t.isIdentifier(path.node.callee)) {\n return\n }\n\n if (\n !(\n path.node.callee.name === 'createRoute' ||\n path.node.callee.name === 'createFileRoute'\n )\n ) {\n return\n }\n\n if (t.isCallExpression(path.parentPath.node)) {\n // Extract out the routeId\n if (t.isCallExpression(path.parentPath.node.callee)) {\n const callee = path.parentPath.node.callee\n\n if (t.isIdentifier(callee.callee)) {\n const firstArg = callee.arguments[0]\n if (t.isStringLiteral(firstArg)) {\n routeId = firstArg.value\n }\n }\n }\n\n // Extracting the codeSplitGroupings\n const options = resolveIdentifier(\n path,\n path.parentPath.node.arguments[0],\n )\n if (t.isObjectExpression(options)) {\n options.properties.forEach((prop) => {\n if (t.isObjectProperty(prop)) {\n if (t.isIdentifier(prop.key)) {\n if (prop.key.name === 'codeSplitGroupings') {\n const value = prop.value\n\n if (t.isArrayExpression(value)) {\n codeSplitGroupings = value.elements.map((group) => {\n if (t.isArrayExpression(group)) {\n return group.elements.map((node) => {\n if (!t.isStringLiteral(node)) {\n throw new Error(\n 'You must provide a string literal for the codeSplitGroupings',\n )\n }\n\n return node.value\n }) as Array<SplitRouteIdentNodes>\n }\n\n throw new Error(\n 'You must provide arrays with codeSplitGroupings options.',\n )\n })\n } else {\n throw new Error(\n 'You must provide an array of arrays for the codeSplitGroupings.',\n )\n }\n }\n }\n }\n })\n }\n }\n },\n })\n },\n },\n })\n\n return { groupings: codeSplitGroupings, routeId }\n}\n\nfunction getImportSpecifierAndPathFromLocalName(\n programPath: babel.NodePath<t.Program>,\n name: string,\n): {\n specifier:\n | t.ImportSpecifier\n | t.ImportDefaultSpecifier\n | t.ImportNamespaceSpecifier\n | null\n path: string | null\n} {\n let specifier:\n | t.ImportSpecifier\n | t.ImportDefaultSpecifier\n | t.ImportNamespaceSpecifier\n | null = null\n let path: string | null = null\n\n programPath.traverse({\n ImportDeclaration(importPath) {\n const found = importPath.node.specifiers.find(\n (targetSpecifier) => targetSpecifier.local.name === name,\n )\n if (found) {\n specifier = found\n path = importPath.node.source.value\n }\n },\n })\n\n return { specifier, path }\n}\n\n// Reusable function to get literal value or resolve variable to literal\nfunction resolveIdentifier(path: any, node: any): t.Node | undefined {\n if (t.isIdentifier(node)) {\n const binding = path.scope.getBinding(node.name)\n if (\n binding\n // && binding.kind === 'const'\n ) {\n const declarator = binding.path.node\n if (t.isObjectExpression(declarator.init)) {\n return declarator.init\n } else if (t.isFunctionDeclaration(declarator.init)) {\n return declarator.init\n }\n }\n return undefined\n }\n\n return node\n}\n\nfunction removeIdentifierLiteral(path: any, node: any) {\n if (t.isIdentifier(node)) {\n const binding = path.scope.getBinding(node.name)\n if (binding) {\n binding.path.remove()\n }\n }\n}\n\nfunction hasExport(ast: t.File, node: t.Identifier): boolean {\n let found = false\n\n babel.traverse(ast, {\n ExportNamedDeclaration(path) {\n if (path.node.declaration) {\n // declared as `const loaderFn = () => {}`\n if (t.isVariableDeclaration(path.node.declaration)) {\n path.node.declaration.declarations.forEach((decl) => {\n if (t.isVariableDeclarator(decl)) {\n if (t.isIdentifier(decl.id)) {\n if (decl.id.name === node.name) {\n found = true\n }\n }\n }\n })\n }\n\n // declared as `function loaderFn() {}`\n if (t.isFunctionDeclaration(path.node.declaration)) {\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n found = true\n }\n }\n }\n }\n },\n ExportDefaultDeclaration(path) {\n // declared as `export default loaderFn`\n if (t.isIdentifier(path.node.declaration)) {\n if (path.node.declaration.name === node.name) {\n found = true\n }\n }\n\n // declared as `export default function loaderFn() {}`\n if (t.isFunctionDeclaration(path.node.declaration)) {\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n found = true\n }\n }\n }\n },\n })\n\n return found\n}\n\nfunction removeExports(ast: t.File, node: t.Identifier): boolean {\n let removed = false\n\n // The checks use sequential if/else if statements since it\n // directly mutates the AST and as such doing normal checks\n // (using only if statements) could lead to a situation where\n // `path.node` is null since it has been already removed from\n // the program tree but typescript doesn't know that.\n babel.traverse(ast, {\n ExportNamedDeclaration(path) {\n if (path.node.declaration) {\n if (t.isVariableDeclaration(path.node.declaration)) {\n // declared as `const loaderFn = () => {}`\n path.node.declaration.declarations.forEach((decl) => {\n if (t.isVariableDeclarator(decl)) {\n if (t.isIdentifier(decl.id)) {\n if (decl.id.name === node.name) {\n path.remove()\n removed = true\n }\n }\n }\n })\n } else if (t.isFunctionDeclaration(path.node.declaration)) {\n // declared as `export const loaderFn = () => {}`\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n path.remove()\n removed = true\n }\n }\n }\n }\n },\n ExportDefaultDeclaration(path) {\n // declared as `export default loaderFn`\n if (t.isIdentifier(path.node.declaration)) {\n if (path.node.declaration.name === node.name) {\n path.remove()\n removed = true\n }\n } else if (t.isFunctionDeclaration(path.node.declaration)) {\n // declared as `export default function loaderFn() {}`\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n path.remove()\n removed = true\n }\n }\n }\n },\n })\n\n return removed\n}\n"],"names":[],"mappings":";;;;;;;;;AAiBc,QAAQ,IAAI;AA2B1B,MAAM,yCAAyB,IAAyC;AAAA,EACtE;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA;AAAA,IAAA;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KAAK,YAAY,aAAa,QAAQ,CAAC,SAAS;AAC/C,gBAAA,EAAE,qBAAqB,IAAI,GAAG;AAChC,kBAAI,EAAE,aAAa,KAAK,EAAE,GAAG;AAC3B,oBAAI,KAAK,GAAG,SAAS,KAAK,MAAM;AAC9B,uBAAK,OAAO;AACF,4BAAA;AAAA,gBAAA;AAAA,cACZ;AAAA,YACF;AAAA,UACF,CACD;AAAA,QAAA,WACQ,EAAE,sBAAsB,KAAK,KAAK,WAAW,GAAG;AAEzD,cAAI,EAAE,aAAa,KAAK,KAAK,YAAY,EAAE,GAAG;AAC5C,gBAAI,KAAK,KAAK,YAAY,GAAG,SAAS,KAAK,MAAM;AAC/C,mBAAK,OAAO;AACF,wBAAA;AAAA,YAAA;AAAA,UACZ;AAAA,QACF;AAAA,MACF;AAAA,IAEJ;AAAA,IACA,yBAAyB,MAAM;AAE7B,UAAI,EAAE,aAAa,KAAK,KAAK,WAAW,GAAG;AACzC,YAAI,KAAK,KAAK,YAAY,SAAS,KAAK,MAAM;AAC5C,eAAK,OAAO;AACF,oBAAA;AAAA,QAAA;AAAA,MACZ,WACS,EAAE,sBAAsB,KAAK,KAAK,WAAW,GAAG;AAEzD,YAAI,EAAE,aAAa,KAAK,KAAK,YAAY,EAAE,GAAG;AAC5C,cAAI,KAAK,KAAK,YAAY,GAAG,SAAS,KAAK,MAAM;AAC/C,iBAAK,OAAO;AACF,sBAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,EACF,CACD;AAEM,SAAA;AACT;"}
|
|
1
|
+
{"version":3,"file":"compilers.js","sources":["../../../../src/core/code-splitter/compilers.ts"],"sourcesContent":["import * as t from '@babel/types'\nimport babel from '@babel/core'\nimport * as template from '@babel/template'\nimport {\n deadCodeElimination,\n findReferencedIdentifiers,\n} from 'babel-dead-code-elimination'\nimport { generateFromAst, parseAst } from '@tanstack/router-utils'\nimport { tsrSplit } from '../constants'\nimport { createIdentifier } from './path-ids'\nimport { getFrameworkOptions } from './framework-options'\nimport type { GeneratorResult, ParseAstOptions } from '@tanstack/router-utils'\nimport type { CodeSplitGroupings, SplitRouteIdentNodes } from '../constants'\nimport type { Config } from '../config'\n\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst debug = process.env.TSR_VITE_DEBUG\n\ntype SplitModulesById = Record<\n string,\n { id: string; node: t.FunctionExpression }\n>\n\ninterface State {\n filename: string\n opts: {\n minify: boolean\n root: string\n }\n imported: Record<string, boolean>\n refs: Set<any>\n serverIndex: number\n splitIndex: number\n splitModulesById: SplitModulesById\n}\n\ntype SplitNodeMeta = {\n routeIdent: SplitRouteIdentNodes\n splitStrategy: 'lazyFn' | 'lazyRouteComponent'\n localImporterIdent: string\n exporterIdent: string\n localExporterIdent: string\n}\nconst SPLIT_NODES_CONFIG = new Map<SplitRouteIdentNodes, SplitNodeMeta>([\n [\n 'loader',\n {\n routeIdent: 'loader',\n localImporterIdent: '$$splitLoaderImporter', // const $$splitLoaderImporter = () => import('...')\n splitStrategy: 'lazyFn',\n localExporterIdent: 'SplitLoader', // const SplitLoader = ...\n exporterIdent: 'loader', // export { SplitLoader as loader }\n },\n ],\n [\n 'component',\n {\n routeIdent: 'component',\n localImporterIdent: '$$splitComponentImporter', // const $$splitComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitComponent', // const SplitComponent = ...\n exporterIdent: 'component', // export { SplitComponent as component }\n },\n ],\n [\n 'pendingComponent',\n {\n routeIdent: 'pendingComponent',\n localImporterIdent: '$$splitPendingComponentImporter', // const $$splitPendingComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitPendingComponent', // const SplitPendingComponent = ...\n exporterIdent: 'pendingComponent', // export { SplitPendingComponent as pendingComponent }\n },\n ],\n [\n 'errorComponent',\n {\n routeIdent: 'errorComponent',\n localImporterIdent: '$$splitErrorComponentImporter', // const $$splitErrorComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitErrorComponent', // const SplitErrorComponent = ...\n exporterIdent: 'errorComponent', // export { SplitErrorComponent as errorComponent }\n },\n ],\n [\n 'notFoundComponent',\n {\n routeIdent: 'notFoundComponent',\n localImporterIdent: '$$splitNotFoundComponentImporter', // const $$splitNotFoundComponentImporter = () => import('...')\n splitStrategy: 'lazyRouteComponent',\n localExporterIdent: 'SplitNotFoundComponent', // const SplitNotFoundComponent = ...\n exporterIdent: 'notFoundComponent', // export { SplitNotFoundComponent as notFoundComponent }\n },\n ],\n])\nconst KNOWN_SPLIT_ROUTE_IDENTS = [...SPLIT_NODES_CONFIG.keys()] as const\n\nfunction addSplitSearchParamToFilename(\n filename: string,\n grouping: Array<string>,\n) {\n const [bareFilename] = filename.split('?')\n\n const params = new URLSearchParams()\n params.append(tsrSplit, createIdentifier(grouping))\n\n return `${bareFilename}?${params.toString()}`\n}\n\nfunction removeSplitSearchParamFromFilename(filename: string) {\n const [bareFilename] = filename.split('?')\n return bareFilename!\n}\n\nexport function compileCodeSplitReferenceRoute(\n opts: ParseAstOptions & {\n runtimeEnv: 'dev' | 'prod'\n codeSplitGroupings: CodeSplitGroupings\n targetFramework: Config['target']\n },\n): GeneratorResult {\n const ast = parseAst(opts)\n\n const refIdents = findReferencedIdentifiers(ast)\n\n function findIndexForSplitNode(str: string) {\n return opts.codeSplitGroupings.findIndex((group) =>\n group.includes(str as any),\n )\n }\n\n const frameworkOptions = getFrameworkOptions(opts.targetFramework)\n const PACKAGE = frameworkOptions.package\n const LAZY_ROUTE_COMPONENT_IDENT = frameworkOptions.idents.lazyRouteComponent\n const LAZY_FN_IDENT = frameworkOptions.idents.lazyFn\n\n babel.traverse(ast, {\n Program: {\n enter(programPath, programState) {\n const state = programState as unknown as State\n\n /**\n * If the component for the route is being imported from\n * another file, this is to track the path to that file\n * the path itself doesn't matter, we just need to keep\n * track of it so that we can remove it from the imports\n * list if it's not being used like:\n *\n * `import '../shared/imported'`\n */\n const removableImportPaths = new Set<string>([])\n\n programPath.traverse(\n {\n CallExpression: (path) => {\n if (!t.isIdentifier(path.node.callee)) {\n return\n }\n\n if (\n !(\n path.node.callee.name === 'createRoute' ||\n path.node.callee.name === 'createFileRoute'\n )\n ) {\n return\n }\n\n if (t.isCallExpression(path.parentPath.node)) {\n const options = resolveIdentifier(\n path,\n path.parentPath.node.arguments[0],\n )\n\n const hasImportedOrDefinedIdentifier = (name: string) => {\n return programPath.scope.hasBinding(name)\n }\n\n if (t.isObjectExpression(options)) {\n options.properties.forEach((prop) => {\n if (t.isObjectProperty(prop)) {\n if (t.isIdentifier(prop.key)) {\n // If the user has not specified a split grouping for this key\n // then we should not split it\n const codeSplitGroupingByKey = findIndexForSplitNode(\n prop.key.name,\n )\n if (codeSplitGroupingByKey === -1) {\n return\n }\n const codeSplitGroup = [\n ...new Set(\n opts.codeSplitGroupings[codeSplitGroupingByKey],\n ),\n ]\n\n const key = prop.key.name\n // find key in nodeSplitConfig\n const isNodeConfigAvailable = SPLIT_NODES_CONFIG.has(\n key as any,\n )\n\n if (!isNodeConfigAvailable) {\n return\n }\n\n const splitNodeMeta = SPLIT_NODES_CONFIG.get(\n key as any,\n )!\n\n // We need to extract the existing search params from the filename, if any\n // and add the relevant codesplitPrefix to them, then write them back to the filename\n const splitUrl = addSplitSearchParamToFilename(\n opts.filename,\n codeSplitGroup,\n )\n\n if (\n splitNodeMeta.splitStrategy === 'lazyRouteComponent'\n ) {\n const value = prop.value\n\n let shouldSplit = true\n\n if (t.isIdentifier(value)) {\n const existingImportPath =\n getImportSpecifierAndPathFromLocalName(\n programPath,\n value.name,\n ).path\n if (existingImportPath) {\n removableImportPaths.add(existingImportPath)\n }\n\n // exported identifiers should not be split\n // since they are already being imported\n // and need to be retained in the compiled file\n const isExported = hasExport(ast, value)\n shouldSplit = !isExported\n\n if (shouldSplit) {\n removeIdentifierLiteral(path, value)\n }\n }\n\n if (!shouldSplit) {\n return\n }\n\n // Prepend the import statement to the program along with the importer function\n // Check to see if lazyRouteComponent is already imported before attempting\n // to import it again\n\n if (\n !hasImportedOrDefinedIdentifier(\n LAZY_ROUTE_COMPONENT_IDENT,\n )\n ) {\n programPath.unshiftContainer('body', [\n template.statement(\n `import { ${LAZY_ROUTE_COMPONENT_IDENT} } from '${PACKAGE}'`,\n )(),\n ])\n }\n\n // Check to see if the importer function is already defined\n // If not, define it with the dynamic import statement\n if (\n !hasImportedOrDefinedIdentifier(\n splitNodeMeta.localImporterIdent,\n )\n ) {\n programPath.unshiftContainer('body', [\n template.statement(\n `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,\n )(),\n ])\n }\n\n // If it's a component, we need to pass the function to check the Route.ssr value\n if (key === 'component') {\n prop.value = template.expression(\n `${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}', () => Route.ssr)`,\n )()\n } else {\n prop.value = template.expression(\n `${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`,\n )()\n }\n\n // If the TSRDummyComponent is not defined, define it\n if (\n opts.runtimeEnv !== 'prod' && // only in development\n !hasImportedOrDefinedIdentifier(\n frameworkOptions.idents.dummyHMRComponent,\n )\n ) {\n programPath.pushContainer('body', [\n template.statement(\n frameworkOptions.dummyHMRComponent,\n )(),\n ])\n }\n }\n\n if (splitNodeMeta.splitStrategy === 'lazyFn') {\n const value = prop.value\n\n let shouldSplit = true\n\n if (t.isIdentifier(value)) {\n const existingImportPath =\n getImportSpecifierAndPathFromLocalName(\n programPath,\n value.name,\n ).path\n if (existingImportPath) {\n removableImportPaths.add(existingImportPath)\n }\n\n // exported identifiers should not be split\n // since they are already being imported\n // and need to be retained in the compiled file\n const isExported = hasExport(ast, value)\n shouldSplit = !isExported\n\n if (shouldSplit) {\n removeIdentifierLiteral(path, value)\n }\n }\n\n if (!shouldSplit) {\n return\n }\n\n // Prepend the import statement to the program along with the importer function\n if (!hasImportedOrDefinedIdentifier(LAZY_FN_IDENT)) {\n programPath.unshiftContainer(\n 'body',\n template.smart(\n `import { ${LAZY_FN_IDENT} } from '${PACKAGE}'`,\n )(),\n )\n }\n\n // Check to see if the importer function is already defined\n // If not, define it with the dynamic import statement\n if (\n !hasImportedOrDefinedIdentifier(\n splitNodeMeta.localImporterIdent,\n )\n ) {\n programPath.unshiftContainer('body', [\n template.statement(\n `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,\n )(),\n ])\n }\n\n // Add the lazyFn call with the dynamic import to the prop value\n prop.value = template.expression(\n `${LAZY_FN_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`,\n )()\n }\n }\n }\n\n programPath.scope.crawl()\n })\n }\n }\n },\n },\n state,\n )\n\n /**\n * If the component for the route is being imported,\n * and it's not being used, remove the import statement\n * from the program, by checking that the import has no\n * specifiers\n */\n if (removableImportPaths.size > 0) {\n programPath.traverse({\n ImportDeclaration(path) {\n if (path.node.specifiers.length > 0) return\n if (removableImportPaths.has(path.node.source.value)) {\n path.remove()\n }\n },\n })\n }\n },\n },\n })\n\n deadCodeElimination(ast, refIdents)\n\n return generateFromAst(ast, {\n sourceMaps: true,\n sourceFileName: opts.filename,\n filename: opts.filename,\n })\n}\n\nexport function compileCodeSplitVirtualRoute(\n opts: ParseAstOptions & {\n splitTargets: Array<SplitRouteIdentNodes>\n },\n): GeneratorResult {\n const ast = parseAst(opts)\n const refIdents = findReferencedIdentifiers(ast)\n\n const intendedSplitNodes = new Set(opts.splitTargets)\n\n const knownExportedIdents = new Set<string>()\n\n babel.traverse(ast, {\n Program: {\n enter(programPath, programState) {\n const state = programState as unknown as State\n\n const trackedNodesToSplitByType: Record<\n SplitRouteIdentNodes,\n { node: t.Node | undefined; meta: SplitNodeMeta } | undefined\n > = {\n component: undefined,\n loader: undefined,\n pendingComponent: undefined,\n errorComponent: undefined,\n notFoundComponent: undefined,\n }\n\n // Find and track all the known split-able nodes\n programPath.traverse(\n {\n CallExpression: (path) => {\n if (!t.isIdentifier(path.node.callee)) {\n return\n }\n\n if (\n !(\n path.node.callee.name === 'createRoute' ||\n path.node.callee.name === 'createFileRoute'\n )\n ) {\n return\n }\n\n if (t.isCallExpression(path.parentPath.node)) {\n const options = resolveIdentifier(\n path,\n path.parentPath.node.arguments[0],\n )\n\n if (t.isObjectExpression(options)) {\n options.properties.forEach((prop) => {\n if (t.isObjectProperty(prop)) {\n // do not use `intendedSplitNodes` here\n // since we have special considerations that need\n // to be accounted for like (not splitting exported identifiers)\n KNOWN_SPLIT_ROUTE_IDENTS.forEach((splitType) => {\n if (\n !t.isIdentifier(prop.key) ||\n prop.key.name !== splitType\n ) {\n return\n }\n\n const value = prop.value\n\n let isExported = false\n if (t.isIdentifier(value)) {\n isExported = hasExport(ast, value)\n if (isExported) {\n knownExportedIdents.add(value.name)\n }\n }\n\n // If the node is exported, we need to remove\n // the export from the split file\n if (isExported && t.isIdentifier(value)) {\n removeExports(ast, value)\n } else {\n const meta = SPLIT_NODES_CONFIG.get(splitType)!\n trackedNodesToSplitByType[splitType] = {\n node: prop.value,\n meta,\n }\n }\n })\n }\n })\n\n // Remove all of the options\n options.properties = []\n }\n }\n },\n },\n state,\n )\n\n // Start the transformation to only exported the intended split nodes\n intendedSplitNodes.forEach((SPLIT_TYPE) => {\n const splitKey = trackedNodesToSplitByType[SPLIT_TYPE]\n\n if (!splitKey) {\n return\n }\n\n let splitNode = splitKey.node\n const splitMeta = splitKey.meta\n\n while (t.isIdentifier(splitNode)) {\n const binding = programPath.scope.getBinding(splitNode.name)\n splitNode = binding?.path.node\n }\n\n // Add the node to the program\n if (splitNode) {\n if (t.isFunctionDeclaration(splitNode)) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n t.functionExpression(\n splitNode.id || null, // Anonymize the function expression\n splitNode.params,\n splitNode.body,\n splitNode.generator,\n splitNode.async,\n ),\n ),\n ]),\n )\n } else if (\n t.isFunctionExpression(splitNode) ||\n t.isArrowFunctionExpression(splitNode)\n ) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode as any,\n ),\n ]),\n )\n } else if (\n t.isImportSpecifier(splitNode) ||\n t.isImportDefaultSpecifier(splitNode)\n ) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode.local,\n ),\n ]),\n )\n } else if (t.isVariableDeclarator(splitNode)) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode.init,\n ),\n ]),\n )\n } else if (t.isCallExpression(splitNode)) {\n const outputSplitNodeCode = generateFromAst(splitNode).code\n const splitNodeAst = babel.parse(outputSplitNodeCode)\n\n if (!splitNodeAst) {\n throw new Error(\n `Failed to parse the generated code for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\"`,\n )\n }\n\n const statement = splitNodeAst.program.body[0]\n\n if (!statement) {\n throw new Error(\n `Failed to parse the generated code for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\" as no statement was found in the program body`,\n )\n }\n\n if (t.isExpressionStatement(statement)) {\n const expression = statement.expression\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n expression,\n ),\n ]),\n )\n } else {\n throw new Error(\n `Unexpected expression type encounter for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\"`,\n )\n }\n } else if (t.isConditionalExpression(splitNode)) {\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode,\n ),\n ]),\n )\n } else if (t.isTSAsExpression(splitNode)) {\n // remove the type assertion\n splitNode = splitNode.expression\n programPath.pushContainer(\n 'body',\n t.variableDeclaration('const', [\n t.variableDeclarator(\n t.identifier(splitMeta.localExporterIdent),\n splitNode,\n ),\n ]),\n )\n } else {\n console.info('Unexpected splitNode type:', splitNode)\n throw new Error(`Unexpected splitNode type ☝️: ${splitNode.type}`)\n }\n }\n\n // If the splitNode exists at the top of the program\n // then we need to remove that copy\n programPath.node.body = programPath.node.body.filter((node) => {\n return node !== splitNode\n })\n\n // Export the node\n programPath.pushContainer('body', [\n t.exportNamedDeclaration(null, [\n t.exportSpecifier(\n t.identifier(splitMeta.localExporterIdent), // local variable name\n t.identifier(splitMeta.exporterIdent), // as what name it should be exported as\n ),\n ]),\n ])\n })\n\n // convert exports to imports from the original file\n programPath.traverse({\n ExportNamedDeclaration(path) {\n // e.g. export const x = 1 or export { x }\n // becomes\n // import { x } from '${opts.id}'\n\n if (path.node.declaration) {\n if (t.isVariableDeclaration(path.node.declaration)) {\n path.replaceWith(\n t.importDeclaration(\n path.node.declaration.declarations.map((decl) =>\n t.importSpecifier(\n t.identifier((decl.id as any).name),\n t.identifier((decl.id as any).name),\n ),\n ),\n t.stringLiteral(\n removeSplitSearchParamFromFilename(opts.filename),\n ),\n ),\n )\n }\n }\n },\n })\n },\n },\n })\n\n deadCodeElimination(ast, refIdents)\n\n // if there are exported identifiers, then we need to add a warning\n // to the file to let the user know that the exported identifiers\n // will not in the split file but in the original file, therefore\n // increasing the bundle size\n if (knownExportedIdents.size > 0) {\n const list = Array.from(knownExportedIdents).reduce((str, ident) => {\n str += `\\n- ${ident}`\n return str\n }, '')\n\n 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.`\n console.warn(warningMessage)\n\n // append this warning to the file using a template\n if (process.env.NODE_ENV !== 'production') {\n const warningTemplate = template.statement(\n `console.warn(${JSON.stringify(warningMessage)})`,\n )()\n ast.program.body.unshift(warningTemplate)\n }\n }\n\n return generateFromAst(ast, {\n sourceMaps: true,\n sourceFileName: opts.filename,\n filename: opts.filename,\n })\n}\n\n/**\n * This function should read get the options from by searching for the key `codeSplitGroupings`\n * on createFileRoute and return it's values if it exists, else return undefined\n */\nexport function detectCodeSplitGroupingsFromRoute(opts: ParseAstOptions): {\n groupings: CodeSplitGroupings | undefined\n routeId: string\n} {\n const ast = parseAst(opts)\n\n let routeId = ''\n\n let codeSplitGroupings: CodeSplitGroupings | undefined = undefined\n\n babel.traverse(ast, {\n Program: {\n enter(programPath) {\n programPath.traverse({\n CallExpression(path) {\n if (!t.isIdentifier(path.node.callee)) {\n return\n }\n\n if (\n !(\n path.node.callee.name === 'createRoute' ||\n path.node.callee.name === 'createFileRoute'\n )\n ) {\n return\n }\n\n if (t.isCallExpression(path.parentPath.node)) {\n // Extract out the routeId\n if (t.isCallExpression(path.parentPath.node.callee)) {\n const callee = path.parentPath.node.callee\n\n if (t.isIdentifier(callee.callee)) {\n const firstArg = callee.arguments[0]\n if (t.isStringLiteral(firstArg)) {\n routeId = firstArg.value\n }\n }\n }\n\n // Extracting the codeSplitGroupings\n const options = resolveIdentifier(\n path,\n path.parentPath.node.arguments[0],\n )\n if (t.isObjectExpression(options)) {\n options.properties.forEach((prop) => {\n if (t.isObjectProperty(prop)) {\n if (t.isIdentifier(prop.key)) {\n if (prop.key.name === 'codeSplitGroupings') {\n const value = prop.value\n\n if (t.isArrayExpression(value)) {\n codeSplitGroupings = value.elements.map((group) => {\n if (t.isArrayExpression(group)) {\n return group.elements.map((node) => {\n if (!t.isStringLiteral(node)) {\n throw new Error(\n 'You must provide a string literal for the codeSplitGroupings',\n )\n }\n\n return node.value\n }) as Array<SplitRouteIdentNodes>\n }\n\n throw new Error(\n 'You must provide arrays with codeSplitGroupings options.',\n )\n })\n } else {\n throw new Error(\n 'You must provide an array of arrays for the codeSplitGroupings.',\n )\n }\n }\n }\n }\n })\n }\n }\n },\n })\n },\n },\n })\n\n return { groupings: codeSplitGroupings, routeId }\n}\n\nfunction getImportSpecifierAndPathFromLocalName(\n programPath: babel.NodePath<t.Program>,\n name: string,\n): {\n specifier:\n | t.ImportSpecifier\n | t.ImportDefaultSpecifier\n | t.ImportNamespaceSpecifier\n | null\n path: string | null\n} {\n let specifier:\n | t.ImportSpecifier\n | t.ImportDefaultSpecifier\n | t.ImportNamespaceSpecifier\n | null = null\n let path: string | null = null\n\n programPath.traverse({\n ImportDeclaration(importPath) {\n const found = importPath.node.specifiers.find(\n (targetSpecifier) => targetSpecifier.local.name === name,\n )\n if (found) {\n specifier = found\n path = importPath.node.source.value\n }\n },\n })\n\n return { specifier, path }\n}\n\n// Reusable function to get literal value or resolve variable to literal\nfunction resolveIdentifier(path: any, node: any) {\n if (t.isIdentifier(node)) {\n const binding = path.scope.getBinding(node.name)\n if (\n binding\n // && binding.kind === 'const'\n ) {\n const declarator = binding.path.node\n if (t.isObjectExpression(declarator.init)) {\n return declarator.init\n } else if (t.isFunctionDeclaration(declarator.init)) {\n return declarator.init\n }\n }\n return undefined\n }\n\n return node\n}\n\nfunction removeIdentifierLiteral(path: any, node: any) {\n if (t.isIdentifier(node)) {\n const binding = path.scope.getBinding(node.name)\n if (binding) {\n binding.path.remove()\n }\n }\n}\n\nfunction hasExport(ast: t.File, node: t.Identifier): boolean {\n let found = false\n\n babel.traverse(ast, {\n ExportNamedDeclaration(path) {\n if (path.node.declaration) {\n // declared as `const loaderFn = () => {}`\n if (t.isVariableDeclaration(path.node.declaration)) {\n path.node.declaration.declarations.forEach((decl) => {\n if (t.isVariableDeclarator(decl)) {\n if (t.isIdentifier(decl.id)) {\n if (decl.id.name === node.name) {\n found = true\n }\n }\n }\n })\n }\n\n // declared as `function loaderFn() {}`\n if (t.isFunctionDeclaration(path.node.declaration)) {\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n found = true\n }\n }\n }\n }\n },\n ExportDefaultDeclaration(path) {\n // declared as `export default loaderFn`\n if (t.isIdentifier(path.node.declaration)) {\n if (path.node.declaration.name === node.name) {\n found = true\n }\n }\n\n // declared as `export default function loaderFn() {}`\n if (t.isFunctionDeclaration(path.node.declaration)) {\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n found = true\n }\n }\n }\n },\n })\n\n return found\n}\n\nfunction removeExports(ast: t.File, node: t.Identifier): boolean {\n let removed = false\n\n // The checks use sequential if/else if statements since it\n // directly mutates the AST and as such doing normal checks\n // (using only if statements) could lead to a situation where\n // `path.node` is null since it has been already removed from\n // the program tree but typescript doesn't know that.\n babel.traverse(ast, {\n ExportNamedDeclaration(path) {\n if (path.node.declaration) {\n if (t.isVariableDeclaration(path.node.declaration)) {\n // declared as `const loaderFn = () => {}`\n path.node.declaration.declarations.forEach((decl) => {\n if (t.isVariableDeclarator(decl)) {\n if (t.isIdentifier(decl.id)) {\n if (decl.id.name === node.name) {\n path.remove()\n removed = true\n }\n }\n }\n })\n } else if (t.isFunctionDeclaration(path.node.declaration)) {\n // declared as `export const loaderFn = () => {}`\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n path.remove()\n removed = true\n }\n }\n }\n }\n },\n ExportDefaultDeclaration(path) {\n // declared as `export default loaderFn`\n if (t.isIdentifier(path.node.declaration)) {\n if (path.node.declaration.name === node.name) {\n path.remove()\n removed = true\n }\n } else if (t.isFunctionDeclaration(path.node.declaration)) {\n // declared as `export default function loaderFn() {}`\n if (t.isIdentifier(path.node.declaration.id)) {\n if (path.node.declaration.id.name === node.name) {\n path.remove()\n removed = true\n }\n }\n }\n },\n })\n\n return removed\n}\n"],"names":[],"mappings":";;;;;;;;AAgBc,QAAQ,IAAI;AA2B1B,MAAM,yCAAyB,IAAyC;AAAA,EACtE;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,MACE,YAAY;AAAA,MACZ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
11
|
export declare function getFrameworkOptions(framework: string): FrameworkOptions;
|
|
10
12
|
export {};
|