@deepseek-ai/dsh-typert-loader 0.1.5-rc.2 → 0.1.6-alpha.1

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/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/typert/loader/README.md
5
- README.md: ba8fe7d6b13924b6f9a39d1e792153f346aec530
6
- README.zh.md: a4c16ac5f5b54e8524422f6574092e909988be95
5
+ README.md: 378be98dea5f47e4d6b0a0c70600e2a4c221c80b
6
+ README.zh.md: e598127bba12e4057405231fe09199db18f9604d
package/README.md CHANGED
@@ -44,7 +44,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
44
44
 
45
45
  ### What gets registered
46
46
 
47
- Each qualifying Loader entry contributes its generated host-face reflection and schemas to the runtime registry. Registration follows the entry lifecycle: it is withdrawn when the entry or the plugin unmounts, and a registration whose import settles after both are gone is discarded.
47
+ Each qualifying Loader entry contributes its generated host-face reflection and schemas to the runtime registry. Registration follows the entry lifecycle: it is withdrawn when the entry or the plugin unmounts, and an import that settles after either owner is gone is discarded.
48
48
 
49
49
  ### Observable behavior and failures
50
50
 
package/README.zh.md CHANGED
@@ -40,15 +40,15 @@ kind: "package-reference"
40
40
  |---|---|---|
41
41
  | `packages` | `[]` | 为嵌套在另一 Loader 配置项下的插件额外注册的包产物;每个包都必须能从配置树解析,并导出 `./typert` |
42
42
 
43
- 生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-typert-loader)是每个受支持字段的穷尽式真源。
43
+ 生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-typert-loader)是所有受支持字段的完整真源。
44
44
 
45
45
  ### 注册什么
46
46
 
47
- 每个符合条件的 Loader 配置项都会把其生成的宿主侧反射与 schema 贡献给运行时注册表。注册跟随配置项生命周期:配置项或本插件卸载时撤销;在两者都已消失后才结束的注册会被丢弃。
47
+ 每个符合条件的 Loader 配置项都会把其生成的宿主侧反射与 schema 贡献给运行时注册表。注册跟随配置项生命周期:配置项或本插件卸载时撤销;在配置项或本插件任一方卸载后才结束的导入操作会被丢弃。
48
48
 
49
49
  ### 可观察行为与失败
50
50
 
51
- 没有该导出的包会被静默跳过。解析结论与已导入的 manifest 会在整个进程生命周期内缓存,因此新增 `./typert` 导出后必须重启。已挂载配置项对应的产物格式错误时,激活会大声失败;之后才发生的失败按包记录日志,不会阻止无关包完成注册。无法从配置树解析、或缺少该导出的显式 `packages` 条目会大声失败并指名该包。
51
+ 没有该导出的包会被静默跳过。解析结论与已导入的 manifest(元数据清单)会在整个进程生命周期内缓存,因此新增 `./typert` 导出后必须重启。已挂载配置项对应的产物格式错误时,激活会明确报错;之后才发生的失败按包记录日志,不会阻止无关包完成注册。无法从配置树解析、或缺少该导出的显式 `packages` 条目会明确报错并指名该包。
52
52
 
53
53
  -----
54
54
 
@@ -62,7 +62,7 @@ kind: "package-reference"
62
62
 
63
63
  ### 设计理念
64
64
 
65
- 本插件是一个增量扫描器,与 client-modules 的 Node 半实现对称:每次 Cordis `internal/plugin` 事件都会把该 fiber 的配置项名称标记为脏,微任务 flush 会针对实时 Loader 配置项逐一调和每个脏名称;激活阶段用所有当前配置项填充同一脏集合。
65
+ 本插件是一个增量扫描器,与 client-modules 的 Node 侧实现对称:每次 Cordis `internal/plugin` 事件都会把该 fiber 的配置项名称标记为脏,微任务 flush 会针对实时 Loader 配置项逐一调和每个脏名称;激活阶段用所有当前配置项填充同一脏集合。
66
66
 
67
67
  ### Manifest 校验
68
68
 
@@ -76,8 +76,8 @@ kind: "package-reference"
76
76
 
77
77
  | 文件 | 职责 |
78
78
  |---|---|
79
- | [`src/index.ts`](src/index.ts) | 插件入口:`Config`、扫描器、manifest 校验、注册接线 |
80
- | — | 不发布运行时不变式伴生入口;Loader entry 生命周期直接持有每个准确的 registry disposer,integration test 会观察注册与移除。 |
79
+ | [`src/index.ts`](src/index.ts) | 插件入口:`Config`、扫描器、manifest 校验、注册装配逻辑 |
80
+ | — | 不发布运行时不变式伴生入口;Loader 配置项的生命周期直接持有每个对应的注册表资源释放函数,集成测试会观察注册与移除。 |
81
81
 
82
82
  </details>
83
83
 
@@ -86,7 +86,7 @@ kind: "package-reference"
86
86
  <a id="further-exploration"></a>
87
87
  ## 进一步探索
88
88
 
89
- 当包级约定不够用时阅读以下页面;它们从 loader 逐步进入它注册什么以及什么产生这些内容。
89
+ 当包级约定不够用时阅读以下页面;这些页面从 loader 开始,依次介绍它注册的内容及其生成方。
90
90
 
91
91
  - [Typert 注册表](../registry/README.zh.md)——本插件所供给的服务。
92
92
  - [Typert 生成器](../generator/README.zh.md)——产生 loader 所导入产物的包。
@@ -102,7 +102,7 @@ kind: "package-reference"
102
102
 
103
103
  #### KV Cache 影响
104
104
 
105
- 无直接影响;注册变化只有在消费方读取注册表时才会触及请求。
105
+ 无直接影响;注册变更只有通过读取注册表的消费方才会影响请求。
106
106
 
107
107
  ## 已知限制与延期工作
108
108
 
package/lib/index.js CHANGED
@@ -217,7 +217,8 @@ function requireStrictCodec(pkgName, value, subject) {
217
217
  */
218
218
  async function apply(ctx, config) {
219
219
  if (ctx.baseUrl === void 0) throw new Error("typert-loader: ctx.baseUrl is unset — the loader needs the config-tree anchor to resolve plugin packages");
220
- const require = createRequire(ctx.baseUrl);
220
+ const baseUrl = ctx.baseUrl;
221
+ const require = createRequire(baseUrl);
221
222
  const configured = new Set(config.packages);
222
223
  const registered = /* @__PURE__ */ new Map();
223
224
  const pending = /* @__PURE__ */ new Map();
@@ -235,17 +236,33 @@ async function apply(ctx, config) {
235
236
  const resolveArtifact = (pkgName) => {
236
237
  const cached = artifactPath.get(pkgName);
237
238
  if (cached !== void 0) return cached;
239
+ const firstSlash = pkgName.indexOf("/");
240
+ if (firstSlash >= 0 && (pkgName[0] !== "@" || pkgName.indexOf("/", firstSlash + 1) >= 0)) {
241
+ if (configured.has(pkgName)) throw new Error(`typert-loader: configured package "${pkgName}" cannot be resolved from the config tree — add it to the composition package dependencies or remove it from packages`);
242
+ artifactPath.set(pkgName, null);
243
+ return null;
244
+ }
238
245
  let pkgPath;
246
+ let pkg;
239
247
  try {
240
- pkgPath = require.resolve(`${pkgName}/package.json`);
248
+ const packages = ctx.get("pluginPackages");
249
+ const resolvedPackage = packages?.packageOf(pkgName, baseUrl);
250
+ if (packages !== void 0 && resolvedPackage === void 0) throw new Error("package is absent from the active resolver");
251
+ pkgPath = resolvedPackage === void 0 ? require.resolve(`${pkgName}/package.json`) : resolvedPackage.manifestPath;
252
+ pkg = resolvedPackage?.manifest;
241
253
  } catch (cause) {
242
254
  if (configured.has(pkgName)) throw new Error(`typert-loader: configured package "${pkgName}" cannot be resolved from the config tree — add it to the composition package dependencies or remove it from packages`, { cause });
243
255
  artifactPath.set(pkgName, null);
244
256
  return null;
245
257
  }
246
- const rel = typertExportOf(pkgName, JSON.parse(readFileSync(pkgPath, "utf8")).exports);
258
+ pkg ??= JSON.parse(readFileSync(pkgPath, "utf8"));
259
+ const manifestName = typeof pkg.name === "string" ? pkg.name : pkgName;
260
+ const rel = typertExportOf(manifestName, pkg.exports);
247
261
  if (rel === void 0 && configured.has(pkgName)) throw new Error(`typert-loader: configured package "${pkgName}" does not export "${TYPERT_HOST_EXPORT}"`);
248
- const resolved = rel === void 0 ? null : join(dirname(pkgPath), rel);
262
+ const resolved = rel === void 0 ? null : {
263
+ packageName: manifestName,
264
+ path: join(dirname(pkgPath), rel)
265
+ };
249
266
  artifactPath.set(pkgName, resolved);
250
267
  return resolved;
251
268
  };
@@ -275,9 +292,9 @@ async function apply(ctx, config) {
275
292
  return;
276
293
  }
277
294
  if (registered.has(entryName) || pending.has(entryName)) return void 0;
278
- const path = resolveArtifact(entryName);
279
- if (path === null) return void 0;
280
- const task = loadManifest(entryName, path).then((manifest) => {
295
+ const artifact = resolveArtifact(entryName);
296
+ if (artifact === null) return void 0;
297
+ const task = loadManifest(artifact.packageName, artifact.path).then((manifest) => {
281
298
  if (!active || !qualifies(entryName) || registered.has(entryName)) return;
282
299
  registered.set(entryName, ctx.typert.register(manifest));
283
300
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-typert-loader",
3
3
  "description": "Loader integration for generated Typert package contributions",
4
- "version": "0.1.5-rc.2",
4
+ "version": "0.1.6-alpha.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -28,16 +28,17 @@
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
30
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
31
- "@deepseek-ai/cordis": "^4.0.2",
32
- "@deepseek-ai/dsh-typert-registry": "^0.1.5-rc.2"
31
+ "@deepseek-ai/dsh-typert-registry": "^0.1.6-alpha.1",
32
+ "@deepseek-ai/cordis": "^4.0.2"
33
33
  },
34
34
  "dependencies": {
35
35
  "@deepseek-ai/schemastery": "^3.18.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "zod": "^4.4.3",
39
+ "@deepseek-ai/dsh-app-boot": "^0.1.6-alpha.1",
39
40
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
40
- "@deepseek-ai/dsh-typert-registry": "^0.1.5-rc.2",
41
+ "@deepseek-ai/dsh-typert-registry": "^0.1.6-alpha.1",
41
42
  "@deepseek-ai/cordis": "^4.0.2"
42
43
  }
43
44
  }