@ohos-rs/oxk 0.5.0 → 0.6.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/bin/oxk.js +15 -0
- package/configuration_schema.json +1817 -0
- package/format.d.ts +2 -0
- package/format.js +2 -3
- package/index.d.ts +3 -0
- package/index.js +53 -52
- package/lint.js +9 -0
- package/oxlint-runtime/plugins.cjs +1 -1
- package/package.json +19 -16
package/bin/oxk.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const VERSION = require('../package.json').version
|
|
4
4
|
const { formatFiles } = require('./format.js')
|
|
5
|
+
const { formatLsp } = require('../index.js')
|
|
5
6
|
const { lint } = require('../lint.js')
|
|
6
7
|
|
|
7
8
|
function parseBoolean(value, flagName) {
|
|
@@ -55,6 +56,7 @@ Lint Options:
|
|
|
55
56
|
Run "oxk lint --help" for the full lint option list.
|
|
56
57
|
|
|
57
58
|
Format Options:
|
|
59
|
+
--lsp
|
|
58
60
|
--config PATH
|
|
59
61
|
--thread, -t THREAD
|
|
60
62
|
--exclude PATTERN
|
|
@@ -94,6 +96,7 @@ function parseFormatArgs(args) {
|
|
|
94
96
|
excludes: [],
|
|
95
97
|
threadCount: 1,
|
|
96
98
|
configPath: undefined,
|
|
99
|
+
lsp: false,
|
|
97
100
|
cliOptions: {},
|
|
98
101
|
}
|
|
99
102
|
|
|
@@ -110,6 +113,10 @@ function parseFormatArgs(args) {
|
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
switch (token.split('=')[0]) {
|
|
116
|
+
case '--lsp': {
|
|
117
|
+
formatArgs.lsp = true
|
|
118
|
+
break
|
|
119
|
+
}
|
|
113
120
|
case '--config': {
|
|
114
121
|
const { value, nextIndex } = parseOptionValue(args, index, token)
|
|
115
122
|
formatArgs.configPath = value
|
|
@@ -298,6 +305,14 @@ async function main() {
|
|
|
298
305
|
process.exit(0)
|
|
299
306
|
}
|
|
300
307
|
|
|
308
|
+
if (formatArgs.lsp) {
|
|
309
|
+
if (typeof formatLsp !== 'function') {
|
|
310
|
+
throw new Error('oxk format --lsp requires the native oxk binding')
|
|
311
|
+
}
|
|
312
|
+
await formatLsp()
|
|
313
|
+
return
|
|
314
|
+
}
|
|
315
|
+
|
|
301
316
|
await formatFiles(formatArgs)
|
|
302
317
|
} catch (error) {
|
|
303
318
|
console.error(error instanceof Error ? error.message : String(error))
|