@bleedingdev/modern-js-plugin-tanstack 3.4.0-ultramodern.2 → 3.4.0-ultramodern.3
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/index.js
CHANGED
|
@@ -73,7 +73,7 @@ var __webpack_exports__ = {};
|
|
|
73
73
|
function getRuntimeRouterCli() {
|
|
74
74
|
if (runtimeRouterCli) return runtimeRouterCli;
|
|
75
75
|
const cli = __webpack_require__("@modern-js/runtime/cli");
|
|
76
|
-
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner) {
|
|
76
|
+
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner && cli.updateNestedRoutesSpec) {
|
|
77
77
|
runtimeRouterCli = cli;
|
|
78
78
|
return runtimeRouterCli;
|
|
79
79
|
}
|
|
@@ -284,11 +284,8 @@ ${canonicalRoutesAugmentation}`;
|
|
|
284
284
|
if (isTanstackEntrypoint(entrypoint)) {
|
|
285
285
|
const { distDirectory } = api.getAppContext();
|
|
286
286
|
const nestedRoutesSpecPath = external_node_path_default().resolve(distDirectory, utils_namespaceObject.NESTED_ROUTE_SPEC_FILE);
|
|
287
|
-
const
|
|
288
|
-
await
|
|
289
|
-
...existingNestedRoutes,
|
|
290
|
-
...nestedRoutesForServer
|
|
291
|
-
});
|
|
287
|
+
const { updateNestedRoutesSpec } = getRuntimeRouterCli();
|
|
288
|
+
await updateNestedRoutesSpec(nestedRoutesSpecPath, nestedRoutesForServer);
|
|
292
289
|
}
|
|
293
290
|
return {
|
|
294
291
|
entrypoint,
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ let runtimeRouterCli;
|
|
|
16
16
|
function getRuntimeRouterCli() {
|
|
17
17
|
if (runtimeRouterCli) return runtimeRouterCli;
|
|
18
18
|
const cli = __webpack_require__(2320);
|
|
19
|
-
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner) {
|
|
19
|
+
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner && cli.updateNestedRoutesSpec) {
|
|
20
20
|
runtimeRouterCli = cli;
|
|
21
21
|
return runtimeRouterCli;
|
|
22
22
|
}
|
|
@@ -227,11 +227,8 @@ function tanstackRouterPlugin(options = {}) {
|
|
|
227
227
|
if (isTanstackEntrypoint(entrypoint)) {
|
|
228
228
|
const { distDirectory } = api.getAppContext();
|
|
229
229
|
const nestedRoutesSpecPath = node_path.resolve(distDirectory, NESTED_ROUTE_SPEC_FILE);
|
|
230
|
-
const
|
|
231
|
-
await
|
|
232
|
-
...existingNestedRoutes,
|
|
233
|
-
...nestedRoutesForServer
|
|
234
|
-
});
|
|
230
|
+
const { updateNestedRoutesSpec } = getRuntimeRouterCli();
|
|
231
|
+
await updateNestedRoutesSpec(nestedRoutesSpecPath, nestedRoutesForServer);
|
|
235
232
|
}
|
|
236
233
|
return {
|
|
237
234
|
entrypoint,
|
|
@@ -20,7 +20,7 @@ let runtimeRouterCli;
|
|
|
20
20
|
function getRuntimeRouterCli() {
|
|
21
21
|
if (runtimeRouterCli) return runtimeRouterCli;
|
|
22
22
|
const cli = __webpack_require__("@modern-js/runtime/cli?9b14");
|
|
23
|
-
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner) {
|
|
23
|
+
if (cli.handleGeneratorEntryCode && cli.getEntrypointRoutesDir && cli.getEntrypointRoutesOwner && cli.updateNestedRoutesSpec) {
|
|
24
24
|
runtimeRouterCli = cli;
|
|
25
25
|
return runtimeRouterCli;
|
|
26
26
|
}
|
|
@@ -231,11 +231,8 @@ function tanstackRouterPlugin(options = {}) {
|
|
|
231
231
|
if (isTanstackEntrypoint(entrypoint)) {
|
|
232
232
|
const { distDirectory } = api.getAppContext();
|
|
233
233
|
const nestedRoutesSpecPath = node_path.resolve(distDirectory, NESTED_ROUTE_SPEC_FILE);
|
|
234
|
-
const
|
|
235
|
-
await
|
|
236
|
-
...existingNestedRoutes,
|
|
237
|
-
...nestedRoutesForServer
|
|
238
|
-
});
|
|
234
|
+
const { updateNestedRoutesSpec } = getRuntimeRouterCli();
|
|
235
|
+
await updateNestedRoutesSpec(nestedRoutesSpecPath, nestedRoutesForServer);
|
|
239
236
|
}
|
|
240
237
|
return {
|
|
241
238
|
entrypoint,
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"modern.js",
|
|
19
19
|
"tanstack-router"
|
|
20
20
|
],
|
|
21
|
-
"version": "3.4.0-ultramodern.
|
|
21
|
+
"version": "3.4.0-ultramodern.3",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"@swc/helpers": "^0.5.23",
|
|
78
78
|
"@tanstack/react-router": "1.170.16",
|
|
79
79
|
"@tanstack/router-core": "1.171.13",
|
|
80
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.4.0-ultramodern.
|
|
81
|
-
"@modern-js/
|
|
82
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.4.0-ultramodern.
|
|
83
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.4.0-ultramodern.
|
|
80
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.4.0-ultramodern.3",
|
|
81
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.4.0-ultramodern.3",
|
|
82
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.4.0-ultramodern.3",
|
|
83
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.4.0-ultramodern.3"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@modern-js/runtime": "3.4.0-ultramodern.
|
|
86
|
+
"@modern-js/runtime": "3.4.0-ultramodern.3",
|
|
87
87
|
"react": "^19.2.7",
|
|
88
88
|
"react-dom": "^19.2.7"
|
|
89
89
|
},
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@typescript/native-preview": "7.0.0-dev.20260624.1",
|
|
99
99
|
"react": "^19.2.7",
|
|
100
100
|
"react-dom": "^19.2.7",
|
|
101
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.4.0-ultramodern.
|
|
102
|
-
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.4.0-ultramodern.
|
|
101
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.4.0-ultramodern.3",
|
|
102
|
+
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.4.0-ultramodern.3",
|
|
103
103
|
"@scripts/rstest-config": "2.66.0"
|
|
104
104
|
},
|
|
105
105
|
"sideEffects": [
|
package/src/cli/index.ts
CHANGED
|
@@ -83,6 +83,10 @@ type RuntimeRouterCliHelpers = {
|
|
|
83
83
|
},
|
|
84
84
|
) => Promise<Entrypoint[]>;
|
|
85
85
|
isRouteEntry: (dir: string, routesDir?: string) => string | false;
|
|
86
|
+
updateNestedRoutesSpec: (
|
|
87
|
+
specPath: string,
|
|
88
|
+
nextRoutes: Record<string, unknown>,
|
|
89
|
+
) => Promise<void>;
|
|
86
90
|
};
|
|
87
91
|
|
|
88
92
|
let runtimeRouterCli: RuntimeRouterCliHelpers | undefined;
|
|
@@ -97,7 +101,8 @@ function getRuntimeRouterCli(): RuntimeRouterCliHelpers {
|
|
|
97
101
|
if (
|
|
98
102
|
cli.handleGeneratorEntryCode &&
|
|
99
103
|
cli.getEntrypointRoutesDir &&
|
|
100
|
-
cli.getEntrypointRoutesOwner
|
|
104
|
+
cli.getEntrypointRoutesOwner &&
|
|
105
|
+
cli.updateNestedRoutesSpec
|
|
101
106
|
) {
|
|
102
107
|
runtimeRouterCli = cli as RuntimeRouterCliHelpers;
|
|
103
108
|
return runtimeRouterCli;
|
|
@@ -497,19 +502,11 @@ export function tanstackRouterPlugin(
|
|
|
497
502
|
distDirectory,
|
|
498
503
|
NESTED_ROUTE_SPEC_FILE,
|
|
499
504
|
);
|
|
500
|
-
const
|
|
505
|
+
const { updateNestedRoutesSpec } = getRuntimeRouterCli();
|
|
506
|
+
await updateNestedRoutesSpec(
|
|
501
507
|
nestedRoutesSpecPath,
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
string,
|
|
505
|
-
unknown
|
|
506
|
-
>)
|
|
507
|
-
: {};
|
|
508
|
-
|
|
509
|
-
await fs.outputJSON(nestedRoutesSpecPath, {
|
|
510
|
-
...existingNestedRoutes,
|
|
511
|
-
...nestedRoutesForServer,
|
|
512
|
-
});
|
|
508
|
+
nestedRoutesForServer,
|
|
509
|
+
);
|
|
513
510
|
}
|
|
514
511
|
|
|
515
512
|
return {
|
package/tests/router/cli.test.ts
CHANGED
|
@@ -57,6 +57,18 @@ rstest.mock('@modern-js/runtime/cli', () => {
|
|
|
57
57
|
const routesEntry = path.join(dir, routesDir);
|
|
58
58
|
return fs.existsSync(routesEntry) ? routesEntry : false;
|
|
59
59
|
},
|
|
60
|
+
updateNestedRoutesSpec: async (
|
|
61
|
+
specPath: string,
|
|
62
|
+
nextRoutes: Record<string, unknown>,
|
|
63
|
+
) => {
|
|
64
|
+
const existingRoutes = fs.existsSync(specPath)
|
|
65
|
+
? await fs.readJSON(specPath)
|
|
66
|
+
: {};
|
|
67
|
+
await fs.outputJSON(specPath, {
|
|
68
|
+
...existingRoutes,
|
|
69
|
+
...nextRoutes,
|
|
70
|
+
});
|
|
71
|
+
},
|
|
60
72
|
};
|
|
61
73
|
});
|
|
62
74
|
|
|
@@ -279,9 +279,14 @@ describe('tanstack router type generation', () => {
|
|
|
279
279
|
);
|
|
280
280
|
|
|
281
281
|
await expect(
|
|
282
|
-
execFileAsync(
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
execFileAsync(
|
|
283
|
+
process.platform === 'win32' ? 'tsgo.cmd' : 'tsgo',
|
|
284
|
+
['--noEmit', '-p', 'tsconfig.json'],
|
|
285
|
+
{
|
|
286
|
+
cwd: tempDir,
|
|
287
|
+
shell: process.platform === 'win32',
|
|
288
|
+
},
|
|
289
|
+
),
|
|
285
290
|
).resolves.toBeDefined();
|
|
286
291
|
});
|
|
287
292
|
|