comment-parser 1.4.1 → 1.4.3
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/CHANGELOG.md +56 -2
- package/browser/index.js +31 -10
- package/es6/parser/tokenizers/name.js +11 -3
- package/es6/parser/tokenizers/tag.js +3 -0
- package/es6/parser/tokenizers/type.d.ts +1 -1
- package/es6/parser/tokenizers/type.js +15 -3
- package/es6/primitives.js +1 -1
- package/jest.config.cjs +5 -7
- package/lib/index.cjs +2 -22
- package/lib/index.cjs.map +1 -1
- package/lib/parser/block-parser.cjs +1 -9
- package/lib/parser/block-parser.cjs.map +1 -1
- package/lib/parser/index.cjs +1 -14
- package/lib/parser/index.cjs.map +1 -1
- package/lib/parser/source-parser.cjs +1 -13
- package/lib/parser/source-parser.cjs.map +1 -1
- package/lib/parser/spec-parser.cjs +1 -7
- package/lib/parser/spec-parser.cjs.map +1 -1
- package/lib/parser/tokenizers/description.cjs +8 -19
- package/lib/parser/tokenizers/description.cjs.map +1 -1
- package/lib/parser/tokenizers/index.cjs.map +1 -1
- package/lib/parser/tokenizers/name.cjs +20 -26
- package/lib/parser/tokenizers/name.cjs.map +1 -1
- package/lib/parser/tokenizers/tag.cjs +4 -5
- package/lib/parser/tokenizers/tag.cjs.map +1 -1
- package/lib/parser/tokenizers/type.cjs +16 -20
- package/lib/parser/tokenizers/type.cjs.map +1 -1
- package/lib/parser/tokenizers/type.d.ts +1 -1
- package/lib/primitives.cjs +1 -3
- package/lib/primitives.cjs.map +1 -1
- package/lib/stringifier/index.cjs +1 -4
- package/lib/stringifier/index.cjs.map +1 -1
- package/lib/stringifier/inspect.cjs +1 -17
- package/lib/stringifier/inspect.cjs.map +1 -1
- package/lib/transforms/align.cjs +6 -29
- package/lib/transforms/align.cjs.map +1 -1
- package/lib/transforms/crlf.cjs +4 -13
- package/lib/transforms/crlf.cjs.map +1 -1
- package/lib/transforms/indent.cjs +4 -17
- package/lib/transforms/indent.cjs.map +1 -1
- package/lib/transforms/index.cjs +1 -4
- package/lib/transforms/index.cjs.map +1 -1
- package/lib/util.cjs +10 -33
- package/lib/util.cjs.map +1 -1
- package/package.json +17 -11
- package/src/parser/tokenizers/name.ts +13 -3
- package/src/parser/tokenizers/tag.ts +4 -0
- package/src/parser/tokenizers/type.ts +16 -3
- package/tests/unit/parser.spec.ts +234 -0
- package/tests/unit/spec-tag-tokenizer.spec.ts +30 -0
- package/tsconfig.node.json +0 -1
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
6
|
+
exports.default = inspect;
|
|
7
7
|
const util_js_1 = require("../util.cjs");
|
|
8
|
-
|
|
9
8
|
const zeroWidth = {
|
|
10
9
|
line: 0,
|
|
11
10
|
start: 0,
|
|
@@ -25,38 +24,26 @@ const headers = {
|
|
|
25
24
|
lineEnd: 'CR'
|
|
26
25
|
};
|
|
27
26
|
const fields = Object.keys(zeroWidth);
|
|
28
|
-
|
|
29
27
|
const repr = x => (0, util_js_1.isSpace)(x) ? `{${x.length}}` : x;
|
|
30
|
-
|
|
31
28
|
const frame = line => '|' + line.join('|') + '|';
|
|
32
|
-
|
|
33
29
|
const align = (width, tokens) => Object.keys(tokens).map(k => repr(tokens[k]).padEnd(width[k]));
|
|
34
|
-
|
|
35
30
|
function inspect({
|
|
36
31
|
source
|
|
37
32
|
}) {
|
|
38
33
|
var _a, _b;
|
|
39
|
-
|
|
40
34
|
if (source.length === 0) return '';
|
|
41
35
|
const width = Object.assign({}, zeroWidth);
|
|
42
|
-
|
|
43
36
|
for (const f of fields) width[f] = ((_a = headers[f]) !== null && _a !== void 0 ? _a : f).length;
|
|
44
|
-
|
|
45
37
|
for (const {
|
|
46
38
|
number,
|
|
47
39
|
tokens
|
|
48
40
|
} of source) {
|
|
49
41
|
width.line = Math.max(width.line, number.toString().length);
|
|
50
|
-
|
|
51
42
|
for (const k in tokens) width[k] = Math.max(width[k], repr(tokens[k]).length);
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
const lines = [[], []];
|
|
55
|
-
|
|
56
45
|
for (const f of fields) lines[0].push(((_b = headers[f]) !== null && _b !== void 0 ? _b : f).padEnd(width[f]));
|
|
57
|
-
|
|
58
46
|
for (const f of fields) lines[1].push('-'.padEnd(width[f], '-'));
|
|
59
|
-
|
|
60
47
|
for (const {
|
|
61
48
|
number,
|
|
62
49
|
tokens
|
|
@@ -64,9 +51,6 @@ function inspect({
|
|
|
64
51
|
const line = number.toString().padStart(width.line);
|
|
65
52
|
lines.push([line, ...align(width, tokens)]);
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
return lines.map(frame).join('\n');
|
|
69
55
|
}
|
|
70
|
-
|
|
71
|
-
exports.default = inspect;
|
|
72
56
|
//# sourceMappingURL=inspect.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"inspect.cjs","names":["Object","defineProperty","exports","value","default","inspect","util_js_1","require","zeroWidth","line","start","delimiter","postDelimiter","tag","postTag","name","postName","type","postType","description","end","lineEnd","headers","fields","keys","repr","x","isSpace","length","frame","join","align","width","tokens","map","k","padEnd","source","_a","_b","assign","f","number","Math","max","toString","lines","push","padStart"],"sources":["inspect.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = inspect;\nconst util_js_1 = require(\"../util.js\");\nconst zeroWidth = {\n line: 0,\n start: 0,\n delimiter: 0,\n postDelimiter: 0,\n tag: 0,\n postTag: 0,\n name: 0,\n postName: 0,\n type: 0,\n postType: 0,\n description: 0,\n end: 0,\n lineEnd: 0,\n};\nconst headers = { lineEnd: 'CR' };\nconst fields = Object.keys(zeroWidth);\nconst repr = (x) => ((0, util_js_1.isSpace)(x) ? `{${x.length}}` : x);\nconst frame = (line) => '|' + line.join('|') + '|';\nconst align = (width, tokens) => Object.keys(tokens).map((k) => repr(tokens[k]).padEnd(width[k]));\nfunction inspect({ source }) {\n var _a, _b;\n if (source.length === 0)\n return '';\n const width = Object.assign({}, zeroWidth);\n for (const f of fields)\n width[f] = ((_a = headers[f]) !== null && _a !== void 0 ? _a : f).length;\n for (const { number, tokens } of source) {\n width.line = Math.max(width.line, number.toString().length);\n for (const k in tokens)\n width[k] = Math.max(width[k], repr(tokens[k]).length);\n }\n const lines = [[], []];\n for (const f of fields)\n lines[0].push(((_b = headers[f]) !== null && _b !== void 0 ? _b : f).padEnd(width[f]));\n for (const f of fields)\n lines[1].push('-'.padEnd(width[f], '-'));\n for (const { number, tokens } of source) {\n const line = number.toString().padStart(width.line);\n lines.push([line, ...align(width, tokens)]);\n }\n return lines.map(frame).join('\\n');\n}\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,OAAO,GAAGC,OAAO;AACzB,MAAMC,SAAS,GAAGC,OAAO,eAAc;AACvC,MAAMC,SAAS,GAAG;EACdC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,SAAS,EAAE,CAAC;EACZC,aAAa,EAAE,CAAC;EAChBC,GAAG,EAAE,CAAC;EACNC,OAAO,EAAE,CAAC;EACVC,IAAI,EAAE,CAAC;EACPC,QAAQ,EAAE,CAAC;EACXC,IAAI,EAAE,CAAC;EACPC,QAAQ,EAAE,CAAC;EACXC,WAAW,EAAE,CAAC;EACdC,GAAG,EAAE,CAAC;EACNC,OAAO,EAAE;AACb,CAAC;AACD,MAAMC,OAAO,GAAG;EAAED,OAAO,EAAE;AAAK,CAAC;AACjC,MAAME,MAAM,GAAGvB,MAAM,CAACwB,IAAI,CAAChB,SAAS,CAAC;AACrC,MAAMiB,IAAI,GAAIC,CAAC,IAAM,CAAC,CAAC,EAAEpB,SAAS,CAACqB,OAAO,EAAED,CAAC,CAAC,GAAG,IAAIA,CA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kB,KAAK,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC;EACtB,KAAK,MAAML,CAAC,IAAIlB,MAAM,EAClBuB,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACR,EAAE,GAAGjB,OAAO,CAACmB,CAAC,CAAC,MAAM,IAAI,IAAIF,EAAE,KAAK,KAAK,CAAC,GAAGA,EAAE,GAAGE,CAAC,EAAEL,MAAM,CAACJ,KAAK,CAACS,CAAC,CAAC,CAAC,CAAC;EAC1F,KAAK,MAAMA,CAAC,IAAIlB,MAAM,EAClBuB,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAACX,MAAM,CAACJ,KAAK,CAACS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;EAC5C,KAAK,MAAM;IAAEC,MAAM;IAAET;EAAO,CAAC,IAAII,MAAM,EAAE;IACrC,MAAM5B,IAAI,GAAGiC,MAAM,CAACG,QAAQ,CAAC,CAAC,CAACG,QAAQ,CAAChB,KAAK,CAACvB,IAAI,CAAC;IACnDqC,KAAK,CAACC,IAAI,CAAC,CAACtC,IAAI,EAAE,GAAGsB,KAAK,CAACC,KAAK,EAAEC,MAAM,CAAC,CAAC,CAAC;EAC/C;EACA,OAAOa,KAAK,CAACZ,GAAG,CAACL,KAAK,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACtC","ignoreList":[]}
|
package/lib/transforms/align.cjs
CHANGED
|
@@ -2,30 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
4
4
|
var t = {};
|
|
5
|
-
|
|
6
5
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
7
|
-
|
|
8
6
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
7
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
8
|
}
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
Object.defineProperty(exports, "__esModule", {
|
|
15
12
|
value: true
|
|
16
13
|
});
|
|
17
|
-
|
|
14
|
+
exports.default = align;
|
|
18
15
|
const primitives_js_1 = require("../primitives.cjs");
|
|
19
|
-
|
|
20
16
|
const util_js_1 = require("../util.cjs");
|
|
21
|
-
|
|
22
17
|
const zeroWidth = {
|
|
23
18
|
start: 0,
|
|
24
19
|
tag: 0,
|
|
25
20
|
type: 0,
|
|
26
21
|
name: 0
|
|
27
22
|
};
|
|
28
|
-
|
|
29
23
|
const getWidth = (markers = primitives_js_1.Markers) => (w, {
|
|
30
24
|
tokens: t
|
|
31
25
|
}) => ({
|
|
@@ -34,73 +28,60 @@ const getWidth = (markers = primitives_js_1.Markers) => (w, {
|
|
|
34
28
|
type: Math.max(w.type, t.type.length),
|
|
35
29
|
name: Math.max(w.name, t.name.length)
|
|
36
30
|
});
|
|
37
|
-
|
|
38
31
|
const space = len => ''.padStart(len, ' ');
|
|
39
|
-
|
|
40
32
|
function align(markers = primitives_js_1.Markers) {
|
|
41
33
|
let intoTags = false;
|
|
42
34
|
let w;
|
|
43
|
-
|
|
44
35
|
function update(line) {
|
|
45
36
|
const tokens = Object.assign({}, line.tokens);
|
|
46
37
|
if (tokens.tag !== '') intoTags = true;
|
|
47
|
-
const isEmpty = tokens.tag === '' && tokens.name === '' && tokens.type === '' && tokens.description === '';
|
|
48
|
-
|
|
38
|
+
const isEmpty = tokens.tag === '' && tokens.name === '' && tokens.type === '' && tokens.description === '';
|
|
39
|
+
// dangling '*/'
|
|
49
40
|
if (tokens.end === markers.end && isEmpty) {
|
|
50
41
|
tokens.start = space(w.start + 1);
|
|
51
42
|
return Object.assign(Object.assign({}, line), {
|
|
52
43
|
tokens
|
|
53
44
|
});
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
switch (tokens.delimiter) {
|
|
57
47
|
case markers.start:
|
|
58
48
|
tokens.start = space(w.start);
|
|
59
49
|
break;
|
|
60
|
-
|
|
61
50
|
case markers.delim:
|
|
62
51
|
tokens.start = space(w.start + 1);
|
|
63
52
|
break;
|
|
64
|
-
|
|
65
53
|
default:
|
|
66
54
|
tokens.delimiter = '';
|
|
67
55
|
tokens.start = space(w.start + 2);
|
|
68
56
|
// compensate delimiter
|
|
69
57
|
}
|
|
70
|
-
|
|
71
58
|
if (!intoTags) {
|
|
72
59
|
tokens.postDelimiter = tokens.description === '' ? '' : ' ';
|
|
73
60
|
return Object.assign(Object.assign({}, line), {
|
|
74
61
|
tokens
|
|
75
62
|
});
|
|
76
63
|
}
|
|
77
|
-
|
|
78
64
|
const nothingAfter = {
|
|
79
65
|
delim: false,
|
|
80
66
|
tag: false,
|
|
81
67
|
type: false,
|
|
82
68
|
name: false
|
|
83
69
|
};
|
|
84
|
-
|
|
85
70
|
if (tokens.description === '') {
|
|
86
71
|
nothingAfter.name = true;
|
|
87
72
|
tokens.postName = '';
|
|
88
|
-
|
|
89
73
|
if (tokens.name === '') {
|
|
90
74
|
nothingAfter.type = true;
|
|
91
75
|
tokens.postType = '';
|
|
92
|
-
|
|
93
76
|
if (tokens.type === '') {
|
|
94
77
|
nothingAfter.tag = true;
|
|
95
78
|
tokens.postTag = '';
|
|
96
|
-
|
|
97
79
|
if (tokens.tag === '') {
|
|
98
80
|
nothingAfter.delim = true;
|
|
99
81
|
}
|
|
100
82
|
}
|
|
101
83
|
}
|
|
102
84
|
}
|
|
103
|
-
|
|
104
85
|
tokens.postDelimiter = nothingAfter.delim ? '' : ' ';
|
|
105
86
|
if (!nothingAfter.tag) tokens.postTag = space(w.tag - tokens.tag.length + 1);
|
|
106
87
|
if (!nothingAfter.type) tokens.postType = space(w.type - tokens.type.length + 1);
|
|
@@ -109,19 +90,15 @@ function align(markers = primitives_js_1.Markers) {
|
|
|
109
90
|
tokens
|
|
110
91
|
});
|
|
111
92
|
}
|
|
112
|
-
|
|
113
93
|
return _a => {
|
|
114
94
|
var {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
95
|
+
source
|
|
96
|
+
} = _a,
|
|
97
|
+
fields = __rest(_a, ["source"]);
|
|
119
98
|
w = source.reduce(getWidth(markers), Object.assign({}, zeroWidth));
|
|
120
99
|
return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), {
|
|
121
100
|
source: source.map(update)
|
|
122
101
|
}));
|
|
123
102
|
};
|
|
124
103
|
}
|
|
125
|
-
|
|
126
|
-
exports.default = align;
|
|
127
104
|
//# sourceMappingURL=align.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"align.cjs","names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","defineProperty","exports","value","default","align","primitives_js_1","require","util_js_1","zeroWidth","start","tag","type","name","getWidth","markers","Markers","w","tokens","delimiter","Math","max","space","len","padStart","intoTags","update","line","assign","isEmpty","description","end","delim","postDelimiter","nothingAfter","postName","postType","postTag","_a","source","fields","reduce","rewireSource","map"],"sources":["align.js"],"sourcesContent":["\"use strict\";\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = align;\nconst primitives_js_1 = require(\"../primitives.js\");\nconst util_js_1 = require(\"../util.js\");\nconst zeroWidth = {\n start: 0,\n tag: 0,\n type: 0,\n name: 0,\n};\nconst getWidth = (markers = primitives_js_1.Markers) => (w, { tokens: t }) => ({\n start: t.delimiter === markers.start ? t.start.length : w.start,\n tag: Math.max(w.tag, t.tag.length),\n type: Math.max(w.type, t.type.length),\n name: Math.max(w.name, t.name.length),\n});\nconst space = (len) => ''.padStart(len, ' ');\nfunction align(markers = primitives_js_1.Markers) {\n let intoTags = false;\n let w;\n function update(line) {\n const tokens = Object.assign({}, line.tokens);\n if (tokens.tag !== '')\n intoTags = true;\n const isEmpty = tokens.tag === '' &&\n tokens.name === '' &&\n tokens.type === '' &&\n tokens.description === '';\n // dangling '*/'\n if (tokens.end === markers.end && isEmpty) {\n tokens.start = space(w.start + 1);\n return Object.assign(Object.assign({}, line), { tokens });\n }\n switch (tokens.delimiter) {\n case markers.start:\n tokens.start = space(w.start);\n break;\n case markers.delim:\n tokens.start = space(w.start + 1);\n break;\n default:\n tokens.delimiter = '';\n tokens.start = space(w.start + 2); // compensate delimiter\n }\n if (!intoTags) {\n tokens.postDelimiter = tokens.description === '' ? '' : ' ';\n return Object.assign(Object.assign({}, line), { tokens });\n }\n const nothingAfter = {\n delim: false,\n tag: false,\n type: false,\n name: false,\n };\n if (tokens.description === '') {\n nothingAfter.name = true;\n tokens.postName = '';\n if (tokens.name === '') {\n nothingAfter.type = true;\n tokens.postType = '';\n if (tokens.type === '') {\n nothingAfter.tag = true;\n tokens.postTag = '';\n if (tokens.tag === '') {\n nothingAfter.delim = true;\n }\n }\n }\n }\n tokens.postDelimiter = nothingAfter.delim ? '' : ' ';\n if (!nothingAfter.tag)\n tokens.postTag = space(w.tag - tokens.tag.length + 1);\n if (!nothingAfter.type)\n tokens.postType = space(w.type - tokens.type.length + 1);\n if (!nothingAfter.name)\n tokens.postName = space(w.name - tokens.name.length + 1);\n return Object.assign(Object.assign({}, line), { tokens });\n }\n return (_a) => {\n var { source } = _a, fields = __rest(_a, [\"source\"]);\n w = source.reduce(getWidth(markers), Object.assign({}, zeroWidth));\n return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), { source: source.map(update) }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QAAQ,CAACC,OAAO,CAAC,EAAEvB,MAAM,CAACoC,MAAM,CAAC,CAAC,CAAC,EAAEnB,SAAS,CAAC,CAAC;IAClE,OAAO,CAAC,CAAC,EAAED,SAAS,CAACkC,YAAY,EAAElD,MAAM,CAACoC,MAAM,CAACpC,MAAM,CAACoC,MAAM,CAAC,CAAC,CAAC,EAAEY,MAAM,CAAC,EAAE;MAAED,MAAM,EAAEA,MAAM,CAACI,GAAG,CAACjB,MAAM;IAAE,CAAC,CAAC,CAAC;EAChH,CAAC;AACL","ignoreList":[]}
|
package/lib/transforms/crlf.cjs
CHANGED
|
@@ -2,23 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
4
4
|
var t = {};
|
|
5
|
-
|
|
6
5
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
7
|
-
|
|
8
6
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
7
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
8
|
}
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
Object.defineProperty(exports, "__esModule", {
|
|
15
12
|
value: true
|
|
16
13
|
});
|
|
17
|
-
|
|
14
|
+
exports.default = crlf;
|
|
18
15
|
const util_js_1 = require("../util.cjs");
|
|
19
|
-
|
|
20
16
|
const order = ['end', 'description', 'postType', 'type', 'postName', 'name', 'postTag', 'tag', 'postDelimiter', 'delimiter', 'start'];
|
|
21
|
-
|
|
22
17
|
function crlf(ending) {
|
|
23
18
|
function update(line) {
|
|
24
19
|
return Object.assign(Object.assign({}, line), {
|
|
@@ -27,18 +22,14 @@ function crlf(ending) {
|
|
|
27
22
|
})
|
|
28
23
|
});
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
return _a => {
|
|
32
26
|
var {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
source
|
|
28
|
+
} = _a,
|
|
29
|
+
fields = __rest(_a, ["source"]);
|
|
37
30
|
return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), {
|
|
38
31
|
source: source.map(update)
|
|
39
32
|
}));
|
|
40
33
|
};
|
|
41
34
|
}
|
|
42
|
-
|
|
43
|
-
exports.default = crlf;
|
|
44
35
|
//# sourceMappingURL=crlf.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"crlf.cjs","names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","defineProperty","exports","value","default","crlf","util_js_1","require","order","ending","update","line","assign","tokens","lineEnd","_a","source","fields","rewireSource","map"],"sources":["crlf.js"],"sourcesContent":["\"use strict\";\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = crlf;\nconst util_js_1 = require(\"../util.js\");\nconst order = [\n 'end',\n 'description',\n 'postType',\n 'type',\n 'postName',\n 'name',\n 'postTag',\n 'tag',\n 'postDelimiter',\n 'delimiter',\n 'start',\n];\nfunction crlf(ending) {\n function update(line) {\n return Object.assign(Object.assign({}, line), { tokens: Object.assign(Object.assign({}, line.tokens), { lineEnd: ending === 'LF' ? '' : '\\r' }) });\n }\n return (_a) => {\n var { source } = _a, fields = __rest(_a, [\"source\"]);\n return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), { source: source.map(update) }));\n };\n}\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,MAAM,GAAI,IAAI,IAAI,IAAI,CAACA,MAAM,IAAK,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAC/ED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EACf,IAAIH,CAAC,IAAI,IAAI,IAAI,OAAOI,MAAM,CAACK,qBAAqB,KAAK,UAAU,EAC/D,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEP,CAAC,GAAGC,MAAM,CAACK,qBAAqB,CAACT,CAAC,CAAC,EAAEU,CAAC,GAAGP,CAAC,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IACpE,IAAIT,CAAC,CAACO,OAAO,CAACL,CAAC,CAACO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAIN,MAAM,CAACC,SAAS,CAACO,oBAAoB,CAACL,IAAI,CAACP,CAAC,EAAEG,CAAC,CAACO,CAAC,CAAC,CAAC,EAC1ER,CAAC,CAACC,CAAC,CAACO,CAAC,CAAC,CAAC,GAAGV,CAAC,CAACG,CAAC,CAACO,CAAC,CAAC,CAAC;EACzB;EACJ,OAAOR,CAAC;AACZ,CAAC;AACDE,MAAM,CAACS,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,OAAO,GAAGC,IAAI;AACtB,MAAMC,SAAS,GAAGC,OAAO,eAAc;AACvC,MAAMC,KAAK,GAAG,CACV,KAAK,EACL,aAAa,EACb,UAAU,EACV,MAAM,EACN,UAAU,EACV,MAAM,EACN,SAAS,EACT,KAAK,EACL,eAAe,EACf,WAAW,EACX,OAAO,CACV;AACD,SAASH,IAAIA,CAACI,MAAM,EAAE;EAClB,SAASC,MAAMA,CAACC,IAAI,EAAE;IAClB,OAAOnB,MAAM,CAACoB,MAAM,CAACpB,MAAM,CAACoB,MAAM,CAAC,CAAC,CAAC,EAAED,IAAI,CAAC,EAAE;MAAEE,MAAM,EAAErB,MAAM,CAACoB,MAAM,CAACpB,MAAM,CAACoB,MAAM,CAAC,CAAC,CAAC,EAAED,IAAI,CAACE,MAAM,CAAC,EAAE;QAAEC,OAAO,EAAEL,MAAM,KAAK,IAAI,GAAG,EAAE,GAAG;MAAK,CAAC;IAAE,CAAC,CAAC;EACtJ;EACA,OAAQM,EAAE,IAAK;IACX,IAAI;QAAEC;MAAO,CAAC,GAAGD,EAAE;MAAEE,MAAM,GAAG9B,MAAM,CAAC4B,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC,EAAET,SAAS,CAACY,YAAY,EAAE1B,MAAM,CAACoB,MAAM,CAACpB,MAAM,CAACoB,MAAM,CAAC,CAAC,CAAC,EAAEK,MAAM,CAAC,EAAE;MAAED,MAAM,EAAEA,MAAM,CAACG,GAAG,CAACT,MAAM;IAAE,CAAC,CAAC,CAAC;EAChH,CAAC;AACL","ignoreList":[]}
|
|
@@ -2,57 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
4
4
|
var t = {};
|
|
5
|
-
|
|
6
5
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
7
|
-
|
|
8
6
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
7
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
8
|
}
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
Object.defineProperty(exports, "__esModule", {
|
|
15
12
|
value: true
|
|
16
13
|
});
|
|
17
|
-
|
|
14
|
+
exports.default = indent;
|
|
18
15
|
const util_js_1 = require("../util.cjs");
|
|
19
|
-
|
|
20
16
|
const pull = offset => str => str.slice(offset);
|
|
21
|
-
|
|
22
17
|
const push = offset => {
|
|
23
18
|
const space = ''.padStart(offset, ' ');
|
|
24
19
|
return str => str + space;
|
|
25
20
|
};
|
|
26
|
-
|
|
27
21
|
function indent(pos) {
|
|
28
22
|
let shift;
|
|
29
|
-
|
|
30
23
|
const pad = start => {
|
|
31
24
|
if (shift === undefined) {
|
|
32
25
|
const offset = pos - start.length;
|
|
33
26
|
shift = offset > 0 ? push(offset) : pull(-offset);
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
return shift(start);
|
|
37
29
|
};
|
|
38
|
-
|
|
39
30
|
const update = line => Object.assign(Object.assign({}, line), {
|
|
40
31
|
tokens: Object.assign(Object.assign({}, line.tokens), {
|
|
41
32
|
start: pad(line.tokens.start)
|
|
42
33
|
})
|
|
43
34
|
});
|
|
44
|
-
|
|
45
35
|
return _a => {
|
|
46
36
|
var {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
source
|
|
38
|
+
} = _a,
|
|
39
|
+
fields = __rest(_a, ["source"]);
|
|
51
40
|
return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), {
|
|
52
41
|
source: source.map(update)
|
|
53
42
|
}));
|
|
54
43
|
};
|
|
55
44
|
}
|
|
56
|
-
|
|
57
|
-
exports.default = indent;
|
|
58
45
|
//# sourceMappingURL=indent.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"indent.cjs","names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","defineProperty","exports","value","default","indent","util_js_1","require","pull","offset","str","slice","push","space","padStart","pos","shift","pad","start","undefined","update","line","assign","tokens","_a","source","fields","rewireSource","map"],"sources":["indent.js"],"sourcesContent":["\"use strict\";\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = indent;\nconst util_js_1 = require(\"../util.js\");\nconst pull = (offset) => (str) => str.slice(offset);\nconst push = (offset) => {\n const space = ''.padStart(offset, ' ');\n return (str) => str + space;\n};\nfunction indent(pos) {\n let shift;\n const pad = (start) => {\n if (shift === undefined) {\n const offset = pos - start.length;\n shift = offset > 0 ? push(offset) : pull(-offset);\n }\n return shift(start);\n };\n const update = (line) => (Object.assign(Object.assign({}, line), { tokens: Object.assign(Object.assign({}, line.tokens), { start: pad(line.tokens.start) }) }));\n return (_a) => {\n var { source } = _a, fields = __rest(_a, [\"source\"]);\n return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), { source: source.map(update) }));\n };\n}\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,MAAM,GAAI,IAAI,IAAI,IAAI,CAACA,MAAM,IAAK,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAA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G,KAAK,CAACnB,MAAM;MACjCiB,KAAK,GAAGP,MAAM,GAAG,CAAC,GAAGG,IAAI,CAACH,MAAM,CAAC,GAAGD,IAAI,CAAC,CAACC,MAAM,CAAC;IACrD;IACA,OAAOO,KAAK,CAACE,KAAK,CAAC;EACvB,CAAC;EACD,MAAME,MAAM,GAAIC,IAAI,IAAM7B,MAAM,CAAC8B,MAAM,CAAC9B,MAAM,CAAC8B,MAAM,CAAC,CAAC,CAAC,EAAED,IAAI,CAAC,EAAE;IAAEE,MAAM,EAAE/B,MAAM,CAAC8B,MAAM,CAAC9B,MAAM,CAAC8B,MAAM,CAAC,CAAC,CAAC,EAAED,IAAI,CAACE,MAAM,CAAC,EAAE;MAAEL,KAAK,EAAED,GAAG,CAACI,IAAI,CAACE,MAAM,CAACL,KAAK;IAAE,CAAC;EAAE,CAAC,CAAE;EAC/J,OAAQM,EAAE,IAAK;IACX,IAAI;QAAEC;MAAO,CAAC,GAAGD,EAAE;MAAEE,MAAM,GAAGvC,MAAM,CAACqC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC,EAAElB,SAAS,CAACqB,YAAY,EAAEnC,MAAM,CAAC8B,MAAM,CAAC9B,MAAM,CAAC8B,MAAM,CAAC,CAAC,CAAC,EAAEI,MAAM,CAAC,EAAE;MAAED,MAAM,EAAEA,MAAM,CAACG,GAAG,CAACR,MAAM;IAAE,CAAC,CAAC,CAAC;EAChH,CAAC;AACL","ignoreList":[]}
|
package/lib/transforms/index.cjs
CHANGED
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.flow =
|
|
7
|
-
|
|
6
|
+
exports.flow = flow;
|
|
8
7
|
function flow(...transforms) {
|
|
9
8
|
return block => transforms.reduce((block, t) => t(block), block);
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
exports.flow = flow;
|
|
13
10
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Object","defineProperty","exports","value","flow","transforms","block","reduce","t"],"sources":["index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.flow = flow;\nfunction flow(...transforms) {\n return (block) => transforms.reduce((block, t) => t(block), block);\n}\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,IAAI,GAAGA,IAAI;AACnB,SAASA,IAAIA,CAAC,GAAGC,UAAU,EAAE;EACzB,OAAQC,KAAK,IAAKD,UAAU,CAACE,MAAM,CAAC,CAACD,KAAK,EAAEE,CAAC,KAAKA,CAAC,CAACF,KAAK,CAAC,EAAEA,KAAK,CAAC;AACtE","ignoreList":[]}
|
package/lib/util.cjs
CHANGED
|
@@ -3,40 +3,33 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.isSpace = isSpace;
|
|
7
|
+
exports.hasCR = hasCR;
|
|
8
|
+
exports.splitCR = splitCR;
|
|
9
|
+
exports.splitSpace = splitSpace;
|
|
10
|
+
exports.splitLines = splitLines;
|
|
11
|
+
exports.seedBlock = seedBlock;
|
|
12
|
+
exports.seedSpec = seedSpec;
|
|
13
|
+
exports.seedTokens = seedTokens;
|
|
14
|
+
exports.rewireSource = rewireSource;
|
|
15
|
+
exports.rewireSpecs = rewireSpecs;
|
|
8
16
|
function isSpace(source) {
|
|
9
17
|
return /^\s+$/.test(source);
|
|
10
18
|
}
|
|
11
|
-
|
|
12
|
-
exports.isSpace = isSpace;
|
|
13
|
-
|
|
14
19
|
function hasCR(source) {
|
|
15
20
|
return /\r$/.test(source);
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
exports.hasCR = hasCR;
|
|
19
|
-
|
|
20
22
|
function splitCR(source) {
|
|
21
23
|
const matches = source.match(/\r+$/);
|
|
22
24
|
return matches == null ? ['', source] : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
exports.splitCR = splitCR;
|
|
26
|
-
|
|
27
26
|
function splitSpace(source) {
|
|
28
27
|
const matches = source.match(/^\s+/);
|
|
29
28
|
return matches == null ? ['', source] : [source.slice(0, matches[0].length), source.slice(matches[0].length)];
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
exports.splitSpace = splitSpace;
|
|
33
|
-
|
|
34
30
|
function splitLines(source) {
|
|
35
31
|
return source.split(/\n/);
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
exports.splitLines = splitLines;
|
|
39
|
-
|
|
40
33
|
function seedBlock(block = {}) {
|
|
41
34
|
return Object.assign({
|
|
42
35
|
description: '',
|
|
@@ -45,9 +38,6 @@ function seedBlock(block = {}) {
|
|
|
45
38
|
problems: []
|
|
46
39
|
}, block);
|
|
47
40
|
}
|
|
48
|
-
|
|
49
|
-
exports.seedBlock = seedBlock;
|
|
50
|
-
|
|
51
41
|
function seedSpec(spec = {}) {
|
|
52
42
|
return Object.assign({
|
|
53
43
|
tag: '',
|
|
@@ -59,9 +49,6 @@ function seedSpec(spec = {}) {
|
|
|
59
49
|
source: []
|
|
60
50
|
}, spec);
|
|
61
51
|
}
|
|
62
|
-
|
|
63
|
-
exports.seedSpec = seedSpec;
|
|
64
|
-
|
|
65
52
|
function seedTokens(tokens = {}) {
|
|
66
53
|
return Object.assign({
|
|
67
54
|
start: '',
|
|
@@ -78,36 +65,26 @@ function seedTokens(tokens = {}) {
|
|
|
78
65
|
lineEnd: ''
|
|
79
66
|
}, tokens);
|
|
80
67
|
}
|
|
81
|
-
|
|
82
|
-
exports.seedTokens = seedTokens;
|
|
83
68
|
/**
|
|
84
69
|
* Assures Block.tags[].source contains references to the Block.source items,
|
|
85
70
|
* using Block.source as a source of truth. This is a counterpart of rewireSpecs
|
|
86
71
|
* @param block parsed coments block
|
|
87
72
|
*/
|
|
88
|
-
|
|
89
73
|
function rewireSource(block) {
|
|
90
74
|
const source = block.source.reduce((acc, line) => acc.set(line.number, line), new Map());
|
|
91
|
-
|
|
92
75
|
for (const spec of block.tags) {
|
|
93
76
|
spec.source = spec.source.map(line => source.get(line.number));
|
|
94
77
|
}
|
|
95
|
-
|
|
96
78
|
return block;
|
|
97
79
|
}
|
|
98
|
-
|
|
99
|
-
exports.rewireSource = rewireSource;
|
|
100
80
|
/**
|
|
101
81
|
* Assures Block.source contains references to the Block.tags[].source items,
|
|
102
82
|
* using Block.tags[].source as a source of truth. This is a counterpart of rewireSource
|
|
103
83
|
* @param block parsed coments block
|
|
104
84
|
*/
|
|
105
|
-
|
|
106
85
|
function rewireSpecs(block) {
|
|
107
86
|
const source = block.tags.reduce((acc, spec) => spec.source.reduce((acc, line) => acc.set(line.number, line), acc), new Map());
|
|
108
87
|
block.source = block.source.map(line => source.get(line.number) || line);
|
|
109
88
|
return block;
|
|
110
89
|
}
|
|
111
|
-
|
|
112
|
-
exports.rewireSpecs = rewireSpecs;
|
|
113
90
|
//# sourceMappingURL=util.cjs.map
|
package/lib/util.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"util.cjs","names":["Object","defineProperty","exports","value","isSpace","hasCR","splitCR","splitSpace","splitLines","seedBlock","seedSpec","seedTokens","rewireSource","rewireSpecs","source","test","matches","match","slice","length","split","block","assign","description","tags","problems","spec","tag","name","type","optional","tokens","start","delimiter","postDelimiter","postTag","postName","postType","end","lineEnd","reduce","acc","line","set","number","Map","map","get"],"sources":["util.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSpace = isSpace;\nexports.hasCR = hasCR;\nexports.splitCR = splitCR;\nexports.splitSpace = splitSpace;\nexports.splitLines = splitLines;\nexports.seedBlock = seedBlock;\nexports.seedSpec = seedSpec;\nexports.seedTokens = seedTokens;\nexports.rewireSource = rewireSource;\nexports.rewireSpecs = rewireSpecs;\nfunction isSpace(source) {\n return /^\\s+$/.test(source);\n}\nfunction hasCR(source) {\n return /\\r$/.test(source);\n}\nfunction splitCR(source) {\n const matches = source.match(/\\r+$/);\n return matches == null\n ? ['', source]\n : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];\n}\nfunction splitSpace(source) {\n const matches = source.match(/^\\s+/);\n return matches == null\n ? ['', source]\n : [source.slice(0, matches[0].length), source.slice(matches[0].length)];\n}\nfunction splitLines(source) {\n return source.split(/\\n/);\n}\nfunction seedBlock(block = {}) {\n return Object.assign({ description: '', tags: [], source: [], problems: [] }, block);\n}\nfunction seedSpec(spec = {}) {\n return Object.assign({ tag: '', name: '', type: '', optional: false, description: '', problems: [], source: [] }, spec);\n}\nfunction seedTokens(tokens = {}) {\n return Object.assign({ start: '', delimiter: '', postDelimiter: '', tag: '', postTag: '', name: '', postName: '', type: '', postType: '', description: '', end: '', lineEnd: '' }, tokens);\n}\n/**\n * Assures Block.tags[].source contains references to the Block.source items,\n * using Block.source as a source of truth. This is a counterpart of rewireSpecs\n * @param block parsed coments block\n */\nfunction rewireSource(block) {\n const source = block.source.reduce((acc, line) => acc.set(line.number, line), new Map());\n for (const spec of block.tags) {\n spec.source = spec.source.map((line) => source.get(line.number));\n }\n return block;\n}\n/**\n * Assures Block.source contains references to the Block.tags[].source items,\n * using Block.tags[].source as a source of truth. This is a counterpart of rewireSource\n * @param block parsed coments block\n */\nfunction rewireSpecs(block) {\n const source = block.tags.reduce((acc, spec) => spec.source.reduce((acc, line) => acc.set(line.number, line), acc), new Map());\n block.source = block.source.map((line) => source.get(line.number) || line);\n return block;\n}\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;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GAAGO,KAAK,CAACP,MAAM,CAAC0B,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAKD,GAAG,CAACE,GAAG,CAACD,IAAI,CAACE,MAAM,EAAEF,IAAI,CAAC,EAAE,IAAIG,GAAG,CAAC,CAAC,CAAC;EACxF,KAAK,MAAMnB,IAAI,IAAIL,KAAK,CAACG,IAAI,EAAE;IAC3BE,IAAI,CAACZ,MAAM,GAAGY,IAAI,CAACZ,MAAM,CAACgC,GAAG,CAAEJ,IAAI,IAAK5B,MAAM,CAACiC,GAAG,CAACL,IAAI,CAACE,MAAM,CAAC,CAAC;EACpE;EACA,OAAOvB,KAAK;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,SAASR,WAAWA,CAACQ,KAAK,EAAE;EACxB,MAAMP,MAAM,GAAGO,KAAK,CAACG,IAAI,CAACgB,MAAM,CAAC,CAACC,GAAG,EAAEf,IAAI,KAAKA,IAAI,CAACZ,MAAM,CAAC0B,MAAM,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAKD,GAAG,CAACE,GAAG,CAACD,IAAI,CAACE,MAAM,EAAEF,IAAI,CAAC,EAAED,GAAG,CAAC,EAAE,IAAII,GAAG,CAAC,CAAC,CAAC;EAC9HxB,KAAK,CAACP,MAAM,GAAGO,KAAK,CAACP,MAAM,CAACgC,GAAG,CAAEJ,IAAI,IAAK5B,MAAM,CAACiC,GAAG,CAACL,IAAI,CAACE,MAAM,CAAC,IAAIF,IAAI,CAAC;EAC1E,OAAOrB,KAAK;AAChB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-parser",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "Generic JSDoc-like comment parser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
9
12
|
"import": "./es6/index.js",
|
|
@@ -35,14 +38,15 @@
|
|
|
35
38
|
"test": "tests"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
|
-
"@
|
|
41
|
+
"@changesets/cli": "^2.29.8",
|
|
42
|
+
"@types/jest": "^30.0.0",
|
|
39
43
|
"convert-extension": "^0.3.0",
|
|
40
|
-
"jest": "^
|
|
41
|
-
"prettier": "
|
|
42
|
-
"rimraf": "^
|
|
43
|
-
"rollup": "^
|
|
44
|
-
"ts-jest": "^
|
|
45
|
-
"typescript": "^
|
|
44
|
+
"jest": "^30.1.3",
|
|
45
|
+
"prettier": "3.6.2",
|
|
46
|
+
"rimraf": "^6.0.1",
|
|
47
|
+
"rollup": "^4.52.0",
|
|
48
|
+
"ts-jest": "^29.4.4",
|
|
49
|
+
"typescript": "^5.9.2"
|
|
46
50
|
},
|
|
47
51
|
"engines": {
|
|
48
52
|
"node": ">= 12.0.0"
|
|
@@ -52,11 +56,13 @@
|
|
|
52
56
|
"format": "prettier --write src tests",
|
|
53
57
|
"pretest": "rimraf coverage; npm run build",
|
|
54
58
|
"test": "prettier --check src tests && jest --verbose",
|
|
55
|
-
"preversion": "npm run build"
|
|
59
|
+
"preversion": "npm run build",
|
|
60
|
+
"prepare": "npm run build",
|
|
61
|
+
"prepublishOnly": "npm run build"
|
|
56
62
|
},
|
|
57
63
|
"repository": {
|
|
58
64
|
"type": "git",
|
|
59
|
-
"url": "git@github.com
|
|
65
|
+
"url": "git+ssh://git@github.com/yavorskiy/comment-parser.git"
|
|
60
66
|
},
|
|
61
67
|
"keywords": [
|
|
62
68
|
"jsdoc",
|
|
@@ -81,4 +87,4 @@
|
|
|
81
87
|
"url": "https://github.com/syavorsky/comment-parser/issues"
|
|
82
88
|
},
|
|
83
89
|
"homepage": "https://github.com/syavorsky/comment-parser"
|
|
84
|
-
}
|
|
90
|
+
}
|