@dsh-workbench/module-hello 0.1.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/client.js ADDED
@@ -0,0 +1,64 @@
1
+ // ⚠️ 本文件由 dsh-wb-module build 生成,请勿手改。改 src/ 后跑:dsh-wb-module build
2
+ window.__ModuleLoader__.load({
3
+ id: "@dsh-workbench/module-hello",
4
+ factory(require) {
5
+ const module = { exports: {} };
6
+ const exports = module.exports;
7
+ "use strict";
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // src/client.tsx
27
+ var client_exports = {};
28
+ __export(client_exports, {
29
+ apply: () => apply,
30
+ inject: () => inject
31
+ });
32
+ module.exports = __toCommonJS(client_exports);
33
+ var import_react = require("react");
34
+ var import_client = require("@dsh-workbench/core/client");
35
+ var UNIT_ID = "hello";
36
+ var manifest = {
37
+ id: UNIT_ID,
38
+ kind: "board",
39
+ card: { titleKey: "hello.cardTitle", order: 90, enabledByDefault: true },
40
+ tools: [],
41
+ host: { inject: [] }
42
+ };
43
+ var helloClient = {
44
+ manifest,
45
+ card: () => (0, import_react.createElement)(
46
+ "section",
47
+ { className: "wb-hello" },
48
+ (0, import_react.createElement)("h2", { className: "wb-helloTitle" }, (0, import_react.createElement)(import_client.kit.components.IconBrandMark, { size: 16 }), " hello, workbench"),
49
+ (0, import_react.createElement)("p", { className: "wb-helloBody" }, "\u8FD9\u4E2A\u5361\u7247\u6765\u81EA\u4E00\u4E2A\u72EC\u7ACB\u7684 dsh \u63D2\u4EF6\u5305\uFF08S1b \u539F\u578B\uFF09\u3002")
50
+ )
51
+ };
52
+ var inject = ["workbenchUnits"];
53
+ function apply(ctx) {
54
+ const units = ctx.get("workbenchUnits");
55
+ if (units === void 0) {
56
+ console.warn(`[${UNIT_ID}] \u5916\u58F3\u6CA1\u6709\u63D0\u4F9B workbenchUnits \u670D\u52A1\uFF1A\u8FD9\u5F20\u5361\u7247\u88C5\u4E0D\u8FDB\u6765`);
57
+ return;
58
+ }
59
+ ctx.effect(() => units.registerUnit(helloClient), `module-hello: \u6CE8\u518C ${UNIT_ID}`);
60
+ }
61
+
62
+ return module.exports;
63
+ },
64
+ });
@@ -0,0 +1,7 @@
1
+ # 模块自己的 bundle 层:把自己插进 profile。
2
+ #
3
+ # 与外壳那份 cordis.patch.yml 同形 —— 一个模块包就是一个 dsh bundle,
4
+ # 装 = 把这个包装进 profile(`dsh plugin add`),插行由这一层负责。
5
+ - insert:
6
+ - id: workbench-module-hello
7
+ name: '@dsh-workbench/module-hello'
package/dist/host.js ADDED
@@ -0,0 +1,29 @@
1
+ // src/host.ts
2
+ var PLUGIN_ID = "@dsh-workbench/module-hello";
3
+ var UNIT_ID = "hello";
4
+ var manifest = {
5
+ id: UNIT_ID,
6
+ kind: "board",
7
+ card: { titleKey: "hello.cardTitle", order: 90, enabledByDefault: true },
8
+ tools: [],
9
+ host: { inject: [] }
10
+ };
11
+ var helloHost = {
12
+ manifest,
13
+ mount: () => ({ routes: {}, registerTools: () => [] })
14
+ };
15
+ var name = PLUGIN_ID;
16
+ var inject = ["workbenchUnits"];
17
+ function apply(ctx) {
18
+ const units = ctx.get("workbenchUnits");
19
+ if (units === void 0) {
20
+ ctx.logger?.warn?.(`[${UNIT_ID}] \u5916\u58F3\u6CA1\u6709\u63D0\u4F9B workbenchUnits \u670D\u52A1\uFF1A\u8FD9\u4E2A\u6A21\u5757\u88C5\u4E0D\u8FDB\u6765`);
21
+ return;
22
+ }
23
+ ctx.effect(() => units.register(helloHost), `module-hello: \u6CE8\u518C ${UNIT_ID}`);
24
+ }
25
+ export {
26
+ apply,
27
+ inject,
28
+ name
29
+ };
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@dsh-workbench/module-hello",
3
+ "version": "0.1.0",
4
+ "description": "最小模块包(S1b 原型):只认外壳的 workbenchUnits 服务,不认识外壳源码。用来证明「装 → 挂载 → 卸 → 消失」这条链路。",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./dist/host.js",
8
+ "./client": "./client.js"
9
+ },
10
+ "//files": "和外壳同一条纪律:client.js 与 dist/ 是构建产物,npm 的兜底是 .gitignore,不显式列出就会漏。",
11
+ "files": [
12
+ "dist",
13
+ "client.js",
14
+ "cordis.patch.yml"
15
+ ],
16
+ "dsh": {
17
+ "bundle": {
18
+ "patch": "./cordis.patch.yml"
19
+ },
20
+ "client": {
21
+ "platform": "web",
22
+ "inject": [
23
+ "@dsh-workbench/core"
24
+ ],
25
+ "external": [
26
+ "@dsh-workbench/core/client"
27
+ ]
28
+ },
29
+ "workbench": {
30
+ "unit": "hello",
31
+ "faces": {
32
+ "host": "src/host.ts",
33
+ "client": "src/client.tsx"
34
+ }
35
+ }
36
+ },
37
+ "peerDependencies": {
38
+ "@dsh-workbench/core": "^0.1.0",
39
+ "react": "*"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "react": {
43
+ "optional": true
44
+ }
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^20.0.0",
48
+ "@types/react": "^19.3.0",
49
+ "esbuild": "^0.28.2",
50
+ "react": "^19.3.0",
51
+ "typescript": "5.9",
52
+ "vitest": "^5.0.2",
53
+ "@dsh-workbench/core": "0.1.0",
54
+ "@dsh-workbench/module-tools": "0.1.0"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "scripts": {
60
+ "build": "dsh-wb-module build",
61
+ "typecheck": "tsc --noEmit",
62
+ "selfcheck": "dsh-wb-module build && node scripts/smoke.mjs",
63
+ "test": "vitest run"
64
+ }
65
+ }