@tanstack/router-plugin 1.120.4-alpha.4 → 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
|
@@ -6,7 +6,6 @@ const template = require("@babel/template");
|
|
|
6
6
|
const babelDeadCodeElimination = require("babel-dead-code-elimination");
|
|
7
7
|
const routerUtils = require("@tanstack/router-utils");
|
|
8
8
|
const constants = require("../constants.cjs");
|
|
9
|
-
const routeHmrStatement = require("../route-hmr-statement.cjs");
|
|
10
9
|
const pathIds = require("./path-ids.cjs");
|
|
11
10
|
const frameworkOptions = require("./framework-options.cjs");
|
|
12
11
|
function _interopNamespaceDefault(e) {
|
|
@@ -132,12 +131,16 @@ function compileCodeSplitReferenceRoute(opts) {
|
|
|
132
131
|
if (!(path.node.callee.name === "createRoute" || path.node.callee.name === "createFileRoute")) {
|
|
133
132
|
return;
|
|
134
133
|
}
|
|
135
|
-
|
|
134
|
+
if (t__namespace.isCallExpression(path.parentPath.node)) {
|
|
135
|
+
const options = resolveIdentifier(
|
|
136
|
+
path,
|
|
137
|
+
path.parentPath.node.arguments[0]
|
|
138
|
+
);
|
|
136
139
|
const hasImportedOrDefinedIdentifier = (name) => {
|
|
137
140
|
return programPath.scope.hasBinding(name);
|
|
138
141
|
};
|
|
139
|
-
if (t__namespace.isObjectExpression(
|
|
140
|
-
|
|
142
|
+
if (t__namespace.isObjectExpression(options)) {
|
|
143
|
+
options.properties.forEach((prop) => {
|
|
141
144
|
if (t__namespace.isObjectProperty(prop)) {
|
|
142
145
|
if (t__namespace.isIdentifier(prop.key)) {
|
|
143
146
|
const codeSplitGroupingByKey = findIndexForSplitNode(
|
|
@@ -212,8 +215,15 @@ function compileCodeSplitReferenceRoute(opts) {
|
|
|
212
215
|
`${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`
|
|
213
216
|
)();
|
|
214
217
|
}
|
|
215
|
-
if (opts.runtimeEnv !== "prod"
|
|
216
|
-
|
|
218
|
+
if (opts.runtimeEnv !== "prod" && // only in development
|
|
219
|
+
!hasImportedOrDefinedIdentifier(
|
|
220
|
+
frameworkOptions$1.idents.dummyHMRComponent
|
|
221
|
+
)) {
|
|
222
|
+
programPath.pushContainer("body", [
|
|
223
|
+
template__namespace.statement(
|
|
224
|
+
frameworkOptions$1.dummyHMRComponent
|
|
225
|
+
)()
|
|
226
|
+
]);
|
|
217
227
|
}
|
|
218
228
|
}
|
|
219
229
|
if (splitNodeMeta.splitStrategy === "lazyFn") {
|
|
@@ -263,22 +273,6 @@ function compileCodeSplitReferenceRoute(opts) {
|
|
|
263
273
|
});
|
|
264
274
|
}
|
|
265
275
|
}
|
|
266
|
-
if (t__namespace.isCallExpression(path.parentPath.node)) {
|
|
267
|
-
const options = resolveIdentifier(
|
|
268
|
-
path,
|
|
269
|
-
path.parentPath.node.arguments[0]
|
|
270
|
-
);
|
|
271
|
-
babelHandleReference(options);
|
|
272
|
-
} else if (t__namespace.isVariableDeclarator(path.parentPath.node)) {
|
|
273
|
-
const caller = resolveIdentifier(
|
|
274
|
-
path,
|
|
275
|
-
path.parentPath.node.init
|
|
276
|
-
);
|
|
277
|
-
if (t__namespace.isCallExpression(caller)) {
|
|
278
|
-
const options = resolveIdentifier(path, caller.arguments[0]);
|
|
279
|
-
babelHandleReference(options);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
276
|
}
|
|
283
277
|
},
|
|
284
278
|
state
|
|
@@ -328,7 +322,11 @@ function compileCodeSplitVirtualRoute(opts) {
|
|
|
328
322
|
if (!(path.node.callee.name === "createRoute" || path.node.callee.name === "createFileRoute")) {
|
|
329
323
|
return;
|
|
330
324
|
}
|
|
331
|
-
|
|
325
|
+
if (t__namespace.isCallExpression(path.parentPath.node)) {
|
|
326
|
+
const options = resolveIdentifier(
|
|
327
|
+
path,
|
|
328
|
+
path.parentPath.node.arguments[0]
|
|
329
|
+
);
|
|
332
330
|
if (t__namespace.isObjectExpression(options)) {
|
|
333
331
|
options.properties.forEach((prop) => {
|
|
334
332
|
if (t__namespace.isObjectProperty(prop)) {
|
|
@@ -359,22 +357,6 @@ function compileCodeSplitVirtualRoute(opts) {
|
|
|
359
357
|
options.properties = [];
|
|
360
358
|
}
|
|
361
359
|
}
|
|
362
|
-
if (t__namespace.isCallExpression(path.parentPath.node)) {
|
|
363
|
-
const options = resolveIdentifier(
|
|
364
|
-
path,
|
|
365
|
-
path.parentPath.node.arguments[0]
|
|
366
|
-
);
|
|
367
|
-
babelHandleVirtual(options);
|
|
368
|
-
} else if (t__namespace.isVariableDeclarator(path.parentPath.node)) {
|
|
369
|
-
const caller = resolveIdentifier(
|
|
370
|
-
path,
|
|
371
|
-
path.parentPath.node.init
|
|
372
|
-
);
|
|
373
|
-
if (t__namespace.isCallExpression(caller)) {
|
|
374
|
-
const options = resolveIdentifier(path, caller.arguments[0]);
|
|
375
|
-
babelHandleVirtual(options);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
360
|
}
|
|
379
361
|
},
|
|
380
362
|
state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilers.cjs","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":["tsrSplit","createIdentifier","parseAst","findReferencedIdentifiers","frameworkOptions","getFrameworkOptions","t","template","routeHmrStatement","deadCodeElimination","generateFromAst"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBc,QAAQ,IAAI;AA2B1B,MAAM,yCAAyB,IAAy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AA,gBAAA;AAAA,cACZ;AAAA,YACF;AAAA,UACF,CACD;AAAA,QAAA,WACQA,aAAE,sBAAsB,KAAK,KAAK,WAAW,GAAG;AAEzD,cAAIA,aAAE,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,UAAIA,aAAE,aAAa,KAAK,KAAK,WAAW,GAAG;AACzC,YAAI,KAAK,KAAK,YAAY,SAAS,KAAK,MAAM;AAC5C,eAAK,OAAO;AACF,oBAAA;AAAA,QAAA;AAAA,MACZ,WACSA,aAAE,sBAAsB,KAAK,KAAK,WAAW,GAAG;AAEzD,YAAIA,aAAE,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.cjs","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":["tsrSplit","createIdentifier","parseAst","findReferencedIdentifiers","frameworkOptions","getFrameworkOptions","t","template","deadCodeElimination","generateFromAst"],"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,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA,MACf,oBAAoB;AAAA;AAAA,MACpB,eAAe;AAAA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imeEnv: '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`
|
|
@@ -9,8 +9,10 @@ function getFrameworkOptions(framework) {
|
|
|
9
9
|
idents: {
|
|
10
10
|
createFileRoute: "createFileRoute",
|
|
11
11
|
lazyFn: "lazyFn",
|
|
12
|
-
lazyRouteComponent: "lazyRouteComponent"
|
|
13
|
-
|
|
12
|
+
lazyRouteComponent: "lazyRouteComponent",
|
|
13
|
+
dummyHMRComponent: "TSRDummyComponent"
|
|
14
|
+
},
|
|
15
|
+
dummyHMRComponent: `export function TSRDummyComponent() { return null }`
|
|
14
16
|
};
|
|
15
17
|
break;
|
|
16
18
|
case "solid":
|
|
@@ -19,8 +21,10 @@ function getFrameworkOptions(framework) {
|
|
|
19
21
|
idents: {
|
|
20
22
|
createFileRoute: "createFileRoute",
|
|
21
23
|
lazyFn: "lazyFn",
|
|
22
|
-
lazyRouteComponent: "lazyRouteComponent"
|
|
23
|
-
|
|
24
|
+
lazyRouteComponent: "lazyRouteComponent",
|
|
25
|
+
dummyHMRComponent: "TSRDummyComponent"
|
|
26
|
+
},
|
|
27
|
+
dummyHMRComponent: `export function TSRDummyComponent() { return null }`
|
|
24
28
|
};
|
|
25
29
|
break;
|
|
26
30
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-options.cjs","sources":["../../../../src/core/code-splitter/framework-options.ts"],"sourcesContent":["type FrameworkOptions = {\n package: string\n idents: {\n createFileRoute: string\n lazyFn: string\n lazyRouteComponent: string\n }\n}\n\nexport function getFrameworkOptions(framework: string): FrameworkOptions {\n let frameworkOptions: FrameworkOptions\n\n switch (framework) {\n case 'react':\n frameworkOptions = {\n package: '@tanstack/react-router',\n idents: {\n createFileRoute: 'createFileRoute',\n lazyFn: 'lazyFn',\n lazyRouteComponent: 'lazyRouteComponent',\n },\n }\n break\n case 'solid':\n frameworkOptions = {\n package: '@tanstack/solid-router',\n idents: {\n createFileRoute: 'createFileRoute',\n lazyFn: 'lazyFn',\n lazyRouteComponent: 'lazyRouteComponent',\n },\n }\n break\n default:\n throw new Error(\n `[getFrameworkOptions] - Unsupported framework: ${framework}`,\n )\n }\n\n return frameworkOptions\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"framework-options.cjs","sources":["../../../../src/core/code-splitter/framework-options.ts"],"sourcesContent":["type FrameworkOptions = {\n package: string\n idents: {\n createFileRoute: string\n lazyFn: string\n lazyRouteComponent: string\n dummyHMRComponent: string\n }\n dummyHMRComponent: string\n}\n\nexport function getFrameworkOptions(framework: string): FrameworkOptions {\n let frameworkOptions: FrameworkOptions\n\n switch (framework) {\n case 'react':\n frameworkOptions = {\n package: '@tanstack/react-router',\n idents: {\n createFileRoute: 'createFileRoute',\n lazyFn: 'lazyFn',\n lazyRouteComponent: 'lazyRouteComponent',\n dummyHMRComponent: 'TSRDummyComponent',\n },\n dummyHMRComponent: `export function TSRDummyComponent() { return null }`,\n }\n break\n case 'solid':\n frameworkOptions = {\n package: '@tanstack/solid-router',\n idents: {\n createFileRoute: 'createFileRoute',\n lazyFn: 'lazyFn',\n lazyRouteComponent: 'lazyRouteComponent',\n dummyHMRComponent: 'TSRDummyComponent',\n },\n dummyHMRComponent: `export function TSRDummyComponent() { return null }`,\n }\n break\n default:\n throw new Error(\n `[getFrameworkOptions] - Unsupported framework: ${framework}`,\n )\n }\n\n return frameworkOptions\n}\n"],"names":[],"mappings":";;AAWO,SAAS,oBAAoB,WAAqC;AACnE,MAAA;AAEJ,UAAQ,WAAW;AAAA,IACjB,KAAK;AACgB,yBAAA;AAAA,QACjB,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,iBAAiB;AAAA,UACjB,QAAQ;AAAA,UACR,oBAAoB;AAAA,UACpB,mBAAmB;AAAA,QACrB;AAAA,QACA,mBAAmB;AAAA,MACrB;AACA;AAAA,IACF,KAAK;AACgB,yBAAA;AAAA,QACjB,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,iBAAiB;AAAA,UACjB,QAAQ;AAAA,UACR,oBAAoB;AAAA,UACpB,mBAAmB;AAAA,QACrB;AAAA,QACA,mBAAmB;AAAA,MACrB;AACA;AAAA,IACF;AACE,YAAM,IAAI;AAAA,QACR,kDAAkD,SAAS;AAAA,MAC7D;AAAA,EAAA;AAGG,SAAA;AACT;;"}
|
|
@@ -4,7 +4,9 @@ type FrameworkOptions = {
|
|
|
4
4
|
createFileRoute: string;
|
|
5
5
|
lazyFn: string;
|
|
6
6
|
lazyRouteComponent: string;
|
|
7
|
+
dummyHMRComponent: string;
|
|
7
8
|
};
|
|
9
|
+
dummyHMRComponent: string;
|
|
8
10
|
};
|
|
9
11
|
export declare function getFrameworkOptions(framework: string): FrameworkOptions;
|
|
10
12
|
export {};
|
|
@@ -19,38 +19,41 @@ export type CodeSplittingOptions = {
|
|
|
19
19
|
*/
|
|
20
20
|
defaultBehavior?: CodeSplitGroupings;
|
|
21
21
|
};
|
|
22
|
-
export declare const configSchema: z.ZodObject<z.objectUtil.extendShape<
|
|
22
|
+
export declare const configSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
23
23
|
target: z.ZodDefault<z.ZodOptional<z.ZodEnum<["react", "solid"]>>>;
|
|
24
24
|
virtualRouteConfig: z.ZodOptional<z.ZodUnion<[z.ZodType<import('@tanstack/virtual-file-routes').VirtualRootRoute, z.ZodTypeDef, import('@tanstack/virtual-file-routes').VirtualRootRoute>, z.ZodString]>>;
|
|
25
25
|
routeFilePrefix: z.ZodOptional<z.ZodString>;
|
|
26
26
|
routeFileIgnorePrefix: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
27
27
|
routeFileIgnorePattern: z.ZodOptional<z.ZodString>;
|
|
28
28
|
routesDirectory: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
generatedRouteTree: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
29
30
|
quoteStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["single", "double"]>>>;
|
|
30
31
|
semicolons: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
31
|
-
disableLogging: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
32
|
-
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
33
|
-
indexToken: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
34
|
-
routeToken: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
35
|
-
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<[";", ":", "@", "&", "=", "+", "$", ","]>, "many">>;
|
|
36
|
-
}, {
|
|
37
|
-
generatedRouteTree: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
38
32
|
disableTypes: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
39
|
-
verboseFileRoutes: z.ZodOptional<z.ZodBoolean>;
|
|
40
33
|
addExtensions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
34
|
+
disableLogging: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
35
|
disableManifestGeneration: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
42
36
|
enableRouteTreeFormatting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
37
|
+
__enableAPIRoutesGeneration: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
apiBase: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
39
|
+
routeTreeFileHeader: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
43
40
|
routeTreeFileFooter: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
44
41
|
autoCodeSplitting: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
indexToken: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
43
|
+
routeToken: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
44
|
+
pathParamsAllowedCharacters: z.ZodOptional<z.ZodArray<z.ZodEnum<[";", ":", "@", "&", "=", "+", "$", ","]>, "many">>;
|
|
45
45
|
customScaffolding: z.ZodOptional<z.ZodObject<{
|
|
46
46
|
routeTemplate: z.ZodOptional<z.ZodString>;
|
|
47
47
|
lazyRouteTemplate: z.ZodOptional<z.ZodString>;
|
|
48
|
+
apiTemplate: z.ZodOptional<z.ZodString>;
|
|
48
49
|
}, "strip", z.ZodTypeAny, {
|
|
49
50
|
routeTemplate?: string | undefined;
|
|
50
51
|
lazyRouteTemplate?: string | undefined;
|
|
52
|
+
apiTemplate?: string | undefined;
|
|
51
53
|
}, {
|
|
52
54
|
routeTemplate?: string | undefined;
|
|
53
55
|
lazyRouteTemplate?: string | undefined;
|
|
56
|
+
apiTemplate?: string | undefined;
|
|
54
57
|
}>>;
|
|
55
58
|
experimental: z.ZodOptional<z.ZodObject<{
|
|
56
59
|
enableCodeSplitting: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -59,36 +62,38 @@ export declare const configSchema: z.ZodObject<z.objectUtil.extendShape<z.object
|
|
|
59
62
|
}, {
|
|
60
63
|
enableCodeSplitting?: boolean | undefined;
|
|
61
64
|
}>>;
|
|
62
|
-
}
|
|
65
|
+
}, {
|
|
63
66
|
enableRouteGeneration: z.ZodOptional<z.ZodBoolean>;
|
|
64
67
|
codeSplittingOptions: z.ZodOptional<z.ZodType<CodeSplittingOptions, z.ZodTypeDef, CodeSplittingOptions>>;
|
|
65
68
|
}>, "strip", z.ZodTypeAny, {
|
|
66
69
|
target: "react" | "solid";
|
|
67
70
|
routeFileIgnorePrefix: string;
|
|
68
71
|
routesDirectory: string;
|
|
72
|
+
generatedRouteTree: string;
|
|
69
73
|
quoteStyle: "single" | "double";
|
|
70
74
|
semicolons: boolean;
|
|
71
|
-
disableLogging: boolean;
|
|
72
|
-
routeTreeFileHeader: string[];
|
|
73
|
-
indexToken: string;
|
|
74
|
-
routeToken: string;
|
|
75
|
-
generatedRouteTree: string;
|
|
76
75
|
disableTypes: boolean;
|
|
77
76
|
addExtensions: boolean;
|
|
77
|
+
disableLogging: boolean;
|
|
78
78
|
disableManifestGeneration: boolean;
|
|
79
79
|
enableRouteTreeFormatting: boolean;
|
|
80
|
+
apiBase: string;
|
|
81
|
+
routeTreeFileHeader: string[];
|
|
80
82
|
routeTreeFileFooter: string[];
|
|
83
|
+
indexToken: string;
|
|
84
|
+
routeToken: string;
|
|
81
85
|
enableRouteGeneration?: boolean | undefined;
|
|
82
86
|
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
83
87
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
84
88
|
routeFilePrefix?: string | undefined;
|
|
85
89
|
routeFileIgnorePattern?: string | undefined;
|
|
86
|
-
|
|
87
|
-
verboseFileRoutes?: boolean | undefined;
|
|
90
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
88
91
|
autoCodeSplitting?: boolean | undefined;
|
|
92
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
89
93
|
customScaffolding?: {
|
|
90
94
|
routeTemplate?: string | undefined;
|
|
91
95
|
lazyRouteTemplate?: string | undefined;
|
|
96
|
+
apiTemplate?: string | undefined;
|
|
92
97
|
} | undefined;
|
|
93
98
|
experimental?: {
|
|
94
99
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -102,24 +107,26 @@ export declare const configSchema: z.ZodObject<z.objectUtil.extendShape<z.object
|
|
|
102
107
|
routeFileIgnorePrefix?: string | undefined;
|
|
103
108
|
routeFileIgnorePattern?: string | undefined;
|
|
104
109
|
routesDirectory?: string | undefined;
|
|
110
|
+
generatedRouteTree?: string | undefined;
|
|
105
111
|
quoteStyle?: "single" | "double" | undefined;
|
|
106
112
|
semicolons?: boolean | undefined;
|
|
107
|
-
disableLogging?: boolean | undefined;
|
|
108
|
-
routeTreeFileHeader?: string[] | undefined;
|
|
109
|
-
indexToken?: string | undefined;
|
|
110
|
-
routeToken?: string | undefined;
|
|
111
|
-
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
112
|
-
generatedRouteTree?: string | undefined;
|
|
113
113
|
disableTypes?: boolean | undefined;
|
|
114
|
-
verboseFileRoutes?: boolean | undefined;
|
|
115
114
|
addExtensions?: boolean | undefined;
|
|
115
|
+
disableLogging?: boolean | undefined;
|
|
116
116
|
disableManifestGeneration?: boolean | undefined;
|
|
117
117
|
enableRouteTreeFormatting?: boolean | undefined;
|
|
118
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
119
|
+
apiBase?: string | undefined;
|
|
120
|
+
routeTreeFileHeader?: string[] | undefined;
|
|
118
121
|
routeTreeFileFooter?: string[] | undefined;
|
|
119
122
|
autoCodeSplitting?: boolean | undefined;
|
|
123
|
+
indexToken?: string | undefined;
|
|
124
|
+
routeToken?: string | undefined;
|
|
125
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
120
126
|
customScaffolding?: {
|
|
121
127
|
routeTemplate?: string | undefined;
|
|
122
128
|
lazyRouteTemplate?: string | undefined;
|
|
129
|
+
apiTemplate?: string | undefined;
|
|
123
130
|
} | undefined;
|
|
124
131
|
experimental?: {
|
|
125
132
|
enableCodeSplitting?: boolean | undefined;
|
|
@@ -129,29 +136,31 @@ export declare const getConfig: (inlineConfig: Partial<Config>, root: string) =>
|
|
|
129
136
|
target: "react" | "solid";
|
|
130
137
|
routeFileIgnorePrefix: string;
|
|
131
138
|
routesDirectory: string;
|
|
139
|
+
generatedRouteTree: string;
|
|
132
140
|
quoteStyle: "single" | "double";
|
|
133
141
|
semicolons: boolean;
|
|
134
|
-
disableLogging: boolean;
|
|
135
|
-
routeTreeFileHeader: string[];
|
|
136
|
-
indexToken: string;
|
|
137
|
-
routeToken: string;
|
|
138
|
-
generatedRouteTree: string;
|
|
139
142
|
disableTypes: boolean;
|
|
140
143
|
addExtensions: boolean;
|
|
144
|
+
disableLogging: boolean;
|
|
141
145
|
disableManifestGeneration: boolean;
|
|
142
146
|
enableRouteTreeFormatting: boolean;
|
|
147
|
+
apiBase: string;
|
|
148
|
+
routeTreeFileHeader: string[];
|
|
143
149
|
routeTreeFileFooter: string[];
|
|
150
|
+
indexToken: string;
|
|
151
|
+
routeToken: string;
|
|
144
152
|
enableRouteGeneration?: boolean | undefined;
|
|
145
153
|
codeSplittingOptions?: CodeSplittingOptions | undefined;
|
|
146
154
|
virtualRouteConfig?: string | import('@tanstack/virtual-file-routes').VirtualRootRoute | undefined;
|
|
147
155
|
routeFilePrefix?: string | undefined;
|
|
148
156
|
routeFileIgnorePattern?: string | undefined;
|
|
149
|
-
|
|
150
|
-
verboseFileRoutes?: boolean | undefined;
|
|
157
|
+
__enableAPIRoutesGeneration?: boolean | undefined;
|
|
151
158
|
autoCodeSplitting?: boolean | undefined;
|
|
159
|
+
pathParamsAllowedCharacters?: (";" | ":" | "@" | "&" | "=" | "+" | "$" | ",")[] | undefined;
|
|
152
160
|
customScaffolding?: {
|
|
153
161
|
routeTemplate?: string | undefined;
|
|
154
162
|
lazyRouteTemplate?: string | undefined;
|
|
163
|
+
apiTemplate?: string | undefined;
|
|
155
164
|
} | undefined;
|
|
156
165
|
experimental?: {
|
|
157
166
|
enableCodeSplitting?: boolean | undefined;
|