coc-vscode-loader 1.2.4 → 1.2.6

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "converter",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "private": true,
5
5
  "description": "vscode → coc.nvim converter prototype",
6
6
  "type": "module",
@@ -0,0 +1,419 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ importers:
8
+
9
+ .:
10
+ dependencies:
11
+ commander:
12
+ specifier: ^15.0.0
13
+ version: 15.0.0
14
+ ts-morph:
15
+ specifier: ^28.0.0
16
+ version: 28.0.0
17
+ typescript:
18
+ specifier: ^6.0.3
19
+ version: 6.0.3
20
+ devDependencies:
21
+ '@types/node':
22
+ specifier: ^25.9.3
23
+ version: 25.9.3
24
+ tsx:
25
+ specifier: ^4.19.0
26
+ version: 4.22.4
27
+
28
+ packages:
29
+
30
+ '@esbuild/aix-ppc64@0.28.1':
31
+ resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==}
32
+ engines: {node: '>=18'}
33
+ cpu: [ppc64]
34
+ os: [aix]
35
+
36
+ '@esbuild/android-arm64@0.28.1':
37
+ resolution: {integrity: sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==}
38
+ engines: {node: '>=18'}
39
+ cpu: [arm64]
40
+ os: [android]
41
+
42
+ '@esbuild/android-arm@0.28.1':
43
+ resolution: {integrity: sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==}
44
+ engines: {node: '>=18'}
45
+ cpu: [arm]
46
+ os: [android]
47
+
48
+ '@esbuild/android-x64@0.28.1':
49
+ resolution: {integrity: sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==}
50
+ engines: {node: '>=18'}
51
+ cpu: [x64]
52
+ os: [android]
53
+
54
+ '@esbuild/darwin-arm64@0.28.1':
55
+ resolution: {integrity: sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==}
56
+ engines: {node: '>=18'}
57
+ cpu: [arm64]
58
+ os: [darwin]
59
+
60
+ '@esbuild/darwin-x64@0.28.1':
61
+ resolution: {integrity: sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==}
62
+ engines: {node: '>=18'}
63
+ cpu: [x64]
64
+ os: [darwin]
65
+
66
+ '@esbuild/freebsd-arm64@0.28.1':
67
+ resolution: {integrity: sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==}
68
+ engines: {node: '>=18'}
69
+ cpu: [arm64]
70
+ os: [freebsd]
71
+
72
+ '@esbuild/freebsd-x64@0.28.1':
73
+ resolution: {integrity: sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==}
74
+ engines: {node: '>=18'}
75
+ cpu: [x64]
76
+ os: [freebsd]
77
+
78
+ '@esbuild/linux-arm64@0.28.1':
79
+ resolution: {integrity: sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==}
80
+ engines: {node: '>=18'}
81
+ cpu: [arm64]
82
+ os: [linux]
83
+
84
+ '@esbuild/linux-arm@0.28.1':
85
+ resolution: {integrity: sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==}
86
+ engines: {node: '>=18'}
87
+ cpu: [arm]
88
+ os: [linux]
89
+
90
+ '@esbuild/linux-ia32@0.28.1':
91
+ resolution: {integrity: sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==}
92
+ engines: {node: '>=18'}
93
+ cpu: [ia32]
94
+ os: [linux]
95
+
96
+ '@esbuild/linux-loong64@0.28.1':
97
+ resolution: {integrity: sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==}
98
+ engines: {node: '>=18'}
99
+ cpu: [loong64]
100
+ os: [linux]
101
+
102
+ '@esbuild/linux-mips64el@0.28.1':
103
+ resolution: {integrity: sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==}
104
+ engines: {node: '>=18'}
105
+ cpu: [mips64el]
106
+ os: [linux]
107
+
108
+ '@esbuild/linux-ppc64@0.28.1':
109
+ resolution: {integrity: sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==}
110
+ engines: {node: '>=18'}
111
+ cpu: [ppc64]
112
+ os: [linux]
113
+
114
+ '@esbuild/linux-riscv64@0.28.1':
115
+ resolution: {integrity: sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==}
116
+ engines: {node: '>=18'}
117
+ cpu: [riscv64]
118
+ os: [linux]
119
+
120
+ '@esbuild/linux-s390x@0.28.1':
121
+ resolution: {integrity: sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==}
122
+ engines: {node: '>=18'}
123
+ cpu: [s390x]
124
+ os: [linux]
125
+
126
+ '@esbuild/linux-x64@0.28.1':
127
+ resolution: {integrity: sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==}
128
+ engines: {node: '>=18'}
129
+ cpu: [x64]
130
+ os: [linux]
131
+
132
+ '@esbuild/netbsd-arm64@0.28.1':
133
+ resolution: {integrity: sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==}
134
+ engines: {node: '>=18'}
135
+ cpu: [arm64]
136
+ os: [netbsd]
137
+
138
+ '@esbuild/netbsd-x64@0.28.1':
139
+ resolution: {integrity: sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==}
140
+ engines: {node: '>=18'}
141
+ cpu: [x64]
142
+ os: [netbsd]
143
+
144
+ '@esbuild/openbsd-arm64@0.28.1':
145
+ resolution: {integrity: sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==}
146
+ engines: {node: '>=18'}
147
+ cpu: [arm64]
148
+ os: [openbsd]
149
+
150
+ '@esbuild/openbsd-x64@0.28.1':
151
+ resolution: {integrity: sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==}
152
+ engines: {node: '>=18'}
153
+ cpu: [x64]
154
+ os: [openbsd]
155
+
156
+ '@esbuild/openharmony-arm64@0.28.1':
157
+ resolution: {integrity: sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==}
158
+ engines: {node: '>=18'}
159
+ cpu: [arm64]
160
+ os: [openharmony]
161
+
162
+ '@esbuild/sunos-x64@0.28.1':
163
+ resolution: {integrity: sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==}
164
+ engines: {node: '>=18'}
165
+ cpu: [x64]
166
+ os: [sunos]
167
+
168
+ '@esbuild/win32-arm64@0.28.1':
169
+ resolution: {integrity: sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==}
170
+ engines: {node: '>=18'}
171
+ cpu: [arm64]
172
+ os: [win32]
173
+
174
+ '@esbuild/win32-ia32@0.28.1':
175
+ resolution: {integrity: sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==}
176
+ engines: {node: '>=18'}
177
+ cpu: [ia32]
178
+ os: [win32]
179
+
180
+ '@esbuild/win32-x64@0.28.1':
181
+ resolution: {integrity: sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==}
182
+ engines: {node: '>=18'}
183
+ cpu: [x64]
184
+ os: [win32]
185
+
186
+ '@ts-morph/common@0.29.0':
187
+ resolution: {integrity: sha512-35oUmphHbJvQ/+UTwFNme/t2p3FoKiGJ5auTjjpNTop2dyREspirjMy82PLSC1pnDJ8ah1GU98hwpVt64YXQsg==}
188
+
189
+ '@types/node@25.9.3':
190
+ resolution: {integrity: sha512-603BddQMv3pUcr4U2dhujk83N2tTDVr/34wII2B6bJy6g+8WD6yUb11jszNs0gdi4PesVWl7ABt8nYMVpnLUcg==}
191
+
192
+ balanced-match@4.0.4:
193
+ resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
194
+ engines: {node: 18 || 20 || >=22}
195
+
196
+ brace-expansion@5.0.6:
197
+ resolution: {integrity: sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==}
198
+ engines: {node: 18 || 20 || >=22}
199
+
200
+ code-block-writer@13.0.3:
201
+ resolution: {integrity: sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==}
202
+
203
+ commander@15.0.0:
204
+ resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==}
205
+ engines: {node: '>=22.12.0'}
206
+
207
+ esbuild@0.28.1:
208
+ resolution: {integrity: sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==}
209
+ engines: {node: '>=18'}
210
+ hasBin: true
211
+
212
+ fdir@6.5.0:
213
+ resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
214
+ engines: {node: '>=12.0.0'}
215
+ peerDependencies:
216
+ picomatch: ^3 || ^4
217
+ peerDependenciesMeta:
218
+ picomatch:
219
+ optional: true
220
+
221
+ fsevents@2.3.3:
222
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
223
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
224
+ os: [darwin]
225
+
226
+ minimatch@10.2.5:
227
+ resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==}
228
+ engines: {node: 18 || 20 || >=22}
229
+
230
+ path-browserify@1.0.1:
231
+ resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
232
+
233
+ picomatch@4.0.4:
234
+ resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==}
235
+ engines: {node: '>=12'}
236
+
237
+ tinyglobby@0.2.17:
238
+ resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
239
+ engines: {node: '>=12.0.0'}
240
+
241
+ ts-morph@28.0.0:
242
+ resolution: {integrity: sha512-Wp3tnZ2bzwxyTZMtgWVzXDfm7lB1Drz+y9DmmYH/L702PQhPyVrp3pkou3yIz4qjS14GY9kcpmLiOOMvl8oG1g==}
243
+
244
+ tsx@4.22.4:
245
+ resolution: {integrity: sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg==}
246
+ engines: {node: '>=18.0.0'}
247
+ hasBin: true
248
+
249
+ typescript@6.0.3:
250
+ resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
251
+ engines: {node: '>=14.17'}
252
+ hasBin: true
253
+
254
+ undici-types@7.24.6:
255
+ resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}
256
+
257
+ snapshots:
258
+
259
+ '@esbuild/aix-ppc64@0.28.1':
260
+ optional: true
261
+
262
+ '@esbuild/android-arm64@0.28.1':
263
+ optional: true
264
+
265
+ '@esbuild/android-arm@0.28.1':
266
+ optional: true
267
+
268
+ '@esbuild/android-x64@0.28.1':
269
+ optional: true
270
+
271
+ '@esbuild/darwin-arm64@0.28.1':
272
+ optional: true
273
+
274
+ '@esbuild/darwin-x64@0.28.1':
275
+ optional: true
276
+
277
+ '@esbuild/freebsd-arm64@0.28.1':
278
+ optional: true
279
+
280
+ '@esbuild/freebsd-x64@0.28.1':
281
+ optional: true
282
+
283
+ '@esbuild/linux-arm64@0.28.1':
284
+ optional: true
285
+
286
+ '@esbuild/linux-arm@0.28.1':
287
+ optional: true
288
+
289
+ '@esbuild/linux-ia32@0.28.1':
290
+ optional: true
291
+
292
+ '@esbuild/linux-loong64@0.28.1':
293
+ optional: true
294
+
295
+ '@esbuild/linux-mips64el@0.28.1':
296
+ optional: true
297
+
298
+ '@esbuild/linux-ppc64@0.28.1':
299
+ optional: true
300
+
301
+ '@esbuild/linux-riscv64@0.28.1':
302
+ optional: true
303
+
304
+ '@esbuild/linux-s390x@0.28.1':
305
+ optional: true
306
+
307
+ '@esbuild/linux-x64@0.28.1':
308
+ optional: true
309
+
310
+ '@esbuild/netbsd-arm64@0.28.1':
311
+ optional: true
312
+
313
+ '@esbuild/netbsd-x64@0.28.1':
314
+ optional: true
315
+
316
+ '@esbuild/openbsd-arm64@0.28.1':
317
+ optional: true
318
+
319
+ '@esbuild/openbsd-x64@0.28.1':
320
+ optional: true
321
+
322
+ '@esbuild/openharmony-arm64@0.28.1':
323
+ optional: true
324
+
325
+ '@esbuild/sunos-x64@0.28.1':
326
+ optional: true
327
+
328
+ '@esbuild/win32-arm64@0.28.1':
329
+ optional: true
330
+
331
+ '@esbuild/win32-ia32@0.28.1':
332
+ optional: true
333
+
334
+ '@esbuild/win32-x64@0.28.1':
335
+ optional: true
336
+
337
+ '@ts-morph/common@0.29.0':
338
+ dependencies:
339
+ minimatch: 10.2.5
340
+ path-browserify: 1.0.1
341
+ tinyglobby: 0.2.17
342
+
343
+ '@types/node@25.9.3':
344
+ dependencies:
345
+ undici-types: 7.24.6
346
+
347
+ balanced-match@4.0.4: {}
348
+
349
+ brace-expansion@5.0.6:
350
+ dependencies:
351
+ balanced-match: 4.0.4
352
+
353
+ code-block-writer@13.0.3: {}
354
+
355
+ commander@15.0.0: {}
356
+
357
+ esbuild@0.28.1:
358
+ optionalDependencies:
359
+ '@esbuild/aix-ppc64': 0.28.1
360
+ '@esbuild/android-arm': 0.28.1
361
+ '@esbuild/android-arm64': 0.28.1
362
+ '@esbuild/android-x64': 0.28.1
363
+ '@esbuild/darwin-arm64': 0.28.1
364
+ '@esbuild/darwin-x64': 0.28.1
365
+ '@esbuild/freebsd-arm64': 0.28.1
366
+ '@esbuild/freebsd-x64': 0.28.1
367
+ '@esbuild/linux-arm': 0.28.1
368
+ '@esbuild/linux-arm64': 0.28.1
369
+ '@esbuild/linux-ia32': 0.28.1
370
+ '@esbuild/linux-loong64': 0.28.1
371
+ '@esbuild/linux-mips64el': 0.28.1
372
+ '@esbuild/linux-ppc64': 0.28.1
373
+ '@esbuild/linux-riscv64': 0.28.1
374
+ '@esbuild/linux-s390x': 0.28.1
375
+ '@esbuild/linux-x64': 0.28.1
376
+ '@esbuild/netbsd-arm64': 0.28.1
377
+ '@esbuild/netbsd-x64': 0.28.1
378
+ '@esbuild/openbsd-arm64': 0.28.1
379
+ '@esbuild/openbsd-x64': 0.28.1
380
+ '@esbuild/openharmony-arm64': 0.28.1
381
+ '@esbuild/sunos-x64': 0.28.1
382
+ '@esbuild/win32-arm64': 0.28.1
383
+ '@esbuild/win32-ia32': 0.28.1
384
+ '@esbuild/win32-x64': 0.28.1
385
+
386
+ fdir@6.5.0(picomatch@4.0.4):
387
+ optionalDependencies:
388
+ picomatch: 4.0.4
389
+
390
+ fsevents@2.3.3:
391
+ optional: true
392
+
393
+ minimatch@10.2.5:
394
+ dependencies:
395
+ brace-expansion: 5.0.6
396
+
397
+ path-browserify@1.0.1: {}
398
+
399
+ picomatch@4.0.4: {}
400
+
401
+ tinyglobby@0.2.17:
402
+ dependencies:
403
+ fdir: 6.5.0(picomatch@4.0.4)
404
+ picomatch: 4.0.4
405
+
406
+ ts-morph@28.0.0:
407
+ dependencies:
408
+ '@ts-morph/common': 0.29.0
409
+ code-block-writer: 13.0.3
410
+
411
+ tsx@4.22.4:
412
+ dependencies:
413
+ esbuild: 0.28.1
414
+ optionalDependencies:
415
+ fsevents: 2.3.3
416
+
417
+ typescript@6.0.3: {}
418
+
419
+ undici-types@7.24.6: {}
@@ -326,6 +326,7 @@ export async function convert(opts: ConvertOptions): Promise<void> {
326
326
  command: c.command,
327
327
  title: c.title,
328
328
  })) || undefined,
329
+ snippets: origPkg.contributes?.snippets || undefined,
329
330
  ...(tsPlugins.length > 0 ? {
330
331
  typescriptServerPlugins: tsPlugins.map(p => ({
331
332
  ...p,
@@ -338,6 +339,7 @@ export async function convert(opts: ConvertOptions): Promise<void> {
338
339
  // Clean null fields
339
340
  if (!pkg.contributes?.configuration) delete (pkg.contributes as any).configuration
340
341
  if (!pkg.contributes?.commands) delete (pkg.contributes as any).commands
342
+ if (!pkg.contributes?.snippets) delete (pkg.contributes as any).snippets
341
343
  if (Object.keys(pkg.contributes).length === 0) delete (pkg as any).contributes
342
344
 
343
345
  fs.writeFileSync(path.join(output, 'package.json'), JSON.stringify(pkg, null, 2))
@@ -3,6 +3,7 @@ import { languageClientGenerator } from './language-client.js'
3
3
  import { sourceGenerator } from './source.js'
4
4
  import { bridgeGenerator } from './bridge.js'
5
5
  import { markUnsupportedGenerator } from './mark-unsupported.js'
6
+ import { snippetsGenerator } from './snippets.js'
6
7
 
7
8
  const REGISTRY: Record<string, StepGenerator> = {}
8
9
 
@@ -27,3 +28,4 @@ registerGenerator(languageClientGenerator)
27
28
  registerGenerator(sourceGenerator)
28
29
  registerGenerator(bridgeGenerator)
29
30
  registerGenerator(markUnsupportedGenerator)
31
+ registerGenerator(snippetsGenerator)
@@ -0,0 +1,101 @@
1
+ import * as fs from 'fs'
2
+ import * as path from 'path'
3
+ import { StepGenerator, StepContext, SnippetsStep, StepResult } from '../types.js'
4
+
5
+ export const snippetsGenerator: StepGenerator = {
6
+ type: 'snippets',
7
+
8
+ generate(ctx: StepContext, step: any): StepResult {
9
+ const ss = step as SnippetsStep
10
+ const { input, output, origPkg, verbose } = ctx
11
+
12
+ const contributedSnippets: Array<{ language: string; path: string }> =
13
+ origPkg.contributes?.snippets || []
14
+
15
+ if (contributedSnippets.length === 0 && !ss.languages) {
16
+ throw new Error('snippets step: source package.json has no contributes.snippets, and no languages specified in step config')
17
+ }
18
+
19
+ // Collect unique (sourcePath → [languages]) mappings
20
+ const fileToLanguages = new Map<string, string[]>()
21
+ if (ss.languages) {
22
+ for (const lang of ss.languages) {
23
+ const entry = contributedSnippets.find(s => s.language === lang)
24
+ if (entry) {
25
+ const langs = fileToLanguages.get(entry.path) || []
26
+ langs.push(lang)
27
+ fileToLanguages.set(entry.path, langs)
28
+ } else {
29
+ const defaultPath = `./snippets/${lang}.json`
30
+ const fp = path.join(input, defaultPath)
31
+ if (fs.existsSync(fp)) {
32
+ const langs = fileToLanguages.get(defaultPath) || []
33
+ langs.push(lang)
34
+ fileToLanguages.set(defaultPath, langs)
35
+ } else if (verbose) {
36
+ console.warn(` snippets: no snippet file found for language "${lang}", skipping`)
37
+ }
38
+ }
39
+ }
40
+ } else {
41
+ for (const s of contributedSnippets) {
42
+ const langs = fileToLanguages.get(s.path) || []
43
+ langs.push(s.language)
44
+ fileToLanguages.set(s.path, langs)
45
+ }
46
+ }
47
+
48
+ if (fileToLanguages.size === 0) {
49
+ throw new Error('snippets step: no snippet files found to copy')
50
+ }
51
+
52
+ // Create output directories and copy files to original relative paths
53
+ const srcDir = path.join(output, 'src')
54
+ fs.mkdirSync(srcDir, { recursive: true })
55
+
56
+ const generatedFiles: Array<{ path: string; content: string }> = []
57
+ let copiedCount = 0
58
+ const allLanguages: string[] = []
59
+
60
+ for (const [sourceRelPath, languages] of fileToLanguages) {
61
+ const sourceFile = path.join(input, sourceRelPath)
62
+ if (!fs.existsSync(sourceFile)) {
63
+ if (verbose) console.warn(` snippets: source file not found: ${sourceFile}, skipping`)
64
+ continue
65
+ }
66
+ const dest = path.join(output, sourceRelPath)
67
+ fs.mkdirSync(path.dirname(dest), { recursive: true })
68
+ fs.copyFileSync(sourceFile, dest)
69
+ copiedCount++
70
+ allLanguages.push(...languages)
71
+ if (verbose) console.log(` snippets: copied ${sourceRelPath} (${languages.join(', ')})`)
72
+ }
73
+
74
+ if (copiedCount === 0) {
75
+ throw new Error('snippets step: no snippet files were copied')
76
+ }
77
+
78
+ // Generate empty src/index.ts
79
+ const indexContent = `\
80
+ import { ExtensionContext } from 'coc.nvim'
81
+
82
+ export function activate(context: ExtensionContext): void {
83
+ // coc-snippets discovers snippets via package.json's contributes.snippets
84
+ }
85
+ `
86
+ generatedFiles.push({ path: 'src/index.ts', content: indexContent })
87
+
88
+ const activationEvents = [...new Set(allLanguages)].map(l => `onLanguage:${l}`)
89
+
90
+ if (verbose) {
91
+ console.log(` snippets: ${copiedCount} files, ${new Set(allLanguages).size} languages`)
92
+ }
93
+
94
+ return {
95
+ generatedFiles,
96
+ entryPoint: 'src/index.ts',
97
+ keepDeps: {},
98
+ activationEvents,
99
+ }
100
+ },
101
+ }
@@ -73,7 +73,13 @@ export interface MarkUnsupportedStep {
73
73
  verbose?: boolean
74
74
  }
75
75
 
76
- export type ConvertStep = LanguageClientStep | SourceStep | BridgeStep | MarkUnsupportedStep
76
+ export interface SnippetsStep {
77
+ type: 'snippets'
78
+ /** Optional: override languages to generate (default: read from source package.json's contributes.snippets) */
79
+ languages?: string[]
80
+ }
81
+
82
+ export type ConvertStep = LanguageClientStep | SourceStep | BridgeStep | MarkUnsupportedStep | SnippetsStep
77
83
 
78
84
  // ---- Step execution ----
79
85