wikilint 2.44.0 → 2.46.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.
Files changed (80) hide show
  1. package/config/default.json +1 -2
  2. package/config/enwiki.json +1 -1
  3. package/config/jawiki.json +1 -1
  4. package/config/minimum.json +1 -1
  5. package/config/zhwiki.json +1 -1
  6. package/data/ext/templatedata.json +13 -5
  7. package/data/signatures.json +38 -32
  8. package/dist/base.d.mts +10 -2
  9. package/dist/base.d.ts +10 -2
  10. package/dist/bin/config.js +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/internal.d.ts +6 -1
  13. package/dist/lib/element.js +5 -5
  14. package/dist/lib/lintConfig.js +7 -0
  15. package/dist/lib/lsp.d.ts +11 -3
  16. package/dist/lib/lsp.js +91 -59
  17. package/dist/lib/node.js +2 -2
  18. package/dist/lib/text.js +2 -2
  19. package/dist/map.d.ts +4 -1
  20. package/dist/mixin/elementLike.js +29 -31
  21. package/dist/mixin/hidden.js +0 -1
  22. package/dist/mixin/paramLineParent.d.ts +29 -0
  23. package/dist/mixin/paramLineParent.js +51 -0
  24. package/dist/src/arg.js +17 -35
  25. package/dist/src/atom.d.ts +1 -1
  26. package/dist/src/atom.js +2 -0
  27. package/dist/src/attribute.js +10 -5
  28. package/dist/src/attributes.js +18 -15
  29. package/dist/src/commented.d.ts +1 -0
  30. package/dist/src/commented.js +1 -3
  31. package/dist/src/converterFlags.js +18 -21
  32. package/dist/src/converterRule.js +2 -2
  33. package/dist/src/funcTag.d.ts +23 -0
  34. package/dist/src/funcTag.js +85 -0
  35. package/dist/src/heading.js +8 -3
  36. package/dist/src/hidden.d.ts +3 -2
  37. package/dist/src/hidden.js +29 -5
  38. package/dist/src/imageParameter.js +16 -4
  39. package/dist/src/index.js +2 -2
  40. package/dist/src/link/base.js +14 -2
  41. package/dist/src/link/categorytree.d.ts +2 -0
  42. package/dist/src/link/categorytree.js +8 -5
  43. package/dist/src/link/file.js +21 -14
  44. package/dist/src/multiLine/charinsert.d.ts +16 -0
  45. package/dist/src/multiLine/charinsert.js +84 -0
  46. package/dist/src/multiLine/gallery.js +4 -4
  47. package/dist/src/multiLine/imagemap.d.ts +1 -1
  48. package/dist/src/multiLine/imagemap.js +13 -12
  49. package/dist/src/multiLine/index.d.ts +3 -0
  50. package/dist/src/multiLine/index.js +79 -18
  51. package/dist/src/multiLine/inputbox.d.ts +1 -0
  52. package/dist/src/multiLine/paramTag.d.ts +3 -0
  53. package/dist/src/multiLine/paramTag.js +60 -13
  54. package/dist/src/nested.js +23 -25
  55. package/dist/src/nowiki/quote.js +6 -5
  56. package/dist/src/paramLine.d.ts +23 -3
  57. package/dist/src/paramLine.js +129 -31
  58. package/dist/src/parameter.d.ts +6 -0
  59. package/dist/src/parameter.js +15 -1
  60. package/dist/src/singleLine/charinsertLine.d.ts +21 -0
  61. package/dist/src/singleLine/charinsertLine.js +69 -0
  62. package/dist/src/{imagemapLink.d.ts → singleLine/imagemapLink.d.ts} +8 -7
  63. package/dist/src/singleLine/imagemapLink.js +95 -0
  64. package/dist/src/singleLine/index.d.ts +10 -0
  65. package/dist/src/singleLine/index.js +16 -0
  66. package/dist/src/table/td.js +5 -4
  67. package/dist/src/tag/html.js +26 -8
  68. package/dist/src/tag/index.js +30 -17
  69. package/dist/src/tagPair/ext.js +23 -2
  70. package/dist/src/tagPair/index.js +1 -10
  71. package/dist/src/transclude.js +15 -15
  72. package/dist/util/sharable.js +22 -0
  73. package/dist/util/sharable.mjs +22 -0
  74. package/dist/util/string.js +27 -2
  75. package/i18n/en.json +4 -0
  76. package/i18n/zh-hans.json +4 -0
  77. package/i18n/zh-hant.json +4 -0
  78. package/package.json +17 -25
  79. package/dist/src/imagemapLink.js +0 -34
  80. /package/dist/{util → vendor}/search.js +0 -0
@@ -104,8 +104,6 @@ let ExtToken = (() => {
104
104
  case 'combooption':
105
105
  case 'tab':
106
106
  case 'tabs':
107
- case 'poll':
108
- case 'seo':
109
107
  case 'langconvert':
110
108
  case 'phonos':
111
109
  switch (lcName) {
@@ -124,6 +122,12 @@ let ExtToken = (() => {
124
122
  }
125
123
  innerToken = new index_2.Token(inner, newConfig, accum);
126
124
  break;
125
+ case 'poll': {
126
+ const { MultiLineToken } = require('../multiLine/index');
127
+ // @ts-expect-error abstract class
128
+ innerToken = new MultiLineToken(inner, newConfig, accum);
129
+ break;
130
+ }
127
131
  case 'dynamicpagelist': {
128
132
  const { ParamTagToken } = require('../multiLine/paramTag');
129
133
  // @ts-expect-error abstract class
@@ -182,6 +186,18 @@ let ExtToken = (() => {
182
186
  innerToken = new CategorytreeToken(inner, undefined, newConfig, accum);
183
187
  break;
184
188
  }
189
+ case 'seo': {
190
+ const { FuncTagToken } = require('../funcTag');
191
+ // @ts-expect-error abstract class
192
+ innerToken = new FuncTagToken(inner, newConfig, accum);
193
+ break;
194
+ }
195
+ case 'charinsert': {
196
+ const { CharinsertToken } = require('../multiLine/charinsert');
197
+ // @ts-expect-error abstract class
198
+ innerToken = new CharinsertToken(inner, newConfig, accum);
199
+ break;
200
+ }
185
201
  // 更多定制扩展的代码示例:
186
202
  // ```
187
203
  // case 'extensionName': {
@@ -222,6 +238,11 @@ let ExtToken = (() => {
222
238
  }
223
239
  }
224
240
  /** @private */
241
+ text() {
242
+ const { name, firstChild, lastChild, selfClosing } = this;
243
+ return `<${name}${firstChild.text()}${selfClosing ? '/>' : `>${lastChild.text()}</${name}>`}`;
244
+ }
245
+ /** @private */
225
246
  lint(start = this.getAbsoluteIndex(), re) {
226
247
  LINT: {
227
248
  const errors = super.lint(start, re), { name } = this, { lintConfig } = index_1.default, rect = new rect_1.BoundingRect(this, start);
@@ -88,16 +88,7 @@ let TagPairToken = (() => {
88
88
  /** @private */
89
89
  toString(skip) {
90
90
  const { firstChild, lastChild, } = this, [opening, closing] = this.#tags;
91
- return this.#selfClosing
92
- ? `<${opening}${firstChild.toString(skip)}/>`
93
- : `<${opening}${firstChild.toString(skip)}>${lastChild.toString(skip)}${this.closed ? `</${closing}>` : ''}`;
94
- }
95
- /** @private */
96
- text() {
97
- const [opening, closing] = this.#tags;
98
- return this.#selfClosing
99
- ? `<${opening}${this.firstChild.text()}/>`
100
- : `<${opening}${super.text('>')}${this.closed ? `</${closing}>` : ''}`;
91
+ return `<${opening}${firstChild.toString(skip)}${this.#selfClosing ? '/>' : `>${lastChild.toString(skip)}${this.closed ? `</${closing}>` : ''}`}`;
101
92
  }
102
93
  /** @private */
103
94
  getAttribute(key) {
@@ -129,9 +129,7 @@ let TranscludeToken = (() => {
129
129
  }
130
130
  const colon = title.search(/[::]/u), fullWidth = title[colon] === ':', isFunction = colon !== -1;
131
131
  if (isFunction || parts.length === 0 && !this.#raw) {
132
- const magicWord = isFunction ? title.slice(0, colon) : title, arg = isFunction && title.slice(colon + 1), cleaned = (0, string_1.removeComment)(magicWord), name = isFunction
133
- ? cleaned.slice(cleaned.search(/\S/u)) + (fullWidth ? ':' : '')
134
- : cleaned.trim(),
132
+ const magicWord = isFunction ? title.slice(0, colon) : title, arg = isFunction && title.slice(colon + 1), cleaned = (0, string_1.removeComment)(magicWord), name = isFunction ? (0, string_1.trimStart)(cleaned) + (fullWidth ? ':' : '') : cleaned.trim(),
135
133
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
136
134
  [, isSensitive, canonicalName] = (0, debug_1.getMagicWordInfo)(name, parserFunction), isFunc = !('functionHook' in config) || functionHook.includes(canonicalName), isVar = variable.includes(canonicalName);
137
135
  if (isFunction ? canonicalName && isFunc : isVar) {
@@ -254,11 +252,11 @@ let TranscludeToken = (() => {
254
252
  if (type === 'magic-word' && name === 'vardefine') {
255
253
  return '';
256
254
  }
257
- return `{{${modifier}${type === 'magic-word'
258
- ? firstChild.text()
259
- + (length === 1 ? '' : this.#colon)
260
- + (0, string_1.text)(childNodes.slice(1), '|')
261
- : super.text('|')}}}`;
255
+ const delimiter = type === 'magic-word' ? this.#colon : '|';
256
+ return `{{${modifier.trim().toLowerCase()}${firstChild.text().trim()}${length === 1 ? '' : delimiter}${childNodes.slice(1).map(child => {
257
+ const str = child.text();
258
+ return child.type === 'parameter' ? str : str.trim();
259
+ }).join('|')}}}`;
262
260
  }
263
261
  /** @private */
264
262
  getAttribute(key) {
@@ -280,7 +278,7 @@ let TranscludeToken = (() => {
280
278
  if (!this.isTemplate()) {
281
279
  return errors;
282
280
  }
283
- const { type, childNodes, length } = this, rect = new rect_1.BoundingRect(this, start), { lintConfig } = index_1.default, { computeEditInfo } = lintConfig, invoke = type === 'magic-word';
281
+ const { type, childNodes, length: l } = this, rect = new rect_1.BoundingRect(this, start), { lintConfig } = index_1.default, { computeEditInfo } = lintConfig, invoke = type === 'magic-word';
284
282
  let rule = 'no-ignored', s = lintConfig.getSeverity(rule, 'fragment');
285
283
  if (invoke && !this.#getTitle().valid) {
286
284
  rule = 'invalid-invoke';
@@ -304,7 +302,7 @@ let TranscludeToken = (() => {
304
302
  }
305
303
  rule = 'invalid-invoke';
306
304
  s = lintConfig.getSeverity(rule, 'function');
307
- if (s && invoke && length === 2) {
305
+ if (s && invoke && l === 2) {
308
306
  errors.push((0, lint_1.generateForSelf)(this, rect, rule, 'missing-function', s));
309
307
  return errors;
310
308
  }
@@ -312,15 +310,17 @@ let TranscludeToken = (() => {
312
310
  s = lintConfig.getSeverity(rule, 'parameter');
313
311
  if (s) {
314
312
  const duplicatedArgs = this.getDuplicatedArgs()
315
- .filter(([, parameter]) => !parameter[0].querySelector('ext')), msg = 'duplicate-parameter';
313
+ .filter(([, parameter]) => !parameter[0].querySelector('ext'));
316
314
  for (const [, args] of duplicatedArgs) {
317
- Array.prototype.push.apply(errors, args.map(arg => {
318
- const e = (0, lint_1.generateForChild)(arg, rect, rule, msg, s);
315
+ const { length } = args, duplication = Array.from({ length });
316
+ for (let i = length - 1; i >= 0; i--) {
317
+ const arg = args[i], e = (0, lint_1.generateForChild)(arg, rect, rule, 'duplicate-parameter', s);
319
318
  if (computeEditInfo) {
320
319
  e.suggestions = [(0, lint_1.fixByRemove)(e, -1)];
321
320
  }
322
- return e;
323
- }));
321
+ duplication[i] = e;
322
+ }
323
+ Array.prototype.push.apply(errors, duplication);
324
324
  }
325
325
  }
326
326
  return errors;
@@ -276,4 +276,26 @@ exports.extParams = (() => ({
276
276
  'tour',
277
277
  'arialabel',
278
278
  ],
279
+ seo: [
280
+ 'hreflang_$1',
281
+ 'title',
282
+ 'title_mode',
283
+ 'title_separator',
284
+ 'keywords',
285
+ 'description',
286
+ 'canonical',
287
+ 'robots',
288
+ 'googlebot',
289
+ 'image',
290
+ 'image_width',
291
+ 'image_height',
292
+ 'image_alt',
293
+ 'type',
294
+ 'site_name',
295
+ 'locale',
296
+ 'section',
297
+ 'author',
298
+ 'published_time',
299
+ 'twitter_site',
300
+ ],
279
301
  }))();
@@ -273,6 +273,28 @@ const extParams = /* @__PURE__ */ (() => ({
273
273
  "searchfilter",
274
274
  "tour",
275
275
  "arialabel"
276
+ ],
277
+ seo: [
278
+ "hreflang_$1",
279
+ "title",
280
+ "title_mode",
281
+ "title_separator",
282
+ "keywords",
283
+ "description",
284
+ "canonical",
285
+ "robots",
286
+ "googlebot",
287
+ "image",
288
+ "image_width",
289
+ "image_height",
290
+ "image_alt",
291
+ "type",
292
+ "site_name",
293
+ "locale",
294
+ "section",
295
+ "author",
296
+ "published_time",
297
+ "twitter_site"
276
298
  ]
277
299
  }))();
278
300
  export {
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toLowerCase = exports.decodeNumber = exports.decodeHtml = exports.decodeHtmlBasic = exports.text = exports.removeComment = exports.tidy = exports.trimLc = exports.extUrlChar = exports.extUrlCharFirst = exports.zs = void 0;
3
+ exports.toLowerCase = exports.decodeNumber = exports.decodeHtml = exports.decodeHtmlBasic = exports.text = exports.removeCommentLine = exports.removeComment = exports.tidy = exports.trimStart = exports.trimLc = exports.extUrlChar = exports.extUrlCharFirst = exports.zs = void 0;
4
4
  exports.restore = restore;
5
+ const common_1 = require("@bhsd/common");
5
6
  exports.zs = String.raw ` \xA0\u1680\u2000-\u200A\u202F\u205F\u3000`;
6
7
  const commonExtUrlChar = String.raw `[^[\]<>"\0-\x1F\x7F${exports.zs}\uFFFD]`;
7
8
  exports.extUrlCharFirst = String.raw `(?:\[[\da-f:.]+\]|${commonExtUrlChar})`;
@@ -12,6 +13,12 @@ exports.extUrlChar = String.raw `(?:${commonExtUrlChar}|\0\d+[cn!~]\x7F)*`;
12
13
  */
13
14
  const trimLc = (s) => s.trim().toLowerCase();
14
15
  exports.trimLc = trimLc;
16
+ /**
17
+ * trim starting whitespaces
18
+ * @param s 字符串
19
+ */
20
+ const trimStart = (s) => s.slice((0, common_1.numLeadingSpaces)(s));
21
+ exports.trimStart = trimStart;
15
22
  function restore(s, stack, translate) {
16
23
  if (translate === 1) {
17
24
  return s.replace(/\0(\d+)g\x7F/gu, (_, p1) => restore(String(stack[p1]), stack, 2));
@@ -31,6 +38,24 @@ const factory = (regex, replace) => (str) => str.replace(regex, replace);
31
38
  exports.tidy = factory(/[\0\x7F]|\r$/gmu, '');
32
39
  /** remove half-parsed comment-like tokens */
33
40
  exports.removeComment = factory(/\0\d+[cn]\x7F/gu, '');
41
+ /**
42
+ * remove lines that only contain comments
43
+ * @param str
44
+ * @param standalone whether for a standalone document
45
+ */
46
+ const removeCommentLine = (str, standalone) => {
47
+ const lines = str.split('\n'), { length } = lines;
48
+ if (!standalone && length < 3) {
49
+ return (0, exports.removeComment)(str);
50
+ }
51
+ const offset = standalone ? 0 : 1, end = length - offset;
52
+ return (0, exports.removeComment)([
53
+ ...lines.slice(0, offset),
54
+ ...lines.slice(offset, end).filter(line => !/^(?!\s*$)(?:\s|\0\d+c\x7F)*$/u.test(line)),
55
+ ...lines.slice(end),
56
+ ].join('\n'));
57
+ };
58
+ exports.removeCommentLine = removeCommentLine;
34
59
  /**
35
60
  * extract effective wikitext
36
61
  * @param childNodes a Token's contents
@@ -52,7 +77,7 @@ const decodeHtml = (str) => {
52
77
  decodeHtmlResolved ??= (() => {
53
78
  /* NOT FOR BROWSER ONLY */
54
79
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
55
- if (typeof process === 'object' && typeof process.versions?.node === 'string') {
80
+ NPM: if (typeof process === 'object' && typeof process.versions?.node === 'string') {
56
81
  try {
57
82
  const { decodeHTMLStrict } = require('entities');
58
83
  return (s) => decodeHTMLStrict(s).replaceAll('\xA0', ' ');
package/i18n/en.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "delink": null,
15
15
  "duplicate-attribute": "duplicate $1 attribute",
16
16
  "duplicate-category": "duplicate category",
17
+ "duplicate-ext-parameter": "duplicate parameter of <$1>",
17
18
  "duplicate-id": "duplicate HTML id",
18
19
  "duplicate-image-parameter": "duplicate image $1 parameter",
19
20
  "duplicate-parameter": "duplicate template parameter",
@@ -39,6 +40,7 @@
39
40
  "invalid-category": "invalid category name",
40
41
  "invalid-content": "invalid content in <$1>",
41
42
  "invalid-conversion-flag": "invalid conversion flag",
43
+ "invalid-coord": "invalid coordinates",
42
44
  "invalid-gallery": "invalid gallery image",
43
45
  "invalid-gallery-link": "invalid link in gallery image",
44
46
  "invalid-image-parameter": "invalid image parameter",
@@ -46,6 +48,7 @@
46
48
  "invalid-isbn": "invalid ISBN",
47
49
  "invalid-parameter": "invalid parameter of <$1>",
48
50
  "invalid-self-closing": "invalid self-closing tag",
51
+ "invalid-space": "invalid whitespace in <$1>",
49
52
  "invalid-thumb": "invalid thumbnail filename",
50
53
  "invalid-url": "invalid URL",
51
54
  "invisible-triple-braces": "invisible content inside triple braces",
@@ -86,6 +89,7 @@
86
89
  "unexpected-argument": "unexpected template argument",
87
90
  "unmatched-closing": "unmatched closing tag",
88
91
  "unnecessary-encoding": "unnecessary percent-encoding in an internal link",
92
+ "unrecognized-shape": "unrecognized shape, which must be one of \"default\", \"rect\", \"circle\", or \"poly\"",
89
93
  "uppercase": null,
90
94
  "useless-attribute": "useless attribute",
91
95
  "useless-fragment": "useless fragment",
package/i18n/zh-hans.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "delink": "移除链接",
15
15
  "duplicate-attribute": "重复的$1属性",
16
16
  "duplicate-category": "重复的分类",
17
+ "duplicate-ext-parameter": "重复的<$1>参数",
17
18
  "duplicate-id": "重复的HTML id属性",
18
19
  "duplicate-image-parameter": "重复的图像$1参数",
19
20
  "duplicate-parameter": "重复的模板参数",
@@ -39,6 +40,7 @@
39
40
  "invalid-category": "无效的分类名",
40
41
  "invalid-content": "<$1>中的无效内容",
41
42
  "invalid-conversion-flag": "无效的转换旗标",
43
+ "invalid-coord": "不正确的坐标",
42
44
  "invalid-gallery": "无效的图库图像",
43
45
  "invalid-gallery-link": "图库图像中的无效链接",
44
46
  "invalid-image-parameter": "无效的图像参数",
@@ -46,6 +48,7 @@
46
48
  "invalid-isbn": "无效的ISBN",
47
49
  "invalid-parameter": "无效的<$1>参数",
48
50
  "invalid-self-closing": "无效自封闭标签",
51
+ "invalid-space": "<$1>中的无效空白字符",
49
52
  "invalid-thumb": "无效的缩略图文件名",
50
53
  "invalid-url": "无效的URL",
51
54
  "invisible-triple-braces": "三重括号内的不可见内容",
@@ -86,6 +89,7 @@
86
89
  "unexpected-argument": "未预期的模板参数",
87
90
  "unmatched-closing": "未匹配的结束标签",
88
91
  "unnecessary-encoding": "内部链接中不必要的百分号编码",
92
+ "unrecognized-shape": "未能认出的形状,必须是这些字面量:\"default\"、\"rect\"、\"circle\"、\"poly\"",
89
93
  "uppercase": "大写",
90
94
  "useless-attribute": "无用的属性",
91
95
  "useless-fragment": "无用的片段",
package/i18n/zh-hant.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "delink": "解除連結",
15
15
  "duplicate-attribute": "重複的$1屬性",
16
16
  "duplicate-category": "重複的分類",
17
+ "duplicate-ext-parameter": "重複的<$1>參數",
17
18
  "duplicate-id": "重複的HTML id屬性",
18
19
  "duplicate-image-parameter": "重複的圖片$1參數",
19
20
  "duplicate-parameter": "重複的模板參數",
@@ -39,6 +40,7 @@
39
40
  "invalid-category": "無效的分類名",
40
41
  "invalid-content": "<$1>有無效內容",
41
42
  "invalid-conversion-flag": "無效的轉換旗標",
43
+ "invalid-coord": "不正確的座標",
42
44
  "invalid-gallery": "無效的圖庫圖片",
43
45
  "invalid-gallery-link": "圖庫圖片裡有無效連結",
44
46
  "invalid-image-parameter": "無效的圖片參數",
@@ -46,6 +48,7 @@
46
48
  "invalid-isbn": "無效的ISBN",
47
49
  "invalid-parameter": "無效的<$1>參數",
48
50
  "invalid-self-closing": "無效自封閉標籤",
51
+ "invalid-space": "<$1>裡有無效空白字元",
49
52
  "invalid-thumb": "無效的縮略圖檔名",
50
53
  "invalid-url": "無效的URL",
51
54
  "invisible-triple-braces": "三重括號內有不可見內容",
@@ -86,6 +89,7 @@
86
89
  "unexpected-argument": "未預期的模板參數",
87
90
  "unmatched-closing": "未匹配的結束標籤",
88
91
  "unnecessary-encoding": "內部連結中有不需要的百分比編碼",
92
+ "unrecognized-shape": "無法辨識的形狀,必須使用下列其中一組字:\"default\"、\"rect\"、\"circle\"或\"poly\"",
89
93
  "uppercase": "大寫",
90
94
  "useless-attribute": "無用屬性",
91
95
  "useless-fragment": "無用的片段內容",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikilint",
3
- "version": "2.44.0",
3
+ "version": "2.46.0",
4
4
  "description": "A Node.js linter for MediaWiki markup",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -42,19 +42,19 @@
42
42
  "ls": "npm i --package-lock-only && npm ls --package-lock-only --all --include=peer --omit=dev",
43
43
  "prepublishOnly": "npm run build:core",
44
44
  "build:core": "bash build.sh",
45
- "build:define": "bash sed.sh -i \"s/pkg = \\$PKG/pkg = $(npm pkg get name)/; s/version = \\$VERSION/version = $(npm pkg get version)/\" dist/bin/config.js",
45
+ "build:define": "bash sed.sh -i \"s/pkg = \\$PKG/pkg = '$(npm pkg get name)'/; s/version = \\$VERSION/version = '$(npm pkg get version)'/\" dist/bin/config.js",
46
46
  "build": "npm run build:core",
47
47
  "diff": "bash diff.sh",
48
48
  "diff:stat": "f() { git diff --stat -w --color=always $1 $2 -- . | grep '\\.ts'; }; f",
49
49
  "lint:ts": "tsc --noEmit && eslint --cache .",
50
- "lint:json": "v8r -s config/.schema.json config/*.json && v8r -s data/.schema.json data/*.json && mocha dist/test/json.js",
50
+ "lint:json": "v8r -s config/.schema.json config/*.json && v8r -s data/.schema.json data/*.json && testUtil dist/test/json.js",
51
51
  "lint:md": "markdownlint-cli2 '*.md'",
52
52
  "lint": "npm run lint:ts && npm run lint:json && npm run lint:md",
53
53
  "prof": "node dist/test/prof.js",
54
54
  "coverage": "tsc --declaration false --target es2024 && npm run build:define && c8 npm run test:ci && node dist/script/coverage.js && open coverage/index.html",
55
- "test:unit": "mocha dist/test/test.js",
56
- "test:parser": "LC_ALL=en.UTF-8 mocha dist/test/parserTests.js",
57
- "test:perf": "mocha --reporter spec dist/test/perf.js",
55
+ "test:unit": "testUtil dist/test/test.js",
56
+ "test:parser": "LC_ALL=en.UTF-8 testUtil dist/test/parserTests.js",
57
+ "test:perf": "testUtil --test-reporter=spec dist/test/perf.js",
58
58
  "test": "npm run test:unit && npm run test:parser",
59
59
  "test:parseronly": "LSP=0 npm run test:parser",
60
60
  "test:ci": "LSP=0 npm test",
@@ -74,7 +74,6 @@
74
74
  ]
75
75
  },
76
76
  "peerDependencies": {
77
- "color-name": ">=2.0.0",
78
77
  "mathoid-texvcjs": ">=0.4.0",
79
78
  "stylelint": ">=16.0.0",
80
79
  "vscode-css-languageservice": ">=3.0.0",
@@ -82,9 +81,6 @@
82
81
  "vscode-json-languageservice": ">=3.2.0"
83
82
  },
84
83
  "peerDependenciesMeta": {
85
- "color-name": {
86
- "optional": true
87
- },
88
84
  "mathoid-texvcjs": {
89
85
  "optional": true
90
86
  },
@@ -102,28 +98,24 @@
102
98
  }
103
99
  },
104
100
  "dependencies": {
105
- "@bhsd/cm-util": "^2.2.0",
106
- "@bhsd/common": "^2.2.1",
101
+ "@bhsd/cm-util": "^2.3.0",
102
+ "@bhsd/common": "^4.0.0",
107
103
  "@bhsd/stylelint-util": "^1.1.0",
108
104
  "entities": "^8.0.0",
109
- "vscode-languageserver-types": "^3.17.5"
105
+ "vscode-languageserver-types": "^3.18.0"
110
106
  },
111
107
  "devDependencies": {
112
- "@bhsd/code-standard": "^2.6.2",
113
- "@bhsd/nodejs": "^1.0.1",
114
- "@bhsd/test-util": "^1.5.0",
115
- "@types/color-name": "^2.0.0",
116
- "@types/color-rgba": "^2.1.3",
108
+ "@bhsd/code-standard": "^3.1.0",
109
+ "@bhsd/nodejs": "^1.2.1",
110
+ "@bhsd/test-util": "^3.1.0",
117
111
  "c8": "^11.0.0",
118
- "color-name": "~2.0.2",
119
- "color-rgba": "^3.0.0",
112
+ "culori": "^4.0.2",
120
113
  "diff2html-cli": "^5.2.15",
121
- "esbuild": "^0.28.0",
122
- "eslint": "^10.4.1",
123
- "markdownlint-cli2": "^0.22.1",
114
+ "esbuild": "^0.28.1",
115
+ "eslint": "^10.7.0",
116
+ "markdownlint-cli2": "^0.23.0",
124
117
  "mathoid-texvcjs": "^0.6.0",
125
- "mocha": "^11.7.6",
126
- "stylelint": "^17.13.0",
118
+ "stylelint": "^17.14.0",
127
119
  "typescript": "^6.0.3",
128
120
  "v8r": "^6.1.0",
129
121
  "vscode-css-languageservice": "^6.3.10",
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImagemapLinkToken = void 0;
4
- const index_1 = require("./index");
5
- const noinclude_1 = require("./nowiki/noinclude");
6
- const index_2 = require("./link/index");
7
- const extLink_1 = require("./extLink");
8
- /**
9
- * link inside the `<imagemap>`
10
- *
11
- * `<imagemap>`内的链接
12
- * @classdesc `{childNodes: [AstText, LinkToken|ExtLinkToken, NoincludeToken]}`
13
- */
14
- class ImagemapLinkToken extends index_1.Token {
15
- get type() {
16
- return 'imagemap-link';
17
- }
18
- /**
19
- * @param pre 链接前的文本
20
- * @param linkStuff 内外链接
21
- * @param post 链接后的文本
22
- */
23
- constructor(pre, linkStuff, post, config, accum = []) {
24
- super(undefined, config, accum);
25
- this.append(pre, linkStuff.length === 2
26
- // @ts-expect-error abstract class
27
- ? new index_2.LinkToken(...linkStuff, config, accum)
28
- // @ts-expect-error abstract class
29
- : new extLink_1.ExtLinkToken(...linkStuff, config, accum),
30
- // @ts-expect-error abstract class
31
- new noinclude_1.NoincludeToken(post, config, accum));
32
- }
33
- }
34
- exports.ImagemapLinkToken = ImagemapLinkToken;
File without changes