wikiparser-node 1.11.0 → 1.11.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.
@@ -289,11 +289,11 @@ const expand = (wikitext, config, include, context, accum = []) => {
289
289
  }
290
290
  return token;
291
291
  };
292
- index_2.Token.prototype.expand = /** @implements */ function (context) {
292
+ index_2.Token.prototype.expand = /** @implements */ function () {
293
293
  if (this.type !== 'root') {
294
294
  throw new Error('Only root token can be expanded!');
295
295
  }
296
- return debug_1.Shadow.run(() => expand(this.toString(), this.getAttribute('config'), this.getAttribute('include'), context).parse());
296
+ return debug_1.Shadow.run(() => expand(this.toString(), this.getAttribute('config'), this.getAttribute('include')).parse());
297
297
  };
298
298
  index_2.Token.prototype.solveConst = /** @implements */ function () {
299
299
  if (this.type !== 'root') {
package/dist/index.js CHANGED
@@ -159,7 +159,7 @@ const Parser = {
159
159
  },
160
160
  /** @implements */
161
161
  async clearCache() {
162
- const promise = (0, diff_1.cmd)('npm', ['run', 'build:core']), entries = [
162
+ const promise = (0, diff_1.cmd)('npm', ['--prefix', path.join(__dirname, '..'), 'run', 'build:core']), entries = [
163
163
  ...Object.entries(constants_1.classes),
164
164
  ...Object.entries(constants_1.mixins),
165
165
  ...Object.entries(constants_1.parsers),
package/dist/lib/node.js CHANGED
@@ -211,8 +211,7 @@ class AstNode {
211
211
  return getDimension(String(this));
212
212
  }
213
213
  /** @private */
214
- // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
215
- getGaps(i) {
214
+ getGaps(_) {
216
215
  return 0;
217
216
  }
218
217
  /**
@@ -13,7 +13,7 @@ function validate(key, val, config, halfParsed, ext) {
13
13
  let value = val.replace(key === 'link' ? /\0\d+[tq]\x7F/gu : /\0\d+t\x7F/gu, '').trim();
14
14
  switch (key) {
15
15
  case 'width':
16
- return !value || /^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(value);
16
+ return !value && Boolean(val) || /^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(value);
17
17
  case 'link': {
18
18
  if (!value) {
19
19
  return val;
@@ -126,7 +126,7 @@ export declare class Token extends AstElement {
126
126
  * 展开模板
127
127
  * @param context 模板调用环境
128
128
  */
129
- expand(context?: false): Token;
129
+ expand(): Token;
130
130
  /** 解析部分魔术字 */
131
131
  solveConst(): Token;
132
132
  /** 合并普通节点的普通子节点 */
package/dist/src/index.js CHANGED
@@ -731,9 +731,9 @@ class Token extends element_1.AstElement {
731
731
  * 展开模板
732
732
  * @param context 模板调用环境
733
733
  */
734
- expand(context) {
734
+ expand() {
735
735
  require('../addon/token');
736
- return this.expand(context);
736
+ return this.expand();
737
737
  }
738
738
  /** 解析部分魔术字 */
739
739
  solveConst() {
@@ -283,9 +283,9 @@ class FileToken extends base_1.LinkBaseToken {
283
283
  if (value === true && free) {
284
284
  this.typeError('setValue', 'String');
285
285
  }
286
- const parameter = debug_1.Shadow.run(
286
+ const parameter = debug_1.Shadow.run(() =>
287
287
  // @ts-expect-error abstract class
288
- () => new imageParameter_1.ImageParameterToken(syntax.replace('$1', ''), this.extension, config));
288
+ new imageParameter_1.ImageParameterToken(syntax.replace('$1', key === 'width' ? '1' : ''), this.extension, config));
289
289
  if (free) {
290
290
  const { childNodes } = index_1.default.parse(value, this.getAttribute('include'), undefined, config);
291
291
  parameter.replaceChildren(...childNodes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -48,23 +48,10 @@
48
48
  "chalk": "^4.1.2"
49
49
  },
50
50
  "devDependencies": {
51
+ "@bhsd/common": "^0.0.0",
51
52
  "@codemirror/lint": "^6.8.0",
52
- "@stylistic/eslint-plugin": "^2.3.0",
53
53
  "@types/node": "^20.11.6",
54
- "@typescript-eslint/eslint-plugin": "^7.15.0",
55
- "@typescript-eslint/parser": "^7.15.0",
56
- "eslint": "^8.56.0",
57
- "eslint-plugin-es-x": "^8.0.0",
58
- "eslint-plugin-eslint-comments": "^3.2.0",
59
- "eslint-plugin-jsdoc": "^48.5.2",
60
- "eslint-plugin-json-es": "^1.6.0",
61
- "eslint-plugin-markdown": "^4.0.1",
62
- "eslint-plugin-n": "^17.9.0",
63
- "eslint-plugin-promise": "^6.2.0",
64
- "eslint-plugin-regexp": "^2.6.0",
65
- "eslint-plugin-unicorn": "^54.0.0",
66
54
  "monaco-editor": "^0.50.0",
67
- "typescript": "^5.5.3",
68
55
  "v8r": "^3.0.0"
69
56
  },
70
57
  "engines": {