@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.
@@ -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 { Tooltip, TooltipView, EditorView } from '@codemirror/view';
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: import("@codemirror/state").Extension & {
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 { StateField } from '@codemirror/state';
2
- import { ViewPlugin } from '@codemirror/view';
3
- import type { DecorationSet, ViewUpdate } from '@codemirror/view';
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
- const DIR = "npm/wikiparser-node/extensions/dist", lang = opt == null ? void 0 : opt["i18n"];
11
- await loadScript(`${DIR}/base.min.js`, "wikiparse");
12
- await loadScript(`${DIR}/lsp.min.js`, "wikiparse.LanguageService");
13
- if (typeof lang === "string") {
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-linter-browserify@8.57.0/linter.min.js", "eslint", true);
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/dist/index.min.js", "luacheck");
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
  };