@shiqianjiang/ceru-plugin-cli 0.3.16 → 3.0.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 (302) hide show
  1. package/README.md +26 -7
  2. package/assets/compatibility.json +18 -0
  3. package/dist/compatibility.d.ts +24 -0
  4. package/dist/compatibility.js +119 -0
  5. package/dist/component.d.ts +6 -0
  6. package/dist/component.js +60 -0
  7. package/dist/dev-music.d.ts +19 -0
  8. package/dist/dev-music.js +81 -0
  9. package/dist/dev-plugin-services.d.ts +10 -0
  10. package/dist/dev-plugin-services.js +67 -0
  11. package/dist/dev.d.ts +1 -9
  12. package/dist/dev.js +53 -713
  13. package/dist/frameworks.d.ts +5 -2
  14. package/dist/frameworks.js +43 -6
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +54 -23
  17. package/dist/init.js +3 -3
  18. package/dist/migrate.d.ts +3 -0
  19. package/dist/migrate.js +109 -0
  20. package/dist/project.d.ts +5 -2
  21. package/dist/project.js +131 -43
  22. package/dist/test-hooks.d.ts +1 -0
  23. package/dist/test-hooks.js +209 -0
  24. package/dist/test-services.d.ts +4 -0
  25. package/dist/test-services.js +54 -0
  26. package/dist/watch-vue-types.d.ts +17 -0
  27. package/dist/watch-vue-types.js +145 -0
  28. package/package.json +10 -6
  29. package/schemas/config.schema.json +954 -452
  30. package/templates/account-qrcode/js/.vscode/extensions.json +3 -0
  31. package/templates/account-qrcode/js/.vscode/launch.json +19 -0
  32. package/templates/account-qrcode/js/.vscode/settings.json +20 -0
  33. package/templates/account-qrcode/js/.vscode/tasks.json +43 -0
  34. package/templates/account-qrcode/js/README.md +15 -0
  35. package/templates/account-qrcode/js/_gitignore +6 -0
  36. package/templates/account-qrcode/js/ceru-plugin.code-workspace +8 -0
  37. package/templates/account-qrcode/js/ceru.plugin.json +62 -0
  38. package/templates/account-qrcode/js/package.json +24 -0
  39. package/templates/account-qrcode/js/src/Login.vue +25 -0
  40. package/templates/account-qrcode/js/src/index.js +25 -0
  41. package/templates/account-qrcode/js/src/login-html.js +23 -0
  42. package/templates/account-qrcode/js/tsconfig.json +17 -0
  43. package/templates/account-qrcode/ts/.vscode/extensions.json +3 -0
  44. package/templates/account-qrcode/ts/.vscode/launch.json +19 -0
  45. package/templates/account-qrcode/ts/.vscode/settings.json +20 -0
  46. package/templates/account-qrcode/ts/.vscode/tasks.json +43 -0
  47. package/templates/account-qrcode/ts/README.md +15 -0
  48. package/templates/account-qrcode/ts/_gitignore +6 -0
  49. package/templates/account-qrcode/ts/ceru-plugin.code-workspace +8 -0
  50. package/templates/account-qrcode/ts/ceru.plugin.json +62 -0
  51. package/templates/account-qrcode/ts/package.json +24 -0
  52. package/templates/account-qrcode/ts/src/Login.vue +25 -0
  53. package/templates/account-qrcode/ts/src/index.ts +25 -0
  54. package/templates/account-qrcode/ts/src/login-html.ts +23 -0
  55. package/templates/account-qrcode/ts/tsconfig.json +17 -0
  56. package/templates/connected-library/js/.vscode/launch.json +12 -29
  57. package/templates/connected-library/js/.vscode/tasks.json +2 -3
  58. package/templates/connected-library/js/README.md +26 -12
  59. package/templates/connected-library/js/ceru.plugin.json +122 -50
  60. package/templates/connected-library/js/package.json +5 -5
  61. package/templates/connected-library/js/src/index.js +46 -5
  62. package/templates/connected-library/js/src/settings.js +28 -0
  63. package/templates/connected-library/ts/.vscode/launch.json +12 -29
  64. package/templates/connected-library/ts/.vscode/tasks.json +2 -3
  65. package/templates/connected-library/ts/README.md +26 -12
  66. package/templates/connected-library/ts/ceru.plugin.json +122 -50
  67. package/templates/connected-library/ts/package.json +5 -5
  68. package/templates/connected-library/ts/src/index.ts +46 -5
  69. package/templates/connected-library/ts/src/settings.ts +28 -0
  70. package/templates/encrypted-source/README.md +86 -0
  71. package/templates/encrypted-source/js/.prettierrc.json +5 -0
  72. package/templates/encrypted-source/js/.vscode/ceru.code-snippets +55 -0
  73. package/templates/encrypted-source/js/.vscode/extensions.json +3 -0
  74. package/templates/encrypted-source/js/.vscode/launch.json +15 -0
  75. package/templates/encrypted-source/js/.vscode/settings.json +20 -0
  76. package/templates/encrypted-source/js/.vscode/tasks.json +40 -0
  77. package/templates/encrypted-source/js/DEMO.md +77 -0
  78. package/templates/encrypted-source/js/README.md +13 -0
  79. package/templates/encrypted-source/js/_gitignore +6 -0
  80. package/templates/encrypted-source/js/ceru-plugin.code-workspace +8 -0
  81. package/templates/encrypted-source/js/ceru.plugin.json +95 -0
  82. package/templates/encrypted-source/js/package.json +26 -0
  83. package/templates/encrypted-source/js/resources/xor-byte.wasm +0 -0
  84. package/templates/encrypted-source/js/resources/xor-byte.wat +5 -0
  85. package/templates/encrypted-source/js/src/demo.js +200 -0
  86. package/templates/encrypted-source/js/src/fixtures.js +118 -0
  87. package/templates/encrypted-source/js/src/index.js +4 -0
  88. package/templates/encrypted-source/js/tests/demo.test.mjs +357 -0
  89. package/templates/encrypted-source/js/tsconfig.json +16 -0
  90. package/templates/encrypted-source/ts/.prettierrc.json +5 -0
  91. package/templates/encrypted-source/ts/.vscode/ceru.code-snippets +55 -0
  92. package/templates/encrypted-source/ts/.vscode/extensions.json +3 -0
  93. package/templates/encrypted-source/ts/.vscode/launch.json +15 -0
  94. package/templates/encrypted-source/ts/.vscode/settings.json +20 -0
  95. package/templates/encrypted-source/ts/.vscode/tasks.json +40 -0
  96. package/templates/encrypted-source/ts/DEMO.md +77 -0
  97. package/templates/encrypted-source/ts/README.md +13 -0
  98. package/templates/encrypted-source/ts/_gitignore +6 -0
  99. package/templates/encrypted-source/ts/ceru-plugin.code-workspace +8 -0
  100. package/templates/encrypted-source/ts/ceru.plugin.json +95 -0
  101. package/templates/encrypted-source/ts/package.json +26 -0
  102. package/templates/encrypted-source/ts/resources/xor-byte.wasm +0 -0
  103. package/templates/encrypted-source/ts/resources/xor-byte.wat +5 -0
  104. package/templates/encrypted-source/ts/src/demo.ts +212 -0
  105. package/templates/encrypted-source/ts/src/fixtures.ts +125 -0
  106. package/templates/encrypted-source/ts/src/index.ts +4 -0
  107. package/templates/encrypted-source/ts/tests/demo.test.mjs +357 -0
  108. package/templates/encrypted-source/ts/tsconfig.json +17 -0
  109. package/templates/guest-adapter/js/.vscode/launch.json +12 -29
  110. package/templates/guest-adapter/js/.vscode/tasks.json +2 -3
  111. package/templates/guest-adapter/js/README.md +10 -10
  112. package/templates/guest-adapter/js/ceru.plugin.json +67 -62
  113. package/templates/guest-adapter/js/package.json +5 -5
  114. package/templates/guest-adapter/js/src/index.js +1 -1
  115. package/templates/guest-adapter/js/src/settings.js +8 -0
  116. package/templates/guest-adapter/ts/.vscode/launch.json +12 -29
  117. package/templates/guest-adapter/ts/.vscode/tasks.json +2 -3
  118. package/templates/guest-adapter/ts/README.md +10 -10
  119. package/templates/guest-adapter/ts/ceru.plugin.json +67 -62
  120. package/templates/guest-adapter/ts/package.json +5 -5
  121. package/templates/guest-adapter/ts/src/index.ts +1 -1
  122. package/templates/guest-adapter/ts/src/settings.ts +8 -0
  123. package/templates/importer/js/.vscode/launch.json +12 -29
  124. package/templates/importer/js/.vscode/tasks.json +2 -3
  125. package/templates/importer/js/README.md +10 -10
  126. package/templates/importer/js/ceru.plugin.json +23 -21
  127. package/templates/importer/js/package.json +5 -5
  128. package/templates/importer/ts/.vscode/launch.json +12 -29
  129. package/templates/importer/ts/.vscode/tasks.json +2 -3
  130. package/templates/importer/ts/README.md +10 -10
  131. package/templates/importer/ts/ceru.plugin.json +23 -21
  132. package/templates/importer/ts/package.json +5 -5
  133. package/templates/page-extension/js/.vscode/extensions.json +3 -0
  134. package/templates/page-extension/js/.vscode/launch.json +19 -0
  135. package/templates/page-extension/js/.vscode/settings.json +20 -0
  136. package/templates/page-extension/js/.vscode/tasks.json +43 -0
  137. package/templates/page-extension/js/README.md +9 -0
  138. package/templates/page-extension/js/_gitignore +6 -0
  139. package/templates/page-extension/js/ceru-plugin.code-workspace +8 -0
  140. package/templates/page-extension/js/ceru.plugin.json +94 -0
  141. package/templates/page-extension/js/package.json +24 -0
  142. package/templates/page-extension/js/src/Open.vue +6 -0
  143. package/templates/page-extension/js/src/Search.vue +62 -0
  144. package/templates/page-extension/js/src/index.js +54 -0
  145. package/templates/page-extension/js/tsconfig.json +17 -0
  146. package/templates/page-extension/ts/.vscode/extensions.json +3 -0
  147. package/templates/page-extension/ts/.vscode/launch.json +19 -0
  148. package/templates/page-extension/ts/.vscode/settings.json +20 -0
  149. package/templates/page-extension/ts/.vscode/tasks.json +43 -0
  150. package/templates/page-extension/ts/README.md +9 -0
  151. package/templates/page-extension/ts/_gitignore +6 -0
  152. package/templates/page-extension/ts/ceru-plugin.code-workspace +8 -0
  153. package/templates/page-extension/ts/ceru.plugin.json +94 -0
  154. package/templates/page-extension/ts/package.json +24 -0
  155. package/templates/page-extension/ts/src/Open.vue +6 -0
  156. package/templates/page-extension/ts/src/Search.vue +62 -0
  157. package/templates/page-extension/ts/src/index.ts +54 -0
  158. package/templates/page-extension/ts/tsconfig.json +17 -0
  159. package/templates/playback-hook/js/.prettierrc.json +5 -0
  160. package/templates/playback-hook/js/.vscode/extensions.json +3 -0
  161. package/templates/playback-hook/js/.vscode/launch.json +19 -0
  162. package/templates/playback-hook/js/.vscode/settings.json +20 -0
  163. package/templates/playback-hook/js/.vscode/tasks.json +50 -0
  164. package/templates/playback-hook/js/README.md +24 -0
  165. package/templates/playback-hook/js/_gitignore +6 -0
  166. package/templates/playback-hook/js/ceru-plugin.code-workspace +8 -0
  167. package/templates/playback-hook/js/ceru.plugin.json +36 -0
  168. package/templates/playback-hook/js/package.json +23 -0
  169. package/templates/playback-hook/js/src/index.js +25 -0
  170. package/templates/playback-hook/js/tests/hooks.json +316 -0
  171. package/templates/playback-hook/js/tsconfig.json +16 -0
  172. package/templates/playback-hook/ts/.prettierrc.json +5 -0
  173. package/templates/playback-hook/ts/.vscode/extensions.json +3 -0
  174. package/templates/playback-hook/ts/.vscode/launch.json +19 -0
  175. package/templates/playback-hook/ts/.vscode/settings.json +20 -0
  176. package/templates/playback-hook/ts/.vscode/tasks.json +50 -0
  177. package/templates/playback-hook/ts/README.md +24 -0
  178. package/templates/playback-hook/ts/_gitignore +6 -0
  179. package/templates/playback-hook/ts/ceru-plugin.code-workspace +8 -0
  180. package/templates/playback-hook/ts/ceru.plugin.json +36 -0
  181. package/templates/playback-hook/ts/package.json +23 -0
  182. package/templates/playback-hook/ts/src/index.ts +25 -0
  183. package/templates/playback-hook/ts/tests/hooks.json +316 -0
  184. package/templates/playback-hook/ts/tsconfig.json +16 -0
  185. package/templates/player-skin/js/.vscode/extensions.json +3 -0
  186. package/templates/player-skin/js/.vscode/launch.json +19 -0
  187. package/templates/player-skin/js/.vscode/settings.json +20 -0
  188. package/templates/player-skin/js/.vscode/tasks.json +43 -0
  189. package/templates/player-skin/js/README.md +11 -0
  190. package/templates/player-skin/js/_gitignore +6 -0
  191. package/templates/player-skin/js/assets/studio-preview.svg +15 -0
  192. package/templates/player-skin/js/ceru-plugin.code-workspace +8 -0
  193. package/templates/player-skin/js/ceru.plugin.json +77 -0
  194. package/templates/player-skin/js/package.json +24 -0
  195. package/templates/player-skin/js/src/Artwork.vue +9 -0
  196. package/templates/player-skin/js/src/Background.vue +15 -0
  197. package/templates/player-skin/js/src/BuiltinLyrics.vue +15 -0
  198. package/templates/player-skin/js/src/Lyrics.vue +28 -0
  199. package/templates/player-skin/js/tsconfig.json +17 -0
  200. package/templates/player-skin/ts/.vscode/extensions.json +3 -0
  201. package/templates/player-skin/ts/.vscode/launch.json +19 -0
  202. package/templates/player-skin/ts/.vscode/settings.json +20 -0
  203. package/templates/player-skin/ts/.vscode/tasks.json +43 -0
  204. package/templates/player-skin/ts/README.md +11 -0
  205. package/templates/player-skin/ts/_gitignore +6 -0
  206. package/templates/player-skin/ts/assets/studio-preview.svg +15 -0
  207. package/templates/player-skin/ts/ceru-plugin.code-workspace +8 -0
  208. package/templates/player-skin/ts/ceru.plugin.json +77 -0
  209. package/templates/player-skin/ts/package.json +24 -0
  210. package/templates/player-skin/ts/src/Artwork.vue +9 -0
  211. package/templates/player-skin/ts/src/Background.vue +15 -0
  212. package/templates/player-skin/ts/src/BuiltinLyrics.vue +15 -0
  213. package/templates/player-skin/ts/src/Lyrics.vue +28 -0
  214. package/templates/player-skin/ts/tsconfig.json +17 -0
  215. package/templates/react/js/.vscode/launch.json +12 -29
  216. package/templates/react/js/.vscode/tasks.json +2 -3
  217. package/templates/react/js/README.md +10 -10
  218. package/templates/react/js/ceru.plugin.json +27 -22
  219. package/templates/react/js/package.json +5 -5
  220. package/templates/react/js/src/index.js +1 -1
  221. package/templates/react/ts/.vscode/launch.json +12 -29
  222. package/templates/react/ts/.vscode/tasks.json +2 -3
  223. package/templates/react/ts/README.md +10 -10
  224. package/templates/react/ts/ceru.plugin.json +27 -22
  225. package/templates/react/ts/package.json +5 -5
  226. package/templates/react/ts/src/index.ts +1 -1
  227. package/templates/snapshot.json +152 -6
  228. package/templates/source/js/.vscode/launch.json +12 -29
  229. package/templates/source/js/.vscode/tasks.json +2 -3
  230. package/templates/source/js/README.md +12 -10
  231. package/templates/source/js/ceru.plugin.json +44 -26
  232. package/templates/source/js/package.json +5 -5
  233. package/templates/source/js/src/index.js +10 -8
  234. package/templates/source/ts/.vscode/launch.json +12 -29
  235. package/templates/source/ts/.vscode/tasks.json +2 -3
  236. package/templates/source/ts/README.md +12 -10
  237. package/templates/source/ts/ceru.plugin.json +44 -26
  238. package/templates/source/ts/package.json +5 -5
  239. package/templates/source/ts/src/index.ts +10 -8
  240. package/templates/vue/js/.vscode/launch.json +12 -29
  241. package/templates/vue/js/.vscode/tasks.json +2 -3
  242. package/templates/vue/js/README.md +10 -10
  243. package/templates/vue/js/ceru.plugin.json +27 -22
  244. package/templates/vue/js/package.json +5 -5
  245. package/templates/vue/js/src/index.js +1 -1
  246. package/templates/vue/ts/.vscode/launch.json +12 -29
  247. package/templates/vue/ts/.vscode/tasks.json +2 -3
  248. package/templates/vue/ts/README.md +10 -10
  249. package/templates/vue/ts/ceru.plugin.json +27 -22
  250. package/templates/vue/ts/package.json +5 -5
  251. package/templates/vue/ts/src/index.ts +1 -1
  252. package/templates/vue-tsx/js/.vscode/launch.json +12 -29
  253. package/templates/vue-tsx/js/.vscode/tasks.json +2 -3
  254. package/templates/vue-tsx/js/README.md +10 -10
  255. package/templates/vue-tsx/js/ceru.plugin.json +27 -22
  256. package/templates/vue-tsx/js/package.json +5 -5
  257. package/templates/vue-tsx/js/src/index.js +1 -1
  258. package/templates/vue-tsx/ts/.vscode/launch.json +12 -29
  259. package/templates/vue-tsx/ts/.vscode/tasks.json +2 -3
  260. package/templates/vue-tsx/ts/README.md +10 -10
  261. package/templates/vue-tsx/ts/ceru.plugin.json +27 -22
  262. package/templates/vue-tsx/ts/package.json +5 -5
  263. package/templates/vue-tsx/ts/src/index.ts +1 -1
  264. package/templates/web-dist/js/.vscode/launch.json +12 -29
  265. package/templates/web-dist/js/.vscode/tasks.json +2 -3
  266. package/templates/web-dist/js/README.md +10 -10
  267. package/templates/web-dist/js/ceru.plugin.json +27 -22
  268. package/templates/web-dist/js/package.json +5 -5
  269. package/templates/web-dist/js/src/index.js +1 -1
  270. package/templates/web-dist/ts/.vscode/launch.json +12 -29
  271. package/templates/web-dist/ts/.vscode/tasks.json +2 -3
  272. package/templates/web-dist/ts/README.md +10 -10
  273. package/templates/web-dist/ts/ceru.plugin.json +27 -22
  274. package/templates/web-dist/ts/package.json +5 -5
  275. package/templates/web-dist/ts/src/index.ts +1 -1
  276. package/templates/web-surface/js/.vscode/launch.json +12 -29
  277. package/templates/web-surface/js/.vscode/tasks.json +2 -3
  278. package/templates/web-surface/js/README.md +10 -10
  279. package/templates/web-surface/js/ceru.plugin.json +35 -35
  280. package/templates/web-surface/js/package.json +5 -5
  281. package/templates/web-surface/js/src/index.js +1 -1
  282. package/templates/web-surface/ts/.vscode/launch.json +12 -29
  283. package/templates/web-surface/ts/.vscode/tasks.json +2 -3
  284. package/templates/web-surface/ts/README.md +10 -10
  285. package/templates/web-surface/ts/ceru.plugin.json +35 -35
  286. package/templates/web-surface/ts/package.json +5 -5
  287. package/templates/web-surface/ts/src/index.ts +1 -1
  288. package/assets/core-contracts.js +0 -1
  289. package/assets/electron-app/main.cjs +0 -1
  290. package/assets/electron-app/package.json +0 -8
  291. package/assets/electron.cjs +0 -42
  292. package/assets/index.html +0 -94
  293. package/assets/native-view.js +0 -197
  294. package/assets/playground.js +0 -883
  295. package/assets/sandbox.js +0 -67
  296. package/assets/style.css +0 -337
  297. package/dist/socket-broker.d.ts +0 -23
  298. package/dist/socket-broker.js +0 -229
  299. package/templates/connected-library/js/ui/settings.json +0 -24
  300. package/templates/connected-library/ts/ui/settings.json +0 -24
  301. package/templates/guest-adapter/js/ui/settings.json +0 -14
  302. package/templates/guest-adapter/ts/ui/settings.json +0 -14
@@ -0,0 +1,17 @@
1
+ import ts from 'typescript';
2
+ export declare class VueWatchTypes {
3
+ private readonly root;
4
+ private accepted?;
5
+ private readonly shapes;
6
+ private readonly cache;
7
+ private readonly create;
8
+ private readonly options;
9
+ private readonly host;
10
+ private readonly extensions;
11
+ private readonly configPath;
12
+ private previous?;
13
+ constructor(root: string);
14
+ private config;
15
+ private independentTemplates;
16
+ check(declarations: string, changed: string[]): ts.Program;
17
+ }
@@ -0,0 +1,145 @@
1
+ import { resolve } from 'node:path';
2
+ import ts from 'typescript';
3
+ import { parse } from '@vue/compiler-sfc';
4
+ import { createParsedCommandLine, createVueLanguagePlugin, getAllExtensions, } from '@vue/language-core';
5
+ import { proxyCreateProgram } from '@volar/typescript/lib/node/proxyCreateProgram.js';
6
+ const normalized = (path) => resolve(path).replaceAll('\\', '/');
7
+ function checkedShape(source, file) {
8
+ const { descriptor, errors } = parse(source, { filename: file });
9
+ const template = descriptor.template;
10
+ if (errors.length || !template?.ast || template.lang || template.src)
11
+ return { types: source, source };
12
+ const spans = [];
13
+ const visit = (node) => {
14
+ if (node.type === 2 && node.content.trim()) {
15
+ spans.push({ start: node.loc.start.offset, end: node.loc.end.offset });
16
+ }
17
+ else if (node.type === 1 && node.tag !== 'script' && node.tag !== 'style') {
18
+ node.children.forEach(visit);
19
+ }
20
+ };
21
+ template.ast.children.forEach(visit);
22
+ let shape = source;
23
+ for (const span of spans.reverse())
24
+ shape = shape.slice(0, span.start) + '\u0000' + shape.slice(span.end);
25
+ return { types: shape, source, outsideTemplate: JSON.stringify([source.slice(0, template.loc.start.offset), source.slice(template.loc.end.offset)]) };
26
+ }
27
+ export class VueWatchTypes {
28
+ root;
29
+ accepted;
30
+ shapes = new Map();
31
+ cache = new Map();
32
+ create;
33
+ options;
34
+ host;
35
+ extensions;
36
+ configPath;
37
+ previous;
38
+ constructor(root) {
39
+ this.root = root;
40
+ this.configPath = normalized(resolve(root, 'tsconfig.json'));
41
+ const { vueOptions } = createParsedCommandLine(ts, ts.sys, this.configPath);
42
+ this.extensions = getAllExtensions(vueOptions).map((extension) => ({
43
+ extension,
44
+ isMixedContent: true,
45
+ scriptKind: ts.ScriptKind.Deferred,
46
+ }));
47
+ const config = this.config();
48
+ this.options = { ...config.options, noEmit: true, allowNonTsExtensions: true };
49
+ this.host = ts.createIncrementalCompilerHost(this.options);
50
+ const getSource = this.host.getSourceFile.bind(this.host);
51
+ this.host.getSourceFile = (file, ...args) => {
52
+ const key = normalized(file);
53
+ const cached = this.cache.get(key);
54
+ if (cached && !args[2])
55
+ return cached;
56
+ const source = getSource(file, ...args);
57
+ if (source)
58
+ this.cache.set(key, source);
59
+ return source;
60
+ };
61
+ this.create = proxyCreateProgram(ts, ts.createProgram, () => [
62
+ createVueLanguagePlugin(ts, this.options, vueOptions, (id) => id),
63
+ ]);
64
+ }
65
+ config() {
66
+ const input = ts.readConfigFile(this.configPath, ts.sys.readFile);
67
+ if (input.error)
68
+ throw Error(ts.flattenDiagnosticMessageText(input.error.messageText, '\n'));
69
+ return ts.parseJsonConfigFileContent(input.config, ts.sys, this.root, undefined, this.configPath, undefined, this.extensions);
70
+ }
71
+ independentTemplates(before, program, edits) {
72
+ if (!before || edits.length !== 1 || !edits[0].endsWith('.vue') || program.getProjectReferences()?.length)
73
+ return;
74
+ const localModule = (source) => source && ts.isExternalModule(source) &&
75
+ !source.statements.some(statement => ts.isModuleDeclaration(statement) || ts.isNamespaceExportDeclaration(statement));
76
+ const roots = program.getRootFileNames();
77
+ if (!roots.includes(edits[0]) || roots.length !== before.getRootFileNames().length ||
78
+ roots.some((root, index) => root !== before.getRootFileNames()[index]))
79
+ return;
80
+ const sources = program.getSourceFiles();
81
+ if (sources.length !== before.getSourceFiles().length)
82
+ return;
83
+ const changed = sources.filter(source => before.getSourceFile(source.fileName) !== source);
84
+ if (!changed.length || changed.some(source => {
85
+ const prior = before.getSourceFile(source.fileName);
86
+ return !source.fileName.endsWith('.vue') || !roots.includes(source.fileName) || !localModule(prior) || !localModule(source);
87
+ }))
88
+ return;
89
+ const names = new Set(changed.map(source => source.fileName));
90
+ if (!names.has(edits[0]))
91
+ return;
92
+ // TypeScript still follows imports, aliases and references after these files cease to be roots.
93
+ const remaining = this.create({ rootNames: roots.filter(root => !names.has(root)), options: this.options,
94
+ host: { ...this.host }, oldProgram: program });
95
+ if (changed.some(source => remaining.getSourceFile(source.fileName)) || remaining.getSourceFiles().length !== sources.length - changed.length)
96
+ return;
97
+ return changed;
98
+ }
99
+ check(declarations, changed) {
100
+ const edits = changed.map((file) => normalized(resolve(this.root, file)));
101
+ const shapes = new Map();
102
+ for (const file of edits) {
103
+ this.cache.delete(file);
104
+ const source = file.endsWith('.vue') ? ts.sys.readFile(file) : undefined;
105
+ if (source !== undefined)
106
+ shapes.set(file, checkedShape(source, file));
107
+ }
108
+ if (this.accepted &&
109
+ edits.length &&
110
+ edits.every((file) => shapes.has(file) && shapes.get(file).types === this.shapes.get(file)?.types))
111
+ return this.accepted;
112
+ const accepted = this.accepted;
113
+ this.accepted = undefined;
114
+ const config = this.config();
115
+ const program = this.create({
116
+ rootNames: [...new Set([...config.fileNames.map(normalized), normalized(declarations)])],
117
+ options: this.options,
118
+ host: { ...this.host },
119
+ oldProgram: accepted ?? this.previous?.getProgram(),
120
+ projectReferences: config.projectReferences,
121
+ });
122
+ const outsideTemplate = shapes.get(edits[0])?.outsideTemplate;
123
+ const independent = outsideTemplate !== undefined && outsideTemplate === this.shapes.get(edits[0])?.outsideTemplate
124
+ ? this.independentTemplates(accepted, program, edits) : undefined;
125
+ if (!independent)
126
+ this.previous = ts.createSemanticDiagnosticsBuilderProgram(program, this.host, this.previous);
127
+ const errors = [
128
+ ...config.errors,
129
+ ...program.getOptionsDiagnostics(),
130
+ ...program.getGlobalDiagnostics(),
131
+ ...program.getSyntacticDiagnostics(),
132
+ ...(independent ? independent.flatMap(source => program.getSemanticDiagnostics(source)) : this.previous.getSemanticDiagnostics()),
133
+ ];
134
+ if (errors.length)
135
+ throw Error(ts.formatDiagnostics(errors, this.host));
136
+ this.shapes.clear();
137
+ for (const file of program.getRootFileNames().filter((file) => file.endsWith('.vue'))) {
138
+ const key = normalized(file), edit = shapes.get(key), source = edit?.source ?? ts.sys.readFile(key);
139
+ if (source !== undefined && program.getSourceFile(file)?.text.startsWith(source))
140
+ this.shapes.set(key, edit ?? checkedShape(source, key));
141
+ }
142
+ this.accepted = program;
143
+ return program;
144
+ }
145
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shiqianjiang/ceru-plugin-cli",
3
- "version": "0.3.16",
3
+ "version": "3.0.0",
4
4
  "description": "TypeScript scaffolding, single-file build, watch, validation, signing and issuance for Ceru plugins",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,10 @@
17
17
  },
18
18
  "files": [
19
19
  "dist",
20
- "assets",
20
+ "assets/catalog.json",
21
+ "assets/compatibility.json",
22
+ "assets/originals",
23
+ "assets/vendor-licenses",
21
24
  "schemas",
22
25
  "templates",
23
26
  "README.md",
@@ -32,8 +35,10 @@
32
35
  },
33
36
  "dependencies": {
34
37
  "@babel/core": "^7.29.7",
35
- "@shiqianjiang/ceru-plugin-issuer": "0.3.16",
36
- "@shiqianjiang/ceru-plugin-sdk": "0.3.16",
38
+ "@shiqianjiang/ceru-plugin-issuer": "3.0.0",
39
+ "@shiqianjiang/ceru-plugin-sdk": "3.0.0",
40
+ "@volar/typescript": "2.4.28",
41
+ "@vue/language-core": "3.3.11",
37
42
  "@vue/babel-plugin-jsx": "^2.0.1",
38
43
  "@vue/compiler-sfc": "3.5.43",
39
44
  "axios": "^1.20.0",
@@ -43,11 +48,10 @@
43
48
  "react": "19.3.0",
44
49
  "react-dom": "19.3.0",
45
50
  "semver": "^7.7.0",
46
- "socket.io-client": "^4.8.3",
47
51
  "typescript": "~5.9.3",
48
52
  "vue": "3.5.43",
49
53
  "vue-tsc": "^3.3.11",
50
- "ws": "^8.21.3"
54
+ "@shiqianjiang/ceru-plugin-core": "3.0.0"
51
55
  },
52
56
  "publishConfig": {
53
57
  "access": "public",