@tanstack/router-plugin 1.167.8 → 1.167.10
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/plugins/react-stable-hmr-split-route-components.cjs +1 -0
- package/dist/cjs/core/code-splitter/plugins/react-stable-hmr-split-route-components.cjs.map +1 -1
- package/dist/esm/core/code-splitter/plugins/react-stable-hmr-split-route-components.js +1 -0
- package/dist/esm/core/code-splitter/plugins/react-stable-hmr-split-route-components.js.map +1 -1
- package/package.json +4 -4
- package/src/core/code-splitter/plugins/react-stable-hmr-split-route-components.ts +1 -0
|
@@ -14,6 +14,7 @@ function createHotDataKey(exportName) {
|
|
|
14
14
|
var buildStableSplitComponentStatements = _babel_template.statements(`
|
|
15
15
|
const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)
|
|
16
16
|
if (import.meta.hot) {
|
|
17
|
+
import.meta.hot.data ??= {}
|
|
17
18
|
import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%
|
|
18
19
|
}
|
|
19
20
|
`, { syntacticPlaceholders: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-stable-hmr-split-route-components.cjs","names":[],"sources":["../../../../../src/core/code-splitter/plugins/react-stable-hmr-split-route-components.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport * as t from '@babel/types'\nimport { getUniqueProgramIdentifier } from '../../utils'\nimport type { ReferenceRouteCompilerPlugin } from '../plugins'\n\nfunction capitalizeIdentifier(str: string) {\n return str[0]!.toUpperCase() + str.slice(1)\n}\n\nfunction createHotDataKey(exportName: string) {\n return `tsr-split-component:${exportName}`\n}\n\nconst buildStableSplitComponentStatements = template.statements(\n `\n const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)\n if (import.meta.hot) {\n import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%\n }\n `,\n {\n syntacticPlaceholders: true,\n },\n)\n\nexport function createReactStableHmrSplitRouteComponentsPlugin(): ReferenceRouteCompilerPlugin {\n return {\n name: 'react-stable-hmr-split-route-components',\n onSplitRouteProperty(ctx) {\n if (ctx.splitNodeMeta.splitStrategy !== 'lazyRouteComponent') {\n return\n }\n\n const stableComponentIdent = getUniqueProgramIdentifier(\n ctx.programPath,\n `TSRSplit${capitalizeIdentifier(ctx.splitNodeMeta.exporterIdent)}`,\n )\n\n const hotDataKey = createHotDataKey(ctx.splitNodeMeta.exporterIdent)\n\n ctx.insertionPath.insertBefore(\n buildStableSplitComponentStatements({\n stableComponentIdent,\n hotDataKey: t.stringLiteral(hotDataKey),\n lazyRouteComponentIdent: t.identifier(ctx.lazyRouteComponentIdent),\n localImporterIdent: t.identifier(\n ctx.splitNodeMeta.localImporterIdent,\n ),\n exporterIdent: t.stringLiteral(ctx.splitNodeMeta.exporterIdent),\n }),\n )\n\n return t.identifier(stableComponentIdent.name)\n },\n }\n}\n"],"mappings":";;;;;;;AAKA,SAAS,qBAAqB,KAAa;AACzC,QAAO,IAAI,GAAI,aAAa,GAAG,IAAI,MAAM,EAAE;;AAG7C,SAAS,iBAAiB,YAAoB;AAC5C,QAAO,uBAAuB;;AAGhC,IAAM,sCAAsC,gBAAS,WACnD
|
|
1
|
+
{"version":3,"file":"react-stable-hmr-split-route-components.cjs","names":[],"sources":["../../../../../src/core/code-splitter/plugins/react-stable-hmr-split-route-components.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport * as t from '@babel/types'\nimport { getUniqueProgramIdentifier } from '../../utils'\nimport type { ReferenceRouteCompilerPlugin } from '../plugins'\n\nfunction capitalizeIdentifier(str: string) {\n return str[0]!.toUpperCase() + str.slice(1)\n}\n\nfunction createHotDataKey(exportName: string) {\n return `tsr-split-component:${exportName}`\n}\n\nconst buildStableSplitComponentStatements = template.statements(\n `\n const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)\n if (import.meta.hot) {\n import.meta.hot.data ??= {}\n import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%\n }\n `,\n {\n syntacticPlaceholders: true,\n },\n)\n\nexport function createReactStableHmrSplitRouteComponentsPlugin(): ReferenceRouteCompilerPlugin {\n return {\n name: 'react-stable-hmr-split-route-components',\n onSplitRouteProperty(ctx) {\n if (ctx.splitNodeMeta.splitStrategy !== 'lazyRouteComponent') {\n return\n }\n\n const stableComponentIdent = getUniqueProgramIdentifier(\n ctx.programPath,\n `TSRSplit${capitalizeIdentifier(ctx.splitNodeMeta.exporterIdent)}`,\n )\n\n const hotDataKey = createHotDataKey(ctx.splitNodeMeta.exporterIdent)\n\n ctx.insertionPath.insertBefore(\n buildStableSplitComponentStatements({\n stableComponentIdent,\n hotDataKey: t.stringLiteral(hotDataKey),\n lazyRouteComponentIdent: t.identifier(ctx.lazyRouteComponentIdent),\n localImporterIdent: t.identifier(\n ctx.splitNodeMeta.localImporterIdent,\n ),\n exporterIdent: t.stringLiteral(ctx.splitNodeMeta.exporterIdent),\n }),\n )\n\n return t.identifier(stableComponentIdent.name)\n },\n }\n}\n"],"mappings":";;;;;;;AAKA,SAAS,qBAAqB,KAAa;AACzC,QAAO,IAAI,GAAI,aAAa,GAAG,IAAI,MAAM,EAAE;;AAG7C,SAAS,iBAAiB,YAAoB;AAC5C,QAAO,uBAAuB;;AAGhC,IAAM,sCAAsC,gBAAS,WACnD;;;;;;KAOA,EACE,uBAAuB,MACxB,CACF;AAED,SAAgB,iDAA+E;AAC7F,QAAO;EACL,MAAM;EACN,qBAAqB,KAAK;AACxB,OAAI,IAAI,cAAc,kBAAkB,qBACtC;GAGF,MAAM,uBAAuB,cAAA,2BAC3B,IAAI,aACJ,WAAW,qBAAqB,IAAI,cAAc,cAAc,GACjE;GAED,MAAM,aAAa,iBAAiB,IAAI,cAAc,cAAc;AAEpE,OAAI,cAAc,aAChB,oCAAoC;IAClC;IACA,YAAY,aAAE,cAAc,WAAW;IACvC,yBAAyB,aAAE,WAAW,IAAI,wBAAwB;IAClE,oBAAoB,aAAE,WACpB,IAAI,cAAc,mBACnB;IACD,eAAe,aAAE,cAAc,IAAI,cAAc,cAAc;IAChE,CAAC,CACH;AAED,UAAO,aAAE,WAAW,qBAAqB,KAAK;;EAEjD"}
|
|
@@ -11,6 +11,7 @@ function createHotDataKey(exportName) {
|
|
|
11
11
|
var buildStableSplitComponentStatements = template.statements(`
|
|
12
12
|
const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)
|
|
13
13
|
if (import.meta.hot) {
|
|
14
|
+
import.meta.hot.data ??= {}
|
|
14
15
|
import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%
|
|
15
16
|
}
|
|
16
17
|
`, { syntacticPlaceholders: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-stable-hmr-split-route-components.js","names":[],"sources":["../../../../../src/core/code-splitter/plugins/react-stable-hmr-split-route-components.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport * as t from '@babel/types'\nimport { getUniqueProgramIdentifier } from '../../utils'\nimport type { ReferenceRouteCompilerPlugin } from '../plugins'\n\nfunction capitalizeIdentifier(str: string) {\n return str[0]!.toUpperCase() + str.slice(1)\n}\n\nfunction createHotDataKey(exportName: string) {\n return `tsr-split-component:${exportName}`\n}\n\nconst buildStableSplitComponentStatements = template.statements(\n `\n const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)\n if (import.meta.hot) {\n import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%\n }\n `,\n {\n syntacticPlaceholders: true,\n },\n)\n\nexport function createReactStableHmrSplitRouteComponentsPlugin(): ReferenceRouteCompilerPlugin {\n return {\n name: 'react-stable-hmr-split-route-components',\n onSplitRouteProperty(ctx) {\n if (ctx.splitNodeMeta.splitStrategy !== 'lazyRouteComponent') {\n return\n }\n\n const stableComponentIdent = getUniqueProgramIdentifier(\n ctx.programPath,\n `TSRSplit${capitalizeIdentifier(ctx.splitNodeMeta.exporterIdent)}`,\n )\n\n const hotDataKey = createHotDataKey(ctx.splitNodeMeta.exporterIdent)\n\n ctx.insertionPath.insertBefore(\n buildStableSplitComponentStatements({\n stableComponentIdent,\n hotDataKey: t.stringLiteral(hotDataKey),\n lazyRouteComponentIdent: t.identifier(ctx.lazyRouteComponentIdent),\n localImporterIdent: t.identifier(\n ctx.splitNodeMeta.localImporterIdent,\n ),\n exporterIdent: t.stringLiteral(ctx.splitNodeMeta.exporterIdent),\n }),\n )\n\n return t.identifier(stableComponentIdent.name)\n },\n }\n}\n"],"mappings":";;;;AAKA,SAAS,qBAAqB,KAAa;AACzC,QAAO,IAAI,GAAI,aAAa,GAAG,IAAI,MAAM,EAAE;;AAG7C,SAAS,iBAAiB,YAAoB;AAC5C,QAAO,uBAAuB;;AAGhC,IAAM,sCAAsC,SAAS,WACnD
|
|
1
|
+
{"version":3,"file":"react-stable-hmr-split-route-components.js","names":[],"sources":["../../../../../src/core/code-splitter/plugins/react-stable-hmr-split-route-components.ts"],"sourcesContent":["import * as template from '@babel/template'\nimport * as t from '@babel/types'\nimport { getUniqueProgramIdentifier } from '../../utils'\nimport type { ReferenceRouteCompilerPlugin } from '../plugins'\n\nfunction capitalizeIdentifier(str: string) {\n return str[0]!.toUpperCase() + str.slice(1)\n}\n\nfunction createHotDataKey(exportName: string) {\n return `tsr-split-component:${exportName}`\n}\n\nconst buildStableSplitComponentStatements = template.statements(\n `\n const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)\n if (import.meta.hot) {\n import.meta.hot.data ??= {}\n import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%\n }\n `,\n {\n syntacticPlaceholders: true,\n },\n)\n\nexport function createReactStableHmrSplitRouteComponentsPlugin(): ReferenceRouteCompilerPlugin {\n return {\n name: 'react-stable-hmr-split-route-components',\n onSplitRouteProperty(ctx) {\n if (ctx.splitNodeMeta.splitStrategy !== 'lazyRouteComponent') {\n return\n }\n\n const stableComponentIdent = getUniqueProgramIdentifier(\n ctx.programPath,\n `TSRSplit${capitalizeIdentifier(ctx.splitNodeMeta.exporterIdent)}`,\n )\n\n const hotDataKey = createHotDataKey(ctx.splitNodeMeta.exporterIdent)\n\n ctx.insertionPath.insertBefore(\n buildStableSplitComponentStatements({\n stableComponentIdent,\n hotDataKey: t.stringLiteral(hotDataKey),\n lazyRouteComponentIdent: t.identifier(ctx.lazyRouteComponentIdent),\n localImporterIdent: t.identifier(\n ctx.splitNodeMeta.localImporterIdent,\n ),\n exporterIdent: t.stringLiteral(ctx.splitNodeMeta.exporterIdent),\n }),\n )\n\n return t.identifier(stableComponentIdent.name)\n },\n }\n}\n"],"mappings":";;;;AAKA,SAAS,qBAAqB,KAAa;AACzC,QAAO,IAAI,GAAI,aAAa,GAAG,IAAI,MAAM,EAAE;;AAG7C,SAAS,iBAAiB,YAAoB;AAC5C,QAAO,uBAAuB;;AAGhC,IAAM,sCAAsC,SAAS,WACnD;;;;;;KAOA,EACE,uBAAuB,MACxB,CACF;AAED,SAAgB,iDAA+E;AAC7F,QAAO;EACL,MAAM;EACN,qBAAqB,KAAK;AACxB,OAAI,IAAI,cAAc,kBAAkB,qBACtC;GAGF,MAAM,uBAAuB,2BAC3B,IAAI,aACJ,WAAW,qBAAqB,IAAI,cAAc,cAAc,GACjE;GAED,MAAM,aAAa,iBAAiB,IAAI,cAAc,cAAc;AAEpE,OAAI,cAAc,aAChB,oCAAoC;IAClC;IACA,YAAY,EAAE,cAAc,WAAW;IACvC,yBAAyB,EAAE,WAAW,IAAI,wBAAwB;IAClE,oBAAoB,EAAE,WACpB,IAAI,cAAc,mBACnB;IACD,eAAe,EAAE,cAAc,IAAI,cAAc,cAAc;IAChE,CAAC,CACH;AAED,UAAO,EAAE,WAAW,qBAAqB,KAAK;;EAEjD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-plugin",
|
|
3
|
-
"version": "1.167.
|
|
3
|
+
"version": "1.167.10",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"chokidar": "^3.6.0",
|
|
100
100
|
"unplugin": "^2.1.2",
|
|
101
101
|
"zod": "^3.24.2",
|
|
102
|
-
"@tanstack/router-core": "1.168.
|
|
103
|
-
"@tanstack/router-generator": "1.166.
|
|
102
|
+
"@tanstack/router-core": "1.168.7",
|
|
103
|
+
"@tanstack/router-generator": "1.166.22",
|
|
104
104
|
"@tanstack/router-utils": "1.161.6",
|
|
105
105
|
"@tanstack/virtual-file-routes": "1.161.7"
|
|
106
106
|
},
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"vite": ">=5.0.0 || >=6.0.0 || >=7.0.0",
|
|
117
117
|
"vite-plugin-solid": "^2.11.10",
|
|
118
118
|
"webpack": ">=5.92.0",
|
|
119
|
-
"@tanstack/react-router": "^1.168.
|
|
119
|
+
"@tanstack/react-router": "^1.168.8"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {
|
|
122
122
|
"@rsbuild/core": {
|
|
@@ -15,6 +15,7 @@ const buildStableSplitComponentStatements = template.statements(
|
|
|
15
15
|
`
|
|
16
16
|
const %%stableComponentIdent%% = import.meta.hot?.data?.[%%hotDataKey%%] ?? %%lazyRouteComponentIdent%%(%%localImporterIdent%%, %%exporterIdent%%)
|
|
17
17
|
if (import.meta.hot) {
|
|
18
|
+
import.meta.hot.data ??= {}
|
|
18
19
|
import.meta.hot.data[%%hotDataKey%%] = %%stableComponentIdent%%
|
|
19
20
|
}
|
|
20
21
|
`,
|