@tmsfe/tmskit 0.0.67 → 0.0.69

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/index.cjs.js CHANGED
@@ -1594,6 +1594,27 @@ function cleanEntranceDeclare(appJson) {
1594
1594
  }
1595
1595
  }
1596
1596
 
1597
+ /**
1598
+ * 清理 agent.skills 中引用了不存在分包路径的技能
1599
+ */
1600
+ function cleanAgentConfig(appJson) {
1601
+ if (!appJson.agent || !appJson.agent.skills) return;
1602
+ const subpackages = appJson.subpackages || [];
1603
+ const allValidRoots = new Set(subpackages.map(sub => sub.root).filter(Boolean));
1604
+ appJson.agent.skills = appJson.agent.skills.filter(skill => {
1605
+ if (!skill.path) return true;
1606
+ // skill.path 格式如 "modules/wechat-skills/skills/takecar",取分包 root 前缀
1607
+ const parts = skill.path.split('/');
1608
+ const root = `${parts[0]}/${parts[1]}`; // e.g. "modules/wechat-skills"
1609
+ if (allValidRoots.has(root)) return true;
1610
+ info$g(`[devStrictModulesInclude] 移除 agent.skills "${skill.name}",分包 ${root} 不存在`);
1611
+ return false;
1612
+ });
1613
+ if (appJson.agent.skills.length === 0) {
1614
+ delete appJson.agent;
1615
+ }
1616
+ }
1617
+
1597
1618
  /**
1598
1619
  * 动态生成编译后的app.json
1599
1620
  * @param {object} tmsConfig
@@ -1624,6 +1645,7 @@ async function buildOutputAppJson$3(tmsConfig, modules) {
1624
1645
  if (tmsConfig.devStrictModulesInclude) {
1625
1646
  cleanPreloadRule(appJson);
1626
1647
  cleanEntranceDeclare(appJson);
1648
+ cleanAgentConfig(appJson);
1627
1649
  }
1628
1650
 
1629
1651
  // 模板渲染:先将 app.json 转为字符串,然后通过 preprocess 渲染
@@ -4461,7 +4483,7 @@ var entry = [{
4461
4483
 
4462
4484
  var require$$12 = {
4463
4485
  name: "@tmsfe/tmskit",
4464
- version: "0.0.67",
4486
+ version: "0.0.69",
4465
4487
  description: "tmskit",
4466
4488
  main: "dist/index.cjs",
4467
4489
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tmskit",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "description": "tmskit",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {
@@ -193,6 +193,7 @@ function cleanPreloadRule(appJson) {
193
193
  }
194
194
  }
195
195
 
196
+
196
197
  /**
197
198
  * 清理 entranceDeclare 中引用了不存在页面的条目
198
199
  */
@@ -220,6 +221,30 @@ function cleanEntranceDeclare(appJson) {
220
221
  }
221
222
  }
222
223
 
224
+ /**
225
+ * 清理 agent.skills 中引用了不存在分包路径的技能
226
+ */
227
+ function cleanAgentConfig(appJson) {
228
+ if (!appJson.agent || !appJson.agent.skills) return;
229
+
230
+ const subpackages = appJson.subpackages || [];
231
+ const allValidRoots = new Set(subpackages.map(sub => sub.root).filter(Boolean));
232
+
233
+ appJson.agent.skills = appJson.agent.skills.filter((skill) => {
234
+ if (!skill.path) return true;
235
+ // skill.path 格式如 "modules/wechat-skills/skills/takecar",取分包 root 前缀
236
+ const parts = skill.path.split('/');
237
+ const root = `${parts[0]}/${parts[1]}`; // e.g. "modules/wechat-skills"
238
+ if (allValidRoots.has(root)) return true;
239
+ info(`[devStrictModulesInclude] 移除 agent.skills "${skill.name}",分包 ${root} 不存在`);
240
+ return false;
241
+ });
242
+
243
+ if (appJson.agent.skills.length === 0) {
244
+ delete appJson.agent;
245
+ }
246
+ }
247
+
223
248
  /**
224
249
  * 动态生成编译后的app.json
225
250
  * @param {object} tmsConfig
@@ -249,6 +274,7 @@ async function buildOutputAppJson(tmsConfig, modules) {
249
274
  if (tmsConfig.devStrictModulesInclude) {
250
275
  cleanPreloadRule(appJson);
251
276
  cleanEntranceDeclare(appJson);
277
+ cleanAgentConfig(appJson);
252
278
  }
253
279
 
254
280
  // 模板渲染:先将 app.json 转为字符串,然后通过 preprocess 渲染