wikilint 2.36.0 → 2.37.1
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/LICENSE +18 -0
- package/config/moegirl.json +3 -0
- package/data/ext/math.json +4 -9
- package/data/ext/score.json +4 -375
- package/dist/bin/cli.js +14 -36
- package/dist/bin/config.js +22 -48
- package/dist/bin/env.js +42 -0
- package/dist/index.js +15 -10
- package/dist/lib/document.d.ts +1 -2
- package/dist/lib/document.js +9 -9
- package/dist/lib/lsp.d.ts +1 -0
- package/dist/lib/lsp.js +45 -28
- package/dist/lib/node.js +4 -1
- package/dist/src/converterFlags.js +9 -5
- package/dist/src/nowiki/index.js +7 -18
- package/dist/util/constants.js +2 -1
- package/dist/util/diff.js +52 -50
- package/package.json +16 -17
package/dist/util/diff.js
CHANGED
|
@@ -18,40 +18,42 @@ process.on('unhandledRejection', e => {
|
|
|
18
18
|
* @param args shell输入参数
|
|
19
19
|
*/
|
|
20
20
|
const cmd = (command, args) => new Promise(resolve => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
NPM: {
|
|
22
|
+
let timer, shell;
|
|
23
|
+
/**
|
|
24
|
+
* 清除进程并返回
|
|
25
|
+
* @param val 返回值
|
|
26
|
+
*/
|
|
27
|
+
const r = (val) => {
|
|
28
|
+
clearTimeout(timer);
|
|
29
|
+
shell?.kill('SIGINT');
|
|
30
|
+
resolve(val);
|
|
31
|
+
};
|
|
32
|
+
try {
|
|
33
|
+
shell = (0, child_process_1.spawn)(command, args);
|
|
34
|
+
timer = setTimeout(() => {
|
|
35
|
+
/* c8 ignore next */
|
|
36
|
+
shell.kill('SIGINT');
|
|
37
|
+
}, 60 * 1e3);
|
|
38
|
+
let buf = '';
|
|
39
|
+
shell.stdout.on('data', data => {
|
|
40
|
+
buf += String(data);
|
|
41
|
+
});
|
|
42
|
+
shell.stdout.on('end', () => {
|
|
43
|
+
r(buf);
|
|
44
|
+
});
|
|
45
|
+
shell.on('exit', () => {
|
|
46
|
+
r(shell.killed ? undefined : '');
|
|
47
|
+
});
|
|
48
|
+
shell.on('error', () => {
|
|
49
|
+
r(undefined);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch /* c8 ignore start */ {
|
|
48
53
|
r(undefined);
|
|
49
|
-
}
|
|
54
|
+
}
|
|
55
|
+
/* c8 ignore stop */
|
|
50
56
|
}
|
|
51
|
-
catch /* c8 ignore start */ {
|
|
52
|
-
r(undefined);
|
|
53
|
-
}
|
|
54
|
-
/* c8 ignore stop */
|
|
55
57
|
});
|
|
56
58
|
exports.cmd = cmd;
|
|
57
59
|
/* c8 ignore start */
|
|
@@ -62,37 +64,37 @@ exports.cmd = cmd;
|
|
|
62
64
|
* @param uid 唯一标识
|
|
63
65
|
*/
|
|
64
66
|
const diff = async (oldStr, newStr, uid) => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
NPM: {
|
|
68
|
+
if (oldStr === newStr) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const oldFile = `diffOld${uid}`, newFile = `diffNew${uid}`;
|
|
72
|
+
await Promise.all([promises_1.default.writeFile(oldFile, oldStr), promises_1.default.writeFile(newFile, newStr)]);
|
|
73
|
+
const stdout = await (0, exports.cmd)('git', [
|
|
74
|
+
'diff',
|
|
75
|
+
'--color-words=[\xC0-\xFF][\x80-\xBF]+|<?/?\\w+/?>?|[^[:space:]]',
|
|
76
|
+
'-U0',
|
|
77
|
+
'--no-index',
|
|
78
|
+
oldFile,
|
|
79
|
+
newFile,
|
|
80
|
+
]);
|
|
81
|
+
console.log(stdout?.split('\n').slice(4).join('\n'));
|
|
82
|
+
await Promise.allSettled([promises_1.default.unlink(oldFile), promises_1.default.unlink(newFile)]);
|
|
67
83
|
}
|
|
68
|
-
const oldFile = `diffOld${uid}`, newFile = `diffNew${uid}`;
|
|
69
|
-
await Promise.all([promises_1.default.writeFile(oldFile, oldStr), promises_1.default.writeFile(newFile, newStr)]);
|
|
70
|
-
const stdout = await (0, exports.cmd)('git', [
|
|
71
|
-
'diff',
|
|
72
|
-
'--color-words=[\xC0-\xFF][\x80-\xBF]+|<?/?\\w+/?>?|[^[:space:]]',
|
|
73
|
-
'-U0',
|
|
74
|
-
'--no-index',
|
|
75
|
-
oldFile,
|
|
76
|
-
newFile,
|
|
77
|
-
]);
|
|
78
|
-
console.log(stdout?.split('\n').slice(4).join('\n'));
|
|
79
|
-
await Promise.allSettled([promises_1.default.unlink(oldFile), promises_1.default.unlink(newFile)]);
|
|
80
84
|
};
|
|
81
85
|
exports.diff = diff;
|
|
82
86
|
/* c8 ignore stop */
|
|
83
87
|
/* c8 ignore start */
|
|
84
88
|
/** @implements */
|
|
85
89
|
const error = (msg, ...args) => {
|
|
86
|
-
|
|
87
|
-
console.error(util_1.default.styleText?.('red', msg) ?? msg, ...args);
|
|
90
|
+
console.error(util_1.default.styleText('red', msg), ...args);
|
|
88
91
|
};
|
|
89
92
|
exports.error = error;
|
|
90
93
|
/* c8 ignore stop */
|
|
91
94
|
/* c8 ignore start */
|
|
92
95
|
/** @implements */
|
|
93
96
|
const info = (msg, ...args) => {
|
|
94
|
-
|
|
95
|
-
console.info(util_1.default.styleText?.('green', msg) ?? msg, ...args);
|
|
97
|
+
NPM: console.info(util_1.default.styleText('green', msg), ...args);
|
|
96
98
|
};
|
|
97
99
|
exports.info = info;
|
|
98
100
|
/* c8 ignore stop */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikilint",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.37.1",
|
|
4
4
|
"description": "A Node.js linter for MediaWiki markup",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/bhsd-harry/wikiparser-node/issues"
|
|
14
14
|
},
|
|
15
|
-
"license": "GPL-3.0",
|
|
15
|
+
"license": "GPL-3.0-or-later",
|
|
16
16
|
"author": "Bhsd",
|
|
17
17
|
"files": [
|
|
18
18
|
"/errors/README",
|
|
@@ -73,44 +73,43 @@
|
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@bhsd/cm-util": "^
|
|
77
|
-
"@bhsd/common": "^
|
|
76
|
+
"@bhsd/cm-util": "^1.0.0",
|
|
77
|
+
"@bhsd/common": "^2.0.0",
|
|
78
78
|
"@bhsd/stylelint-util": "^1.0.1",
|
|
79
79
|
"binary-search": "^1.3.6",
|
|
80
80
|
"vscode-languageserver-types": "^3.17.5"
|
|
81
81
|
},
|
|
82
82
|
"optionalDependencies": {
|
|
83
83
|
"color-name": "^2.0.0",
|
|
84
|
-
"entities": "^
|
|
84
|
+
"entities": "^8.0.0",
|
|
85
85
|
"mathoid-texvcjs": "^0.6.0",
|
|
86
|
-
"
|
|
87
|
-
"stylelint": "^17.4.0",
|
|
86
|
+
"stylelint": "^17.6.0",
|
|
88
87
|
"vscode-css-languageservice": "^6.3.10",
|
|
89
88
|
"vscode-html-languageservice": "^5.6.2",
|
|
90
89
|
"vscode-json-languageservice": "^5.7.2"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
93
|
-
"@bhsd/code-standard": "^2.1.
|
|
94
|
-
"@bhsd/nodejs": "^0.
|
|
95
|
-
"@bhsd/test-util": "^0.
|
|
96
|
-
"@stylistic/eslint-plugin": "^5.
|
|
92
|
+
"@bhsd/code-standard": "^2.1.1",
|
|
93
|
+
"@bhsd/nodejs": "^1.0.0",
|
|
94
|
+
"@bhsd/test-util": "^0.4.0",
|
|
95
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
97
96
|
"@types/color-name": "^2.0.0",
|
|
98
97
|
"@types/color-rgba": "^2.1.3",
|
|
99
98
|
"@types/mocha": "^10.0.10",
|
|
100
99
|
"@types/node": "^24.11.0",
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
102
|
-
"@typescript-eslint/parser": "^8.
|
|
100
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
101
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
103
102
|
"c8": "^11.0.0",
|
|
104
103
|
"color-rgba": "^3.0.0",
|
|
105
104
|
"diff2html-cli": "^5.2.15",
|
|
106
|
-
"esbuild": "^0.27.
|
|
107
|
-
"eslint": "^9.39.
|
|
105
|
+
"esbuild": "^0.27.4",
|
|
106
|
+
"eslint": "^9.39.4",
|
|
108
107
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
109
108
|
"eslint-plugin-jsdoc": "^62.7.1",
|
|
110
109
|
"eslint-plugin-jsonc": "^3.1.1",
|
|
111
110
|
"eslint-plugin-n": "^17.24.0",
|
|
112
111
|
"eslint-plugin-promise": "^7.2.1",
|
|
113
|
-
"eslint-plugin-regexp": "^3.
|
|
112
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
114
113
|
"eslint-plugin-unicorn": "^63.0.0",
|
|
115
114
|
"markdownlint-cli2": "^0.21.0",
|
|
116
115
|
"mocha": "^11.7.5",
|
|
@@ -119,6 +118,6 @@
|
|
|
119
118
|
"vscode-languageserver-textdocument": "^1.0.12"
|
|
120
119
|
},
|
|
121
120
|
"engines": {
|
|
122
|
-
"node": "
|
|
121
|
+
"node": "^20.19.0 || ^22.13.0 || >=24.11.0"
|
|
123
122
|
}
|
|
124
123
|
}
|