@morlay/dsh-client-modules 0.2.8 → 0.2.10

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/client.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Context } from "@deepseek-ai/cordis";
2
2
  //#region src/client/index.d.ts
3
3
  /**
4
- * 发布 `modules` 服务(上游同名的服务面,见文件头)。
4
+ * 浏览器侧的根插件。
5
5
  *
6
6
  * @param ctx - 浏览器侧根上下文。
7
7
  */
package/dist/client.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Context } from "@deepseek-ai/cordis";
2
2
  //#region src/client/index.d.ts
3
3
  /**
4
- * 发布 `modules` 服务(上游同名的服务面,见文件头)。
4
+ * 浏览器侧的根插件。
5
5
  *
6
6
  * @param ctx - 浏览器侧根上下文。
7
7
  */
package/dist/client.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { apply as apply$1 } from "@morlay/dsh-client-ui-primitives/client";
1
2
  //#region src/client/index.ts
2
3
  /** 恒 `undefined` 的可订阅快照(`useSyncExternalStore` 的入参形状)。 */
3
4
  const NO_RELEASE_CHANGE = {
@@ -10,6 +11,7 @@ const NO_RELEASE_CHANGE = {
10
11
  * @param ctx - 浏览器侧根上下文。
11
12
  */
12
13
  function apply(ctx) {
14
+ apply$1(ctx);
13
15
  ctx.reflect.provide("modules", {
14
16
  entries: {
15
17
  releaseChange: NO_RELEASE_CHANGE,
package/dist/index.cjs CHANGED
@@ -1127,10 +1127,17 @@ async function clientRowsOf(loader) {
1127
1127
  }
1128
1128
  return [...found.values()];
1129
1129
  }
1130
- /** 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。 */
1130
+ /**
1131
+ * 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。
1132
+ *
1133
+ * 上游包的 `lib/` 也是打包输入:`exports` 的 `./typert` / `./remote` / `./client/typert` 指向
1134
+ * `lib/typert.*.ts`(`just vendor prebuild` 生成的),只盯 `src/` 时重新生成 typert 产物不会让缓存失效,
1135
+ * 浏览器会继续拿旧的 descriptor——例如 `terminal/retain` 仍按旧的 `workspaceFileScopeId` 发参数,宿主
1136
+ * 按新 descriptor 拒掉(`missing "sessionId"`)。
1137
+ */
1131
1138
  function watchOf(root, entry) {
1132
1139
  if (root === void 0) return [entry];
1133
- return root.includes("node_modules") ? [(0, node_path.join)(root, "package.json")] : [(0, node_path.join)(root, "src")];
1140
+ return root.includes("node_modules") ? [(0, node_path.join)(root, "package.json")] : [(0, node_path.join)(root, "src"), (0, node_path.join)(root, "lib")];
1134
1141
  }
1135
1142
  function apply(ctx) {
1136
1143
  const trace = traceOf(ctx, "federation");
@@ -1443,3 +1450,4 @@ function apply(ctx) {
1443
1450
  exports.apply = apply;
1444
1451
  exports.inject = inject;
1445
1452
  exports.name = name;
1453
+ exports.watchOf = watchOf;
package/dist/index.d.mts CHANGED
@@ -9,5 +9,14 @@ export interface ClientRow {
9
9
  /** 包版本:联邦地址(`@client-modules/<pkg>@<version>/<file>`)的组成部分。 */
10
10
  version: string;
11
11
  }
12
+ /**
13
+ * 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。
14
+ *
15
+ * 上游包的 `lib/` 也是打包输入:`exports` 的 `./typert` / `./remote` / `./client/typert` 指向
16
+ * `lib/typert.*.ts`(`just vendor prebuild` 生成的),只盯 `src/` 时重新生成 typert 产物不会让缓存失效,
17
+ * 浏览器会继续拿旧的 descriptor——例如 `terminal/retain` 仍按旧的 `workspaceFileScopeId` 发参数,宿主
18
+ * 按新 descriptor 拒掉(`missing "sessionId"`)。
19
+ */
20
+ export declare function watchOf(root: string | undefined, entry: string): string[];
12
21
  export declare function apply(ctx: Context): void;
13
22
  //#endregion
package/dist/index.mjs CHANGED
@@ -1126,10 +1126,17 @@ async function clientRowsOf(loader) {
1126
1126
  }
1127
1127
  return [...found.values()];
1128
1128
  }
1129
- /** 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。 */
1129
+ /**
1130
+ * 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。
1131
+ *
1132
+ * 上游包的 `lib/` 也是打包输入:`exports` 的 `./typert` / `./remote` / `./client/typert` 指向
1133
+ * `lib/typert.*.ts`(`just vendor prebuild` 生成的),只盯 `src/` 时重新生成 typert 产物不会让缓存失效,
1134
+ * 浏览器会继续拿旧的 descriptor——例如 `terminal/retain` 仍按旧的 `workspaceFileScopeId` 发参数,宿主
1135
+ * 按新 descriptor 拒掉(`missing "sessionId"`)。
1136
+ */
1130
1137
  function watchOf(root, entry) {
1131
1138
  if (root === void 0) return [entry];
1132
- return root.includes("node_modules") ? [join(root, "package.json")] : [join(root, "src")];
1139
+ return root.includes("node_modules") ? [join(root, "package.json")] : [join(root, "src"), join(root, "lib")];
1133
1140
  }
1134
1141
  function apply(ctx) {
1135
1142
  const trace = traceOf(ctx, "federation");
@@ -1439,4 +1446,4 @@ function apply(ctx) {
1439
1446
  }), "client-modules: /plugins route");
1440
1447
  }
1441
1448
  //#endregion
1442
- export { apply, inject, name };
1449
+ export { apply, inject, name, watchOf };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morlay/dsh-client-modules",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Dev-form web layer for dsh: serves the page, the app entry and every client resource through an in-process vite dev server (middleware mode) — the node-side counterpart of upstream @deepseek-ai/dsh-client-modules, with the module table replaced by vite's resolver, dependency prebundling and HMR.",
5
5
  "keywords": [
6
6
  "client",
@@ -38,7 +38,8 @@
38
38
  "dependencies": {
39
39
  "@deepseek-ai/dsh-client-ui-theme": "^0.2.1-rc.1",
40
40
  "@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.1",
41
- "@morlay/dsh-cordis-assets": "0.2.7",
41
+ "@morlay/dsh-client-ui-primitives": "0.0.13",
42
+ "@morlay/dsh-cordis-assets": "0.2.9",
42
43
  "@oxc-project/runtime": "^0.153.0",
43
44
  "lightningcss": "^1.30.0",
44
45
  "vite": "^8.3.1"
@@ -54,8 +55,8 @@
54
55
  "rolldown": "^1.2.14"
55
56
  },
56
57
  "engines": {
57
- "node": ">=24.11.0",
58
- "dsh": ">= 0.2.1-rc.1 < 0.2.2"
58
+ "dsh": ">= 0.2.1-rc.1 < 0.2.2",
59
+ "node": ">=24.11.0"
59
60
  },
60
61
  "dsh": {
61
62
  "client": {
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 预编译缓存指纹的输入集:上游包的 `lib/`(typert 产物)与 `src/` 都是打包输入。
3
+ *
4
+ * 现场:`just vendor prebuild` 重新生成 `lib/typert.*.ts` 后,指纹只盯 `src/` 时会继续命中旧缓存,
5
+ * 浏览器拿到的还是旧 descriptor(`terminal/retain` 仍发 `workspaceFileScopeId`,宿主按新 descriptor
6
+ * 拒掉 `missing "sessionId"`)。
7
+ */
8
+ import { join } from "node:path";
9
+ import { expect, test } from "vitest";
10
+ import { watchOf } from "../index.ts";
11
+
12
+ test("上游包(非 node_modules):指纹看 src 与 lib", () => {
13
+ const root = join(process.cwd(), "vendor", "deepseek-harness", "packages", "api", "demo");
14
+ expect(watchOf(root, join(root, "src", "index.ts"))).toEqual([
15
+ join(root, "src"),
16
+ join(root, "lib"),
17
+ ]);
18
+ });
19
+
20
+ test("node_modules 里的三方包:只看 package.json(版本已进缓存目录名)", () => {
21
+ const root = join(
22
+ process.cwd(),
23
+ "node_modules",
24
+ ".pnpm",
25
+ "react@18.3.1",
26
+ "node_modules",
27
+ "react",
28
+ );
29
+ expect(watchOf(root, join(root, "index.js"))).toEqual([join(root, "package.json")]);
30
+ });
31
+
32
+ test("没有包根时退到入口文件", () => {
33
+ const entry = join(process.cwd(), "dist", "index.js");
34
+ expect(watchOf(undefined, entry)).toEqual([entry]);
35
+ });
@@ -1,4 +1,8 @@
1
- // client 半:两件事,都是**把上游那条链缺的面补上**。
1
+ // client 半:三件事——把上游那条链缺的面补上,并给内联的 UI 基础面一个唯一装配点。
2
+ //
3
+ // 0. UI 基础面(`@morlay/dsh-client-ui-primitives`)的装配:它是内联库(不是装配行),
4
+ // 字典 / 字段槽 / 按行配置页只能装一次;由本行(客户端装配的根)统一调用,消费方不再各自调用
5
+ // (多份副本同时注册会撞 `locale namespace "settings.schema-form" already has locale "zh"`)。
2
6
  //
3
7
  // 1. `modules` 服务面:上游 `ui-settings-general` 的 client 插件 inject 它(有它就忽略 peer),
4
8
  // 我们的装配停用了上游 `client-modules` 行,所以这里补一个最小实现(见文件头注释与 README)。
@@ -8,6 +12,7 @@
8
12
  // 已失效的 id 一直带回来,`TerminalView` 的 `createWhenMissing` 只在「没有 saved id」时才分配新终端
9
13
  // —— 于是面板永远停在"此终端已不存在,请新建终端",点"新建终端"复用的还是它。
10
14
  import type { Context } from "@deepseek-ai/cordis";
15
+ import { apply as installUiPrimitives } from "@morlay/dsh-client-ui-primitives/client";
11
16
 
12
17
  /** 恒 `undefined` 的可订阅快照(`useSyncExternalStore` 的入参形状)。 */
13
18
  const NO_RELEASE_CHANGE = {
@@ -21,6 +26,8 @@ const NO_RELEASE_CHANGE = {
21
26
  * @param ctx - 浏览器侧根上下文。
22
27
  */
23
28
  export function apply(ctx: Context): void {
29
+ // 内联库的唯一装配点:`apply` 自己等依赖到齐,并在服务已在场时让位。
30
+ installUiPrimitives(ctx);
24
31
  ctx.reflect.provide("modules", {
25
32
  entries: {
26
33
  releaseChange: NO_RELEASE_CHANGE,
package/src/index.ts CHANGED
@@ -131,10 +131,19 @@ async function clientRowsOf(loader: { entries(): Generator<LoaderEntry> }): Prom
131
131
  return [...found.values()];
132
132
  }
133
133
 
134
- /** 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。 */
135
- function watchOf(root: string | undefined, entry: string): string[] {
134
+ /**
135
+ * 打包器指纹的输入集:**只与包有关、与出口无关**(缓存按包聚合,rev 跟着出口变就等于永不命中)。
136
+ *
137
+ * 上游包的 `lib/` 也是打包输入:`exports` 的 `./typert` / `./remote` / `./client/typert` 指向
138
+ * `lib/typert.*.ts`(`just vendor prebuild` 生成的),只盯 `src/` 时重新生成 typert 产物不会让缓存失效,
139
+ * 浏览器会继续拿旧的 descriptor——例如 `terminal/retain` 仍按旧的 `workspaceFileScopeId` 发参数,宿主
140
+ * 按新 descriptor 拒掉(`missing "sessionId"`)。
141
+ */
142
+ export function watchOf(root: string | undefined, entry: string): string[] {
136
143
  if (root === undefined) return [entry];
137
- return root.includes("node_modules") ? [join(root, "package.json")] : [join(root, "src")];
144
+ return root.includes("node_modules")
145
+ ? [join(root, "package.json")]
146
+ : [join(root, "src"), join(root, "lib")];
138
147
  }
139
148
 
140
149
  export function apply(ctx: Context): void {