wikiparser-node 1.3.8 → 1.3.9-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 (155) 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 +64 -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 +114 -0
  11. package/i18n/zh-hans.json +6 -1
  12. package/i18n/zh-hant.json +6 -1
  13. package/package.json +31 -13
  14. package/config/.schema.json +0 -172
  15. package/dist/addon/table.d.ts +0 -6
  16. package/dist/addon/table.js +0 -558
  17. package/dist/base.d.ts +0 -45
  18. package/dist/index.d.ts +0 -32
  19. package/dist/index.js +0 -209
  20. package/dist/internal.d.ts +0 -44
  21. package/dist/lib/element.d.ts +0 -154
  22. package/dist/lib/element.js +0 -630
  23. package/dist/lib/node.d.ts +0 -146
  24. package/dist/lib/node.js +0 -419
  25. package/dist/lib/range.d.ts +0 -104
  26. package/dist/lib/range.js +0 -385
  27. package/dist/lib/ranges.d.ts +0 -26
  28. package/dist/lib/ranges.js +0 -118
  29. package/dist/lib/text.d.ts +0 -62
  30. package/dist/lib/text.js +0 -255
  31. package/dist/lib/title.d.ts +0 -38
  32. package/dist/lib/title.js +0 -163
  33. package/dist/mixin/attributesParent.js +0 -89
  34. package/dist/mixin/fixed.js +0 -25
  35. package/dist/mixin/flagsParent.js +0 -70
  36. package/dist/mixin/hidden.js +0 -25
  37. package/dist/mixin/magicLinkParent.js +0 -41
  38. package/dist/mixin/singleLine.js +0 -25
  39. package/dist/mixin/sol.js +0 -43
  40. package/dist/mixin/syntax.js +0 -54
  41. package/dist/parser/braces.js +0 -128
  42. package/dist/parser/commentAndExt.js +0 -85
  43. package/dist/parser/converter.js +0 -40
  44. package/dist/parser/externalLinks.js +0 -31
  45. package/dist/parser/hrAndDoubleUnderscore.js +0 -38
  46. package/dist/parser/html.js +0 -36
  47. package/dist/parser/links.js +0 -94
  48. package/dist/parser/list.js +0 -66
  49. package/dist/parser/magicLinks.js +0 -42
  50. package/dist/parser/quotes.js +0 -67
  51. package/dist/parser/selector.js +0 -162
  52. package/dist/parser/table.js +0 -120
  53. package/dist/src/arg.d.ts +0 -58
  54. package/dist/src/arg.js +0 -194
  55. package/dist/src/atom.d.ts +0 -12
  56. package/dist/src/atom.js +0 -27
  57. package/dist/src/attribute.d.ts +0 -88
  58. package/dist/src/attribute.js +0 -399
  59. package/dist/src/attributes.d.ts +0 -109
  60. package/dist/src/attributes.js +0 -343
  61. package/dist/src/converter.d.ts +0 -53
  62. package/dist/src/converter.js +0 -79
  63. package/dist/src/converterFlags.d.ts +0 -87
  64. package/dist/src/converterFlags.js +0 -224
  65. package/dist/src/converterRule.d.ts +0 -77
  66. package/dist/src/converterRule.js +0 -208
  67. package/dist/src/extLink.d.ts +0 -55
  68. package/dist/src/extLink.js +0 -122
  69. package/dist/src/gallery.d.ts +0 -54
  70. package/dist/src/gallery.js +0 -121
  71. package/dist/src/heading.d.ts +0 -78
  72. package/dist/src/heading.js +0 -134
  73. package/dist/src/hidden.d.ts +0 -23
  74. package/dist/src/hidden.js +0 -23
  75. package/dist/src/html.d.ts +0 -106
  76. package/dist/src/html.js +0 -234
  77. package/dist/src/imageParameter.d.ts +0 -65
  78. package/dist/src/imageParameter.js +0 -247
  79. package/dist/src/imagemap.d.ts +0 -56
  80. package/dist/src/imagemap.js +0 -147
  81. package/dist/src/imagemapLink.d.ts +0 -61
  82. package/dist/src/imagemapLink.js +0 -40
  83. package/dist/src/index.d.ts +0 -140
  84. package/dist/src/index.js +0 -769
  85. package/dist/src/link/base.d.ts +0 -52
  86. package/dist/src/link/base.js +0 -209
  87. package/dist/src/link/category.d.ts +0 -13
  88. package/dist/src/link/category.js +0 -29
  89. package/dist/src/link/file.d.ts +0 -96
  90. package/dist/src/link/file.js +0 -256
  91. package/dist/src/link/galleryImage.d.ts +0 -45
  92. package/dist/src/link/galleryImage.js +0 -106
  93. package/dist/src/link/index.d.ts +0 -53
  94. package/dist/src/link/index.js +0 -124
  95. package/dist/src/magicLink.d.ts +0 -69
  96. package/dist/src/magicLink.js +0 -147
  97. package/dist/src/nested.d.ts +0 -43
  98. package/dist/src/nested.js +0 -86
  99. package/dist/src/nowiki/base.d.ts +0 -48
  100. package/dist/src/nowiki/base.js +0 -42
  101. package/dist/src/nowiki/comment.d.ts +0 -43
  102. package/dist/src/nowiki/comment.js +0 -74
  103. package/dist/src/nowiki/dd.d.ts +0 -8
  104. package/dist/src/nowiki/dd.js +0 -25
  105. package/dist/src/nowiki/doubleUnderscore.d.ts +0 -47
  106. package/dist/src/nowiki/doubleUnderscore.js +0 -50
  107. package/dist/src/nowiki/hr.d.ts +0 -33
  108. package/dist/src/nowiki/hr.js +0 -14
  109. package/dist/src/nowiki/index.d.ts +0 -16
  110. package/dist/src/nowiki/index.js +0 -21
  111. package/dist/src/nowiki/list.d.ts +0 -31
  112. package/dist/src/nowiki/list.js +0 -48
  113. package/dist/src/nowiki/listBase.d.ts +0 -20
  114. package/dist/src/nowiki/listBase.js +0 -12
  115. package/dist/src/nowiki/noinclude.d.ts +0 -26
  116. package/dist/src/nowiki/noinclude.js +0 -24
  117. package/dist/src/nowiki/quote.d.ts +0 -24
  118. package/dist/src/nowiki/quote.js +0 -45
  119. package/dist/src/onlyinclude.d.ts +0 -16
  120. package/dist/src/onlyinclude.js +0 -57
  121. package/dist/src/paramTag/index.d.ts +0 -37
  122. package/dist/src/paramTag/index.js +0 -68
  123. package/dist/src/paramTag/inputbox.d.ts +0 -8
  124. package/dist/src/paramTag/inputbox.js +0 -23
  125. package/dist/src/parameter.d.ts +0 -88
  126. package/dist/src/parameter.js +0 -214
  127. package/dist/src/pre.d.ts +0 -28
  128. package/dist/src/pre.js +0 -51
  129. package/dist/src/syntax.d.ts +0 -30
  130. package/dist/src/syntax.js +0 -34
  131. package/dist/src/table/base.d.ts +0 -59
  132. package/dist/src/table/base.js +0 -78
  133. package/dist/src/table/index.d.ts +0 -230
  134. package/dist/src/table/index.js +0 -386
  135. package/dist/src/table/td.d.ts +0 -109
  136. package/dist/src/table/td.js +0 -270
  137. package/dist/src/table/tr.d.ts +0 -32
  138. package/dist/src/table/tr.js +0 -56
  139. package/dist/src/table/trBase.d.ts +0 -53
  140. package/dist/src/table/trBase.js +0 -153
  141. package/dist/src/tagPair/ext.d.ts +0 -57
  142. package/dist/src/tagPair/ext.js +0 -134
  143. package/dist/src/tagPair/include.d.ts +0 -56
  144. package/dist/src/tagPair/include.js +0 -70
  145. package/dist/src/tagPair/index.d.ts +0 -45
  146. package/dist/src/tagPair/index.js +0 -76
  147. package/dist/src/transclude.d.ts +0 -167
  148. package/dist/src/transclude.js +0 -693
  149. package/dist/util/constants.js +0 -113
  150. package/dist/util/debug.js +0 -83
  151. package/dist/util/diff.js +0 -72
  152. package/dist/util/lint.js +0 -30
  153. package/dist/util/string.js +0 -51
  154. package/errors/README +0 -1
  155. 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,114 @@
1
+ .wikiparser {
2
+ white-space: pre-wrap;
3
+ overflow-wrap: break-word;
4
+ font-family: monospace;
5
+ }
6
+
7
+ .wpb-html-invalid, .wpb-image-invalid, .wpb-table-inter {
8
+ color: #f00;
9
+ font-weight: normal;
10
+ text-decoration: underline wavy 1px;
11
+ }
12
+
13
+ .wpb-hidden, .wpb-noinclude, .wpb-include, .wpb-comment, .wpb-attr-dirty {
14
+ color: #72777d;
15
+ font-weight: normal;
16
+ font-style: italic;
17
+ }
18
+
19
+ .wpb-ext, .wpb-html {
20
+ color: #14866d;
21
+ font-weight: bold;
22
+ }
23
+ .wpb-ext-attrs, .wpb-html-attrs {
24
+ font-weight: normal;
25
+ }
26
+ .wpb-ext-attr > .wpb-attr-value, .wpb-html-attr > .wpb-attr-value {
27
+ color: #179b1c;
28
+ }
29
+ .wpb-ext-inner {
30
+ color: initial;
31
+ font-weight: normal;
32
+ background-color: rgba(0, 0, 0, .03);
33
+ }
34
+
35
+ .wpb-arg {
36
+ color: #ac6600;
37
+ font-weight: bold;
38
+ }
39
+ .wpb-arg-default {
40
+ color: #ad9300;
41
+ font-weight: normal;
42
+ }
43
+
44
+ .wpb-template {
45
+ color: #80c;
46
+ font-weight: bold;
47
+ background-color: rgba(119, 0, 170, .03);
48
+ }
49
+ .wpb-magic-word {
50
+ color: #d33;
51
+ font-weight: bold;
52
+ background-color: rgba(170, 17, 17, .03);
53
+ }
54
+ .wpb-invoke-module, .wpb-invoke-function {
55
+ color: #dd5d33;
56
+ font-weight: normal;
57
+ }
58
+ .wpb-parameter {
59
+ color: initial;
60
+ font-weight: normal;
61
+ }
62
+ .wpb-template > .wpb-parameter > .wpb-parameter-key,
63
+ .wpb-invoke-function ~ .wpb-parameter > .wpb-parameter-key {
64
+ color: #b0c;
65
+ }
66
+
67
+ .wpb-heading, .wpb-image-parameter {
68
+ color: #0076dd;
69
+ }
70
+ .wpb-heading-title {
71
+ color: initial;
72
+ font-weight: bold;
73
+ }
74
+
75
+ .wpb-table, .wpb-tr, .wpb-td {
76
+ color: #d08;
77
+ font-weight: bold;
78
+ }
79
+ .wpb-table-attrs {
80
+ font-weight: normal;
81
+ }
82
+ .wpb-table-attr > .wpb-attr-value {
83
+ color: #f500d4;
84
+ }
85
+ .wpb-td-inner {
86
+ color: initial;
87
+ font-weight: normal;
88
+ }
89
+
90
+ .wpb-double-underscore, .wpb-hr, .wpb-quote, .wpb-list, .wpb-dd {
91
+ color: #0076dd;
92
+ font-weight: bold;
93
+ background-color: #eee;
94
+ }
95
+
96
+ .wpb-link, .wpb-category, .wpb-file, .wpb-gallery-image, .wpb-imagemap-image,
97
+ .wpb-ext-link, .wpb-free-ext-link {
98
+ color: #000aaa;
99
+ background-color: rgba(34, 17, 153, .03);
100
+ }
101
+ .wpb-link-text, .wpb-image-caption, .wpb-ext-link-text {
102
+ color: initial;
103
+ }
104
+
105
+ .wpb-converter {
106
+ color: #b68;
107
+ font-weight: bold;
108
+ }
109
+ .wpb-converter-rule {
110
+ font-weight: normal;
111
+ }
112
+ .wpb-converter-rule-from, .wpb-converter-rule-to, .wpb-converter-noconvert {
113
+ color: initial;
114
+ }
package/i18n/zh-hans.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "additional \"|\" in a table cell": "表格单元格中多余的\"|\"",
5
5
  "additional \"|\" in the link text": "链接文本中多余的\"|\"",
6
6
  "attributes of a closing tag": "位于闭合标签的属性",
7
+ "bold": "粗体单引号",
7
8
  "conflicting image $1 parameter": "冲突的图片$1参数",
8
9
  "containing invalid attribute": "包含无效属性",
9
10
  "content to be moved out from the table": "将被移出表格的内容",
@@ -19,6 +20,7 @@
19
20
  "illegal attribute name": "非法的属性名",
20
21
  "illegal module name": "非法的模块名称",
21
22
  "insecure style": "不安全的样式",
23
+ "internal link in an external link": "外链中的内链",
22
24
  "invalid content in <$1>": "<$1>内的无效内容",
23
25
  "invalid conversion flag": "无效的转换标记",
24
26
  "invalid gallery image": "无效的图库图片",
@@ -27,17 +29,20 @@
27
29
  "invalid parameter of $1": "$1的无效参数",
28
30
  "invalid self-closing tag": "无效自封闭标签",
29
31
  "invisible content inside triple brackets": "三重括号内的不可见部分",
32
+ "italic": "斜体单引号",
30
33
  "lonely \"$1\"": "孤立的\"$1\"",
31
34
  "missing module function": "缺少模块函数",
32
35
  "missing module name": "缺少模块名称",
33
36
  "nonzero tabindex": "不为0的tabindex",
34
37
  "nothing should be in <$1>": "<$1>标签内不应有任何内容",
38
+ "obsolete attribute": "过时的属性",
39
+ "obsolete HTML tag": "过时的HTML标签",
35
40
  "quotes": "引号",
36
41
  "section header in a HTML tag": "HTML标签属性中的段落标题",
37
42
  "table": "表格",
38
43
  "tag that is both closing and self-closing": "同时闭合和自封闭的标签",
39
44
  "template in an internal link target": "内链目标包含模板",
40
- "unbalanced \"=\" in a section header": "段落标题中不平衡的\"=\"",
45
+ "unbalanced $1 in a section header": "段落标题中不平衡的$1",
41
46
  "unclosed $1": "未闭合的$1",
42
47
  "unclosed tag": "未闭合的标签",
43
48
  "unescaped query string in an anonymous parameter": "匿名参数中未转义的查询参数",
package/i18n/zh-hant.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "additional \"|\" in a table cell": "表哥單元格中多餘的\"|\"",
5
5
  "additional \"|\" in the link text": "連結文本中多餘的\"|\"",
6
6
  "attributes of a closing tag": "位於閉合標籤的屬性",
7
+ "bold apostrophes": "粗體撇號",
7
8
  "conflicting image $1 parameter": "衝突的圖片$1參數",
8
9
  "containing invalid attribute": "包含無效屬性",
9
10
  "content to be moved out from the table": "將被移出表格的內容",
@@ -19,6 +20,7 @@
19
20
  "illegal attribute name": "非法的屬性名",
20
21
  "illegal module name": "非法的模組名稱",
21
22
  "insecure style": "不安全的樣式",
23
+ "internal link in an external link": "外部連結中的內部連結",
22
24
  "invalid content in <$1>": "<$1>內的無效內容",
23
25
  "invalid conversion flag": "無效的轉換標記",
24
26
  "invalid gallery image": "無效的圖庫圖片",
@@ -27,17 +29,20 @@
27
29
  "invalid parameter of $1": "$1的無效參數",
28
30
  "invalid self-closing tag": "無效自封閉標籤",
29
31
  "invisible content inside triple brackets": "三重括號內的不可見部分",
32
+ "italic apostrophes": "斜體撇號",
30
33
  "lonely \"$1\"": "孤立的\"$1\"",
31
34
  "missing module function": "缺少模組函式",
32
35
  "missing module name": "缺少模組名稱",
33
36
  "nonzero tabindex": "不為0的tabindex",
34
37
  "nothing should be in <$1>": "<$1>標籤內不應有任何內容",
38
+ "obsolete attribute": "過時的屬性",
39
+ "obsolete HTML tag": "過時的HTML標籤",
35
40
  "quotes": "引號",
36
41
  "section header in a HTML tag": "HTML標籤屬性中的段落標題",
37
42
  "table": "表格",
38
43
  "tag that is both closing and self-closing": "同時閉合和自封閉的標籤",
39
44
  "template in an internal link target": "內部連結目標包含模板",
40
- "unbalanced \"=\" in a section header": "段落標題中不平衡的\"=\"",
45
+ "unbalanced $1 in a section header": "段落標題中不平衡的$1",
41
46
  "unclosed $1": "未閉合的$1",
42
47
  "unclosed tag": "未閉合的標籤",
43
48
  "unescaped query string in an anonymous parameter": "匿名參數中未轉義的查詢參數",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.3.8",
3
+ "version": "1.3.9-b",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",
@@ -14,38 +14,53 @@
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/",
22
- "!/dist/[bt]*/"
24
+ "!/config/.schema.json"
23
25
  ],
24
- "main": "./dist/index.js",
26
+ "browser": "/bundle/bundle.min.js",
27
+ "main": "./bundle/bundle.js",
28
+ "types": "./extensions/typings.d.ts",
25
29
  "repository": {
26
30
  "type": "git",
27
31
  "url": "git+https://github.com/bhsd-harry/wikiparser-node.git"
28
32
  },
29
33
  "scripts": {
30
- "toc": "node ./dist/bin/toc.js",
31
- "prepublishOnly": "npm run build && rm dist/internal.js dist/base.js dist/[mpu]*/*.d.ts",
32
- "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": "tsc --project tsconfig.test.json",
40
+ "build": "npm run build:core && npm run build:ext",
33
41
  "diff": "git diff --ignore-all-space --color-moved",
34
- "lint:ts": "tsc --noEmit && eslint --cache .",
42
+ "lint:ts": "tsc --noEmit && tsc --noEmit --project extensions/tsconfig.json && eslint --cache .",
35
43
  "lint:json": "ajv -s config/.schema.json -d 'config/*.json' --strict=true --strict-required=false",
36
- "lint": "npm run lint:ts && npm run lint:json",
37
- "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 build:prod && npm run build:ext && npm run server",
48
+ "test:end": "pkill -x http-server",
38
49
  "test:real": "node dist/test/real.js",
39
- "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"
40
51
  },
41
52
  "devDependencies": {
53
+ "@bhsd/codemirror-mediawiki": "^2.0.14",
54
+ "@codemirror/lint": "^6.4.2",
42
55
  "@cypress/request": "^3.0.1",
43
56
  "@stylistic/eslint-plugin": "^1.5.3",
57
+ "@stylistic/stylelint-plugin": "^2.0.0",
44
58
  "@types/node": "^20.9.0",
45
59
  "@types/request": "^2.48.12",
46
60
  "@typescript-eslint/eslint-plugin": "^6.12.0",
47
61
  "@typescript-eslint/parser": "^6.12.0",
48
62
  "ajv-cli": "^5.0.0",
63
+ "esbuild": "^0.19.7",
49
64
  "eslint": "^8.56.0",
50
65
  "eslint-plugin-es-x": "^7.3.0",
51
66
  "eslint-plugin-eslint-comments": "^3.2.0",
@@ -55,6 +70,9 @@
55
70
  "eslint-plugin-promise": "^6.1.1",
56
71
  "eslint-plugin-regexp": "^2.1.1",
57
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",
58
76
  "typescript": "^5.1.6"
59
77
  },
60
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
- }