@bleedingdev/modern-js-plugin-tanstack 3.9.0-ultramodern.20 → 3.9.0-ultramodern.21
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.
|
@@ -52,7 +52,7 @@ const ROUTE_METADATA_MANIFEST_HEADER = `// @generated by @modern-js/plugin-tanst
|
|
|
52
52
|
const PRINT_WIDTH = 120;
|
|
53
53
|
const MANIFEST_BODY = `export const ultramodernLocalisedUrls = Object.fromEntries(
|
|
54
54
|
ultramodernRouteMetadata
|
|
55
|
-
.filter((route) => route.canonicalPath !== '/')
|
|
55
|
+
.filter((route: { canonicalPath: string }) => route.canonicalPath !== '/')
|
|
56
56
|
.map((route) => [route.canonicalPath, route.localisedPaths]),
|
|
57
57
|
);
|
|
58
58
|
export const ultramodernPublicRoutes = ultramodernRouteMetadata
|
|
@@ -6,7 +6,7 @@ const ROUTE_METADATA_MANIFEST_HEADER = `// @generated by @modern-js/plugin-tanst
|
|
|
6
6
|
const PRINT_WIDTH = 120;
|
|
7
7
|
const MANIFEST_BODY = `export const ultramodernLocalisedUrls = Object.fromEntries(
|
|
8
8
|
ultramodernRouteMetadata
|
|
9
|
-
.filter((route) => route.canonicalPath !== '/')
|
|
9
|
+
.filter((route: { canonicalPath: string }) => route.canonicalPath !== '/')
|
|
10
10
|
.map((route) => [route.canonicalPath, route.localisedPaths]),
|
|
11
11
|
);
|
|
12
12
|
export const ultramodernPublicRoutes = ultramodernRouteMetadata
|
|
@@ -7,7 +7,7 @@ const ROUTE_METADATA_MANIFEST_HEADER = `// @generated by @modern-js/plugin-tanst
|
|
|
7
7
|
const PRINT_WIDTH = 120;
|
|
8
8
|
const MANIFEST_BODY = `export const ultramodernLocalisedUrls = Object.fromEntries(
|
|
9
9
|
ultramodernRouteMetadata
|
|
10
|
-
.filter((route) => route.canonicalPath !== '/')
|
|
10
|
+
.filter((route: { canonicalPath: string }) => route.canonicalPath !== '/')
|
|
11
11
|
.map((route) => [route.canonicalPath, route.localisedPaths]),
|
|
12
12
|
);
|
|
13
13
|
export const ultramodernPublicRoutes = ultramodernRouteMetadata
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"modern.js",
|
|
19
19
|
"tanstack-router"
|
|
20
20
|
],
|
|
21
|
-
"version": "3.9.0-ultramodern.
|
|
21
|
+
"version": "3.9.0-ultramodern.21",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20"
|
|
24
24
|
},
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.0-ultramodern.
|
|
98
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
99
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
100
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.
|
|
101
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
102
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
97
|
+
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.0-ultramodern.21",
|
|
98
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.21",
|
|
99
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.21",
|
|
100
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.21",
|
|
101
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.21",
|
|
102
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.21",
|
|
103
103
|
"@swc/helpers": "^0.5.23",
|
|
104
104
|
"@tanstack/react-router": "1.170.39",
|
|
105
105
|
"@tanstack/router-core": "1.171.32"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
|
-
"@modern-js/app-tools": "3.9.0-ultramodern.
|
|
109
|
-
"@modern-js/runtime": "3.9.0-ultramodern.
|
|
108
|
+
"@modern-js/app-tools": "3.9.0-ultramodern.21",
|
|
109
|
+
"@modern-js/runtime": "3.9.0-ultramodern.21",
|
|
110
110
|
"react": "^19.2.8",
|
|
111
111
|
"react-dom": "^19.2.8",
|
|
112
112
|
"react-server-dom-rspack": "0.1.0"
|
|
@@ -117,9 +117,9 @@
|
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.
|
|
121
|
-
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.
|
|
122
|
-
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.
|
|
120
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.21",
|
|
121
|
+
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.21",
|
|
122
|
+
"@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.9.0-ultramodern.21",
|
|
123
123
|
"@rslib/core": "1.0.2",
|
|
124
124
|
"@scripts/rstest-config": "2.66.0",
|
|
125
125
|
"@tanstack/history": "1.162.4",
|
package/src/cli/routeMetadata.ts
CHANGED
|
@@ -15,7 +15,7 @@ const PRINT_WIDTH = 120;
|
|
|
15
15
|
|
|
16
16
|
const MANIFEST_BODY = `export const ultramodernLocalisedUrls = Object.fromEntries(
|
|
17
17
|
ultramodernRouteMetadata
|
|
18
|
-
.filter((route) => route.canonicalPath !== '/')
|
|
18
|
+
.filter((route: { canonicalPath: string }) => route.canonicalPath !== '/')
|
|
19
19
|
.map((route) => [route.canonicalPath, route.localisedPaths]),
|
|
20
20
|
);
|
|
21
21
|
export const ultramodernPublicRoutes = ultramodernRouteMetadata
|
|
@@ -1,9 +1,59 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
1
2
|
import fs from 'node:fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
2
4
|
import os from 'node:os';
|
|
3
5
|
import path from 'node:path';
|
|
4
6
|
import { writeRouteMetadataManifest } from '../../src/cli/artifacts';
|
|
5
7
|
import { renderRouteMetadataManifest } from '../../src/cli/routeMetadata';
|
|
6
8
|
|
|
9
|
+
const requireCjs = createRequire(import.meta.url);
|
|
10
|
+
|
|
11
|
+
const typedRouteMeta = (canonicalPath: string) => `export const routeMeta = {
|
|
12
|
+
canonicalPath: '${canonicalPath}',
|
|
13
|
+
descriptionKey: 'contacts.description',
|
|
14
|
+
id: 'contacts',
|
|
15
|
+
indexable: false,
|
|
16
|
+
localisedPaths: { cs: '/kontakty', en: '${canonicalPath}' },
|
|
17
|
+
namespace: 'contacts',
|
|
18
|
+
ownerAppId: 'contacts',
|
|
19
|
+
public: false,
|
|
20
|
+
titleKey: 'contacts.title',
|
|
21
|
+
} as const;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const typecheck = (directory: string) => {
|
|
25
|
+
fs.writeFileSync(
|
|
26
|
+
path.join(directory, 'tsconfig.json'),
|
|
27
|
+
JSON.stringify({
|
|
28
|
+
compilerOptions: {
|
|
29
|
+
lib: ['ESNext'],
|
|
30
|
+
module: 'ESNext',
|
|
31
|
+
moduleResolution: 'Bundler',
|
|
32
|
+
noEmit: true,
|
|
33
|
+
strict: true,
|
|
34
|
+
target: 'ES2024',
|
|
35
|
+
types: [],
|
|
36
|
+
},
|
|
37
|
+
include: ['src/routes/ultramodern-route-metadata.ts'],
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
const compilerManifestPath = requireCjs.resolve(
|
|
41
|
+
'@typescript/native-preview/package.json',
|
|
42
|
+
);
|
|
43
|
+
const { bin } = JSON.parse(fs.readFileSync(compilerManifestPath, 'utf8')) as {
|
|
44
|
+
bin: { tsgo: string };
|
|
45
|
+
};
|
|
46
|
+
return spawnSync(
|
|
47
|
+
process.execPath,
|
|
48
|
+
[
|
|
49
|
+
path.resolve(path.dirname(compilerManifestPath), bin.tsgo),
|
|
50
|
+
'--project',
|
|
51
|
+
path.join(directory, 'tsconfig.json'),
|
|
52
|
+
],
|
|
53
|
+
{ encoding: 'utf8' },
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
7
57
|
const routeMeta = (id: string) =>
|
|
8
58
|
`export const routeMeta = { id: '${id}', namespace: 'shop' } as const;\n`;
|
|
9
59
|
|
|
@@ -16,7 +66,7 @@ export const ultramodernRouteNamespace = route0.namespace;
|
|
|
16
66
|
export const ultramodernRouteMetadata = [route0, route1, route2] as const;
|
|
17
67
|
export const ultramodernLocalisedUrls = Object.fromEntries(
|
|
18
68
|
ultramodernRouteMetadata
|
|
19
|
-
.filter((route) => route.canonicalPath !== '/')
|
|
69
|
+
.filter((route: { canonicalPath: string }) => route.canonicalPath !== '/')
|
|
20
70
|
.map((route) => [route.canonicalPath, route.localisedPaths]),
|
|
21
71
|
);
|
|
22
72
|
export const ultramodernPublicRoutes = ultramodernRouteMetadata
|
|
@@ -91,6 +141,18 @@ describe('route metadata manifest', () => {
|
|
|
91
141
|
expect(fs.statSync(manifestPath).mtimeMs).toBe(writtenAt);
|
|
92
142
|
});
|
|
93
143
|
|
|
144
|
+
// Every route literal is narrowed by `as const`. An app whose only route is
|
|
145
|
+
// not the root must still type-check the root-path filter.
|
|
146
|
+
it('type-checks a manifest whose only route is not the root', async () => {
|
|
147
|
+
write('[lang]/contacts/route.meta.ts', typedRouteMeta('/contacts'));
|
|
148
|
+
await writeRouteMetadataManifest({ appDirectory });
|
|
149
|
+
|
|
150
|
+
const result = typecheck(appDirectory);
|
|
151
|
+
|
|
152
|
+
expect(result.error).toBeUndefined();
|
|
153
|
+
expect(result.status, `${result.stdout}\n${result.stderr}`).toBe(0);
|
|
154
|
+
});
|
|
155
|
+
|
|
94
156
|
it('drops deleted route metadata from an existing manifest', async () => {
|
|
95
157
|
write('[lang]/route.meta.ts', routeMeta('home'));
|
|
96
158
|
write('[lang]/gone/route.meta.ts', routeMeta('gone'));
|