@dp-bohrium/widget-cli 0.4.0 → 0.5.0

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/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as resolveWidgetProjects, l as compileAuthorManifest, n as scaffoldDshWidget, r as buildWidgetPackage, s as checkWidgetProject, t as auditDshPlugin } from "./dsh-BvnlfCRX.mjs";
1
+ import { c as compileAuthorManifest, n as scaffoldDshWidget, o as checkWidgetProject, r as buildWidgetPackage, s as resolveWidgetProjects, t as auditDshPlugin } from "./dsh-BkPMTfZ_.mjs";
2
2
  //#region src/core.mjs
3
3
  /** Validate a community template before registering it in a custom CLI. */
4
4
  function defineWidgetTemplate(template) {
@@ -1,12 +1,12 @@
1
- export interface WidgetDevelopmentEndpointSetV1 {
1
+ //#region src/development-host.d.mts
2
+ interface WidgetDevelopmentEndpointSetV1 {
2
3
  readonly claim: string;
3
4
  readonly status: string;
4
5
  readonly events: string;
5
6
  readonly control: string;
6
7
  readonly profile: string;
7
8
  }
8
-
9
- export interface WidgetDevelopmentDescriptorV1 {
9
+ interface WidgetDevelopmentDescriptorV1 {
10
10
  readonly protocol: "bohrium.widget-development-host";
11
11
  readonly protocolVersion: 1;
12
12
  readonly sessionId: string;
@@ -15,32 +15,28 @@ export interface WidgetDevelopmentDescriptorV1 {
15
15
  readonly origin: string;
16
16
  readonly endpoints: WidgetDevelopmentEndpointSetV1;
17
17
  }
18
-
19
- export interface WidgetDevelopmentClaimV1 {
18
+ interface WidgetDevelopmentClaimV1 {
20
19
  readonly tokenType: "Bearer";
21
20
  readonly accessToken: string;
22
21
  readonly expiresAt: string;
23
22
  }
24
-
25
- export interface WidgetDevelopmentAssetV1 {
23
+ interface WidgetDevelopmentAssetV1 {
26
24
  readonly path: string;
27
25
  readonly bytes: number;
28
26
  readonly digest: `sha256:${string}`;
29
27
  }
30
-
31
- export interface WidgetDevelopmentPresentationRequestV1 {
28
+ interface WidgetDevelopmentPresentationRequestV1 {
32
29
  readonly requestId: string;
33
30
  readonly key: string;
34
31
  readonly surface: "workspace" | "floating" | "overlay";
35
32
  }
36
-
37
- export interface WidgetDevelopmentPanelProjectionV1 {
33
+ interface WidgetDevelopmentPanelProjectionV1 {
38
34
  readonly key: string;
39
35
  readonly runId: string;
40
36
  readonly widgetId: string;
41
37
  readonly widgetVersionId: string;
42
38
  readonly snapshot: Readonly<{
43
- id: string;
39
+ panelType: string;
44
40
  title?: string;
45
41
  state: "loading" | "partial" | "complete" | "error";
46
42
  data: unknown;
@@ -52,15 +48,13 @@ export interface WidgetDevelopmentPanelProjectionV1 {
52
48
  resizable: boolean;
53
49
  }>;
54
50
  }
55
-
56
- export interface WidgetDevelopmentRuntimeDescriptorV1 {
51
+ interface WidgetDevelopmentRuntimeDescriptorV1 {
57
52
  readonly profileUrl: string;
58
53
  readonly statusUrl: string;
59
54
  readonly panel?: WidgetDevelopmentPanelProjectionV1;
60
55
  readonly presentationRequests?: readonly WidgetDevelopmentPresentationRequestV1[];
61
56
  }
62
-
63
- export interface WidgetDevelopmentStatusV1 {
57
+ interface WidgetDevelopmentStatusV1 {
64
58
  readonly protocolVersion: 1;
65
59
  readonly state: "ready" | "stopping" | "build-failed";
66
60
  readonly sessionId: string;
@@ -75,45 +69,34 @@ export interface WidgetDevelopmentStatusV1 {
75
69
  readonly lastBuild: Readonly<Record<string, unknown>>;
76
70
  readonly lastBuildError: Readonly<Record<string, unknown>> | null;
77
71
  }
78
-
79
- export type WidgetDevelopmentEventTypeV1 =
80
- | "generation-ready"
81
- | "generation-failed"
82
- | "reload-requested"
83
- | "session-stopping"
84
- | "disconnected";
85
-
86
- export interface WidgetDevelopmentEventV1 {
72
+ type WidgetDevelopmentEventTypeV1 = "generation-ready" | "generation-failed" | "reload-requested" | "session-stopping" | "disconnected";
73
+ interface WidgetDevelopmentEventV1 {
87
74
  readonly protocolVersion: 1;
88
75
  readonly eventId: string;
89
76
  readonly type: WidgetDevelopmentEventTypeV1;
90
77
  readonly data: Readonly<Record<string, unknown>>;
91
78
  }
92
-
93
- export interface WidgetDevelopmentControlRequestV1 {
79
+ interface WidgetDevelopmentControlRequestV1 {
94
80
  readonly protocolVersion: 1;
95
81
  readonly action: "reload" | "disconnect";
96
82
  }
97
-
98
- export interface WidgetDevelopmentBridgeRequestV1 {
83
+ interface WidgetDevelopmentBridgeRequestV1 {
99
84
  readonly protocol: "bohrium.widget-development-host";
100
85
  readonly protocolVersion: 1;
101
86
  readonly sessionId: string;
102
87
  readonly descriptorUrl: string;
103
88
  readonly expiresAt: string;
104
89
  }
105
-
106
- export interface WidgetDevelopmentBridgeResponseV1 {
90
+ interface WidgetDevelopmentBridgeResponseV1 {
107
91
  readonly accepted: true;
108
92
  readonly protocolVersion: 1;
109
93
  readonly sessionId: string;
110
94
  }
111
-
112
- export interface WidgetDevelopmentCliEnvelopeV1<
113
- T = Readonly<Record<string, unknown>>,
114
- > {
95
+ interface WidgetDevelopmentCliEnvelopeV1<T = Readonly<Record<string, unknown>>> {
115
96
  readonly protocol: "bohrium.widget-development-cli";
116
97
  readonly version: 1;
117
98
  readonly type: string;
118
99
  readonly data: T;
119
100
  }
101
+ //#endregion
102
+ export { WidgetDevelopmentAssetV1, WidgetDevelopmentBridgeRequestV1, WidgetDevelopmentBridgeResponseV1, WidgetDevelopmentClaimV1, WidgetDevelopmentCliEnvelopeV1, WidgetDevelopmentControlRequestV1, WidgetDevelopmentDescriptorV1, WidgetDevelopmentEndpointSetV1, WidgetDevelopmentEventTypeV1, WidgetDevelopmentEventV1, WidgetDevelopmentPanelProjectionV1, WidgetDevelopmentPresentationRequestV1, WidgetDevelopmentRuntimeDescriptorV1, WidgetDevelopmentStatusV1 };
@@ -1,4 +1,3 @@
1
- import { createRequire } from "node:module";
2
1
  import { createHash } from "node:crypto";
3
2
  import { existsSync, lstatSync, readFileSync, readdirSync, statSync } from "node:fs";
4
3
  import { lstat, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
@@ -95,11 +94,7 @@ function collectReferencedFileIds(request) {
95
94
  return referenced;
96
95
  }
97
96
  //#endregion
98
- //#region ../widget-sdk/dist/runtime-D7KxTtdu.js
99
- /** 从当前安装的 SDK package.json 读取版本,插件作者不需要重复填写。 */
100
- const WIDGET_SDK_VERSION = "0.6.0";
101
- //#endregion
102
- //#region ../widget-sdk/dist/index.js
97
+ //#region ../widget-project/src/manifest-compiler.mjs
103
98
  function compiledContribution(contribution) {
104
99
  switch (contribution.type) {
105
100
  case "panel": return {
@@ -113,13 +108,8 @@ function compiledContribution(contribution) {
113
108
  };
114
109
  }
115
110
  }
116
- /**
117
- * 将开发者维护的插件清单编译为宿主可加载的宿主清单。
118
- *
119
- * 这是构建工具的边界函数,不是类型提示入口:作者直接编辑带 `$schema` 的 JSON,
120
- * SDK 版本从当前安装包读取,宿主入口默认落到 dist/widget.js,内部 contribution 标识只在这里生成。
121
- */
122
- function compileWidgetPluginManifest(manifest, options = {}) {
111
+ /** 只编译协议数据;SDK 版本由可信调用方绑定,不读取安装或执行环境。 */
112
+ function compileWidgetPluginManifest(manifest, sdkVersion, options = {}) {
123
113
  const samples = options.samples ?? manifest.samples;
124
114
  if (!samples || samples.length === 0) throw new Error("Widget Plugin Manifest must provide at least one sample before packaging");
125
115
  const contribution = manifest.contributes.widget;
@@ -131,7 +121,7 @@ function compileWidgetPluginManifest(manifest, options = {}) {
131
121
  widgetConfig: {
132
122
  schemaVersion: 1,
133
123
  hostApiVersion: 1,
134
- widgetSdkVersion: WIDGET_SDK_VERSION,
124
+ widgetSdkVersion: sdkVersion,
135
125
  entry: options.hostEntry ?? "dist/widget.js",
136
126
  contribution: compiledContribution(manifest.contributes.widget),
137
127
  ...activationEvents === void 0 ? {} : { activationEvents },
@@ -142,7 +132,21 @@ function compileWidgetPluginManifest(manifest, options = {}) {
142
132
  };
143
133
  }
144
134
  //#endregion
135
+ //#region ../widget-sdk/package.json
136
+ var name = "@dp-bohrium/widget-sdk";
137
+ var version = "0.7.0";
138
+ //#endregion
139
+ //#region ../widget-project/src/sdk-metadata.mjs
140
+ /** 只读取交付包元数据,不加载 SDK 公开入口的执行代码。 */
141
+ function getSdkVersion() {
142
+ if (name !== "@dp-bohrium/widget-sdk" || typeof version !== "string" || version.length === 0) throw new Error("Widget SDK package metadata is invalid");
143
+ return version;
144
+ }
145
+ //#endregion
145
146
  //#region ../widget-project/src/manifest.mjs
147
+ function compileWithSdkMetadata(manifest, options) {
148
+ return compileWidgetPluginManifest(manifest, getSdkVersion(), options);
149
+ }
146
150
  /**
147
151
  * Convert the author-facing VS Code-style plugin manifest to the Host
148
152
  * manifest consumed by Host Runtime Config. This is deliberately a tooling
@@ -153,7 +157,7 @@ function compileAuthorManifest(manifest, options = {}) {
153
157
  if (!isAuthorManifest(manifest)) return manifest;
154
158
  const contribution = manifest.contributes?.widget;
155
159
  if (!contribution || typeof contribution !== "object" || !["panel", "file-preview"].includes(contribution.type) || contribution.type === "file-preview" && !Array.isArray(contribution.extensions)) return manifest;
156
- const compiled = (options.compiler ?? compileWidgetPluginManifest)(manifest, {
160
+ const compiled = (options.compiler ?? compileWithSdkMetadata)(manifest, {
157
161
  hostEntry: options.hostEntry,
158
162
  samples: options.samples
159
163
  });
@@ -7431,7 +7435,8 @@ function validateWidgetManifest(value) {
7431
7435
  value
7432
7436
  };
7433
7437
  }
7434
- createRequire(import.meta.url);
7438
+ //#endregion
7439
+ //#region ../contract-testing/dist/index.js
7435
7440
  /** GENERATED FILE. Do not edit directly. */
7436
7441
  const widgetRuntimeContractsSchema = {
7437
7442
  "$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -8355,17 +8360,15 @@ const widgetRuntimeContractsSchema = {
8355
8360
  "limits": {
8356
8361
  "type": "object",
8357
8362
  "additionalProperties": false,
8358
- "required": [
8359
- "bytesPerRequest",
8360
- "bytesPerRun",
8361
- "callsPerMinute"
8362
- ],
8363
+ "required": ["bytesPerRequest", "callsPerMinute"],
8363
8364
  "properties": {
8364
8365
  "bytesPerRequest": {
8365
8366
  "type": "integer",
8366
8367
  "minimum": 1
8367
8368
  },
8368
8369
  "bytesPerRun": {
8370
+ "description": "历史读取累计额度字段,仅为兼容旧配置保留;当前 files.read 不累计或执行此额度,新宿主不再下发。",
8371
+ "deprecated": true,
8369
8372
  "type": "integer",
8370
8373
  "minimum": 1
8371
8374
  },
@@ -9681,7 +9684,6 @@ const widgetRuntimeContractsSchema = {
9681
9684
  "additionalProperties": false,
9682
9685
  "required": [
9683
9686
  "readBytesPerRequest",
9684
- "readBytesPerRun",
9685
9687
  "callsPerMinute",
9686
9688
  "listPageSize"
9687
9689
  ],
@@ -9691,6 +9693,8 @@ const widgetRuntimeContractsSchema = {
9691
9693
  "minimum": 1
9692
9694
  },
9693
9695
  "readBytesPerRun": {
9696
+ "description": "历史读取累计额度字段,仅为兼容旧配置保留;当前 files.read 不累计或执行此额度,新宿主不再下发。",
9697
+ "deprecated": true,
9694
9698
  "type": "integer",
9695
9699
  "minimum": 1
9696
9700
  },
@@ -11347,7 +11351,7 @@ function storedZip(files) {
11347
11351
  ]);
11348
11352
  }
11349
11353
  //#endregion
11350
- //#region ../widget-project/src/export.mjs
11354
+ //#region ../widget-project/src/packaging.mjs
11351
11355
  const EXCLUDED_BUILD_NAMES = /* @__PURE__ */ new Set([
11352
11356
  "node_modules",
11353
11357
  ".git",
@@ -11392,8 +11396,25 @@ function collectBuildAssets(root, entry) {
11392
11396
  visit(rootName);
11393
11397
  return files;
11394
11398
  }
11399
+ function assembleWidgetPackage(project, options) {
11400
+ const files = collectWidgetPackageFiles(project, options);
11401
+ return {
11402
+ files,
11403
+ archive: storedZip(files)
11404
+ };
11405
+ }
11406
+ /** 已完成作者工程检查后的内部交付组装;不执行构建或改变预览夹具规则。 */
11407
+ function prepareWidgetPackage(project, options = {}) {
11408
+ const prepared = assembleWidgetPackage(project, options);
11409
+ return {
11410
+ ...prepared,
11411
+ bytes: prepared.archive.byteLength,
11412
+ sha256: `sha256:${createHash("sha256").update(prepared.archive).digest("hex")}`
11413
+ };
11414
+ }
11415
+ /** 保留既有同步 ZIP 返回值;不要求调用者使用完整交付结果。 */
11395
11416
  function buildWidgetPackage(project, options = {}) {
11396
- return storedZip(collectWidgetPackageFiles(project, options));
11417
+ return assembleWidgetPackage(project, options).archive;
11397
11418
  }
11398
11419
  /** 返回将写入 ZIP 的 `[路径, 字节]` 列表;同一路径可能重复出现,由 `storedZip` 去重。 */
11399
11420
  function collectWidgetPackageFiles(project, options = {}) {
@@ -11836,10 +11857,7 @@ async function scaffoldDshWidget(input, output, options) {
11836
11857
  const repeated = await auditDshPlugin(sourceRoot);
11837
11858
  const snapshotFingerprint = `sha256:${createHash("sha256").update(JSON.stringify([...snapshot.files].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0))).digest("hex")}`;
11838
11859
  if (repeated.source.fingerprint !== report.source.fingerprint || snapshotFingerprint !== report.source.fingerprint) throw failure("SOURCE_CHANGED", "迁移期间源快照发生变化。");
11839
- const projectFiles = applyDshRecipe(recipe, snapshot.files, {
11840
- sdkVersion: options?.sdkVersion ?? "0.1.0",
11841
- contractsVersion: options?.contractsVersion ?? "0.1.0"
11842
- });
11860
+ const projectFiles = applyDshRecipe(recipe, snapshot.files, { sdkVersion: options?.sdkVersion ?? "0.1.0" });
11843
11861
  const root = resolve(output);
11844
11862
  await mkdir(root);
11845
11863
  for (const [path, content] of Object.entries(projectFiles)) {
@@ -11857,4 +11875,4 @@ async function scaffoldDshWidget(input, output, options) {
11857
11875
  };
11858
11876
  }
11859
11877
  //#endregion
11860
- export { normalizeArchivePath as a, resolveWidgetProjects as c, collectWidgetPackageFiles as i, compileAuthorManifest as l, scaffoldDshWidget as n, storedZip as o, buildWidgetPackage as r, checkWidgetProject as s, auditDshPlugin as t };
11878
+ export { normalizeArchivePath as a, compileAuthorManifest as c, prepareWidgetPackage as i, scaffoldDshWidget as n, checkWidgetProject as o, buildWidgetPackage as r, resolveWidgetProjects as s, auditDshPlugin as t };
package/llms.txt CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  > Widget 工程的本地创建、迁移、校验、开发、构建和打包工具;可由 Bohr CLI 桥接或调度。
4
4
 
5
- 要求 Node.js >=20。CLI 发布包固定 SDK/compiler、contracts/Schema、校验器和模板,
6
- 提供文档站地址,不再内置 skills。生成工程仍安装自己的精确版本依赖。
5
+ 要求 Node.js >=20;默认生成工程构建器要求 `^22.18.0 || >=24.11.0`。
6
+ 生成工程精确依赖 SDK 与构建器,类型、Schema 和工程命令均由 SDK 提供。
7
7
 
8
8
  先看全局帮助,再按命令查看参数、默认值、示例和必要提示:
9
9
 
@@ -19,14 +19,15 @@ pnpm exec bohr-widget --version --json
19
19
  `<命令路径> --help` 与 `help <命令路径>` 查看对应层级;例如 `dev -h`、`pack --help` 或
20
20
  `migrate dsh --help`。`-v` / `--version` 等价于 `version`,`--version --json` 等价于 `version --json`。
21
21
  帮助仅输出本地文本,不执行所选命令或联网获取文档。npm 的全局帮助用
22
- `npx --no-install bohr-widget --help`,其他命令同样替换前缀;未安装时可用
23
- 新工程优先用 `pnpm dlx @dp-bohrium/widget-sdk --help`;本包入口在兼容期保持可用。
22
+ `npx --no-install bohr-widget --help`,其他命令同样替换前缀。
23
+ 创建新工程可使用 `pnpm dlx @dp-bohrium/widget-sdk --help`;工具集成可使用
24
+ `pnpm dlx @dp-bohrium/widget-cli --help`,并核对实际执行包的身份、版本与 SDK profile。
24
25
 
25
26
  ## Agent 入口
26
27
 
27
28
  - [Agent 使用说明](./AGENTS.md): 命令参数、执行顺序、错误恢复和安全边界。
28
29
  - [README](./README.md): 安装、模板和公开 core 出口。
29
- - [更新记录](./CHANGELOG.md): 当前 CLI 的使用者可感知变化;配套包职责与 npm 链接见 README。
30
+ - [更新记录](./CHANGELOG.md): 版本与更新记录。
30
31
  - [文档站索引](https://dev.dp.tech/bohrium-widget-sdk/llms.txt): 先按任务选择教程或参考。
31
32
  - [完整文档](https://dev.dp.tech/bohrium-widget-sdk/llms-full.txt): 文档站自动生成的全文。
32
33
  - 自闭环范围:本包负责本地工程闭环;上传、平台预览、版本发布和 Agent 绑定不在本包内执行。
@@ -37,12 +38,12 @@ pnpm exec bohr-widget --version --json
37
38
 
38
39
  ## 本地闭环
39
40
 
40
- - `integration --json`: `interfaceVersion=2`,返回固定 profile、执行器位置、
41
- `toolchain.formatVersion=2` 和 `documentation { url, quickStart, cli, llms, llmsFull }`,
41
+ - `integration --json`: `interfaceVersion=3`,返回固定 profile、执行器位置、
42
+ `toolchain.formatVersion=3` 和 `documentation { url, quickStart, cli, llms, llmsFull }`,
42
43
  不返回 `skills`。已有工程加 `--project <目录>` 核对锁定,再读取对应参考。
43
44
  - `create`: 创建 vanilla 或 React 工程并写 `widget-toolchain.json`;工作区文件面板使用
44
45
  `--panel-id workspace-files`。
45
- - `adopt`: 为旧工程显式写入工具链锁,先核对精确依赖、实际 SDK/contracts、Manifest 和 samples。
46
+ - `adopt`: 为旧工程显式写入工具链锁,先核对精确依赖、实际 SDK 与内置协议摘要、Manifest 和 samples。
46
47
  - SDK 0.5.0 的任务 Panel 在 Manifest 声明 `capabilities.tasks.list`;需要观察单个任务时再声明
47
48
  `tasks.watch`。列表刷新遵守 grant 的 `minPollMs`,面板不可见后停止轮询;CLI 校验通过不代表
48
49
  目标 Host 已签发 grant,详见 AGENTS.md。
@@ -53,10 +54,11 @@ pnpm exec bohr-widget --version --json
53
54
  当前工作目录为根,找不到工程时返回 `WIDGET_CLI_NO_WIDGET_PROJECT`,不会静默通过。
54
55
  - `dev`: 启动本地开发服务器和 Host Bridge 连接;每轮重建检查锁定信息和实际依赖,失败时保留上一轮。
55
56
  - `build`: 委托工程自己的构建命令,并拒绝“退出 0 但仍有未解析依赖”的结果,写入构建 receipt。
56
- - `pack`: 生成可交给平台的 ZIP,并输出 SHA-256 digest、Manifest 摘要和 CLI/SDK/Contracts 版本。
57
+ - `pack`: 生成可交给平台的 ZIP,并输出 SHA-256 digest、Manifest 摘要、执行器身份与版本、
58
+ SDK profile 和协议标识。
57
59
  `--no-build` 要求 `.widget-build-receipt.json` 的工具链、实际依赖、输入和产物摘要全部匹配。
58
60
  执行摘要仅含 `compiler`、`validators`、`schemas`、`templates`;文档站正文更新不影响
59
- receipt,也不要求 CLI 发版。
61
+ receipt。
60
62
  - `doctor`: 输出 Node、固定 profile 和工程状态;始终核对候选 profile 的精确依赖,已有锁定时再核对
61
63
  profile,`ready` 还要求锁定、依赖和入口。
62
64
  - `schema`: 输出插件 Manifest Schema 路径。
@@ -68,8 +70,8 @@ pnpm exec bohr-widget --version --json
68
70
 
69
71
  `--host-compat <文件>` 接受平台 statement 与调用方 observation。状态 `unknown` 表示无声明,
70
72
  `snapshot` 表示匹配的快照或过期声明,`confirmed` 表示调用方报告在线取得、仍有效且匹配当前
71
- profile;它不代表发布成功。无效声明或不匹配 profile 会报错。当前完成 A、B 本地能力,平台在线
72
- 发现接口和 Bohr 获取声明仍需后续接入。
73
+ profile;它不代表发布成功。无效声明或不匹配 profile 会报错。
74
+ CLI 不自动获取线上声明,调用方需提供目标 Host 的兼容证据。
73
75
 
74
76
  ## 平台侧动作
75
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dp-bohrium/widget-cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Bohrium Widget 插件工程的创建、校验、开发和打包工具。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,47 +24,46 @@
24
24
  "import": "./dist/cli.mjs"
25
25
  },
26
26
  "./core": {
27
- "types": "./src/core.d.mts",
27
+ "types": "./dist/core.d.mts",
28
28
  "import": "./dist/core.mjs"
29
29
  },
30
30
  "./development-host": {
31
- "types": "./src/development-host.d.mts"
31
+ "types": "./dist/development-host.d.mts"
32
32
  },
33
33
  "./package.json": "./package.json"
34
34
  },
35
35
  "files": [
36
36
  "dist",
37
37
  "assets",
38
- "src/core.d.mts",
39
- "src/development-host.d.mts",
40
38
  "README.md",
41
39
  "AGENTS.md",
42
40
  "llms.txt",
43
41
  "CHANGELOG.md",
44
42
  "LICENSE"
45
43
  ],
46
- "publishConfig": {
47
- "access": "public"
48
- },
49
44
  "devDependencies": {
50
45
  "@biomejs/biome": "^2.2.0",
51
46
  "@types/node": "^22.15.0",
52
47
  "tsdown": "0.22.14",
53
48
  "typescript": "5.9.3",
49
+ "@dp-bohrium/widget-contracts": "0.7.0",
54
50
  "@dp-bohrium/widget-contract-testing": "0.1.0-alpha.0",
55
- "@dp-bohrium/widget-contracts": "0.6.0",
56
- "@dp-bohrium/widget-sdk": "0.6.0"
51
+ "@dp-bohrium/widget-sdk": "0.7.0"
57
52
  },
58
53
  "sideEffects": false,
54
+ "publishConfig": {
55
+ "access": "public"
56
+ },
59
57
  "scripts": {
60
58
  "build:assets": "node scripts/build-assets.mjs",
59
+ "build:types": "tsdown --config types.tsdown.config.ts",
60
+ "package:contents": "node ../../scripts/quality/check-widget-cli-package-contents.mjs ../../.artifacts/dp-bohrium-widget-cli-*.tgz",
61
61
  "build:inputs": "pnpm --filter @dp-bohrium/widget-sdk... run build && pnpm --filter @dp-bohrium/widget-contract-testing run build",
62
- "build": "pnpm build:inputs && pnpm build:assets && tsdown && node --check dist/cli.mjs",
62
+ "build": "pnpm build:inputs && pnpm build:assets && tsdown && pnpm build:types && node --check dist/cli.mjs",
63
63
  "typecheck": "node --check src/cli.mjs && node --check src/help.mjs && node --check src/core.mjs && node --check src/templates.mjs && node --check src/toolchain.mjs && node --check src/project-executor.mjs && node --check scripts/build-assets.mjs",
64
- "test": "pnpm build:inputs && pnpm build:assets && node --test test/*.test.mjs",
64
+ "test": "pnpm build:inputs && pnpm build:assets && pnpm build:types && node --test test/*.test.mjs",
65
65
  "lint": "biome check src test scripts",
66
66
  "format:check": "biome check --linter-enabled=false src test scripts",
67
- "package:contents": "node ../../scripts/quality/check-widget-cli-package-contents.mjs ../../.artifacts/dp-bohrium-widget-cli-*.tgz",
68
67
  "check": "pnpm --filter @dp-bohrium/widget-contracts build && pnpm --filter @dp-bohrium/widget-contract-testing build && pnpm --filter widget-project build && pnpm typecheck && pnpm test && pnpm lint && pnpm format:check && pnpm build"
69
68
  }
70
69
  }
package/src/core.d.mts DELETED
@@ -1,58 +0,0 @@
1
- export interface WidgetTemplateContext {
2
- readonly name: string;
3
- readonly ui?: "vanilla" | "react" | string;
4
- }
5
-
6
- export interface WidgetTemplate {
7
- readonly id: string;
8
- readonly description?: string;
9
- manifest(context: WidgetTemplateContext): Record<string, unknown>;
10
- sample(context: WidgetTemplateContext): Record<string, unknown>;
11
- readonly source: string | ((context: WidgetTemplateContext) => string);
12
- }
13
-
14
- export interface WidgetTemplateRegistry {
15
- register(template: WidgetTemplate): WidgetTemplate;
16
- get(id: string): WidgetTemplate | undefined;
17
- list(): readonly WidgetTemplate[];
18
- }
19
-
20
- export declare function defineWidgetTemplate(
21
- template: WidgetTemplate,
22
- ): WidgetTemplate;
23
- export declare function createWidgetTemplateRegistry(
24
- initialTemplates?: readonly WidgetTemplate[],
25
- ): WidgetTemplateRegistry;
26
-
27
- export declare function compileAuthorManifest(
28
- manifest: Record<string, unknown>,
29
- options?: Record<string, unknown>,
30
- ): Record<string, unknown>;
31
- export declare function checkWidgetProject(
32
- projectRoot: string,
33
- options?: Record<string, unknown>,
34
- ): Promise<Record<string, unknown>>;
35
- export declare function resolveWidgetProjects(input: string): readonly string[];
36
- export declare function auditDshPlugin(
37
- input: string,
38
- ): Promise<Record<string, unknown>>;
39
- export declare function scaffoldDshWidget(
40
- input: string,
41
- output: string,
42
- options?: Record<string, unknown>,
43
- ): Promise<Record<string, unknown>>;
44
- export declare function buildWidgetPackage(
45
- project: Record<string, unknown>,
46
- options?: Record<string, unknown>,
47
- ): Uint8Array;
48
-
49
- export declare const widgetCliCore: {
50
- readonly buildWidgetPackage: typeof buildWidgetPackage;
51
- readonly checkWidgetProject: typeof checkWidgetProject;
52
- readonly compileAuthorManifest: typeof compileAuthorManifest;
53
- readonly resolveWidgetProjects: typeof resolveWidgetProjects;
54
- readonly createWidgetTemplateRegistry: typeof createWidgetTemplateRegistry;
55
- readonly defineWidgetTemplate: typeof defineWidgetTemplate;
56
- readonly auditDshPlugin: typeof auditDshPlugin;
57
- readonly scaffoldDshWidget: typeof scaffoldDshWidget;
58
- };