coc-vscode-loader 1.1.8 → 1.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.
- package/converter/src/cli.ts +33 -2
- package/converter/src/convert.ts +294 -361
- package/converter/src/scanner.ts +5 -89
- package/converter/src/steps/bridge.ts +142 -0
- package/converter/src/steps/index.ts +29 -0
- package/converter/src/steps/language-client.ts +150 -0
- package/converter/src/steps/mark-unsupported.ts +81 -0
- package/converter/src/steps/source.ts +159 -0
- package/converter/src/transforms/class-to-factory.ts +1 -2
- package/converter/src/transforms/enum-offset.ts +0 -17
- package/converter/src/transforms/provider-register.ts +7 -1
- package/converter/src/transforms/strip-volar.ts +29 -0
- package/converter/src/types.ts +117 -0
- package/lib/index.js +49 -60
- package/package.json +4 -3
- package/converter/README.md +0 -134
- package/converter/package-lock.json +0 -692
- package/converter/pnpm-lock.yaml +0 -419
package/converter/src/cli.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import * as fs from 'fs'
|
|
2
3
|
import { Command } from 'commander'
|
|
3
4
|
import { convert } from './convert.js'
|
|
4
5
|
|
|
@@ -14,13 +15,43 @@ program
|
|
|
14
15
|
.description('convert a VS Code extension to coc.nvim')
|
|
15
16
|
.argument('<input>', 'input directory (VS Code extension)')
|
|
16
17
|
.option('-o, --output <dir>', 'output directory', './output')
|
|
17
|
-
.option('--
|
|
18
|
+
.option('--convert <json>', 'convert step configuration (JSON array)')
|
|
19
|
+
.option('--convert-file <path>', 'path to JSON file with convert step configuration')
|
|
20
|
+
.option('--presets-file <path>', 'path to JSON file with preset definitions (e.g. bridge presets)')
|
|
18
21
|
.option('-v, --verbose', 'verbose output')
|
|
19
22
|
.action(async (input, opts) => {
|
|
23
|
+
let steps: any[]
|
|
24
|
+
let presets: any
|
|
25
|
+
if (opts.presetsFile) {
|
|
26
|
+
try { presets = JSON.parse(fs.readFileSync(opts.presetsFile, 'utf-8')) } catch {}
|
|
27
|
+
}
|
|
28
|
+
if (opts.convertFile) {
|
|
29
|
+
try {
|
|
30
|
+
const content = fs.readFileSync(opts.convertFile, 'utf-8')
|
|
31
|
+
steps = JSON.parse(content)
|
|
32
|
+
if (!Array.isArray(steps)) throw new Error('must be an array')
|
|
33
|
+
} catch (e: any) {
|
|
34
|
+
console.error(`invalid --convert-file: ${e.message}`)
|
|
35
|
+
process.exit(1)
|
|
36
|
+
}
|
|
37
|
+
} else if (opts.convert) {
|
|
38
|
+
try {
|
|
39
|
+
steps = JSON.parse(opts.convert)
|
|
40
|
+
if (!Array.isArray(steps)) throw new Error('must be an array')
|
|
41
|
+
} catch (e: any) {
|
|
42
|
+
console.error(`invalid --convert JSON: ${e.message}`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
console.error('--convert <JSON> or --convert-file <path> is required')
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
|
|
20
50
|
await convert({
|
|
21
51
|
input,
|
|
22
52
|
output: opts.output,
|
|
23
|
-
|
|
53
|
+
convert: steps,
|
|
54
|
+
presets,
|
|
24
55
|
verbose: opts.verbose,
|
|
25
56
|
})
|
|
26
57
|
})
|