wikiparser-node 1.7.0 → 1.7.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/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { log } from './util/diff';
2
1
  import type { Config, LintError, Parser as ParserBase } from './base';
3
2
  import type { Title } from './lib/title';
4
3
  import type { Token } from './internal';
@@ -26,6 +25,11 @@ declare interface Parser extends ParserBase {
26
25
  isInterwiki(title: string, config?: Config): RegExpExecArray | null;
27
26
  }
28
27
  declare const Parser: Parser;
28
+ // @ts-expect-error mixed export styles
29
29
  export = Parser;
30
30
  export type { Config, LintError };
31
31
  export type * from './internal';
32
+ declare global {
33
+ type Acceptable = unknown;
34
+ type PrintOpt = unknown;
35
+ }
@@ -125,7 +125,7 @@ export declare abstract class AstNode implements AstNodeBase {
125
125
  * @param e 事件对象
126
126
  * @param data 事件数据
127
127
  */
128
- dispatchEvent(e: Event, data: AstEventData): void;
128
+ dispatchEvent(e: Event, data: unknown): void;
129
129
  /** 获取所有祖先节点 */
130
130
  getAncestors(): Token[];
131
131
  /**
@@ -47,4 +47,3 @@ export interface AttributesParentBase {
47
47
  * @param constructor 基类
48
48
  * @param _ context
49
49
  */
50
- export declare const attributesParent: (i?: number) => <T extends AstConstructor>(constructor: T, _?: unknown) => T;
@@ -3,4 +3,3 @@
3
3
  * @param constructor 基类
4
4
  * @param _ context
5
5
  */
6
- export declare const fixedToken: <S extends AstConstructor>(constructor: S, _?: unknown) => S;
@@ -39,34 +39,3 @@ export interface FlagsParentBase {
39
39
  * @param constructor 基类
40
40
  * @param _ context
41
41
  */
42
- export declare const flagsParent: <T extends AstConstructor>(constructor: T, _?: unknown) => (abstract new (...args: any[]) => {
43
- readonly firstChild: ConverterFlagsToken;
44
- readonly firstElementChild: ConverterFlagsToken;
45
- /** @implements */
46
- flags: Set<string>;
47
- /** @implements */
48
- getAllFlags(): Set<string>;
49
- /** @implements */
50
- getEffectiveFlags(): Set<string>;
51
- /** @implements */
52
- getUnknownFlags(): Set<string>;
53
- /** @implements */
54
- hasFlag(flag: string): boolean;
55
- /** @implements */
56
- hasEffectiveFlag(flag: string): boolean;
57
- /** @implements */
58
- removeFlag(flag: string): void;
59
- /** @implements */
60
- setFlag(flag: string): void;
61
- /** @implements */
62
- toggleFlag(flag: string): void;
63
- toString(separator?: string | undefined): string;
64
- text(separator?: string | undefined): string;
65
- insertAt(token: unknown, i?: number | undefined): unknown;
66
- getAttribute<T_1 extends string>(key: T_1): TokenAttributeGetter<T_1>;
67
- setAttribute<T_2 extends string>(key: T_2, value: TokenAttributeSetter<T_2>): void;
68
- addEventListener(events: string | string[], listener: AstListener): void;
69
- replaceChildren(...elements: (string | import("..").AstNodes)[]): void;
70
- constructorError(msg: string): never;
71
- seal(key: string, permanent?: boolean | undefined): void;
72
- }) & T;
@@ -2,4 +2,3 @@
2
2
  * 解析后不可见的类
3
3
  * @param constructor 基类
4
4
  */
5
- export declare const hiddenToken: <T extends AstConstructor>(constructor: T) => T;
@@ -17,25 +17,3 @@ export interface MagicLinkParentBase {
17
17
  * @param constructor 基类
18
18
  * @param _ context
19
19
  */
20
- export declare const magicLinkParent: <T extends AstConstructor>(constructor: T, _?: unknown) => (abstract new (...args: any[]) => {
21
- readonly firstChild: MagicLinkToken;
22
- readonly firstElementChild: MagicLinkToken;
23
- /** @implements */
24
- get protocol(): string | undefined;
25
- set protocol(value: string);
26
- /** @implements */
27
- link: string;
28
- /** @implements */
29
- getUrl(): URL;
30
- /** @implements */
31
- setTarget(url: string): void;
32
- toString(separator?: string | undefined): string;
33
- text(separator?: string | undefined): string;
34
- insertAt(token: unknown, i?: number | undefined): unknown;
35
- getAttribute<T_1 extends string>(key: T_1): TokenAttributeGetter<T_1>;
36
- setAttribute<T_2 extends string>(key: T_2, value: TokenAttributeSetter<T_2>): void;
37
- addEventListener(events: string | string[], listener: AstListener): void;
38
- replaceChildren(...elements: (string | import("..").AstNodes)[]): void;
39
- constructorError(msg: string): never;
40
- seal(key: string, permanent?: boolean | undefined): void;
41
- }) & T;
@@ -3,4 +3,3 @@
3
3
  * @param constructor 基类
4
4
  * @param _ context
5
5
  */
6
- export declare const singleLine: <T extends AstConstructor>(constructor: T, _?: unknown) => T;
@@ -3,4 +3,3 @@
3
3
  * @param constructor 基类
4
4
  * @param _ context
5
5
  */
6
- export declare const sol: <T extends AstConstructor>(constructor: T, _?: unknown) => T;
@@ -6,4 +6,3 @@ export interface SyntaxBase {
6
6
  * @param constructor 基类
7
7
  * @param _ context
8
8
  */
9
- export declare const syntax: (pattern?: RegExp) => <S extends AstConstructor>(constructor: S, _?: unknown) => S;
@@ -1,4 +1,3 @@
1
- import { BuildMethod } from '../util/constants';
2
1
  import Parser from '../index';
3
2
  import { AstElement } from '../lib/element';
4
3
  import { AstText } from '../lib/text';
@@ -43,7 +42,7 @@ export declare class Token extends AstElement {
43
42
  /** @override */
44
43
  lint(start?: number, re?: RegExp): LintError[];
45
44
  /** @override */
46
- dispatchEvent(e: Event, data: AstEventData): void;
45
+ dispatchEvent(e: Event, data: unknown): void;
47
46
  /**
48
47
  * @override
49
48
  * @param i 移除位置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "scripts": {
30
30
  "toc": "node ./dist/bin/toc.js",
31
- "declaration": "grep -rl --include='*.d.ts' '@private' dist/ | xargs bash sed.sh -i -E '/^\\s+\\/\\*\\* @private/,+1d'; node ./dist/bin/declaration.js",
32
- "prepublishOnly": "npm run build && rm dist/internal.js dist/[pu]*/*.d.ts",
31
+ "declaration": "grep -rl --include='*.d.ts' '@private' dist/ | xargs bash sed.sh -i -E '/^\\s+\\/\\*\\* @private/,+1d'; grep -rl --include='*.d.ts' '/util/' dist/ | xargs bash sed.sh -i -E '/^import .+\\/util\\//d'; node ./dist/bin/declaration.js",
32
+ "prepublishOnly": "npm run build",
33
33
  "build:core": "bash build.sh",
34
34
  "build": "npm run build:core && node ./dist/bin/parserTests.js",
35
35
  "diff": "bash diff.sh",