dsh-activity-pane 0.1.0
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/.dsh-plugin/client.js +5305 -0
- package/.dsh-plugin/index.mjs +5 -0
- package/LICENSE +38 -0
- package/README.md +41 -0
- package/cordis.patch.yml +7 -0
- package/package.json +68 -0
- package/scripts/acceptance.mjs +203 -0
- package/scripts/bench.mjs +151 -0
- package/scripts/build-client.mjs +46 -0
- package/scripts/check-staged-client.mjs +47 -0
- package/scripts/check.mjs +3536 -0
- package/scripts/watch.mjs +43 -0
- package/src/client.mjs +3269 -0
- package/src/core.mjs +1933 -0
- package/src/host.mjs +207 -0
- package/src/navigation.mjs +91 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// 校验 Git index 中的 source/build script 与 staged client bundle 完全一致(C-059、T-089)。
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
10
|
+
const inputs = [
|
|
11
|
+
"scripts/build-client.mjs",
|
|
12
|
+
"src/core.mjs",
|
|
13
|
+
"src/navigation.mjs",
|
|
14
|
+
"src/client.mjs",
|
|
15
|
+
".dsh-plugin/client.js",
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
function staged(path) {
|
|
19
|
+
try {
|
|
20
|
+
return execFileSync("git", ["show", `:${path}`], { cwd: root });
|
|
21
|
+
} catch {
|
|
22
|
+
throw new Error(`staged client check: Git index 缺少 ${path}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const directory = await mkdtemp(join(tmpdir(), "dap-staged-client-"));
|
|
27
|
+
try {
|
|
28
|
+
const stagedBundle = staged(".dsh-plugin/client.js");
|
|
29
|
+
for (const path of inputs) {
|
|
30
|
+
const target = join(directory, path);
|
|
31
|
+
await mkdir(dirname(target), { recursive: true });
|
|
32
|
+
await writeFile(target, staged(path));
|
|
33
|
+
}
|
|
34
|
+
execFileSync(process.execPath, [join(directory, "scripts/build-client.mjs")], {
|
|
35
|
+
cwd: directory,
|
|
36
|
+
stdio: "pipe",
|
|
37
|
+
});
|
|
38
|
+
const generated = await readFile(join(directory, ".dsh-plugin/client.js"));
|
|
39
|
+
assert.deepEqual(
|
|
40
|
+
generated,
|
|
41
|
+
stagedBundle,
|
|
42
|
+
"staged client bundle 已过期:请运行 pnpm build:client,并重新暂存 src、scripts/build-client.mjs 与 .dsh-plugin/client.js",
|
|
43
|
+
);
|
|
44
|
+
console.log("staged client bundle check passed");
|
|
45
|
+
} finally {
|
|
46
|
+
await rm(directory, { recursive: true, force: true });
|
|
47
|
+
}
|