@shiqianjiang/ceru-plugin-cli 0.1.1 → 0.2.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.
Files changed (153) hide show
  1. package/README.md +9 -5
  2. package/assets/catalog.json +1 -1
  3. package/assets/core-contracts.js +1 -0
  4. package/assets/index.html +94 -93
  5. package/assets/playground.js +293 -30
  6. package/assets/sandbox.js +50 -19
  7. package/assets/style.css +16 -0
  8. package/dist/dependencies.d.ts +6 -0
  9. package/dist/dependencies.js +45 -0
  10. package/dist/dev.d.ts +2 -0
  11. package/dist/dev.js +297 -144
  12. package/dist/frameworks.d.ts +2 -2
  13. package/dist/frameworks.js +11 -29
  14. package/dist/index.js +12 -4
  15. package/dist/project.d.ts +1 -0
  16. package/dist/project.js +48 -21
  17. package/dist/socket-broker.d.ts +23 -0
  18. package/dist/socket-broker.js +230 -0
  19. package/package.json +71 -67
  20. package/schemas/config.schema.json +349 -0
  21. package/templates/connected-library/js/.vscode/ceru.code-snippets +37 -9
  22. package/templates/connected-library/js/.vscode/launch.json +36 -46
  23. package/templates/connected-library/js/.vscode/tasks.json +11 -3
  24. package/templates/connected-library/js/README.md +7 -2
  25. package/templates/connected-library/js/ceru-plugin.code-workspace +8 -0
  26. package/templates/connected-library/js/package.json +4 -3
  27. package/templates/connected-library/js/src/index.js +7 -5
  28. package/templates/connected-library/ts/.vscode/ceru.code-snippets +37 -9
  29. package/templates/connected-library/ts/.vscode/launch.json +36 -46
  30. package/templates/connected-library/ts/.vscode/tasks.json +11 -3
  31. package/templates/connected-library/ts/README.md +7 -2
  32. package/templates/connected-library/ts/ceru-plugin.code-workspace +8 -0
  33. package/templates/connected-library/ts/package.json +4 -3
  34. package/templates/connected-library/ts/src/index.ts +7 -5
  35. package/templates/guest-adapter/js/.vscode/ceru.code-snippets +37 -9
  36. package/templates/guest-adapter/js/.vscode/launch.json +36 -46
  37. package/templates/guest-adapter/js/.vscode/tasks.json +11 -3
  38. package/templates/guest-adapter/js/README.md +7 -2
  39. package/templates/guest-adapter/js/ceru-plugin.code-workspace +8 -0
  40. package/templates/guest-adapter/js/package.json +4 -3
  41. package/templates/guest-adapter/ts/.vscode/ceru.code-snippets +37 -9
  42. package/templates/guest-adapter/ts/.vscode/launch.json +36 -46
  43. package/templates/guest-adapter/ts/.vscode/tasks.json +11 -3
  44. package/templates/guest-adapter/ts/README.md +7 -2
  45. package/templates/guest-adapter/ts/ceru-plugin.code-workspace +8 -0
  46. package/templates/guest-adapter/ts/package.json +4 -3
  47. package/templates/importer/js/.vscode/ceru.code-snippets +37 -9
  48. package/templates/importer/js/.vscode/launch.json +36 -46
  49. package/templates/importer/js/.vscode/tasks.json +11 -3
  50. package/templates/importer/js/README.md +8 -3
  51. package/templates/importer/js/ceru-plugin.code-workspace +8 -0
  52. package/templates/importer/js/ceru.plugin.json +8 -24
  53. package/templates/importer/js/package.json +4 -3
  54. package/templates/importer/js/src/index.js +28 -34
  55. package/templates/importer/ts/.vscode/ceru.code-snippets +37 -9
  56. package/templates/importer/ts/.vscode/launch.json +36 -46
  57. package/templates/importer/ts/.vscode/tasks.json +11 -3
  58. package/templates/importer/ts/README.md +8 -3
  59. package/templates/importer/ts/ceru-plugin.code-workspace +8 -0
  60. package/templates/importer/ts/ceru.plugin.json +8 -24
  61. package/templates/importer/ts/package.json +4 -3
  62. package/templates/importer/ts/src/index.ts +28 -34
  63. package/templates/react/js/.vscode/ceru.code-snippets +37 -9
  64. package/templates/react/js/.vscode/launch.json +36 -46
  65. package/templates/react/js/.vscode/tasks.json +11 -3
  66. package/templates/react/js/README.md +7 -2
  67. package/templates/react/js/ceru-plugin.code-workspace +8 -0
  68. package/templates/react/js/ceru.plugin.json +1 -5
  69. package/templates/react/js/package.json +4 -3
  70. package/templates/react/ts/.vscode/ceru.code-snippets +37 -9
  71. package/templates/react/ts/.vscode/launch.json +36 -46
  72. package/templates/react/ts/.vscode/tasks.json +11 -3
  73. package/templates/react/ts/README.md +7 -2
  74. package/templates/react/ts/ceru-plugin.code-workspace +8 -0
  75. package/templates/react/ts/ceru.plugin.json +1 -5
  76. package/templates/react/ts/package.json +4 -3
  77. package/templates/snapshot.json +22 -2
  78. package/templates/source/js/.vscode/ceru.code-snippets +37 -9
  79. package/templates/source/js/.vscode/launch.json +36 -46
  80. package/templates/source/js/.vscode/tasks.json +11 -3
  81. package/templates/source/js/README.md +7 -2
  82. package/templates/source/js/ceru-plugin.code-workspace +8 -0
  83. package/templates/source/js/ceru.plugin.json +9 -0
  84. package/templates/source/js/package.json +4 -3
  85. package/templates/source/js/src/index.js +29 -26
  86. package/templates/source/ts/.vscode/ceru.code-snippets +37 -9
  87. package/templates/source/ts/.vscode/launch.json +36 -46
  88. package/templates/source/ts/.vscode/tasks.json +11 -3
  89. package/templates/source/ts/README.md +7 -2
  90. package/templates/source/ts/ceru-plugin.code-workspace +8 -0
  91. package/templates/source/ts/ceru.plugin.json +9 -0
  92. package/templates/source/ts/package.json +4 -3
  93. package/templates/source/ts/src/index.ts +29 -26
  94. package/templates/vue/js/.vscode/ceru.code-snippets +37 -9
  95. package/templates/vue/js/.vscode/launch.json +36 -46
  96. package/templates/vue/js/.vscode/tasks.json +11 -3
  97. package/templates/vue/js/README.md +7 -2
  98. package/templates/vue/js/ceru-plugin.code-workspace +8 -0
  99. package/templates/vue/js/ceru.plugin.json +1 -4
  100. package/templates/vue/js/package.json +4 -3
  101. package/templates/vue/ts/.vscode/ceru.code-snippets +37 -9
  102. package/templates/vue/ts/.vscode/launch.json +36 -46
  103. package/templates/vue/ts/.vscode/tasks.json +11 -3
  104. package/templates/vue/ts/README.md +7 -2
  105. package/templates/vue/ts/ceru-plugin.code-workspace +8 -0
  106. package/templates/vue/ts/ceru.plugin.json +1 -4
  107. package/templates/vue/ts/package.json +4 -3
  108. package/templates/vue-tsx/js/.vscode/ceru.code-snippets +37 -9
  109. package/templates/vue-tsx/js/.vscode/launch.json +36 -46
  110. package/templates/vue-tsx/js/.vscode/tasks.json +11 -3
  111. package/templates/vue-tsx/js/README.md +7 -2
  112. package/templates/vue-tsx/js/ceru-plugin.code-workspace +8 -0
  113. package/templates/vue-tsx/js/ceru.plugin.json +1 -4
  114. package/templates/vue-tsx/js/package.json +4 -3
  115. package/templates/vue-tsx/ts/.vscode/ceru.code-snippets +37 -9
  116. package/templates/vue-tsx/ts/.vscode/launch.json +36 -46
  117. package/templates/vue-tsx/ts/.vscode/tasks.json +11 -3
  118. package/templates/vue-tsx/ts/README.md +7 -2
  119. package/templates/vue-tsx/ts/ceru-plugin.code-workspace +8 -0
  120. package/templates/vue-tsx/ts/ceru.plugin.json +1 -4
  121. package/templates/vue-tsx/ts/package.json +4 -3
  122. package/templates/web-dist/js/.vscode/ceru.code-snippets +37 -9
  123. package/templates/web-dist/js/.vscode/launch.json +36 -46
  124. package/templates/web-dist/js/.vscode/tasks.json +11 -3
  125. package/templates/web-dist/js/README.md +7 -2
  126. package/templates/web-dist/js/ceru-plugin.code-workspace +8 -0
  127. package/templates/web-dist/js/package.json +4 -3
  128. package/templates/web-dist/ts/.vscode/ceru.code-snippets +37 -9
  129. package/templates/web-dist/ts/.vscode/launch.json +36 -46
  130. package/templates/web-dist/ts/.vscode/tasks.json +11 -3
  131. package/templates/web-dist/ts/README.md +7 -2
  132. package/templates/web-dist/ts/ceru-plugin.code-workspace +8 -0
  133. package/templates/web-dist/ts/package.json +4 -3
  134. package/templates/web-surface/js/.vscode/ceru.code-snippets +37 -9
  135. package/templates/web-surface/js/.vscode/launch.json +36 -46
  136. package/templates/web-surface/js/.vscode/tasks.json +11 -3
  137. package/templates/web-surface/js/README.md +7 -2
  138. package/templates/web-surface/js/ceru-plugin.code-workspace +8 -0
  139. package/templates/web-surface/js/ceru.plugin.json +9 -0
  140. package/templates/web-surface/js/package.json +4 -3
  141. package/templates/web-surface/js/src/view.js +4 -1
  142. package/templates/web-surface/js/ui/search-note.css +3 -0
  143. package/templates/web-surface/ts/.vscode/ceru.code-snippets +37 -9
  144. package/templates/web-surface/ts/.vscode/launch.json +36 -46
  145. package/templates/web-surface/ts/.vscode/tasks.json +11 -3
  146. package/templates/web-surface/ts/README.md +7 -2
  147. package/templates/web-surface/ts/ceru-plugin.code-workspace +8 -0
  148. package/templates/web-surface/ts/ceru.plugin.json +9 -0
  149. package/templates/web-surface/ts/package.json +4 -3
  150. package/templates/web-surface/ts/src/view.ts +4 -1
  151. package/templates/web-surface/ts/ui/search-note.css +3 -0
  152. package/assets/shared-react.js +0 -77
  153. package/assets/shared-vue.js +0 -44
package/README.md CHANGED
@@ -2,25 +2,29 @@
2
2
 
3
3
  构建、调试和发行单文件 Ceru v2 插件。支持 TS/JS、Vue SFC、Vue TSX、React 和已有网页产物。
4
4
 
5
- ~~~bash
5
+ ```bash
6
6
  npm create ceru-plugin@latest my-plugin -- --template vue --lang ts
7
7
  cd my-plugin
8
8
  npm install
9
9
  npm run dev
10
10
  npm run build
11
- ~~~
11
+ ```
12
12
 
13
13
  Dev 启动独立 Electron 工作台,实际执行插件并支持 TS 源码断点、日志、搜索/解析、页面预览、权限模拟和宿主资源。VS Code 配置由脚手架生成。
14
14
 
15
- ~~~text
15
+ ```text
16
16
  ceru-plugin list-templates
17
17
  ceru-plugin build --out dist/plugin.js
18
18
  ceru-plugin validate dist/plugin.js --json
19
19
  ceru-plugin keygen --out .keys/publisher
20
20
  ceru-plugin sign dist/plugin.js --key .keys/publisher.private.pem
21
- ~~~
21
+ ```
22
22
 
23
- 最终交付单个 JS;也可选择 .jsx 后缀,内容仍为完成编译的 JavaScript。编译器、node_modules 和开发服务器不进入产物。
23
+ 最终交付单个 `.js`。JSX/TSX/Vue 只作为开发源码;编译器、node_modules 和开发服务器不进入产物。
24
+
25
+ Vue/React 生产运行代码会直接打入发行文件,不依赖宿主提供框架。执行 `ceru-plugin preview dist/plugin.js` 可以只加载最终文件验证页面。0.2.0 起发行格式使用静态 `exports.manifest / exports.activate / exports.surfaces`,并支持手写单文件插件。
26
+
27
+ 在多根/父目录工作区中,请打开生成的 ceru-plugin.code-workspace 或把插件工程本身加入工作区。已经运行 dev 时选择 Attach to Ceru plugin;Launch 会启动或复用当前项目的 Host。
24
28
 
25
29
  当前 v1 Host 不能直接安装 v2 产物。开发工作台不代替生产凭据保险箱、完整音乐业务或 Guest 安装。
26
30