@bleedingdev/modern-js-plugin-tanstack 3.5.0-ultramodern.36 → 3.5.0-ultramodern.37
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/cli/tanstackTypes/shared.js +12 -19
- package/dist/cjs/cli/tanstackTypes/source.js +24 -19
- package/dist/cjs/runtime/blockingSubscribe.js +0 -7
- package/dist/cjs/runtime/clientHydration.js +2 -14
- package/dist/cjs/runtime/loaderBridge.js +3 -10
- package/dist/cjs/runtime/pluginShared.js +0 -3
- package/dist/cjs/runtime/register.js +1 -47
- package/dist/cjs/runtime/rsc/ReplayableStream.js +0 -4
- package/dist/cjs/runtime/rsc/payloadFetch.js +3 -16
- package/dist/cjs/runtime/rsc/payloadRoutes.js +2 -14
- package/dist/cjs/runtime/rsc/shared.js +2 -5
- package/dist/cjs/runtime/shared/isAbsoluteUrl.js +47 -0
- package/dist/esm/cli/index.mjs +4 -4
- package/dist/esm/cli/tanstackTypes/shared.mjs +12 -19
- package/dist/esm/cli/tanstackTypes/source.mjs +23 -18
- package/dist/esm/runtime/blockingSubscribe.mjs +1 -1
- package/dist/esm/runtime/clientHydration.mjs +1 -1
- package/dist/esm/runtime/loaderBridge.mjs +1 -8
- package/dist/esm/runtime/pluginShared.mjs +1 -1
- package/dist/esm/runtime/register.mjs +0 -14
- package/dist/esm/runtime/rsc/ReplayableStream.mjs +1 -1
- package/dist/esm/runtime/rsc/payloadFetch.mjs +2 -9
- package/dist/esm/runtime/rsc/payloadRoutes.mjs +1 -1
- package/dist/esm/runtime/rsc/shared.mjs +1 -1
- package/dist/esm/runtime/shared/isAbsoluteUrl.mjs +9 -0
- package/dist/esm-node/cli/index.mjs +4 -4
- package/dist/esm-node/cli/tanstackTypes/shared.mjs +12 -19
- package/dist/esm-node/cli/tanstackTypes/source.mjs +23 -18
- package/dist/esm-node/runtime/blockingSubscribe.mjs +1 -1
- package/dist/esm-node/runtime/clientHydration.mjs +1 -1
- package/dist/esm-node/runtime/loaderBridge.mjs +1 -8
- package/dist/esm-node/runtime/pluginShared.mjs +1 -1
- package/dist/esm-node/runtime/register.mjs +0 -14
- package/dist/esm-node/runtime/rsc/ReplayableStream.mjs +1 -1
- package/dist/esm-node/runtime/rsc/payloadFetch.mjs +2 -9
- package/dist/esm-node/runtime/rsc/payloadRoutes.mjs +1 -1
- package/dist/esm-node/runtime/rsc/shared.mjs +1 -1
- package/dist/esm-node/runtime/shared/isAbsoluteUrl.mjs +10 -0
- package/dist/types/cli/tanstackTypes/shared.d.ts +1 -1
- package/dist/types/cli/tanstackTypes/source.d.ts +3 -1
- package/dist/types/runtime/blockingSubscribe.d.ts +0 -2
- package/dist/types/runtime/clientHydration.d.ts +0 -9
- package/dist/types/runtime/formData.d.ts +2 -1
- package/dist/types/runtime/loaderBridge.d.ts +2 -1
- package/dist/types/runtime/pluginShared.d.ts +2 -3
- package/dist/types/runtime/register.d.ts +1 -9
- package/dist/types/runtime/routeTree/types.d.ts +2 -1
- package/dist/types/runtime/rsc/ReplayableStream.d.ts +3 -2
- package/dist/types/runtime/rsc/SlotContext.d.ts +2 -1
- package/dist/types/runtime/rsc/payloadFetch.d.ts +2 -4
- package/dist/types/runtime/rsc/payloadRoutes.d.ts +3 -6
- package/dist/types/runtime/rsc/shared.d.ts +0 -1
- package/dist/types/runtime/shared/isAbsoluteUrl.d.ts +1 -0
- package/dist/types/runtime/ssrTypes.d.ts +3 -2
- package/dist/types/runtime/types.d.ts +2 -3
- package/package.json +15 -16
- package/src/cli/tanstackTypes/canonicalRoutes.ts +1 -1
- package/src/cli/tanstackTypes/shared.ts +24 -30
- package/src/cli/tanstackTypes/source.ts +31 -21
- package/src/runtime/blockingSubscribe.ts +2 -2
- package/src/runtime/clientHydration.ts +5 -10
- package/src/runtime/formData.ts +1 -1
- package/src/runtime/loaderBridge.ts +3 -9
- package/src/runtime/pluginShared.ts +3 -3
- package/src/runtime/register.ts +5 -37
- package/src/runtime/routeTree/types.ts +1 -1
- package/src/runtime/rsc/ReplayableStream.ts +2 -2
- package/src/runtime/rsc/SlotContext.tsx +1 -1
- package/src/runtime/rsc/payloadFetch.ts +5 -11
- package/src/runtime/rsc/payloadRoutes.ts +6 -6
- package/src/runtime/rsc/shared.ts +1 -1
- package/src/runtime/shared/isAbsoluteUrl.ts +8 -0
- package/src/runtime/ssrTypes.ts +2 -2
- package/src/runtime/submitAction.ts +17 -10
- package/src/runtime/types.ts +1 -8
- package/tests/router/register.test.ts +1 -39
|
@@ -36,10 +36,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
36
36
|
pickRouteSearchContractModules: ()=>pickRouteSearchContractModules,
|
|
37
37
|
quote: ()=>quote,
|
|
38
38
|
resolveFileNoExt: ()=>resolveFileNoExt,
|
|
39
|
-
toTanstackPath: ()=>toTanstackPath
|
|
39
|
+
toTanstackPath: ()=>paths_js_namespaceObject.toTanstackPath
|
|
40
40
|
});
|
|
41
41
|
const cli_namespaceObject = require("@modern-js/runtime/cli");
|
|
42
42
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
43
|
+
const paths_js_namespaceObject = require("../../runtime/routeTree/paths.js");
|
|
43
44
|
const JS_OR_TS_EXTS = [
|
|
44
45
|
'.js',
|
|
45
46
|
'.jsx',
|
|
@@ -50,18 +51,6 @@ const JS_OR_TS_EXTS = [
|
|
|
50
51
|
'.cjs',
|
|
51
52
|
'.cts'
|
|
52
53
|
];
|
|
53
|
-
function toTanstackPath(pathname) {
|
|
54
|
-
return pathname.split('/').map((segment)=>{
|
|
55
|
-
if (!segment) return segment;
|
|
56
|
-
if ('*' === segment) return '$';
|
|
57
|
-
if (segment.startsWith(':')) {
|
|
58
|
-
const name = segment.slice(1);
|
|
59
|
-
if (name.endsWith('?')) return `{-$${name.slice(0, -1)}}`;
|
|
60
|
-
return `$${name}`;
|
|
61
|
-
}
|
|
62
|
-
return segment;
|
|
63
|
-
}).join('/');
|
|
64
|
-
}
|
|
65
54
|
async function resolveFileNoExt(inputNoExtPath) {
|
|
66
55
|
const file = (0, utils_namespaceObject.findExists)(JS_OR_TS_EXTS.map((ext)=>`${inputNoExtPath}${ext}`));
|
|
67
56
|
return file ? (0, cli_namespaceObject.getPathWithoutExt)(file) : null;
|
|
@@ -75,27 +64,31 @@ function normalizeRelativeImport(p) {
|
|
|
75
64
|
return `./${normalized}`;
|
|
76
65
|
}
|
|
77
66
|
function pickModernLoaderModule(route) {
|
|
78
|
-
const
|
|
67
|
+
const extras = route;
|
|
68
|
+
const loaderPath = extras.data || extras.loader;
|
|
79
69
|
if (!loaderPath || 'string' != typeof loaderPath) return null;
|
|
80
|
-
const inline = Boolean(
|
|
70
|
+
const inline = Boolean(extras.data);
|
|
81
71
|
return {
|
|
82
72
|
loaderPath,
|
|
83
73
|
inline
|
|
84
74
|
};
|
|
85
75
|
}
|
|
86
76
|
function pickRouteSearchContractModules(route) {
|
|
87
|
-
const
|
|
88
|
-
const
|
|
77
|
+
const extras = route;
|
|
78
|
+
const validateSearchPath = extras.validateSearch;
|
|
79
|
+
const loaderDepsPath = extras.loaderDeps;
|
|
89
80
|
return {
|
|
90
81
|
validateSearchPath: 'string' == typeof validateSearchPath ? validateSearchPath : null,
|
|
91
82
|
loaderDepsPath: 'string' == typeof loaderDepsPath ? loaderDepsPath : null
|
|
92
83
|
};
|
|
93
84
|
}
|
|
94
85
|
function isPathlessLayout(route) {
|
|
95
|
-
|
|
86
|
+
const extras = route;
|
|
87
|
+
return 'nested' === extras.type && 'boolean' != typeof extras.index && void 0 === extras.path;
|
|
96
88
|
}
|
|
97
89
|
function isIndexRoute(route) {
|
|
98
|
-
|
|
90
|
+
const extras = route;
|
|
91
|
+
return 'nested' === extras.type && Boolean(extras.index);
|
|
99
92
|
}
|
|
100
93
|
function createRouteStaticDataSnippet(opts) {
|
|
101
94
|
const staticDataLines = [];
|
|
@@ -39,15 +39,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
40
40
|
generateTanstackRouterTypesSourceForEntry: ()=>generateTanstackRouterTypesSourceForEntry
|
|
41
41
|
});
|
|
42
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
43
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
42
44
|
const cli_namespaceObject = require("@modern-js/runtime/cli");
|
|
43
|
-
const external_path_namespaceObject = require("path");
|
|
44
|
-
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
45
45
|
const external_shared_js_namespaceObject = require("./shared.js");
|
|
46
46
|
async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
47
47
|
const { appContext, entryName, generatedDirName = 'modern-tanstack', routes } = opts;
|
|
48
|
-
const outDir =
|
|
49
|
-
const rootModern = routes.find((r)=>
|
|
50
|
-
|
|
48
|
+
const outDir = external_node_path_default().join(appContext.srcDirectory, generatedDirName, entryName);
|
|
49
|
+
const rootModern = routes.find((r)=>{
|
|
50
|
+
const extras = r;
|
|
51
|
+
return r && 'nested' === extras.type && extras.isRoot;
|
|
52
|
+
});
|
|
53
|
+
const rootExtras = rootModern;
|
|
54
|
+
const topLevel = rootModern ? rootExtras?.children || [] : routes;
|
|
51
55
|
const imports = [];
|
|
52
56
|
const statements = [];
|
|
53
57
|
const loaderImportMap = new Map();
|
|
@@ -66,7 +70,7 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
66
70
|
pendingImportName = (async ()=>{
|
|
67
71
|
const resolvedNoExt = await resolveRouteModuleNoExt(componentPath);
|
|
68
72
|
if (!resolvedNoExt) return null;
|
|
69
|
-
const relImport = (0, external_shared_js_namespaceObject.normalizeRelativeImport)(
|
|
73
|
+
const relImport = (0, external_shared_js_namespaceObject.normalizeRelativeImport)(external_node_path_default().relative(outDir, resolvedNoExt));
|
|
70
74
|
const componentName = `component_${componentIndex++}`;
|
|
71
75
|
imports.push(`import ${componentName} from ${(0, external_shared_js_namespaceObject.quote)(relImport)};`);
|
|
72
76
|
return componentName;
|
|
@@ -80,8 +84,8 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
80
84
|
let absNoExt;
|
|
81
85
|
if (aliasedNoExtPath.startsWith(prefix)) {
|
|
82
86
|
const rel = aliasedNoExtPath.slice(prefix.length);
|
|
83
|
-
absNoExt =
|
|
84
|
-
} else absNoExt =
|
|
87
|
+
absNoExt = external_node_path_default().join(appContext.srcDirectory, rel);
|
|
88
|
+
} else absNoExt = external_node_path_default().isAbsolute(aliasedNoExtPath) ? aliasedNoExtPath : external_node_path_default().join(appContext.srcDirectory, aliasedNoExtPath);
|
|
85
89
|
return (0, external_shared_js_namespaceObject.resolveFileNoExt)(absNoExt);
|
|
86
90
|
};
|
|
87
91
|
const getImportNamesForLoader = async (aliasedNoExtPath, inline, hasAction)=>{
|
|
@@ -93,7 +97,7 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
93
97
|
};
|
|
94
98
|
const resolvedNoExt = await resolveRouteModuleNoExt(aliasedNoExtPath);
|
|
95
99
|
if (!resolvedNoExt) return null;
|
|
96
|
-
const relImport = (0, external_shared_js_namespaceObject.normalizeRelativeImport)(
|
|
100
|
+
const relImport = (0, external_shared_js_namespaceObject.normalizeRelativeImport)(external_node_path_default().relative(outDir, resolvedNoExt));
|
|
97
101
|
const importName = `loader_${loaderIndex++}`;
|
|
98
102
|
const actionName = hasAction ? importName.replace(/^loader_/, 'action_') : null;
|
|
99
103
|
if (inline) {
|
|
@@ -115,7 +119,7 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
115
119
|
if (existing) return existing;
|
|
116
120
|
const resolvedNoExt = await resolveRouteModuleNoExt(aliasedNoExtPath);
|
|
117
121
|
if (!resolvedNoExt) return null;
|
|
118
|
-
const relImport = (0, external_shared_js_namespaceObject.normalizeRelativeImport)(
|
|
122
|
+
const relImport = (0, external_shared_js_namespaceObject.normalizeRelativeImport)(external_node_path_default().relative(outDir, resolvedNoExt));
|
|
119
123
|
const importName = 'validateSearch' === exportName ? `validateSearch_${validateSearchIndex++}` : `loaderDeps_${loaderDepsIndex++}`;
|
|
120
124
|
imports.push(`import { ${exportName} as ${importName} } from ${(0, external_shared_js_namespaceObject.quote)(relImport)};`);
|
|
121
125
|
searchContractImportMap.set(key, importName);
|
|
@@ -136,23 +140,24 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
136
140
|
const buildRoute = async (opts)=>{
|
|
137
141
|
const { parentVar, route } = opts;
|
|
138
142
|
const varName = createRouteVarName(route);
|
|
143
|
+
const routeExtras = route;
|
|
139
144
|
const loaderInfo = (0, external_shared_js_namespaceObject.pickModernLoaderModule)(route);
|
|
140
|
-
const routeAction =
|
|
145
|
+
const routeAction = routeExtras.action;
|
|
141
146
|
const loaderImports = loaderInfo ? await getImportNamesForLoader(loaderInfo.loaderPath, loaderInfo.inline, Boolean(loaderInfo.inline && routeAction === loaderInfo.loaderPath)) : null;
|
|
142
147
|
const loaderName = loaderImports?.loaderName || null;
|
|
143
148
|
const actionName = loaderImports?.actionName || null;
|
|
144
149
|
const searchContractInfo = (0, external_shared_js_namespaceObject.pickRouteSearchContractModules)(route);
|
|
145
150
|
const validateSearchName = searchContractInfo.validateSearchPath ? await getImportNameForSearchContract(searchContractInfo.validateSearchPath, 'validateSearch') : null;
|
|
146
151
|
const loaderDepsName = searchContractInfo.loaderDepsPath ? await getImportNameForSearchContract(searchContractInfo.loaderDepsPath, 'loaderDeps') : null;
|
|
147
|
-
const rawPath =
|
|
152
|
+
const rawPath = routeExtras.path;
|
|
148
153
|
const hasSplat = 'string' == typeof rawPath && rawPath.includes('*');
|
|
149
154
|
const routeOpts = [
|
|
150
155
|
`getParentRoute: () => ${parentVar},`
|
|
151
156
|
];
|
|
152
|
-
const componentName = await getImportNameForComponent(
|
|
157
|
+
const componentName = await getImportNameForComponent(routeExtras._component);
|
|
153
158
|
if (componentName) routeOpts.push(`component: ${componentName},`);
|
|
154
159
|
if ((0, external_shared_js_namespaceObject.isPathlessLayout)(route)) {
|
|
155
|
-
const id =
|
|
160
|
+
const id = routeExtras.id;
|
|
156
161
|
routeOpts.push(`id: ${(0, external_shared_js_namespaceObject.quote)(id || 'pathless')},`);
|
|
157
162
|
} else {
|
|
158
163
|
const p = (0, external_shared_js_namespaceObject.isIndexRoute)(route) ? '/' : (0, external_shared_js_namespaceObject.toTanstackPath)(rawPath || '');
|
|
@@ -162,12 +167,12 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
162
167
|
if (validateSearchName) routeOpts.push(`validateSearch: ${validateSearchName},`);
|
|
163
168
|
if (loaderDepsName) routeOpts.push(`loaderDeps: ${loaderDepsName},`);
|
|
164
169
|
const staticDataSnippet = (0, external_shared_js_namespaceObject.createRouteStaticDataSnippet)({
|
|
165
|
-
modernRouteId:
|
|
170
|
+
modernRouteId: routeExtras.id,
|
|
166
171
|
loaderName,
|
|
167
172
|
actionName
|
|
168
173
|
});
|
|
169
174
|
if (staticDataSnippet) routeOpts.push(staticDataSnippet);
|
|
170
|
-
const children =
|
|
175
|
+
const children = routeExtras.children;
|
|
171
176
|
const hasChildren = Boolean(children && children.length > 0);
|
|
172
177
|
const routeCtorVarName = hasChildren ? reserveRouteVarName(`${varName}__base`) : varName;
|
|
173
178
|
statements.push(`const ${routeCtorVarName} = createRoute({\n ${routeOpts.join('\n ')}\n});`);
|
|
@@ -182,7 +187,7 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
182
187
|
return varName;
|
|
183
188
|
};
|
|
184
189
|
const rootLoaderInfo = rootModern ? (0, external_shared_js_namespaceObject.pickModernLoaderModule)(rootModern) : null;
|
|
185
|
-
const rootAction =
|
|
190
|
+
const rootAction = rootExtras?.action;
|
|
186
191
|
const rootLoaderImports = rootLoaderInfo?.loaderPath ? await getImportNamesForLoader(rootLoaderInfo.loaderPath, rootLoaderInfo.inline, Boolean(rootLoaderInfo.inline && rootAction === rootLoaderInfo.loaderPath)) : null;
|
|
187
192
|
const rootLoaderName = rootLoaderImports?.loaderName || null;
|
|
188
193
|
const rootActionName = rootLoaderImports?.actionName || null;
|
|
@@ -195,7 +200,7 @@ async function generateTanstackRouterTypesSourceForEntry(opts) {
|
|
|
195
200
|
route
|
|
196
201
|
}));
|
|
197
202
|
const rootOpts = [];
|
|
198
|
-
const rootComponentName = await getImportNameForComponent(
|
|
203
|
+
const rootComponentName = await getImportNameForComponent(rootExtras?._component);
|
|
199
204
|
if (rootComponentName) rootOpts.push(`component: ${rootComponentName},`);
|
|
200
205
|
if (rootLoaderName) rootOpts.push(`loader: modernLoaderToTanstack({ hasSplat: false }, ${rootLoaderName}),`);
|
|
201
206
|
if (rootValidateSearchName) rootOpts.push(`validateSearch: ${rootValidateSearchName},`);
|
|
@@ -219,7 +224,7 @@ ${imports.join('\n')}
|
|
|
219
224
|
export const rootRoute = createRootRouteWithContext<ModernRouterContext>()({
|
|
220
225
|
${rootOpts.join('\n ')}
|
|
221
226
|
${(0, external_shared_js_namespaceObject.createRouteStaticDataSnippet)({
|
|
222
|
-
modernRouteId:
|
|
227
|
+
modernRouteId: rootExtras?.id,
|
|
223
228
|
loaderName: rootLoaderName,
|
|
224
229
|
actionName: rootActionName
|
|
225
230
|
}) || ''}
|
|
@@ -47,16 +47,9 @@ function wrapRouterSubscribeWithBlockState(router, getBlockNavState) {
|
|
|
47
47
|
}
|
|
48
48
|
__webpack_require__.d(__webpack_exports__, {
|
|
49
49
|
wrapRouterSubscribeWithBlockState: ()=>wrapRouterSubscribeWithBlockState
|
|
50
|
-
}, {
|
|
51
|
-
BLOCKING_STATE_SYMBOL: BLOCKING_STATE_SYMBOL,
|
|
52
|
-
BLOCKING_SUBSCRIBE_SYMBOL: BLOCKING_SUBSCRIBE_SYMBOL
|
|
53
50
|
});
|
|
54
|
-
exports.BLOCKING_STATE_SYMBOL = __webpack_exports__.BLOCKING_STATE_SYMBOL;
|
|
55
|
-
exports.BLOCKING_SUBSCRIBE_SYMBOL = __webpack_exports__.BLOCKING_SUBSCRIBE_SYMBOL;
|
|
56
51
|
exports.wrapRouterSubscribeWithBlockState = __webpack_exports__.wrapRouterSubscribeWithBlockState;
|
|
57
52
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
58
|
-
"BLOCKING_STATE_SYMBOL",
|
|
59
|
-
"BLOCKING_SUBSCRIBE_SYMBOL",
|
|
60
53
|
"wrapRouterSubscribeWithBlockState"
|
|
61
54
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
62
55
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -29,13 +29,9 @@ var __webpack_exports__ = {};
|
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
ModernRouterClient: ()=>ModernRouterClient,
|
|
32
|
-
getCachedRouteModule: ()=>getCachedRouteModule,
|
|
33
32
|
getTanstackSsrHydrationPromise: ()=>getTanstackSsrHydrationPromise,
|
|
34
|
-
getTanstackSsrHydrationRecord: ()=>getTanstackSsrHydrationRecord,
|
|
35
33
|
hasTanstackSsrHydrationRecord: ()=>hasTanstackSsrHydrationRecord,
|
|
36
|
-
hydrateTanstackRouter: ()=>hydrateTanstackRouter
|
|
37
|
-
preloadHydratedRouteComponents: ()=>preloadHydratedRouteComponents,
|
|
38
|
-
routerHydrationRecords: ()=>routerHydrationRecords
|
|
34
|
+
hydrateTanstackRouter: ()=>hydrateTanstackRouter
|
|
39
35
|
});
|
|
40
36
|
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
41
37
|
const external_react_namespaceObject = require("react");
|
|
@@ -107,22 +103,14 @@ function ModernRouterClient({ router }) {
|
|
|
107
103
|
});
|
|
108
104
|
}
|
|
109
105
|
exports.ModernRouterClient = __webpack_exports__.ModernRouterClient;
|
|
110
|
-
exports.getCachedRouteModule = __webpack_exports__.getCachedRouteModule;
|
|
111
106
|
exports.getTanstackSsrHydrationPromise = __webpack_exports__.getTanstackSsrHydrationPromise;
|
|
112
|
-
exports.getTanstackSsrHydrationRecord = __webpack_exports__.getTanstackSsrHydrationRecord;
|
|
113
107
|
exports.hasTanstackSsrHydrationRecord = __webpack_exports__.hasTanstackSsrHydrationRecord;
|
|
114
108
|
exports.hydrateTanstackRouter = __webpack_exports__.hydrateTanstackRouter;
|
|
115
|
-
exports.preloadHydratedRouteComponents = __webpack_exports__.preloadHydratedRouteComponents;
|
|
116
|
-
exports.routerHydrationRecords = __webpack_exports__.routerHydrationRecords;
|
|
117
109
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
118
110
|
"ModernRouterClient",
|
|
119
|
-
"getCachedRouteModule",
|
|
120
111
|
"getTanstackSsrHydrationPromise",
|
|
121
|
-
"getTanstackSsrHydrationRecord",
|
|
122
112
|
"hasTanstackSsrHydrationRecord",
|
|
123
|
-
"hydrateTanstackRouter"
|
|
124
|
-
"preloadHydratedRouteComponents",
|
|
125
|
-
"routerHydrationRecords"
|
|
113
|
+
"hydrateTanstackRouter"
|
|
126
114
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
127
115
|
Object.defineProperty(exports, '__esModule', {
|
|
128
116
|
value: true
|
|
@@ -29,7 +29,7 @@ var __webpack_exports__ = {};
|
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
createRouteStaticData: ()=>createRouteStaticData,
|
|
32
|
-
isAbsoluteUrl: ()=>isAbsoluteUrl,
|
|
32
|
+
isAbsoluteUrl: ()=>isAbsoluteUrl_js_namespaceObject.isAbsoluteUrl,
|
|
33
33
|
isRedirectResponse: ()=>isRedirectResponse,
|
|
34
34
|
isResponse: ()=>isResponse,
|
|
35
35
|
isTanstackRedirect: ()=>isTanstackRedirect,
|
|
@@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
throwTanstackRedirect: ()=>throwTanstackRedirect
|
|
39
39
|
});
|
|
40
40
|
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
41
|
+
const isAbsoluteUrl_js_namespaceObject = require("./shared/isAbsoluteUrl.js");
|
|
41
42
|
function isResponse(value) {
|
|
42
43
|
const record = value;
|
|
43
44
|
return null != record && 'object' == typeof record && 'number' == typeof record.status && 'object' == typeof record.headers;
|
|
@@ -55,17 +56,9 @@ function isRedirectResponse(res) {
|
|
|
55
56
|
function isTanstackRedirect(value) {
|
|
56
57
|
return isResponse(value) && 'object' == typeof value.options;
|
|
57
58
|
}
|
|
58
|
-
function isAbsoluteUrl(value) {
|
|
59
|
-
try {
|
|
60
|
-
new URL(value);
|
|
61
|
-
return true;
|
|
62
|
-
} catch {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
59
|
function throwTanstackRedirect(location) {
|
|
67
60
|
const target = location || '/';
|
|
68
|
-
if (isAbsoluteUrl(target)) throw (0, react_router_namespaceObject.redirect)({
|
|
61
|
+
if ((0, isAbsoluteUrl_js_namespaceObject.isAbsoluteUrl)(target)) throw (0, react_router_namespaceObject.redirect)({
|
|
69
62
|
href: target
|
|
70
63
|
});
|
|
71
64
|
throw (0, react_router_namespaceObject.redirect)({
|
|
@@ -29,7 +29,6 @@ var __webpack_exports__ = {};
|
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
createTanstackRouteObjects: ()=>createTanstackRouteObjects,
|
|
32
|
-
getFinalRouteConfig: ()=>getFinalRouteConfig,
|
|
33
32
|
getMergedRouterConfig: ()=>getMergedRouterConfig,
|
|
34
33
|
getTanstackRouteConfig: ()=>getTanstackRouteConfig,
|
|
35
34
|
joinBasename: ()=>joinBasename
|
|
@@ -74,13 +73,11 @@ function joinBasename(baseUrl, basename) {
|
|
|
74
73
|
return `${trimmedBase}/${trimmedBasename}`.replace(/\/{2,}/g, '/');
|
|
75
74
|
}
|
|
76
75
|
exports.createTanstackRouteObjects = __webpack_exports__.createTanstackRouteObjects;
|
|
77
|
-
exports.getFinalRouteConfig = __webpack_exports__.getFinalRouteConfig;
|
|
78
76
|
exports.getMergedRouterConfig = __webpack_exports__.getMergedRouterConfig;
|
|
79
77
|
exports.getTanstackRouteConfig = __webpack_exports__.getTanstackRouteConfig;
|
|
80
78
|
exports.joinBasename = __webpack_exports__.joinBasename;
|
|
81
79
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
82
80
|
"createTanstackRouteObjects",
|
|
83
|
-
"getFinalRouteConfig",
|
|
84
81
|
"getMergedRouterConfig",
|
|
85
82
|
"getTanstackRouteConfig",
|
|
86
83
|
"joinBasename"
|
|
@@ -1,56 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
2
|
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
tanstackRouterCompatBindings: ()=>tanstackRouterCompatBindings
|
|
32
|
-
});
|
|
33
3
|
const context_namespaceObject = require("@modern-js/runtime/context");
|
|
34
|
-
const external_dataMutation_js_namespaceObject = require("./dataMutation.js");
|
|
35
|
-
const external_outlet_js_namespaceObject = require("./outlet.js");
|
|
36
4
|
const external_plugin_js_namespaceObject = require("./plugin.js");
|
|
37
|
-
const external_prefetchLink_js_namespaceObject = require("./prefetchLink.js");
|
|
38
5
|
const tanstackRouterProviderFactory = (userConfig)=>(0, external_plugin_js_namespaceObject.tanstackRouterPlugin)(userConfig);
|
|
39
6
|
(0, context_namespaceObject.registerRouterProvider)('tanstack', tanstackRouterProviderFactory);
|
|
40
|
-
|
|
41
|
-
const tanstackRouterCompatBindings = {
|
|
42
|
-
Form: external_dataMutation_js_namespaceObject.Form,
|
|
43
|
-
Link: external_prefetchLink_js_namespaceObject.Link,
|
|
44
|
-
NavLink: external_prefetchLink_js_namespaceObject.NavLink,
|
|
45
|
-
Outlet: external_outlet_js_namespaceObject.Outlet,
|
|
46
|
-
RouteActionResponseError: external_dataMutation_js_namespaceObject.RouteActionResponseError,
|
|
47
|
-
useFetcher: external_dataMutation_js_namespaceObject.useFetcher
|
|
48
|
-
};
|
|
49
|
-
globalThis[COMPAT_BINDINGS_SLOT] ??= tanstackRouterCompatBindings;
|
|
50
|
-
exports.tanstackRouterCompatBindings = __webpack_exports__.tanstackRouterCompatBindings;
|
|
51
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
52
|
-
"tanstackRouterCompatBindings"
|
|
53
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
7
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
54
8
|
Object.defineProperty(exports, '__esModule', {
|
|
55
9
|
value: true
|
|
56
10
|
});
|
|
@@ -132,13 +132,9 @@ _REPLAYABLE_STREAM_MARKER = REPLAYABLE_STREAM_MARKER;
|
|
|
132
132
|
var _REPLAYABLE_STREAM_MARKER;
|
|
133
133
|
__webpack_require__.d(__webpack_exports__, {
|
|
134
134
|
ReplayableStream: ()=>ReplayableStream
|
|
135
|
-
}, {
|
|
136
|
-
REPLAYABLE_STREAM_MARKER: REPLAYABLE_STREAM_MARKER
|
|
137
135
|
});
|
|
138
|
-
exports.REPLAYABLE_STREAM_MARKER = __webpack_exports__.REPLAYABLE_STREAM_MARKER;
|
|
139
136
|
exports.ReplayableStream = __webpack_exports__.ReplayableStream;
|
|
140
137
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
141
|
-
"REPLAYABLE_STREAM_MARKER",
|
|
142
138
|
"ReplayableStream"
|
|
143
139
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
144
140
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -30,13 +30,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
__setTanstackRscPayloadDecoderForTests: ()=>__setTanstackRscPayloadDecoderForTests,
|
|
32
32
|
createPayloadFetchKey: ()=>createPayloadFetchKey,
|
|
33
|
-
decodePayload: ()=>decodePayload,
|
|
34
33
|
fetchTanstackRscPayload: ()=>fetchTanstackRscPayload,
|
|
35
|
-
isAbsoluteUrl: ()=>isAbsoluteUrl,
|
|
36
|
-
isServerPayload: ()=>isServerPayload,
|
|
34
|
+
isAbsoluteUrl: ()=>isAbsoluteUrl_js_namespaceObject.isAbsoluteUrl,
|
|
37
35
|
payloadFetchCache: ()=>payloadFetchCache
|
|
38
36
|
});
|
|
39
37
|
const react_router_namespaceObject = require("@tanstack/react-router");
|
|
38
|
+
const isAbsoluteUrl_js_namespaceObject = require("../shared/isAbsoluteUrl.js");
|
|
40
39
|
const external_flightSerialization_js_namespaceObject = require("./flightSerialization.js");
|
|
41
40
|
const payloadFetchCache = new Map();
|
|
42
41
|
let payloadDecoder;
|
|
@@ -57,14 +56,6 @@ function createPayloadFetchKey(request) {
|
|
|
57
56
|
].sort(([left], [right])=>left.localeCompare(right))
|
|
58
57
|
]);
|
|
59
58
|
}
|
|
60
|
-
function isAbsoluteUrl(value) {
|
|
61
|
-
try {
|
|
62
|
-
new URL(value);
|
|
63
|
-
return true;
|
|
64
|
-
} catch {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
59
|
async function fetchTanstackRscPayload(request) {
|
|
69
60
|
const headers = new Headers(request.headers);
|
|
70
61
|
headers.set('x-rsc-tree', 'true');
|
|
@@ -76,7 +67,7 @@ async function fetchTanstackRscPayload(request) {
|
|
|
76
67
|
});
|
|
77
68
|
const redirectLocation = response.headers.get('X-Modernjs-Redirect');
|
|
78
69
|
if (redirectLocation) {
|
|
79
|
-
if (isAbsoluteUrl(redirectLocation)) throw (0, react_router_namespaceObject.redirect)({
|
|
70
|
+
if ((0, isAbsoluteUrl_js_namespaceObject.isAbsoluteUrl)(redirectLocation)) throw (0, react_router_namespaceObject.redirect)({
|
|
80
71
|
headers: response.headers,
|
|
81
72
|
href: redirectLocation,
|
|
82
73
|
statusCode: response.status
|
|
@@ -99,18 +90,14 @@ function __setTanstackRscPayloadDecoderForTests(decoder) {
|
|
|
99
90
|
}
|
|
100
91
|
exports.__setTanstackRscPayloadDecoderForTests = __webpack_exports__.__setTanstackRscPayloadDecoderForTests;
|
|
101
92
|
exports.createPayloadFetchKey = __webpack_exports__.createPayloadFetchKey;
|
|
102
|
-
exports.decodePayload = __webpack_exports__.decodePayload;
|
|
103
93
|
exports.fetchTanstackRscPayload = __webpack_exports__.fetchTanstackRscPayload;
|
|
104
94
|
exports.isAbsoluteUrl = __webpack_exports__.isAbsoluteUrl;
|
|
105
|
-
exports.isServerPayload = __webpack_exports__.isServerPayload;
|
|
106
95
|
exports.payloadFetchCache = __webpack_exports__.payloadFetchCache;
|
|
107
96
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
108
97
|
"__setTanstackRscPayloadDecoderForTests",
|
|
109
98
|
"createPayloadFetchKey",
|
|
110
|
-
"decodePayload",
|
|
111
99
|
"fetchTanstackRscPayload",
|
|
112
100
|
"isAbsoluteUrl",
|
|
113
|
-
"isServerPayload",
|
|
114
101
|
"payloadFetchCache"
|
|
115
102
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
116
103
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -78,28 +78,16 @@ function toPayloadRoute(match) {
|
|
|
78
78
|
}
|
|
79
79
|
__webpack_require__.d(__webpack_exports__, {
|
|
80
80
|
getRouteId: ()=>getRouteId,
|
|
81
|
-
getRouteParentId: ()=>getRouteParentId,
|
|
82
|
-
getRouteStaticData: ()=>getRouteStaticData,
|
|
83
81
|
toPayloadRoute: ()=>toPayloadRoute,
|
|
84
|
-
toPlainLocation: ()=>toPlainLocation
|
|
85
|
-
toPlainRecord: ()=>toPlainRecord,
|
|
86
|
-
toRoutePath: ()=>toRoutePath
|
|
82
|
+
toPlainLocation: ()=>toPlainLocation
|
|
87
83
|
});
|
|
88
84
|
exports.getRouteId = __webpack_exports__.getRouteId;
|
|
89
|
-
exports.getRouteParentId = __webpack_exports__.getRouteParentId;
|
|
90
|
-
exports.getRouteStaticData = __webpack_exports__.getRouteStaticData;
|
|
91
85
|
exports.toPayloadRoute = __webpack_exports__.toPayloadRoute;
|
|
92
86
|
exports.toPlainLocation = __webpack_exports__.toPlainLocation;
|
|
93
|
-
exports.toPlainRecord = __webpack_exports__.toPlainRecord;
|
|
94
|
-
exports.toRoutePath = __webpack_exports__.toRoutePath;
|
|
95
87
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
96
88
|
"getRouteId",
|
|
97
|
-
"getRouteParentId",
|
|
98
|
-
"getRouteStaticData",
|
|
99
89
|
"toPayloadRoute",
|
|
100
|
-
"toPlainLocation"
|
|
101
|
-
"toPlainRecord",
|
|
102
|
-
"toRoutePath"
|
|
90
|
+
"toPlainLocation"
|
|
103
91
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
104
92
|
Object.defineProperty(exports, '__esModule', {
|
|
105
93
|
value: true
|
|
@@ -31,8 +31,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
31
|
EmptyFallback: ()=>EmptyFallback,
|
|
32
32
|
TANSTACK_RSC_FLIGHT_VALUE: ()=>TANSTACK_RSC_FLIGHT_VALUE,
|
|
33
33
|
isSerializedTanstackRscFlightValue: ()=>isSerializedTanstackRscFlightValue,
|
|
34
|
-
renderSelectedTree: ()=>renderSelectedTree
|
|
35
|
-
selectTreePath: ()=>selectTreePath
|
|
34
|
+
renderSelectedTree: ()=>renderSelectedTree
|
|
36
35
|
});
|
|
37
36
|
const external_symbols_js_namespaceObject = require("./symbols.js");
|
|
38
37
|
const TANSTACK_RSC_FLIGHT_VALUE = '__modernTanstackRsc';
|
|
@@ -58,13 +57,11 @@ exports.EmptyFallback = __webpack_exports__.EmptyFallback;
|
|
|
58
57
|
exports.TANSTACK_RSC_FLIGHT_VALUE = __webpack_exports__.TANSTACK_RSC_FLIGHT_VALUE;
|
|
59
58
|
exports.isSerializedTanstackRscFlightValue = __webpack_exports__.isSerializedTanstackRscFlightValue;
|
|
60
59
|
exports.renderSelectedTree = __webpack_exports__.renderSelectedTree;
|
|
61
|
-
exports.selectTreePath = __webpack_exports__.selectTreePath;
|
|
62
60
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
61
|
"EmptyFallback",
|
|
64
62
|
"TANSTACK_RSC_FLIGHT_VALUE",
|
|
65
63
|
"isSerializedTanstackRscFlightValue",
|
|
66
|
-
"renderSelectedTree"
|
|
67
|
-
"selectTreePath"
|
|
64
|
+
"renderSelectedTree"
|
|
68
65
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
69
66
|
Object.defineProperty(exports, '__esModule', {
|
|
70
67
|
value: true
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
function isAbsoluteUrl(value) {
|
|
31
|
+
try {
|
|
32
|
+
new URL(value);
|
|
33
|
+
return true;
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
+
isAbsoluteUrl: ()=>isAbsoluteUrl
|
|
40
|
+
});
|
|
41
|
+
exports.isAbsoluteUrl = __webpack_exports__.isAbsoluteUrl;
|
|
42
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
43
|
+
"isAbsoluteUrl"
|
|
44
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
45
|
+
Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -3,10 +3,10 @@ import { NESTED_ROUTE_SPEC_FILE, filterRoutesForServer } from "@modern-js/utils"
|
|
|
3
3
|
import { generateTanstackRouteArtifacts, writeTanstackRegisterFile, writeTanstackRouterTypesForEntries } from "./artifacts.mjs";
|
|
4
4
|
import { createTanstackRsbuildRouteSplittingProfile, resolveTanstackRouteCodeSplittingEnabled } from "./routeSplitting.mjs";
|
|
5
5
|
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
6
|
-
import * as
|
|
6
|
+
import * as __rspack_external__modern_js_runtime_cli_d0edd589 from "@modern-js/runtime/cli";
|
|
7
7
|
__webpack_require__.add({
|
|
8
|
-
|
|
9
|
-
module.exports =
|
|
8
|
+
3203 (module) {
|
|
9
|
+
module.exports = __rspack_external__modern_js_runtime_cli_d0edd589;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
const DEFAULT_ROUTES_DIR = 'routes';
|
|
@@ -15,7 +15,7 @@ const ENTRYPOINTS_KEY = '@modern-js/plugin-tanstack';
|
|
|
15
15
|
let runtimeRouterCli;
|
|
16
16
|
function getRuntimeRouterCli() {
|
|
17
17
|
if (runtimeRouterCli) return runtimeRouterCli;
|
|
18
|
-
const cli = __webpack_require__(
|
|
18
|
+
const cli = __webpack_require__(3203);
|
|
19
19
|
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner && cli.updateNestedRoutesSpec) {
|
|
20
20
|
runtimeRouterCli = cli;
|
|
21
21
|
return runtimeRouterCli;
|
|
@@ -10,18 +10,6 @@ const JS_OR_TS_EXTS = [
|
|
|
10
10
|
'.cjs',
|
|
11
11
|
'.cts'
|
|
12
12
|
];
|
|
13
|
-
function toTanstackPath(pathname) {
|
|
14
|
-
return pathname.split('/').map((segment)=>{
|
|
15
|
-
if (!segment) return segment;
|
|
16
|
-
if ('*' === segment) return '$';
|
|
17
|
-
if (segment.startsWith(':')) {
|
|
18
|
-
const name = segment.slice(1);
|
|
19
|
-
if (name.endsWith('?')) return `{-$${name.slice(0, -1)}}`;
|
|
20
|
-
return `$${name}`;
|
|
21
|
-
}
|
|
22
|
-
return segment;
|
|
23
|
-
}).join('/');
|
|
24
|
-
}
|
|
25
13
|
async function resolveFileNoExt(inputNoExtPath) {
|
|
26
14
|
const file = findExists(JS_OR_TS_EXTS.map((ext)=>`${inputNoExtPath}${ext}`));
|
|
27
15
|
return file ? getPathWithoutExt(file) : null;
|
|
@@ -35,27 +23,31 @@ function normalizeRelativeImport(p) {
|
|
|
35
23
|
return `./${normalized}`;
|
|
36
24
|
}
|
|
37
25
|
function pickModernLoaderModule(route) {
|
|
38
|
-
const
|
|
26
|
+
const extras = route;
|
|
27
|
+
const loaderPath = extras.data || extras.loader;
|
|
39
28
|
if (!loaderPath || 'string' != typeof loaderPath) return null;
|
|
40
|
-
const inline = Boolean(
|
|
29
|
+
const inline = Boolean(extras.data);
|
|
41
30
|
return {
|
|
42
31
|
loaderPath,
|
|
43
32
|
inline
|
|
44
33
|
};
|
|
45
34
|
}
|
|
46
35
|
function pickRouteSearchContractModules(route) {
|
|
47
|
-
const
|
|
48
|
-
const
|
|
36
|
+
const extras = route;
|
|
37
|
+
const validateSearchPath = extras.validateSearch;
|
|
38
|
+
const loaderDepsPath = extras.loaderDeps;
|
|
49
39
|
return {
|
|
50
40
|
validateSearchPath: 'string' == typeof validateSearchPath ? validateSearchPath : null,
|
|
51
41
|
loaderDepsPath: 'string' == typeof loaderDepsPath ? loaderDepsPath : null
|
|
52
42
|
};
|
|
53
43
|
}
|
|
54
44
|
function isPathlessLayout(route) {
|
|
55
|
-
|
|
45
|
+
const extras = route;
|
|
46
|
+
return 'nested' === extras.type && 'boolean' != typeof extras.index && void 0 === extras.path;
|
|
56
47
|
}
|
|
57
48
|
function isIndexRoute(route) {
|
|
58
|
-
|
|
49
|
+
const extras = route;
|
|
50
|
+
return 'nested' === extras.type && Boolean(extras.index);
|
|
59
51
|
}
|
|
60
52
|
function createRouteStaticDataSnippet(opts) {
|
|
61
53
|
const staticDataLines = [];
|
|
@@ -65,4 +57,5 @@ function createRouteStaticDataSnippet(opts) {
|
|
|
65
57
|
if (!staticDataLines.length) return null;
|
|
66
58
|
return `staticData: createRouteStaticData({\n ${staticDataLines.join('\n ')}\n }),`;
|
|
67
59
|
}
|
|
68
|
-
export {
|
|
60
|
+
export { toTanstackPath } from "../../runtime/routeTree/paths.mjs";
|
|
61
|
+
export { createRouteStaticDataSnippet, isIndexRoute, isPathlessLayout, normalizeRelativeImport, pickModernLoaderModule, pickRouteSearchContractModules, quote, resolveFileNoExt };
|