@bhsd/codemirror-mediawiki 3.8.0 → 3.8.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/dist/linter.d.ts CHANGED
@@ -26,10 +26,11 @@ declare interface JsonError {
26
26
  column: string | undefined;
27
27
  position: string | undefined;
28
28
  }
29
- export declare const stylelintRepo = "npm/@bhsd/stylelint-browserify", eslintRepo = "npm/@bhsd/eslint-browserify", luacheckRepo = "npm/luacheck-browserify", wikilintRepo = "npm/wikiparser-node";
29
+ export declare const stylelintRepo = "npm/@bhsd/stylelint-browserify", eslintRepo = "npm/@bhsd/eslint-browserify", luacheckRepo = "npm/luacheck-browserify";
30
30
  /**
31
31
  * 获取 Wikitext LSP
32
32
  * @param opt 选项
33
+ * @param opt.cdn jsDelivr CDN,不含库名
33
34
  * @param obj 对象
34
35
  */
35
36
  export declare const getWikiLinter: getAsyncLinter<Promise<MixedDiagnostic[]>, Option, object>;
package/dist/linter.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { sanitizeInlineStyle } from '@bhsd/common';
2
2
  import { loadScript, getWikiparse, getLSP } from '@bhsd/browser';
3
3
  import { styleLint } from '@bhsd/stylelint-util';
4
- export const stylelintRepo = 'npm/@bhsd/stylelint-browserify', eslintRepo = 'npm/@bhsd/eslint-browserify', luacheckRepo = 'npm/luacheck-browserify', wikilintRepo = 'npm/wikiparser-node';
4
+ export const stylelintRepo = 'npm/@bhsd/stylelint-browserify', eslintRepo = 'npm/@bhsd/eslint-browserify', luacheckRepo = 'npm/luacheck-browserify';
5
5
  /**
6
6
  * 计算位置
7
7
  * @param range 范围
@@ -42,11 +42,12 @@ const isStylelintConfig = (config) => Boolean(config && ('extends' in config ||
42
42
  /**
43
43
  * 获取 Wikitext LSP
44
44
  * @param opt 选项
45
+ * @param opt.cdn jsDelivr CDN,不含库名
45
46
  * @param obj 对象
46
47
  */
47
48
  export const getWikiLinter = async (opt, obj) => {
48
49
  const cdn = opt?.['cdn'];
49
- await getWikiparse(opt?.['getConfig'], opt?.['i18n'], cdn && `${cdn}/${wikilintRepo}`);
50
+ await getWikiparse(opt?.['getConfig'], opt?.['i18n'], cdn);
50
51
  const lsp = getLSP(obj, opt?.['include']), cssLint = await getCssLinter(cdn && `${cdn}/${stylelintRepo}`);
51
52
  const linter = async (text, config) => {
52
53
  const defaultSeverity = config?.['defaultSeverity'] ?? 2, diagnostics = (await lsp.provideDiagnostics(text)).filter(({ code, severity }) => Number(config?.[code] ?? defaultSeverity) > Number(severity === 2)), tokens = 'findStyleTokens' in lsp && config?.['invalid-css'] !== '0' ? await lsp.findStyleTokens() : [];