wikiparser-node 1.3.1 → 1.3.2-b

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 (156) hide show
  1. package/bundle/bundle.min.js +36 -0
  2. package/config/llwiki.json +1 -35
  3. package/config/moegirl.json +1 -44
  4. package/config/zhwiki.json +1 -466
  5. package/extensions/dist/base.js +68 -0
  6. package/extensions/dist/editor.js +159 -0
  7. package/extensions/dist/highlight.js +30 -0
  8. package/extensions/dist/lint.js +48 -0
  9. package/extensions/editor.css +63 -0
  10. package/extensions/ui.css +117 -0
  11. package/i18n/zh-hans.json +4 -3
  12. package/i18n/zh-hant.json +4 -3
  13. package/package.json +32 -12
  14. package/config/.schema.json +0 -172
  15. package/dist/addon/table.d.ts +0 -6
  16. package/dist/addon/table.js +0 -564
  17. package/dist/base.d.ts +0 -45
  18. package/dist/bin/toc.js +0 -18
  19. package/dist/index.d.ts +0 -31
  20. package/dist/index.js +0 -209
  21. package/dist/internal.d.ts +0 -44
  22. package/dist/lib/element.d.ts +0 -155
  23. package/dist/lib/element.js +0 -654
  24. package/dist/lib/node.d.ts +0 -146
  25. package/dist/lib/node.js +0 -419
  26. package/dist/lib/range.d.ts +0 -104
  27. package/dist/lib/range.js +0 -385
  28. package/dist/lib/ranges.d.ts +0 -26
  29. package/dist/lib/ranges.js +0 -117
  30. package/dist/lib/text.d.ts +0 -62
  31. package/dist/lib/text.js +0 -235
  32. package/dist/lib/title.d.ts +0 -38
  33. package/dist/lib/title.js +0 -162
  34. package/dist/mixin/attributesParent.js +0 -94
  35. package/dist/mixin/fixed.js +0 -32
  36. package/dist/mixin/flagsParent.js +0 -70
  37. package/dist/mixin/hidden.js +0 -22
  38. package/dist/mixin/magicLinkParent.js +0 -41
  39. package/dist/mixin/singleLine.js +0 -25
  40. package/dist/mixin/sol.js +0 -43
  41. package/dist/mixin/syntax.js +0 -56
  42. package/dist/parser/braces.js +0 -122
  43. package/dist/parser/commentAndExt.js +0 -69
  44. package/dist/parser/converter.js +0 -40
  45. package/dist/parser/externalLinks.js +0 -28
  46. package/dist/parser/hrAndDoubleUnderscore.js +0 -38
  47. package/dist/parser/html.js +0 -36
  48. package/dist/parser/links.js +0 -94
  49. package/dist/parser/list.js +0 -59
  50. package/dist/parser/magicLinks.js +0 -40
  51. package/dist/parser/quotes.js +0 -67
  52. package/dist/parser/selector.js +0 -162
  53. package/dist/parser/table.js +0 -112
  54. package/dist/src/arg.d.ts +0 -58
  55. package/dist/src/arg.js +0 -189
  56. package/dist/src/atom.d.ts +0 -12
  57. package/dist/src/atom.js +0 -27
  58. package/dist/src/attribute.d.ts +0 -86
  59. package/dist/src/attribute.js +0 -391
  60. package/dist/src/attributes.d.ts +0 -107
  61. package/dist/src/attributes.js +0 -341
  62. package/dist/src/converter.d.ts +0 -51
  63. package/dist/src/converter.js +0 -79
  64. package/dist/src/converterFlags.d.ts +0 -87
  65. package/dist/src/converterFlags.js +0 -222
  66. package/dist/src/converterRule.d.ts +0 -81
  67. package/dist/src/converterRule.js +0 -212
  68. package/dist/src/extLink.d.ts +0 -53
  69. package/dist/src/extLink.js +0 -121
  70. package/dist/src/gallery.d.ts +0 -55
  71. package/dist/src/gallery.js +0 -122
  72. package/dist/src/heading.d.ts +0 -72
  73. package/dist/src/heading.js +0 -127
  74. package/dist/src/hidden.d.ts +0 -21
  75. package/dist/src/hidden.js +0 -23
  76. package/dist/src/html.d.ts +0 -103
  77. package/dist/src/html.js +0 -222
  78. package/dist/src/imageParameter.d.ts +0 -66
  79. package/dist/src/imageParameter.js +0 -247
  80. package/dist/src/imagemap.d.ts +0 -57
  81. package/dist/src/imagemap.js +0 -148
  82. package/dist/src/imagemapLink.d.ts +0 -57
  83. package/dist/src/imagemapLink.js +0 -40
  84. package/dist/src/index.d.ts +0 -146
  85. package/dist/src/index.js +0 -777
  86. package/dist/src/link/base.d.ts +0 -52
  87. package/dist/src/link/base.js +0 -207
  88. package/dist/src/link/category.d.ts +0 -13
  89. package/dist/src/link/category.js +0 -29
  90. package/dist/src/link/file.d.ts +0 -96
  91. package/dist/src/link/file.js +0 -253
  92. package/dist/src/link/galleryImage.d.ts +0 -43
  93. package/dist/src/link/galleryImage.js +0 -106
  94. package/dist/src/link/index.d.ts +0 -53
  95. package/dist/src/link/index.js +0 -123
  96. package/dist/src/magicLink.d.ts +0 -69
  97. package/dist/src/magicLink.js +0 -147
  98. package/dist/src/nested.d.ts +0 -44
  99. package/dist/src/nested.js +0 -87
  100. package/dist/src/nowiki/base.d.ts +0 -46
  101. package/dist/src/nowiki/base.js +0 -42
  102. package/dist/src/nowiki/comment.d.ts +0 -39
  103. package/dist/src/nowiki/comment.js +0 -67
  104. package/dist/src/nowiki/dd.d.ts +0 -8
  105. package/dist/src/nowiki/dd.js +0 -25
  106. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -43
  107. package/dist/src/nowiki/doubleUnderscore.js +0 -50
  108. package/dist/src/nowiki/hr.d.ts +0 -29
  109. package/dist/src/nowiki/hr.js +0 -14
  110. package/dist/src/nowiki/index.d.ts +0 -16
  111. package/dist/src/nowiki/index.js +0 -21
  112. package/dist/src/nowiki/list.d.ts +0 -29
  113. package/dist/src/nowiki/list.js +0 -48
  114. package/dist/src/nowiki/listBase.d.ts +0 -18
  115. package/dist/src/nowiki/listBase.js +0 -12
  116. package/dist/src/nowiki/noinclude.d.ts +0 -25
  117. package/dist/src/nowiki/noinclude.js +0 -25
  118. package/dist/src/nowiki/quote.d.ts +0 -22
  119. package/dist/src/nowiki/quote.js +0 -45
  120. package/dist/src/onlyinclude.d.ts +0 -16
  121. package/dist/src/onlyinclude.js +0 -57
  122. package/dist/src/paramTag/index.d.ts +0 -37
  123. package/dist/src/paramTag/index.js +0 -68
  124. package/dist/src/paramTag/inputbox.d.ts +0 -8
  125. package/dist/src/paramTag/inputbox.js +0 -23
  126. package/dist/src/parameter.d.ts +0 -84
  127. package/dist/src/parameter.js +0 -205
  128. package/dist/src/pre.d.ts +0 -28
  129. package/dist/src/pre.js +0 -51
  130. package/dist/src/syntax.d.ts +0 -24
  131. package/dist/src/syntax.js +0 -30
  132. package/dist/src/table/base.d.ts +0 -52
  133. package/dist/src/table/base.js +0 -78
  134. package/dist/src/table/index.d.ts +0 -229
  135. package/dist/src/table/index.js +0 -379
  136. package/dist/src/table/td.d.ts +0 -103
  137. package/dist/src/table/td.js +0 -261
  138. package/dist/src/table/tr.d.ts +0 -32
  139. package/dist/src/table/tr.js +0 -56
  140. package/dist/src/table/trBase.d.ts +0 -54
  141. package/dist/src/table/trBase.js +0 -158
  142. package/dist/src/tagPair/ext.d.ts +0 -58
  143. package/dist/src/tagPair/ext.js +0 -142
  144. package/dist/src/tagPair/include.d.ts +0 -52
  145. package/dist/src/tagPair/include.js +0 -58
  146. package/dist/src/tagPair/index.d.ts +0 -47
  147. package/dist/src/tagPair/index.js +0 -93
  148. package/dist/src/transclude.d.ts +0 -167
  149. package/dist/src/transclude.js +0 -689
  150. package/dist/util/constants.js +0 -108
  151. package/dist/util/debug.js +0 -64
  152. package/dist/util/diff.js +0 -72
  153. package/dist/util/lint.js +0 -46
  154. package/dist/util/string.js +0 -61
  155. package/errors/README +0 -1
  156. package/printed/README +0 -1
@@ -0,0 +1,30 @@
1
+ (() => {
2
+ "use strict";
3
+ const highlight = async (ele, include, linenums = false, start = 1) => {
4
+ if (ele.classList.contains('highlighted')) {
5
+ return;
6
+ }
7
+ const html = (await wikiparse.print(ele.innerText, include)).map(([, , printed]) => printed).join('');
8
+ ele.classList.add('highlighted');
9
+ if (linenums) {
10
+ const lines = html.split('\n').map((line, i) => {
11
+ const li = document.createElement('li');
12
+ li.id = `L${i + start}`;
13
+ li.innerHTML = line;
14
+ return li;
15
+ });
16
+ if (!lines[lines.length - 1].textContent) {
17
+ lines.pop();
18
+ }
19
+ const ol = document.createElement('ol');
20
+ ol.start = start;
21
+ ol.style.paddingLeft = `${String(lines.length + start - 1).length + 2.5}ch`;
22
+ ol.append(...lines);
23
+ ele.replaceChildren(ol);
24
+ }
25
+ else {
26
+ ele.innerHTML = html;
27
+ }
28
+ };
29
+ wikiparse.highlight = highlight;
30
+ })();
@@ -0,0 +1,48 @@
1
+ (() => {
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _Linter_instances, _Linter_id, _Linter_wikitext, _Linter_running, _Linter_lint;
14
+ class Linter {
15
+ constructor(include) {
16
+ _Linter_instances.add(this);
17
+ _Linter_id.set(this, void 0);
18
+ _Linter_wikitext.set(this, void 0);
19
+ _Linter_running.set(this, void 0);
20
+ __classPrivateFieldSet(this, _Linter_id, wikiparse.id++, "f");
21
+ this.include = Boolean(include);
22
+ }
23
+ queue(wikitext) {
24
+ var _a;
25
+ __classPrivateFieldSet(this, _Linter_wikitext, wikitext, "f");
26
+ __classPrivateFieldSet(this, _Linter_running, (_a = __classPrivateFieldGet(this, _Linter_running, "f")) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _Linter_instances, "m", _Linter_lint).call(this, wikitext), "f");
27
+ return __classPrivateFieldGet(this, _Linter_running, "f");
28
+ }
29
+ async codemirror(wikitext) {
30
+ return (await this.queue(wikitext)).map(({ startIndex, endIndex, severity, message }) => ({
31
+ from: startIndex,
32
+ to: endIndex,
33
+ severity,
34
+ message,
35
+ }));
36
+ }
37
+ }
38
+ _Linter_id = new WeakMap(), _Linter_wikitext = new WeakMap(), _Linter_running = new WeakMap(), _Linter_instances = new WeakSet(), _Linter_lint = async function _Linter_lint(wikitext) {
39
+ const { include } = this, errors = await wikiparse.lint(wikitext, include, __classPrivateFieldGet(this, _Linter_id, "f"));
40
+ if (this.include === include && __classPrivateFieldGet(this, _Linter_wikitext, "f") === wikitext) {
41
+ __classPrivateFieldSet(this, _Linter_running, undefined, "f");
42
+ return errors;
43
+ }
44
+ __classPrivateFieldSet(this, _Linter_running, __classPrivateFieldGet(this, _Linter_instances, "m", _Linter_lint).call(this, __classPrivateFieldGet(this, _Linter_wikitext, "f")), "f");
45
+ return __classPrivateFieldGet(this, _Linter_running, "f");
46
+ };
47
+ wikiparse.Linter = Linter;
48
+ })();
@@ -0,0 +1,63 @@
1
+ .wikiparse-container {
2
+ position: relative;
3
+ -webkit-text-size-adjust: none;
4
+ }
5
+ .wikiparsed {
6
+ position: relative;
7
+ display: block;
8
+ box-sizing: border-box;
9
+ width: 100%;
10
+ resize: vertical;
11
+ font-family: monospace;
12
+ background: none !important;
13
+ caret-color: #000;
14
+ }
15
+ #wikiPretty {
16
+ position: absolute;
17
+ inset: 0;
18
+ background-color: #fff;
19
+ -webkit-user-select: none;
20
+ user-select: none;
21
+ }
22
+ #wikiPretty + .wikiparsed, #wikiPretty {
23
+ outline: none;
24
+ border: 1.5px solid #dedede !important;
25
+ border-radius: 0;
26
+ padding: .4em;
27
+ line-height: 1.4 !important;
28
+ font-size: inherit;
29
+ tab-size: 4;
30
+ overflow-y: auto;
31
+ word-break: normal;
32
+ }
33
+
34
+ /* compromise for font-weight: bold */
35
+ .wpb-ext, .wpb-html,
36
+ .wpb-arg,
37
+ .wpb-template,
38
+ .wpb-magic-word,
39
+ .wpb-heading-title,
40
+ .wpb-table, .wpb-tr, .wpb-td,
41
+ .wpb-double-underscore, .wpb-hr, .wpb-quote, .wpb-list, .wpb-dd
42
+ .wpb-converter {
43
+ -webkit-text-stroke-width: .1ex;
44
+ }
45
+ .wpb-image-invalid, .wpb-table-inter,
46
+ .wpb-hidden, .wpb-noinclude, .wpb-include, .wpb-comment, .wpb-attr-dirty,
47
+ .wpb-ext-attrs, .wpb-html-attrs,
48
+ .wpb-ext-inner,
49
+ .wpb-arg-default,
50
+ .wpb-invoke-module, .wpb-invoke-function,
51
+ .wpb-parameter,
52
+ .wpb-table-attrs, .wpb-td-inner,
53
+ .wpb-converter-rule {
54
+ -webkit-text-stroke-width: 0;
55
+ }
56
+ #wikiPretty span {
57
+ font-weight: normal;
58
+ }
59
+
60
+ #wikiPretty.active span {
61
+ color: transparent;
62
+ background: none;
63
+ }
@@ -0,0 +1,117 @@
1
+ .wikiparser {
2
+ white-space: pre-wrap;
3
+ overflow-wrap: break-word;
4
+ font-family: monospace;
5
+ }
6
+
7
+ .wpb-error {
8
+ text-decoration: underline wavy #f00 1px;
9
+ }
10
+ .wpb-image-invalid, .wpb-table-inter {
11
+ color: #f00;
12
+ font-weight: normal;
13
+ text-decoration: underline wavy 1px;
14
+ }
15
+
16
+ .wpb-hidden, .wpb-noinclude, .wpb-include, .wpb-comment, .wpb-attr-dirty {
17
+ color: #72777d;
18
+ font-weight: normal;
19
+ font-style: italic;
20
+ }
21
+
22
+ .wpb-ext, .wpb-html {
23
+ color: #14866d;
24
+ font-weight: bold;
25
+ }
26
+ .wpb-ext-attrs, .wpb-html-attrs {
27
+ font-weight: normal;
28
+ }
29
+ .wpb-ext-attr > .wpb-attr-value, .wpb-html-attr > .wpb-attr-value {
30
+ color: #179b1c;
31
+ }
32
+ .wpb-ext-inner {
33
+ color: initial;
34
+ font-weight: normal;
35
+ background-color: rgba(0, 0, 0, .03);
36
+ }
37
+
38
+ .wpb-arg {
39
+ color: #ac6600;
40
+ font-weight: bold;
41
+ }
42
+ .wpb-arg-default {
43
+ color: #ad9300;
44
+ font-weight: normal;
45
+ }
46
+
47
+ .wpb-template {
48
+ color: #80c;
49
+ font-weight: bold;
50
+ background-color: rgba(119, 0, 170, .03);
51
+ }
52
+ .wpb-magic-word {
53
+ color: #d33;
54
+ font-weight: bold;
55
+ background-color: rgba(170, 17, 17, .03);
56
+ }
57
+ .wpb-invoke-module, .wpb-invoke-function {
58
+ color: #dd5d33;
59
+ font-weight: normal;
60
+ }
61
+ .wpb-parameter {
62
+ color: initial;
63
+ font-weight: normal;
64
+ }
65
+ .wpb-template > .wpb-parameter > .wpb-parameter-key,
66
+ .wpb-invoke-function ~ .wpb-parameter > .wpb-parameter-key {
67
+ color: #b0c;
68
+ }
69
+
70
+ .wpb-heading, .wpb-image-parameter {
71
+ color: #0076dd;
72
+ }
73
+ .wpb-heading-title {
74
+ color: initial;
75
+ font-weight: bold;
76
+ }
77
+
78
+ .wpb-table, .wpb-tr, .wpb-td {
79
+ color: #d08;
80
+ font-weight: bold;
81
+ }
82
+ .wpb-table-attrs {
83
+ font-weight: normal;
84
+ }
85
+ .wpb-table-attr > .wpb-attr-value {
86
+ color: #f500d4;
87
+ }
88
+ .wpb-td-inner {
89
+ color: initial;
90
+ font-weight: normal;
91
+ }
92
+
93
+ .wpb-double-underscore, .wpb-hr, .wpb-quote, .wpb-list, .wpb-dd {
94
+ color: #0076dd;
95
+ font-weight: bold;
96
+ background-color: #eee;
97
+ }
98
+
99
+ .wpb-link, .wpb-category, .wpb-file, .wpb-gallery-image, .wpb-imagemap-image,
100
+ .wpb-ext-link, .wpb-free-ext-link {
101
+ color: #000aaa;
102
+ background-color: rgba(34, 17, 153, .03);
103
+ }
104
+ .wpb-link-text, .wpb-image-caption, .wpb-ext-link-text {
105
+ color: initial;
106
+ }
107
+
108
+ .wpb-converter {
109
+ color: #b68;
110
+ font-weight: bold;
111
+ }
112
+ .wpb-converter-rule {
113
+ font-weight: normal;
114
+ }
115
+ .wpb-converter-rule-from, .wpb-converter-rule-to, .wpb-converter-noconvert {
116
+ color: initial;
117
+ }
package/i18n/zh-hans.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "frame": "框架",
15
15
  "full-width punctuation": "全角标点",
16
16
  "horizontal-alignment": "水平对齐",
17
+ "HTML comment": "HTML注释",
17
18
  "HTML tag in table attributes": "表格属性中的HTML标签",
18
19
  "illegal attribute name": "非法的属性名",
19
20
  "illegal module name": "非法的模块名称",
@@ -31,13 +32,13 @@
31
32
  "missing module name": "缺少模块名称",
32
33
  "nonzero tabindex": "不为0的tabindex",
33
34
  "nothing should be in <$1>": "<$1>标签内不应有任何内容",
35
+ "quotes": "引号",
34
36
  "section header in a HTML tag": "HTML标签属性中的段落标题",
37
+ "table": "表格",
35
38
  "tag that is both closing and self-closing": "同时闭合和自封闭的标签",
36
39
  "template in an internal link target": "内链目标包含模板",
37
40
  "unbalanced \"=\" in a section header": "段落标题中不平衡的\"=\"",
38
- "unclosed HTML comment": "未闭合的HTML注释",
39
- "unclosed quotes": "未闭合的引号",
40
- "unclosed table": "未闭合的表格",
41
+ "unclosed $1": "未闭合的$1",
41
42
  "unclosed tag": "未闭合的标签",
42
43
  "unescaped query string in an anonymous parameter": "匿名参数中未转义的查询参数",
43
44
  "unexpected template argument": "未预期的模板参数",
package/i18n/zh-hant.json CHANGED
@@ -14,6 +14,7 @@
14
14
  "frame": "框架",
15
15
  "full-width punctuation": "全形標點",
16
16
  "horizontal-alignment": "水瓶對齊",
17
+ "HTML comment": "HTML註釋",
17
18
  "HTML tag in table attributes": "表格屬性中的HTML標籤",
18
19
  "illegal attribute name": "非法的屬性名",
19
20
  "illegal module name": "非法的模組名稱",
@@ -31,13 +32,13 @@
31
32
  "missing module name": "缺少模組名稱",
32
33
  "nonzero tabindex": "不為0的tabindex",
33
34
  "nothing should be in <$1>": "<$1>標籤內不應有任何內容",
35
+ "quotes": "引號",
34
36
  "section header in a HTML tag": "HTML標籤屬性中的段落標題",
37
+ "table": "表格",
35
38
  "tag that is both closing and self-closing": "同時閉合和自封閉的標籤",
36
39
  "template in an internal link target": "內部連結目標包含模板",
37
40
  "unbalanced \"=\" in a section header": "段落標題中不平衡的\"=\"",
38
- "unclosed HTML comment": "未閉合的HTML註釋",
39
- "unclosed quotes": "未閉合的引號",
40
- "unclosed table": "未閉合的表格",
41
+ "unclosed $1": "未閉合的$1",
41
42
  "unclosed tag": "未閉合的標籤",
42
43
  "unescaped query string in an anonymous parameter": "匿名參數中未轉義的查詢參數",
43
44
  "unexpected template argument": "未預期的模板參數",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.3.1",
3
+ "version": "1.3.2-b",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -14,38 +14,55 @@
14
14
  "license": "GPL-3.0",
15
15
  "author": "Bhsd",
16
16
  "files": [
17
- "/errors/README",
18
- "/printed/README",
17
+ "/bundle/bundle.min.js",
18
+ "/extensions/dist/",
19
+ "/extensions/*.css",
20
+ "!/extensions/dist/gh-page.js",
21
+ "!/extensions/gh-page.css",
19
22
  "/config/",
20
23
  "/i18n/",
21
- "/dist/"
24
+ "!/config/.schema.json"
22
25
  ],
23
- "main": "./dist/index.js",
26
+ "browser": "/bundle/bundle.min.js",
27
+ "main": "./bundle/bundle.js",
28
+ "types": "./extensions/typings.d.ts",
24
29
  "repository": {
25
30
  "type": "git",
26
31
  "url": "git+https://github.com/bhsd-harry/wikiparser-node.git"
27
32
  },
28
33
  "scripts": {
29
- "toc": "node ./dist/bin/toc.js",
30
- "prepublishOnly": "npm run build; rm dist/internal.js dist/base.js dist/[bmpu]*/*.d.ts; rm -r dist/test",
31
- "build": "rm -rf dist/; tsc; grep -rl --include='*.d.ts' '@private' dist/ | xargs gsed -i '/@private/,+1d'",
34
+ "prepublishOnly": "npm run build:prod && npm run build:ext",
35
+ "build:dev": "esbuild index.ts --bundle --target=es2018 --outfile=bundle/bundle.js",
36
+ "build:prod": "esbuild index.ts --bundle --minify --target=es2018 --outfile=bundle/bundle.min.js",
37
+ "build:core": "rm bundle/*.js; npm run build:dev; npm run build:prod; eslint --no-eslintrc -c .eslintrc.browser.json bundle/",
38
+ "build:ext": "bash build-ext.sh",
39
+ "build:test": "rm -rf dist/; tsc; gsed -i 's|../config/minimum|../../config/minimum|' dist/util/constants.js",
40
+ "build": "npm run build:core && npm run build:ext",
32
41
  "diff": "git diff --ignore-all-space --color-moved",
33
- "lint:ts": "tsc --noEmit && eslint --cache .",
42
+ "lint:ts": "tsc --noEmit && tsc --noEmit --project extensions/tsconfig.json && eslint --cache .",
34
43
  "lint:json": "ajv -s config/.schema.json -d 'config/*.json' --strict=true --strict-required=false",
35
- "lint": "npm run lint:ts && npm run lint:json",
36
- "test": "node dist/test/test.js",
44
+ "lint:css": "stylelint extensions/*.css",
45
+ "lint": "npm run lint:ts && npm run lint:json && npm run lint:css",
46
+ "server": "http-server .. -c-1 --cors &",
47
+ "test": "npm run server; open http://127.0.0.1:8080/wikiparser-node/index.html",
48
+ "test:end": "pkill -x http-server",
37
49
  "test:real": "node dist/test/real.js",
38
- "test:single": "node dist/test/single.js; node --prof dist/test/single.js && node --prof-process isolate-0x*-v8.log > test/processed.txt && rm isolate-0x*-v8.log"
50
+ "test:single": "node dist/test/single.js"
39
51
  },
40
52
  "devDependencies": {
53
+ "@bhsd/codemirror-mediawiki": "^2.0.14",
54
+ "@codemirror/lint": "^6.4.2",
41
55
  "@cypress/request": "^3.0.1",
42
56
  "@stylistic/eslint-plugin": "^1.5.3",
57
+ "@stylistic/stylelint-plugin": "^2.0.0",
43
58
  "@types/node": "^20.9.0",
44
59
  "@types/request": "^2.48.12",
45
60
  "@typescript-eslint/eslint-plugin": "^6.12.0",
46
61
  "@typescript-eslint/parser": "^6.12.0",
47
62
  "ajv-cli": "^5.0.0",
63
+ "esbuild": "^0.19.7",
48
64
  "eslint": "^8.56.0",
65
+ "eslint-plugin-es-x": "^7.3.0",
49
66
  "eslint-plugin-eslint-comments": "^3.2.0",
50
67
  "eslint-plugin-jsdoc": "^47.0.2",
51
68
  "eslint-plugin-json-es": "^1.5.7",
@@ -53,6 +70,9 @@
53
70
  "eslint-plugin-promise": "^6.1.1",
54
71
  "eslint-plugin-regexp": "^2.1.1",
55
72
  "eslint-plugin-unicorn": "^50.0.1",
73
+ "http-server": "^14.1.0",
74
+ "stylelint": "^16.1.0",
75
+ "stylelint-config-recommended": "^14.0.0",
56
76
  "typescript": "^5.1.6"
57
77
  },
58
78
  "engines": {
@@ -1,172 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "ext": {
5
- "description": "extension tags",
6
- "type": "array",
7
- "items": {
8
- "type": "string",
9
- "pattern": "^[a-z\\d_]+$"
10
- }
11
- },
12
- "html": {
13
- "description": "valid HTML tags",
14
- "type": "array",
15
- "items": {
16
- "type": "array",
17
- "items": {
18
- "type": "string",
19
- "pattern": "^[a-z\\d]+$"
20
- }
21
- },
22
- "minItems": 3,
23
- "maxItems": 3
24
- },
25
- "namespaces": {
26
- "description": "formatted namespaces",
27
- "type": "object",
28
- "patternProperties": {
29
- "^-?\\d+$": {
30
- "type": "string"
31
- }
32
- },
33
- "additionalProperties": false
34
- },
35
- "nsid": {
36
- "description": "namespace IDs",
37
- "type": "object",
38
- "required": [
39
- "file",
40
- "category"
41
- ],
42
- "additionalProperties": {
43
- "type": "integer"
44
- }
45
- },
46
- "parserFunction": {
47
- "type": "array",
48
- "items": [
49
- {
50
- "description": "case-insensitive parser functions",
51
- "type": "object",
52
- "additionalProperties": {
53
- "type": "string"
54
- }
55
- },
56
- {
57
- "description": "case-sensitive parser functions",
58
- "type": "array",
59
- "allOf": [
60
- {
61
- "contains": {
62
- "const": "!"
63
- }
64
- },
65
- {
66
- "contains": {
67
- "const": "="
68
- }
69
- }
70
- ],
71
- "items": {
72
- "type": "string"
73
- }
74
- },
75
- {
76
- "description": "msg and raw",
77
- "type": "array",
78
- "items": {
79
- "type": "string"
80
- }
81
- },
82
- {
83
- "description": "subst and safesubst",
84
- "type": "array",
85
- "items": {
86
- "type": "string"
87
- }
88
- }
89
- ],
90
- "minItems": 4,
91
- "maxItems": 4
92
- },
93
- "doubleUnderscore": {
94
- "description": "behavior switches",
95
- "type": "array",
96
- "items": {
97
- "type": "array",
98
- "items": {
99
- "type": "string"
100
- }
101
- },
102
- "minItems": 2,
103
- "maxItems": 2
104
- },
105
- "protocol": {
106
- "description": "external link protocols",
107
- "type": "string",
108
- "pattern": "^[a-z:/]+(?:\\|[a-z:/]+)*$"
109
- },
110
- "interwiki": {
111
- "type": "array",
112
- "items": {
113
- "type": "string"
114
- }
115
- },
116
- "img": {
117
- "description": "image-related magic words",
118
- "type": "object",
119
- "additionalProperties": {
120
- "type": "string",
121
- "pattern": "^[-a-z]+$"
122
- }
123
- },
124
- "variants": {
125
- "description": "variants for language conversion",
126
- "type": "array",
127
- "items": {
128
- "type": "string",
129
- "pattern": "^[-a-z]+$"
130
- }
131
- },
132
- "conversionTable": {
133
- "description": "table of unidirectional conversions",
134
- "type": "array",
135
- "items": {
136
- "type": "array",
137
- "items": {
138
- "type": "string",
139
- "pattern": "^[^ <>[\\]{}|]+$"
140
- },
141
- "minItems": 2,
142
- "maxItems": 2
143
- }
144
- },
145
- "redirects": {
146
- "description": "table of redirects",
147
- "type": "array",
148
- "items": {
149
- "type": "array",
150
- "items": {
151
- "type": "string",
152
- "pattern": "^[^ <>[\\]{}|]+$"
153
- },
154
- "minItems": 2,
155
- "maxItems": 2
156
- }
157
- }
158
- },
159
- "required": [
160
- "ext",
161
- "html",
162
- "namespaces",
163
- "nsid",
164
- "parserFunction",
165
- "doubleUnderscore",
166
- "protocol",
167
- "interwiki",
168
- "img",
169
- "variants"
170
- ],
171
- "additionalProperties": false
172
- }
@@ -1,6 +0,0 @@
1
- import type { TableCoords } from '../src/table/trBase';
2
- /** @extends {Array<TableCoords[]>} */
3
- export declare class Layout extends Array<TableCoords[]> {
4
- /** 打印表格布局 */
5
- print(): void;
6
- }