wikiparser-node 1.3.4 → 1.3.7-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.
- package/bundle/bundle.min.js +36 -0
- package/config/llwiki.json +1 -35
- package/config/moegirl.json +1 -44
- package/config/zhwiki.json +1 -466
- package/extensions/dist/base.js +68 -0
- package/extensions/dist/editor.js +159 -0
- package/extensions/dist/highlight.js +30 -0
- package/extensions/dist/lint.js +48 -0
- package/extensions/editor.css +63 -0
- package/extensions/ui.css +114 -0
- package/package.json +32 -12
- package/config/.schema.json +0 -172
- package/dist/addon/table.d.ts +0 -6
- package/dist/addon/table.js +0 -564
- package/dist/base.d.ts +0 -45
- package/dist/bin/toc.js +0 -18
- package/dist/index.d.ts +0 -31
- package/dist/index.js +0 -209
- package/dist/internal.d.ts +0 -44
- package/dist/lib/element.d.ts +0 -155
- package/dist/lib/element.js +0 -634
- package/dist/lib/node.d.ts +0 -146
- package/dist/lib/node.js +0 -419
- package/dist/lib/range.d.ts +0 -104
- package/dist/lib/range.js +0 -385
- package/dist/lib/ranges.d.ts +0 -26
- package/dist/lib/ranges.js +0 -117
- package/dist/lib/text.d.ts +0 -62
- package/dist/lib/text.js +0 -248
- package/dist/lib/title.d.ts +0 -38
- package/dist/lib/title.js +0 -162
- package/dist/mixin/attributesParent.js +0 -94
- package/dist/mixin/fixed.js +0 -32
- package/dist/mixin/flagsParent.js +0 -70
- package/dist/mixin/hidden.js +0 -26
- package/dist/mixin/magicLinkParent.js +0 -41
- package/dist/mixin/singleLine.js +0 -25
- package/dist/mixin/sol.js +0 -43
- package/dist/mixin/syntax.js +0 -56
- package/dist/parser/braces.js +0 -121
- package/dist/parser/commentAndExt.js +0 -69
- package/dist/parser/converter.js +0 -40
- package/dist/parser/externalLinks.js +0 -28
- package/dist/parser/hrAndDoubleUnderscore.js +0 -38
- package/dist/parser/html.js +0 -36
- package/dist/parser/links.js +0 -94
- package/dist/parser/list.js +0 -59
- package/dist/parser/magicLinks.js +0 -40
- package/dist/parser/quotes.js +0 -67
- package/dist/parser/selector.js +0 -162
- package/dist/parser/table.js +0 -112
- package/dist/src/arg.d.ts +0 -58
- package/dist/src/arg.js +0 -189
- package/dist/src/atom.d.ts +0 -12
- package/dist/src/atom.js +0 -27
- package/dist/src/attribute.d.ts +0 -87
- package/dist/src/attribute.js +0 -392
- package/dist/src/attributes.d.ts +0 -107
- package/dist/src/attributes.js +0 -341
- package/dist/src/converter.d.ts +0 -52
- package/dist/src/converter.js +0 -79
- package/dist/src/converterFlags.d.ts +0 -87
- package/dist/src/converterFlags.js +0 -224
- package/dist/src/converterRule.d.ts +0 -81
- package/dist/src/converterRule.js +0 -212
- package/dist/src/extLink.d.ts +0 -54
- package/dist/src/extLink.js +0 -122
- package/dist/src/gallery.d.ts +0 -55
- package/dist/src/gallery.js +0 -122
- package/dist/src/heading.d.ts +0 -74
- package/dist/src/heading.js +0 -127
- package/dist/src/hidden.d.ts +0 -22
- package/dist/src/hidden.js +0 -23
- package/dist/src/html.d.ts +0 -101
- package/dist/src/html.js +0 -227
- package/dist/src/imageParameter.d.ts +0 -66
- package/dist/src/imageParameter.js +0 -247
- package/dist/src/imagemap.d.ts +0 -57
- package/dist/src/imagemap.js +0 -148
- package/dist/src/imagemapLink.d.ts +0 -59
- package/dist/src/imagemapLink.js +0 -40
- package/dist/src/index.d.ts +0 -146
- package/dist/src/index.js +0 -777
- package/dist/src/link/base.d.ts +0 -52
- package/dist/src/link/base.js +0 -209
- package/dist/src/link/category.d.ts +0 -13
- package/dist/src/link/category.js +0 -29
- package/dist/src/link/file.d.ts +0 -96
- package/dist/src/link/file.js +0 -255
- package/dist/src/link/galleryImage.d.ts +0 -44
- package/dist/src/link/galleryImage.js +0 -106
- package/dist/src/link/index.d.ts +0 -53
- package/dist/src/link/index.js +0 -123
- package/dist/src/magicLink.d.ts +0 -70
- package/dist/src/magicLink.js +0 -147
- package/dist/src/nested.d.ts +0 -44
- package/dist/src/nested.js +0 -87
- package/dist/src/nowiki/base.d.ts +0 -47
- package/dist/src/nowiki/base.js +0 -42
- package/dist/src/nowiki/comment.d.ts +0 -40
- package/dist/src/nowiki/comment.js +0 -67
- package/dist/src/nowiki/dd.d.ts +0 -8
- package/dist/src/nowiki/dd.js +0 -25
- package/dist/src/nowiki/doubleUnderscore.d.ts +0 -45
- package/dist/src/nowiki/doubleUnderscore.js +0 -50
- package/dist/src/nowiki/hr.d.ts +0 -31
- package/dist/src/nowiki/hr.js +0 -14
- package/dist/src/nowiki/index.d.ts +0 -16
- package/dist/src/nowiki/index.js +0 -21
- package/dist/src/nowiki/list.d.ts +0 -30
- package/dist/src/nowiki/list.js +0 -48
- package/dist/src/nowiki/listBase.d.ts +0 -19
- package/dist/src/nowiki/listBase.js +0 -12
- package/dist/src/nowiki/noinclude.d.ts +0 -26
- package/dist/src/nowiki/noinclude.js +0 -25
- package/dist/src/nowiki/quote.d.ts +0 -23
- package/dist/src/nowiki/quote.js +0 -45
- package/dist/src/onlyinclude.d.ts +0 -16
- package/dist/src/onlyinclude.js +0 -57
- package/dist/src/paramTag/index.d.ts +0 -37
- package/dist/src/paramTag/index.js +0 -68
- package/dist/src/paramTag/inputbox.d.ts +0 -8
- package/dist/src/paramTag/inputbox.js +0 -23
- package/dist/src/parameter.d.ts +0 -85
- package/dist/src/parameter.js +0 -205
- package/dist/src/pre.d.ts +0 -28
- package/dist/src/pre.js +0 -51
- package/dist/src/syntax.d.ts +0 -28
- package/dist/src/syntax.js +0 -34
- package/dist/src/table/base.d.ts +0 -53
- package/dist/src/table/base.js +0 -78
- package/dist/src/table/index.d.ts +0 -229
- package/dist/src/table/index.js +0 -379
- package/dist/src/table/td.d.ts +0 -104
- package/dist/src/table/td.js +0 -261
- package/dist/src/table/tr.d.ts +0 -32
- package/dist/src/table/tr.js +0 -56
- package/dist/src/table/trBase.d.ts +0 -54
- package/dist/src/table/trBase.js +0 -159
- package/dist/src/tagPair/ext.d.ts +0 -56
- package/dist/src/tagPair/ext.js +0 -142
- package/dist/src/tagPair/include.d.ts +0 -53
- package/dist/src/tagPair/include.js +0 -63
- package/dist/src/tagPair/index.d.ts +0 -48
- package/dist/src/tagPair/index.js +0 -93
- package/dist/src/transclude.d.ts +0 -167
- package/dist/src/transclude.js +0 -698
- package/dist/util/constants.js +0 -108
- package/dist/util/debug.js +0 -64
- package/dist/util/diff.js +0 -72
- package/dist/util/lint.js +0 -46
- package/dist/util/string.js +0 -61
- package/errors/README +0 -1
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikiparser-node",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7-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
|
-
"/
|
|
18
|
-
"/
|
|
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
|
-
"
|
|
24
|
+
"!/config/.schema.json"
|
|
22
25
|
],
|
|
23
|
-
"
|
|
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
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"build": "
|
|
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",
|
|
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": "
|
|
36
|
-
"
|
|
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",
|
|
37
49
|
"test:real": "node dist/test/real.js",
|
|
38
|
-
"test:single": "node dist/test/single.js
|
|
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": {
|
package/config/.schema.json
DELETED
|
@@ -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
|
-
}
|