@shiqianjiang/ceru-plugin-cli 0.2.6 → 0.3.2

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.
Files changed (41) hide show
  1. package/README.md +8 -0
  2. package/assets/core-contracts.js +1 -1
  3. package/assets/index.html +94 -94
  4. package/assets/native-view.js +125 -0
  5. package/assets/playground.js +109 -11
  6. package/assets/sandbox.js +22 -22
  7. package/assets/style.css +46 -0
  8. package/dist/dev.js +9 -14
  9. package/dist/storage.d.ts +12 -0
  10. package/dist/storage.js +65 -0
  11. package/package.json +71 -71
  12. package/schemas/config.schema.json +166 -1
  13. package/templates/connected-library/js/README.md +6 -2
  14. package/templates/connected-library/js/ceru.plugin.json +11 -2
  15. package/templates/connected-library/js/package.json +22 -22
  16. package/templates/connected-library/js/src/index.js +52 -1
  17. package/templates/connected-library/ts/README.md +6 -2
  18. package/templates/connected-library/ts/ceru.plugin.json +11 -2
  19. package/templates/connected-library/ts/package.json +22 -22
  20. package/templates/connected-library/ts/src/index.ts +52 -1
  21. package/templates/guest-adapter/js/package.json +22 -22
  22. package/templates/guest-adapter/ts/package.json +22 -22
  23. package/templates/importer/js/package.json +22 -22
  24. package/templates/importer/ts/package.json +22 -22
  25. package/templates/react/js/package.json +26 -26
  26. package/templates/react/ts/package.json +26 -26
  27. package/templates/snapshot.json +1 -1
  28. package/templates/source/js/package.json +22 -22
  29. package/templates/source/ts/package.json +22 -22
  30. package/templates/vue/js/package.json +23 -23
  31. package/templates/vue/ts/package.json +23 -23
  32. package/templates/vue-tsx/js/package.json +23 -23
  33. package/templates/vue-tsx/ts/package.json +23 -23
  34. package/templates/web-dist/js/package.json +22 -22
  35. package/templates/web-dist/ts/package.json +22 -22
  36. package/templates/web-surface/js/ceru.plugin.json +31 -2
  37. package/templates/web-surface/js/package.json +22 -22
  38. package/templates/web-surface/js/src/index.js +7 -0
  39. package/templates/web-surface/ts/ceru.plugin.json +31 -2
  40. package/templates/web-surface/ts/package.json +22 -22
  41. package/templates/web-surface/ts/src/index.ts +7 -0
@@ -1,23 +1,23 @@
1
- {
2
- "name": "js",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2",
21
- "vue": "3.5.43"
22
- }
23
- }
1
+ {
2
+ "name": "js",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2",
21
+ "vue": "3.5.43"
22
+ }
23
+ }
@@ -1,23 +1,23 @@
1
- {
2
- "name": "ts",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2",
21
- "vue": "3.5.43"
22
- }
23
- }
1
+ {
2
+ "name": "ts",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2",
21
+ "vue": "3.5.43"
22
+ }
23
+ }
@@ -1,23 +1,23 @@
1
- {
2
- "name": "js",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2",
21
- "vue": "3.5.43"
22
- }
23
- }
1
+ {
2
+ "name": "js",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2",
21
+ "vue": "3.5.43"
22
+ }
23
+ }
@@ -1,23 +1,23 @@
1
- {
2
- "name": "ts",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2",
21
- "vue": "3.5.43"
22
- }
23
- }
1
+ {
2
+ "name": "ts",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2",
21
+ "vue": "3.5.43"
22
+ }
23
+ }
@@ -1,22 +1,22 @@
1
- {
2
- "name": "js",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2"
21
- }
22
- }
1
+ {
2
+ "name": "js",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2"
21
+ }
22
+ }
@@ -1,22 +1,22 @@
1
- {
2
- "name": "ts",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2"
21
- }
22
- }
1
+ {
2
+ "name": "ts",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2"
21
+ }
22
+ }
@@ -13,13 +13,25 @@
13
13
  "modules": {
14
14
  "logic": {
15
15
  "entry": "logic.main",
16
- "activation": ["onCommand:hello"]
16
+ "activation": [
17
+ "onCommand:hello"
18
+ ]
17
19
  },
18
20
  "surfaces": [
19
21
  {
20
22
  "id": "page",
21
23
  "kind": "web",
22
- "entry": "view.main"
24
+ "entry": "view.main",
25
+ "title": "插件页面",
26
+ "presentation": {
27
+ "kind": "drawer",
28
+ "placement": "right",
29
+ "size": 480
30
+ },
31
+ "lifecycle": {
32
+ "openAction": "page.open",
33
+ "closeAction": "page.close"
34
+ }
23
35
  }
24
36
  ]
25
37
  },
@@ -29,6 +41,16 @@
29
41
  "id": "hello",
30
42
  "title": "Hello",
31
43
  "action": "hello"
44
+ },
45
+ {
46
+ "id": "page.open",
47
+ "title": "打开页面",
48
+ "action": "page.open"
49
+ },
50
+ {
51
+ "id": "page.close",
52
+ "title": "关闭页面",
53
+ "action": "page.close"
32
54
  }
33
55
  ],
34
56
  "sidebarItems": [
@@ -47,6 +69,13 @@
47
69
  "view": "page",
48
70
  "order": 10
49
71
  }
72
+ ],
73
+ "settingsPages": [
74
+ {
75
+ "id": "settings",
76
+ "title": "插件设置",
77
+ "view": "page"
78
+ }
50
79
  ]
51
80
  },
52
81
  "permissions": [],
@@ -1,22 +1,22 @@
1
- {
2
- "name": "js",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2"
21
- }
22
- }
1
+ {
2
+ "name": "js",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2"
21
+ }
22
+ }
@@ -1,6 +1,13 @@
1
1
  import { definePlugin } from '@shiqianjiang/ceru-plugin-sdk'
2
2
 
3
3
  export default definePlugin(async (ctx) => {
4
+ ctx.actions.register('page.open', async () => {
5
+ await ctx.ui.setState('page', { status: '页面已打开,可在插件中自行实现交互' })
6
+ })
7
+ ctx.actions.register('page.close', async () => {
8
+ // 在这里取消后台轮询或释放当前页面占用的资源。
9
+ await ctx.ui.setState('page', { status: '页面已关闭' })
10
+ })
4
11
  ctx.actions.register('hello', async () => {
5
12
  await ctx.ui.notify({ key: 'hello', level: 'info', message: 'Hello Ceru v2!' })
6
13
  })
@@ -13,13 +13,25 @@
13
13
  "modules": {
14
14
  "logic": {
15
15
  "entry": "logic.main",
16
- "activation": ["onCommand:hello"]
16
+ "activation": [
17
+ "onCommand:hello"
18
+ ]
17
19
  },
18
20
  "surfaces": [
19
21
  {
20
22
  "id": "page",
21
23
  "kind": "web",
22
- "entry": "view.main"
24
+ "entry": "view.main",
25
+ "title": "插件页面",
26
+ "presentation": {
27
+ "kind": "drawer",
28
+ "placement": "right",
29
+ "size": 480
30
+ },
31
+ "lifecycle": {
32
+ "openAction": "page.open",
33
+ "closeAction": "page.close"
34
+ }
23
35
  }
24
36
  ]
25
37
  },
@@ -29,6 +41,16 @@
29
41
  "id": "hello",
30
42
  "title": "Hello",
31
43
  "action": "hello"
44
+ },
45
+ {
46
+ "id": "page.open",
47
+ "title": "打开页面",
48
+ "action": "page.open"
49
+ },
50
+ {
51
+ "id": "page.close",
52
+ "title": "关闭页面",
53
+ "action": "page.close"
32
54
  }
33
55
  ],
34
56
  "sidebarItems": [
@@ -47,6 +69,13 @@
47
69
  "view": "page",
48
70
  "order": 10
49
71
  }
72
+ ],
73
+ "settingsPages": [
74
+ {
75
+ "id": "settings",
76
+ "title": "插件设置",
77
+ "view": "page"
78
+ }
50
79
  ]
51
80
  },
52
81
  "permissions": [],
@@ -1,22 +1,22 @@
1
- {
2
- "name": "ts",
3
- "version": "0.1.0",
4
- "private": true,
5
- "type": "module",
6
- "scripts": {
7
- "dev": "ceru-plugin dev",
8
- "build": "ceru-plugin build",
9
- "typecheck": "tsc --noEmit",
10
- "validate": "ceru-plugin validate dist/plugin.js",
11
- "preview": "ceru-plugin preview dist/plugin.js"
12
- },
13
- "dependencies": {
14
- "@shiqianjiang/ceru-plugin-sdk": "^0.2.4"
15
- },
16
- "devDependencies": {
17
- "@shiqianjiang/ceru-plugin-cli": "^0.2.6",
18
- "typescript": "~5.9.3",
19
- "electron": "^44.4.2",
20
- "prettier": "^3.6.2"
21
- }
22
- }
1
+ {
2
+ "name": "ts",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "ceru-plugin dev",
8
+ "build": "ceru-plugin build",
9
+ "typecheck": "tsc --noEmit",
10
+ "validate": "ceru-plugin validate dist/plugin.js",
11
+ "preview": "ceru-plugin preview dist/plugin.js"
12
+ },
13
+ "dependencies": {
14
+ "@shiqianjiang/ceru-plugin-sdk": "^0.3.2"
15
+ },
16
+ "devDependencies": {
17
+ "@shiqianjiang/ceru-plugin-cli": "^0.3.2",
18
+ "typescript": "~5.9.3",
19
+ "electron": "^44.4.2",
20
+ "prettier": "^3.6.2"
21
+ }
22
+ }
@@ -1,6 +1,13 @@
1
1
  import { definePlugin } from '@shiqianjiang/ceru-plugin-sdk'
2
2
 
3
3
  export default definePlugin(async (ctx) => {
4
+ ctx.actions.register('page.open', async () => {
5
+ await ctx.ui.setState('page', { status: '页面已打开,可在插件中自行实现交互' })
6
+ })
7
+ ctx.actions.register('page.close', async () => {
8
+ // 在这里取消后台轮询或释放当前页面占用的资源。
9
+ await ctx.ui.setState('page', { status: '页面已关闭' })
10
+ })
4
11
  ctx.actions.register('hello', async () => {
5
12
  await ctx.ui.notify({ key: 'hello', level: 'info', message: 'Hello Ceru v2!' })
6
13
  })