create-windy 0.2.27 → 0.2.29
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/cli.js
CHANGED
|
@@ -4336,7 +4336,9 @@ var recipes = [
|
|
|
4336
4336
|
{ id: "starter-0.2.23-to-0.2.24", from: "0.2.23", to: "0.2.24" },
|
|
4337
4337
|
{ id: "starter-0.2.24-to-0.2.25", from: "0.2.24", to: "0.2.25" },
|
|
4338
4338
|
{ id: "starter-0.2.25-to-0.2.26", from: "0.2.25", to: "0.2.26" },
|
|
4339
|
-
{ id: "starter-0.2.26-to-0.2.27", from: "0.2.26", to: "0.2.27" }
|
|
4339
|
+
{ id: "starter-0.2.26-to-0.2.27", from: "0.2.26", to: "0.2.27" },
|
|
4340
|
+
{ id: "starter-0.2.27-to-0.2.28", from: "0.2.27", to: "0.2.28" },
|
|
4341
|
+
{ id: "starter-0.2.28-to-0.2.29", from: "0.2.28", to: "0.2.29" }
|
|
4340
4342
|
];
|
|
4341
4343
|
function resolveRecipeChain(sourceVersion, targetVersion) {
|
|
4342
4344
|
if (sourceVersion === targetVersion)
|
|
@@ -4431,6 +4433,17 @@ import { join as join16 } from "node:path";
|
|
|
4431
4433
|
import { createHash as createHash2 } from "node:crypto";
|
|
4432
4434
|
var wrongTextVersions = new Set(["0.2.12", "0.2.13"]);
|
|
4433
4435
|
var formattedBaselineVersions = new Set(["0.2.14", "0.2.15"]);
|
|
4436
|
+
var known026DownstreamHashes = new Map([
|
|
4437
|
+
[
|
|
4438
|
+
"apps/server/src/module-bootstrap.ts",
|
|
4439
|
+
"4b79ab5d0271b3111c7cb546e0b581d483da8c5de263f8d2f9671d53f60c5099"
|
|
4440
|
+
],
|
|
4441
|
+
[
|
|
4442
|
+
"apps/web/src/router/router-test-fixtures.ts",
|
|
4443
|
+
"e498fa34cf6ab6dbabf014ec11233772f30995dceab250ff4f993323834ebc82"
|
|
4444
|
+
]
|
|
4445
|
+
]);
|
|
4446
|
+
var known026RouterHash = "55a60a28d7a8e88386a38cab763b1eac43d66a11e60b84a21acefacc29c6f44d";
|
|
4434
4447
|
var known023DownstreamHashes = new Map([
|
|
4435
4448
|
[
|
|
4436
4449
|
"apps/server/src/http-app.ts",
|
|
@@ -4484,23 +4497,12 @@ function repairKnownDerivedFile(input) {
|
|
|
4484
4497
|
function repairKnown026Downstream(input) {
|
|
4485
4498
|
if (input.sourceVersion !== "0.2.26")
|
|
4486
4499
|
return;
|
|
4487
|
-
if (input.path ===
|
|
4488
|
-
return
|
|
4489
|
-
}
|
|
4490
|
-
if (input.path !== "apps/web/src/router/router-test-fixtures.ts" || input.targetContent.includes("lijian.")) {
|
|
4491
|
-
return;
|
|
4500
|
+
if (known026DownstreamHashes.get(input.path) === contentHash(input.content)) {
|
|
4501
|
+
return input.targetContent;
|
|
4492
4502
|
}
|
|
4493
|
-
|
|
4494
|
-
["
|
|
4495
|
-
["lijian.evidence.read", "evidence.read"],
|
|
4496
|
-
["lijian.case", "case"],
|
|
4497
|
-
["lijian.evidence.import", "evidence.import"],
|
|
4498
|
-
["lijian.evidence", "evidence"]
|
|
4499
|
-
];
|
|
4500
|
-
if (!replacements2.every(([source]) => input.content.includes(source))) {
|
|
4501
|
-
return;
|
|
4503
|
+
if (input.path === "apps/web/src/router/index.ts" && contentHash(input.content) === known026RouterHash && input.targetContent.includes("@/pages/auth/LoginPage.vue")) {
|
|
4504
|
+
return replaceKnown(input.content, /import LoginPage from "@\/app\/auth\/[^"\n]+LoginPage\.vue";/, 'import LoginPage from "@/pages/auth/LoginPage.vue";');
|
|
4502
4505
|
}
|
|
4503
|
-
return replacements2.reduce((content, [source, target]) => content.replaceAll(source, target), input.content);
|
|
4504
4506
|
}
|
|
4505
4507
|
function repairKnown023Downstream(input) {
|
|
4506
4508
|
if (input.sourceVersion !== "0.2.23" || known023DownstreamHashes.get(input.path) !== contentHash(input.content)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { WebAccessSnapshot } from "@/layout/navigation";
|
|
2
|
+
import type { RouteRecordRaw } from "vue-router";
|
|
2
3
|
// @windy-module system.license begin
|
|
3
4
|
import type { PlatformLicenseSnapshot } from "@/services/license-api";
|
|
4
5
|
// @windy-module system.license end
|
|
6
|
+
import { routes } from "./index";
|
|
5
7
|
|
|
6
8
|
export function provider(snapshot: WebAccessSnapshot) {
|
|
7
9
|
return { refresh: async () => snapshot };
|
|
@@ -41,6 +43,7 @@ export function authProvider(
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export function accessSnapshot(): WebAccessSnapshot {
|
|
46
|
+
const routeAccess = collectRouteAccess(routes);
|
|
44
47
|
return {
|
|
45
48
|
actor: {
|
|
46
49
|
id: "user_1",
|
|
@@ -51,6 +54,7 @@ export function accessSnapshot(): WebAccessSnapshot {
|
|
|
51
54
|
"system.admin.access",
|
|
52
55
|
"system.audit.read",
|
|
53
56
|
"system.feature.read",
|
|
57
|
+
...routeAccess.permissionKeys,
|
|
54
58
|
],
|
|
55
59
|
},
|
|
56
60
|
menus: [],
|
|
@@ -70,6 +74,34 @@ export function accessSnapshot(): WebAccessSnapshot {
|
|
|
70
74
|
allowed: true,
|
|
71
75
|
reason: "allowed",
|
|
72
76
|
},
|
|
77
|
+
...routeAccess.featureKeys.map((key) => ({
|
|
78
|
+
key,
|
|
79
|
+
enabled: true,
|
|
80
|
+
visible: "visible" as const,
|
|
81
|
+
allowed: true,
|
|
82
|
+
reason: "allowed" as const,
|
|
83
|
+
})),
|
|
73
84
|
],
|
|
74
85
|
};
|
|
75
86
|
}
|
|
87
|
+
|
|
88
|
+
export function collectRouteAccess(routeRecords: RouteRecordRaw[]) {
|
|
89
|
+
const permissionKeys = new Set<string>();
|
|
90
|
+
const featureKeys = new Set<string>();
|
|
91
|
+
const visit = (records: RouteRecordRaw[]) => {
|
|
92
|
+
for (const route of records) {
|
|
93
|
+
if (typeof route.meta?.permissionKey === "string") {
|
|
94
|
+
permissionKeys.add(route.meta.permissionKey);
|
|
95
|
+
}
|
|
96
|
+
if (typeof route.meta?.featureKey === "string") {
|
|
97
|
+
featureKeys.add(route.meta.featureKey);
|
|
98
|
+
}
|
|
99
|
+
if (route.children) visit(route.children);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
visit(routeRecords);
|
|
103
|
+
return {
|
|
104
|
+
permissionKeys: [...permissionKeys],
|
|
105
|
+
featureKeys: [...featureKeys],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
|
+
import type { RouteRecordRaw } from "vue-router";
|
|
2
3
|
import routerSource from "./index.ts?raw";
|
|
3
4
|
import fixtureSource from "./router-test-fixtures.ts?raw";
|
|
5
|
+
import { collectRouteAccess } from "./router-test-fixtures";
|
|
4
6
|
|
|
5
7
|
describe("Router shared-scaffold 中性契约", () => {
|
|
6
8
|
test("平台登录页与测试快照不固化下游产品命名", () => {
|
|
@@ -11,4 +13,32 @@ describe("Router shared-scaffold 中性契约", () => {
|
|
|
11
13
|
/LijianLoginPage|lijian\./,
|
|
12
14
|
);
|
|
13
15
|
});
|
|
16
|
+
|
|
17
|
+
test("测试快照从项目路由递归派生真实访问键", () => {
|
|
18
|
+
const projectRoutes: RouteRecordRaw[] = [
|
|
19
|
+
{
|
|
20
|
+
path: "/records",
|
|
21
|
+
component: {},
|
|
22
|
+
meta: {
|
|
23
|
+
permissionKey: "records.read",
|
|
24
|
+
featureKey: "records",
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
{
|
|
28
|
+
path: "import",
|
|
29
|
+
component: {},
|
|
30
|
+
meta: {
|
|
31
|
+
permissionKey: "records.import",
|
|
32
|
+
featureKey: "records.import",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
expect(collectRouteAccess(projectRoutes)).toEqual({
|
|
40
|
+
permissionKeys: ["records.read", "records.import"],
|
|
41
|
+
featureKeys: ["records", "records.import"],
|
|
42
|
+
});
|
|
43
|
+
});
|
|
14
44
|
});
|