@dsh-workbench/module-tools 1.2.8 → 1.2.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/module-tools",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "模块包的构建与门禁工具:build(单文件 ESM 宿主侧 + 套 loader 壳的浏览器侧)、check(契约/产物边界/源码边界/卡片渲染)。模块包不再各带一份构建脚本。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "semver": "^7.8.5",
34
34
  "typescript": "5.9.3",
35
35
  "typescript-eslint": "^8.71.0",
36
- "@dsh-workbench/shared": "1.2.8"
36
+ "@dsh-workbench/shared": "1.2.9"
37
37
  },
38
38
  "repository": {
39
39
  "type": "git",
@@ -306,6 +306,19 @@ describe('宿主侧的长任务与工具', () => {
306
306
  expect((await settled(h, started.runId))?.status).toBe('ok');
307
307
  });
308
308
 
309
+ it('★ 按钮带来的会话要接着用:这一趟记在它名下,不是另起一条', async () => {
310
+ const h = harness();
311
+ const action = h.mounted.actions?.find((one) => one.resource === RUN_RESOURCE);
312
+ const started = action?.handle({ path: join(scratch, 'sample'), session: 'session-from-card' }) as {
313
+ ok: boolean;
314
+ runId: string;
315
+ };
316
+ expect(started.ok).toBe(true);
317
+ const done = await settled(h, started.runId);
318
+ expect(done?.status).toBe('ok');
319
+ expect(done?.session).toBe('session-from-card');
320
+ });
321
+
309
322
  it('没有工作区时工具说清楚,不抛', async () => {
310
323
  const h = harness();
311
324
  h.mounted.registerTools();
@@ -92,11 +92,13 @@ export function createSample(deps: UnitMountDeps): Sample {
92
92
  runs,
93
93
  runTool,
94
94
  startFromPayload(payload: unknown): StartResult {
95
- const path = textOf(recordOf(payload)['path']);
95
+ const body = recordOf(payload);
96
+ const path = textOf(body['path']);
96
97
  if (path === '') {
97
98
  return { ok: false, code: 'no-path', message: '没告诉我要跑哪个目录', text: '先打开一个项目再跑。' };
98
99
  }
99
- return start(path, null);
100
+ const session = textOf(body['session']);
101
+ return start(path, session === '' ? null : session);
100
102
  },
101
103
  };
102
104
  }