@bhsd/codemirror-mediawiki 2.25.2 → 2.25.4
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/dist/codemirror.d.ts +1 -0
- package/dist/hover.d.ts +4 -5
- package/dist/inlay.d.ts +3 -6
- package/dist/linter.mjs +7 -13
- package/dist/main.min.js +16 -16
- package/dist/mw.min.js +21 -21
- package/dist/ref.d.ts +2 -1
- package/dist/signature.d.ts +2 -1
- package/dist/wiki.min.js +21 -21
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +2 -2
package/dist/codemirror.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type Addon<T> = [(config?: T, cm?: CodeMirror6) => Extension, Record<stri
|
|
|
15
15
|
/** CodeMirror 6 编辑器 */
|
|
16
16
|
export declare class CodeMirror6 {
|
|
17
17
|
#private;
|
|
18
|
+
getWikiConfig?: () => Promise<ConfigData>;
|
|
18
19
|
langConfig: MwConfig | undefined;
|
|
19
20
|
get textarea(): HTMLTextAreaElement;
|
|
20
21
|
get view(): EditorView | undefined;
|
package/dist/hover.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Text } from '@codemirror/state';
|
|
1
|
+
import type { TooltipView, EditorView } from '@codemirror/view';
|
|
2
|
+
import type { Text, Extension } from '@codemirror/state';
|
|
3
3
|
import type { Position } from 'vscode-languageserver-types';
|
|
4
|
+
import type { CodeMirror6 } from './codemirror';
|
|
4
5
|
/**
|
|
5
6
|
* 将索引转换为位置
|
|
6
7
|
* @param doc Text 实例
|
|
@@ -19,7 +20,5 @@ export declare const posToIndex: (doc: Text, pos: Position) => number;
|
|
|
19
20
|
* @param innerHTML 提示内容
|
|
20
21
|
*/
|
|
21
22
|
export declare const createTooltipView: (view: EditorView, innerHTML: string) => TooltipView;
|
|
22
|
-
declare const _default:
|
|
23
|
-
active: import("@codemirror/state").StateField<readonly Tooltip[]>;
|
|
24
|
-
};
|
|
23
|
+
declare const _default: (cm: CodeMirror6) => Extension;
|
|
25
24
|
export default _default;
|
package/dist/inlay.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
declare const _default: (StateField<DecorationSet> | ViewPlugin<{
|
|
5
|
-
update(update: ViewUpdate): void;
|
|
6
|
-
}>)[];
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import type { CodeMirror6 } from './codemirror';
|
|
3
|
+
declare const _default: (cm: CodeMirror6) => Extension;
|
|
7
4
|
export default _default;
|
package/dist/linter.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadScript, getLSP, sanitizeInlineStyle } from "@bhsd/common";
|
|
1
|
+
import { loadScript, getWikiparse, getLSP, sanitizeInlineStyle } from "@bhsd/common";
|
|
2
2
|
import { styleLint } from "@bhsd/common/dist/stylelint";
|
|
3
3
|
const offsetAt = (range, line, column) => {
|
|
4
4
|
if (line === -2) {
|
|
@@ -7,16 +7,10 @@ const offsetAt = (range, line, column) => {
|
|
|
7
7
|
return line === 0 ? range[1] : range[0] + column;
|
|
8
8
|
};
|
|
9
9
|
const getWikiLinter = async (opt, obj) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const i18n = await (await fetch(`${wikiparse.CDN}/i18n/${lang.toLowerCase()}.json`)).json();
|
|
16
|
-
wikiparse.setI18N(i18n);
|
|
17
|
-
} catch {
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
await getWikiparse(
|
|
11
|
+
opt == null ? void 0 : opt["getConfig"],
|
|
12
|
+
opt == null ? void 0 : opt["i18n"]
|
|
13
|
+
);
|
|
20
14
|
const lsp = getLSP(obj, opt == null ? void 0 : opt["include"]);
|
|
21
15
|
return async (text, config) => {
|
|
22
16
|
const diagnostics = (await lsp.provideDiagnostics(text)).filter(
|
|
@@ -51,7 +45,7 @@ ${sanitizeInlineStyle(childNodes[1].childNodes[0].data).replace(/\n/gu, " ")}
|
|
|
51
45
|
};
|
|
52
46
|
const getJsLinter = async () => {
|
|
53
47
|
var _a;
|
|
54
|
-
await loadScript("npm/eslint-
|
|
48
|
+
await loadScript("npm/@bhsd/eslint-browserify", "eslint");
|
|
55
49
|
const esLinter = new eslint.Linter(), conf = {
|
|
56
50
|
env: { browser: true, es2024: true },
|
|
57
51
|
parserOptions: { ecmaVersion: 15, sourceType: "module" }
|
|
@@ -103,7 +97,7 @@ const getCssLinter = async () => {
|
|
|
103
97
|
return linter;
|
|
104
98
|
};
|
|
105
99
|
const getLuaLinter = async () => {
|
|
106
|
-
await loadScript("npm/luacheck-browserify
|
|
100
|
+
await loadScript("npm/luacheck-browserify", "luacheck");
|
|
107
101
|
const luachecker = await luacheck(void 0);
|
|
108
102
|
return async (text) => (await luachecker.queue(text)).filter(({ severity }) => severity);
|
|
109
103
|
};
|