@chatbi-v/cli 2.0.5 → 2.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/dist/index.js CHANGED
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -14,32 +8,31 @@ var __export = (target, all) => {
14
8
  __defProp(target, name, { get: all[name], enumerable: true });
15
9
  };
16
10
 
17
- // ../../../chatbi-v/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js
11
+ // ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js
18
12
  import path from "path";
19
13
  import { fileURLToPath } from "url";
20
- var getFilename, getDirname, __dirname;
21
14
  var init_esm_shims = __esm({
22
- "../../../chatbi-v/node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js"() {
15
+ "../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.6_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js"() {
23
16
  "use strict";
24
- getFilename = () => fileURLToPath(import.meta.url);
25
- getDirname = () => path.dirname(getFilename());
26
- __dirname = /* @__PURE__ */ getDirname();
27
17
  }
28
18
  });
29
19
 
30
20
  // src/utils.ts
31
21
  import path2 from "path";
22
+ import { createRequire } from "module";
23
+ import { fileURLToPath as fileURLToPath2 } from "url";
32
24
  import fs from "fs-extra";
33
25
  import pc from "picocolors";
34
26
  import ora from "ora";
35
27
  import boxen from "boxen";
36
- var _require, _dirname, logger, createSpinner, printBox, findPackageRoot, getCliRoot;
28
+ var _require, _filename, _dirname, logger, createSpinner, printBox, findPackageRoot, getCliRoot;
37
29
  var init_utils = __esm({
38
30
  "src/utils.ts"() {
39
31
  "use strict";
40
32
  init_esm_shims();
41
- _require = __require;
42
- _dirname = __dirname;
33
+ _require = createRequire(import.meta.url);
34
+ _filename = fileURLToPath2(import.meta.url);
35
+ _dirname = path2.dirname(_filename);
43
36
  logger = {
44
37
  info: (msg) => console.log(pc.cyan(`\u2139 ${msg}`)),
45
38
  success: (msg) => console.log(pc.green(`\u2714 ${msg}`)),
@@ -278,7 +271,14 @@ var init_SandboxRenderer = __esm({
278
271
  "className",
279
272
  "dependencies",
280
273
  "devDependencies",
281
- "json"
274
+ "json",
275
+ "if",
276
+ "else",
277
+ "unless",
278
+ "each",
279
+ "with",
280
+ "log",
281
+ "lookup"
282
282
  ];
283
283
  }
284
284
  /**
@@ -927,12 +927,13 @@ var init_config = __esm({
927
927
  });
928
928
 
929
929
  // src/corekit.ts
930
+ import { createRequire as createRequire2 } from "module";
930
931
  import path10 from "path";
931
932
  import fs8 from "fs-extra";
932
933
  import pc4 from "picocolors";
933
934
  import prompts from "prompts";
934
935
  import fg3 from "fast-glob";
935
- var CoreKit;
936
+ var nativeRequire, CoreKit;
936
937
  var init_corekit = __esm({
937
938
  "src/corekit.ts"() {
938
939
  "use strict";
@@ -940,6 +941,7 @@ var init_corekit = __esm({
940
941
  init_utils();
941
942
  init_sandbox();
942
943
  init_config();
944
+ nativeRequire = createRequire2(import.meta.url);
943
945
  CoreKit = class {
944
946
  /**
945
947
  * 解析项目模式
@@ -1119,8 +1121,8 @@ ${pc4.gray("Root: ")} ${pc4.white(cwd)}`,
1119
1121
  css: {
1120
1122
  postcss: {
1121
1123
  plugins: [
1122
- __require(tailwindPath)({
1123
- presets: [__require(path10.join(sandboxNodeModules, "@chatbi-v/tailwind-config"))],
1124
+ nativeRequire(tailwindPath)({
1125
+ presets: [nativeRequire(path10.join(sandboxNodeModules, "@chatbi-v/tailwind-config"))],
1124
1126
  darkMode: "class",
1125
1127
  content: [
1126
1128
  path10.join(shellDir, "index.html"),
@@ -1128,7 +1130,7 @@ ${pc4.gray("Root: ")} ${pc4.white(cwd)}`,
1128
1130
  path10.join(pluginDir, "src/**/*.{ts,tsx}")
1129
1131
  ]
1130
1132
  }),
1131
- __require(autoprefixerPath)
1133
+ nativeRequire(autoprefixerPath)
1132
1134
  ]
1133
1135
  }
1134
1136
  },
@@ -1936,6 +1938,11 @@ import fs12 from "fs-extra";
1936
1938
  import path14 from "path";
1937
1939
  import pc8 from "picocolors";
1938
1940
  import prompts3 from "prompts";
1941
+ import { createRequire as createRequire3 } from "module";
1942
+ import { fileURLToPath as fileURLToPath3 } from "url";
1943
+ var _require2 = createRequire3(import.meta.url);
1944
+ var _filename2 = fileURLToPath3(import.meta.url);
1945
+ var _dirname2 = path14.dirname(_filename2);
1939
1946
  async function add(options) {
1940
1947
  let { name, type, displayName, description } = options;
1941
1948
  const cwd = process.cwd();
@@ -2523,7 +2530,7 @@ async function clean(options) {
2523
2530
  // package.json
2524
2531
  var package_default = {
2525
2532
  name: "@chatbi-v/cli",
2526
- version: "2.0.5",
2533
+ version: "2.1.0",
2527
2534
  description: "Standardized CLI tooling for ChatBI Monorepo",
2528
2535
  type: "module",
2529
2536
  main: "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatbi-v/cli",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Standardized CLI tooling for ChatBI Monorepo",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,9 +12,9 @@
12
12
  "dependencies": {
13
13
  "@ant-design/icons": "^5.2.6",
14
14
  "@ant-design/x": "^2.1.1",
15
- "@chatbi-v/core": "^2.0.5",
16
- "@chatbi-v/mocks": "^2.0.5",
17
- "@chatbi-v/cli": "^2.0.5",
15
+ "@chatbi-v/core": "^2.1.0",
16
+ "@chatbi-v/mocks": "^2.1.0",
17
+ "@chatbi-v/cli": "^2.1.0",
18
18
  "@chatbi-v/plugin-theme-manager": "2.0.4",
19
19
  "@chatbi-v/plugin-layout-transform": "2.0.4",
20
20
  "@chatbi-v/plugin-system-monitor": "2.0.4",
@@ -25,7 +25,7 @@
25
25
  "zustand": "^5.0.9"
26
26
  },
27
27
  "devDependencies": {
28
- "@chatbi-v/tsconfig":"^2.0.2",
28
+ "@chatbi-v/tsconfig":"^2.1.0",
29
29
  "@types/node": "^25.0.3",
30
30
  "@types/react": "^18.2.43",
31
31
  "@types/react-dom": "^18.2.17",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "typescript": "^5.0.0",
27
- "@chatbi-v/cli": "^2.0.2",
27
+ "@chatbi-v/cli": "^2.1.0",
28
28
  "@ant-design/icons": "^5.6.1",
29
29
  "@types/react": "^18.3.1",
30
30
  "@types/react-dom": "^18.3.1",
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "plugin": true,
23
23
  "peerDependencies": {
24
- "@chatbi-v/core": "^2.0.5",
24
+ "@chatbi-v/core": "^2.1.0",
25
25
  "antd": "^5.20.0",
26
26
  "react": ">=18.0.0",
27
27
  "react-dom": ">=18.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@chatbi-v/core": "^2.0.5",
31
- "@chatbi-v/tsconfig": "^2.0.5",
30
+ "@chatbi-v/core": "^2.1.0",
31
+ "@chatbi-v/tsconfig": "^2.1.0",
32
32
  "tsup": "^8.5.1",
33
33
  "vite": "^5.0.0"
34
34
  }
@@ -42,7 +42,14 @@ export const {{pluginClassName}} = definePlugin({
42
42
  }
43
43
  ],
44
44
  configuration: [
45
- // 在此定义插件配置项
45
+ // 示例:定义一个可配置项
46
+ // {
47
+ // key: 'apiKey',
48
+ // type: 'string',
49
+ // label: 'API Key',
50
+ // default: '',
51
+ // description: '用于访问外部服务的密钥'
52
+ // }
46
53
  ],
47
54
  storage: [
48
55
  // 在此定义插件持久化状态
@@ -51,6 +58,25 @@ export const {{pluginClassName}} = definePlugin({
51
58
 
52
59
  async onLoad(context: PluginContext) {
53
60
  logger.info('{{pluginDisplayName}} loaded');
61
+
62
+ // [示例] 服务注册 (Service Registry)
63
+ // 推荐模式:通过服务暴露配置或能力,供其他插件消费
64
+ // context.registerService(`${pkg.name}.service`, {
65
+ // getPublicConfig: () => ({
66
+ // // 仅暴露允许公开的配置
67
+ // someConfig: context.storage.get('someConfig')
68
+ // }),
69
+ // doSomething: () => {
70
+ // logger.info('Doing something...');
71
+ // }
72
+ // });
73
+
74
+ // [示例] 服务消费 (Service Consumption)
75
+ // 注意:需要在 metadata.dependencies 中声明依赖的插件 ID
76
+ // const otherService = context.getService('com.example.other-plugin.service');
77
+ // if (otherService) {
78
+ // otherService.doSomething();
79
+ // }
54
80
  }
55
81
  });
56
82