@dsh-workbench/module-tools 0.1.16 → 0.1.18

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.
@@ -56,25 +56,13 @@ function limitOf(search: URLSearchParams): number {
56
56
  return Math.min(MAX_LIMIT, Math.max(1, Math.trunc(parsed)));
57
57
  }
58
58
 
59
- interface UnitManifest {
60
- readonly id: string;
61
- readonly kind: string;
62
- readonly card: {
63
- readonly titleKey: string;
64
- readonly order: number;
65
- readonly enabledByDefault: boolean;
66
- } | null;
67
- readonly tools: readonly unknown[];
68
- readonly host: { readonly inject: readonly string[] };
69
- }
70
-
71
- interface UnitHostFace {
72
- readonly manifest: UnitManifest;
59
+ interface UnitModuleFace {
60
+ readonly unit: string;
73
61
  mount(): { routes: Record<string, RouteHandler>; registerTools(): Array<() => void> };
74
62
  }
75
63
 
76
64
  interface UnitRegistry {
77
- register(face: UnitHostFace): () => void;
65
+ register(face: UnitModuleFace): () => void;
78
66
  }
79
67
 
80
68
  interface HostContext {
@@ -83,16 +71,8 @@ interface HostContext {
83
71
  logger?: { warn?(message: string): void } | undefined;
84
72
  }
85
73
 
86
- const manifest: UnitManifest = {
87
- id: UNIT_ID,
88
- kind: 'board',
89
- card: { titleKey: `${UNIT_ID}.cardTitle`, order: 90, enabledByDefault: true },
90
- tools: [],
91
- host: { inject: [] },
92
- };
93
-
94
- const face: UnitHostFace = {
95
- manifest,
74
+ const face: UnitModuleFace = {
75
+ unit: UNIT_ID,
96
76
  mount: () => ({
97
77
  routes: {
98
78
  [OVERVIEW_ROUTE]: async (search: URLSearchParams) => {
@@ -51,12 +51,12 @@ import {
51
51
  } from './client';
52
52
 
53
53
  interface HostFace {
54
- readonly manifest: { readonly id: string };
54
+ readonly unit: string;
55
55
  mount(): { readonly routes: Record<string, (search: URLSearchParams) => Promise<unknown>> };
56
56
  }
57
57
 
58
58
  interface ClientFace {
59
- readonly manifest: { readonly id: string };
59
+ readonly unit: string;
60
60
  readonly card: (props: {
61
61
  readonly world: { readonly current: { readonly workspace?: { readonly path: string } | null } };
62
62
  readonly refreshToken: number;
@@ -163,8 +163,8 @@ describe('__NAME__ 的面', () => {
163
163
  });
164
164
 
165
165
  it('宿主半侧与浏览器半侧都把自己的面注册进外壳', () => {
166
- expect(hostFace().manifest.id).toBe('__UNIT__');
167
- expect(clientFace().manifest.id).toBe('__UNIT__');
166
+ expect(hostFace().unit).toBe('__UNIT__');
167
+ expect(clientFace().unit).toBe('__UNIT__');
168
168
  });
169
169
  });
170
170