comment-parser 1.4.2 → 1.4.4
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 +12 -0
- package/browser/index.js +671 -0
- package/es6/parser/block-parser.d.ts +1 -1
- package/es6/parser/block-parser.js +1 -1
- package/lib/index.cjs +68 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.ts +32 -0
- package/lib/parser/block-parser.cjs +36 -0
- package/lib/parser/block-parser.cjs.map +1 -0
- package/lib/parser/block-parser.d.ts +24 -0
- package/lib/parser/index.cjs +52 -0
- package/lib/parser/index.cjs.map +1 -0
- package/lib/parser/index.d.ts +11 -0
- package/lib/parser/source-parser.cjs +56 -0
- package/lib/parser/source-parser.cjs.map +1 -0
- package/lib/parser/source-parser.d.ts +7 -0
- package/lib/parser/spec-parser.cjs +23 -0
- package/lib/parser/spec-parser.cjs.map +1 -0
- package/lib/parser/spec-parser.d.ts +7 -0
- package/lib/parser/tokenizers/description.cjs +51 -0
- package/lib/parser/tokenizers/description.cjs.map +1 -0
- package/lib/parser/tokenizers/description.d.ts +20 -0
- package/lib/parser/tokenizers/index.cjs +6 -0
- package/lib/parser/tokenizers/index.cjs.map +1 -0
- package/lib/parser/tokenizers/index.d.ts +7 -0
- package/lib/parser/tokenizers/name.cjs +103 -0
- package/lib/parser/tokenizers/name.cjs.map +1 -0
- package/lib/parser/tokenizers/name.d.ts +6 -0
- package/lib/parser/tokenizers/tag.cjs +36 -0
- package/lib/parser/tokenizers/tag.cjs.map +1 -0
- package/lib/parser/tokenizers/tag.d.ts +6 -0
- package/lib/parser/tokenizers/type.cjs +75 -0
- package/lib/parser/tokenizers/type.cjs.map +1 -0
- package/lib/parser/tokenizers/type.d.ts +27 -0
- package/lib/primitives.cjs +15 -0
- package/lib/primitives.cjs.map +1 -0
- package/lib/primitives.d.ts +54 -0
- package/lib/stringifier/index.cjs +15 -0
- package/lib/stringifier/index.cjs.map +1 -0
- package/lib/stringifier/index.d.ts +3 -0
- package/lib/stringifier/inspect.cjs +56 -0
- package/lib/stringifier/inspect.cjs.map +1 -0
- package/lib/stringifier/inspect.d.ts +2 -0
- package/lib/transforms/align.cjs +104 -0
- package/lib/transforms/align.cjs.map +1 -0
- package/lib/transforms/align.d.ts +3 -0
- package/lib/transforms/crlf.cjs +35 -0
- package/lib/transforms/crlf.cjs.map +1 -0
- package/lib/transforms/crlf.d.ts +3 -0
- package/lib/transforms/indent.cjs +45 -0
- package/lib/transforms/indent.cjs.map +1 -0
- package/lib/transforms/indent.d.ts +2 -0
- package/lib/transforms/index.cjs +10 -0
- package/lib/transforms/index.cjs.map +1 -0
- package/lib/transforms/index.d.ts +3 -0
- package/lib/util.cjs +90 -0
- package/lib/util.cjs.map +1 -0
- package/lib/util.d.ts +21 -0
- package/package.json +8 -2
- package/src/parser/block-parser.ts +2 -2
- package/tests/unit/block-parser.spec.ts +80 -0
package/lib/util.cjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
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;
|
|
16
|
+
function isSpace(source) {
|
|
17
|
+
return /^\s+$/.test(source);
|
|
18
|
+
}
|
|
19
|
+
function hasCR(source) {
|
|
20
|
+
return /\r$/.test(source);
|
|
21
|
+
}
|
|
22
|
+
function splitCR(source) {
|
|
23
|
+
const matches = source.match(/\r+$/);
|
|
24
|
+
return matches == null ? ['', source] : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];
|
|
25
|
+
}
|
|
26
|
+
function splitSpace(source) {
|
|
27
|
+
const matches = source.match(/^\s+/);
|
|
28
|
+
return matches == null ? ['', source] : [source.slice(0, matches[0].length), source.slice(matches[0].length)];
|
|
29
|
+
}
|
|
30
|
+
function splitLines(source) {
|
|
31
|
+
return source.split(/\n/);
|
|
32
|
+
}
|
|
33
|
+
function seedBlock(block = {}) {
|
|
34
|
+
return Object.assign({
|
|
35
|
+
description: '',
|
|
36
|
+
tags: [],
|
|
37
|
+
source: [],
|
|
38
|
+
problems: []
|
|
39
|
+
}, block);
|
|
40
|
+
}
|
|
41
|
+
function seedSpec(spec = {}) {
|
|
42
|
+
return Object.assign({
|
|
43
|
+
tag: '',
|
|
44
|
+
name: '',
|
|
45
|
+
type: '',
|
|
46
|
+
optional: false,
|
|
47
|
+
description: '',
|
|
48
|
+
problems: [],
|
|
49
|
+
source: []
|
|
50
|
+
}, spec);
|
|
51
|
+
}
|
|
52
|
+
function seedTokens(tokens = {}) {
|
|
53
|
+
return Object.assign({
|
|
54
|
+
start: '',
|
|
55
|
+
delimiter: '',
|
|
56
|
+
postDelimiter: '',
|
|
57
|
+
tag: '',
|
|
58
|
+
postTag: '',
|
|
59
|
+
name: '',
|
|
60
|
+
postName: '',
|
|
61
|
+
type: '',
|
|
62
|
+
postType: '',
|
|
63
|
+
description: '',
|
|
64
|
+
end: '',
|
|
65
|
+
lineEnd: ''
|
|
66
|
+
}, tokens);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Assures Block.tags[].source contains references to the Block.source items,
|
|
70
|
+
* using Block.source as a source of truth. This is a counterpart of rewireSpecs
|
|
71
|
+
* @param block parsed coments block
|
|
72
|
+
*/
|
|
73
|
+
function rewireSource(block) {
|
|
74
|
+
const source = block.source.reduce((acc, line) => acc.set(line.number, line), new Map());
|
|
75
|
+
for (const spec of block.tags) {
|
|
76
|
+
spec.source = spec.source.map(line => source.get(line.number));
|
|
77
|
+
}
|
|
78
|
+
return block;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Assures Block.source contains references to the Block.tags[].source items,
|
|
82
|
+
* using Block.tags[].source as a source of truth. This is a counterpart of rewireSource
|
|
83
|
+
* @param block parsed coments block
|
|
84
|
+
*/
|
|
85
|
+
function rewireSpecs(block) {
|
|
86
|
+
const source = block.tags.reduce((acc, spec) => spec.source.reduce((acc, line) => acc.set(line.number, line), acc), new Map());
|
|
87
|
+
block.source = block.source.map(line => source.get(line.number) || line);
|
|
88
|
+
return block;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=util.cjs.map
|
package/lib/util.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,OAAO,GAAGA,OAAO;AACzBF,OAAO,CAACG,KAAK,GAAGA,KAAK;AACrBH,OAAO,CAACI,OAAO,GAAGA,OAAO;AACzBJ,OAAO,CAACK,UAAU,GAAGA,UAAU;AAC/BL,OAAO,CAACM,UAAU,GAAGA,UAAU;AAC/BN,OAAO,CAACO,SAAS,GAAGA,SAAS;AAC7BP,OAAO,CAACQ,QAAQ,GAAGA,QAAQ;AAC3BR,OAAO,CAACS,UAAU,GAAGA,UAAU;AAC/BT,OAAO,CAACU,YAAY,GAAGA,YAAY;AACnCV,OAAO,CAACW,WAAW,GAAG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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/lib/util.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Block, Tokens, Spec } from './primitives.js';
|
|
2
|
+
export declare function isSpace(source: string): boolean;
|
|
3
|
+
export declare function hasCR(source: string): boolean;
|
|
4
|
+
export declare function splitCR(source: string): [string, string];
|
|
5
|
+
export declare function splitSpace(source: string): [string, string];
|
|
6
|
+
export declare function splitLines(source: string): string[];
|
|
7
|
+
export declare function seedBlock(block?: Partial<Block>): Block;
|
|
8
|
+
export declare function seedSpec(spec?: Partial<Spec>): Spec;
|
|
9
|
+
export declare function seedTokens(tokens?: Partial<Tokens>): Tokens;
|
|
10
|
+
/**
|
|
11
|
+
* Assures Block.tags[].source contains references to the Block.source items,
|
|
12
|
+
* using Block.source as a source of truth. This is a counterpart of rewireSpecs
|
|
13
|
+
* @param block parsed coments block
|
|
14
|
+
*/
|
|
15
|
+
export declare function rewireSource(block: Block): Block;
|
|
16
|
+
/**
|
|
17
|
+
* Assures Block.source contains references to the Block.tags[].source items,
|
|
18
|
+
* using Block.tags[].source as a source of truth. This is a counterpart of rewireSource
|
|
19
|
+
* @param block parsed coments block
|
|
20
|
+
*/
|
|
21
|
+
export declare function rewireSpecs(block: Block): Block;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comment-parser",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "Generic JSDoc-like comment parser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -56,7 +56,13 @@
|
|
|
56
56
|
"format": "prettier --write src tests",
|
|
57
57
|
"pretest": "rimraf coverage; npm run build",
|
|
58
58
|
"test": "prettier --check src tests && jest --verbose",
|
|
59
|
-
"preversion": "npm run build"
|
|
59
|
+
"preversion": "npm run build",
|
|
60
|
+
"postversion": "git add . && git commit -m \"chore: release v$(node -p \"require('./package.json').version\")\"",
|
|
61
|
+
"prepare": "npm run build",
|
|
62
|
+
"prepublishOnly": "npm run build",
|
|
63
|
+
"release:add": "git pull origin master && changeset",
|
|
64
|
+
"release:version": "git pull origin master && changeset version && npm install",
|
|
65
|
+
"release:publish": "git pull origin master && npm run build && changeset publish && git push --follow-tags"
|
|
60
66
|
},
|
|
61
67
|
"repository": {
|
|
62
68
|
"type": "git",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Line } from '../primitives.js';
|
|
2
2
|
|
|
3
|
-
const reTag =
|
|
3
|
+
const reTag = /^@[^\s/]+(?=\s|$)/;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Groups source lines in sections representing tags.
|
|
7
7
|
* First section is a block description if present. Last section captures lines starting with
|
|
8
8
|
* the last tag to the end of the block, including dangling closing marker.
|
|
9
|
-
* @param {Line[]} block
|
|
9
|
+
* @param {Line[]} block source lines making a single comment block
|
|
10
10
|
*/
|
|
11
11
|
export type Parser = (block: Line[]) => Line[][];
|
|
12
12
|
|
|
@@ -167,3 +167,83 @@ test('fence function', () => {
|
|
|
167
167
|
expect(groups.length).toBe(2);
|
|
168
168
|
expect(groups).toEqual([source.slice(0, 5), source.slice(5)]);
|
|
169
169
|
});
|
|
170
|
+
|
|
171
|
+
test('should not treat @npm/package or @ember/debug as tags', () => {
|
|
172
|
+
const parser = getParser();
|
|
173
|
+
const lines: Line[] = [
|
|
174
|
+
{
|
|
175
|
+
number: 1,
|
|
176
|
+
source: '/**',
|
|
177
|
+
tokens: seedTokens({
|
|
178
|
+
start: '',
|
|
179
|
+
delimiter: '/**',
|
|
180
|
+
postDelimiter: '',
|
|
181
|
+
description: '',
|
|
182
|
+
end: '',
|
|
183
|
+
}),
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
number: 2,
|
|
187
|
+
source: ' * Description line',
|
|
188
|
+
tokens: seedTokens({
|
|
189
|
+
start: ' ',
|
|
190
|
+
delimiter: '*',
|
|
191
|
+
postDelimiter: ' ',
|
|
192
|
+
description: 'Description line',
|
|
193
|
+
end: '',
|
|
194
|
+
}),
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
number: 3,
|
|
198
|
+
source: ' * @ember/debug should not be treated as tag',
|
|
199
|
+
tokens: seedTokens({
|
|
200
|
+
start: ' ',
|
|
201
|
+
delimiter: '*',
|
|
202
|
+
postDelimiter: ' ',
|
|
203
|
+
description: '@ember/debug should not be treated as tag',
|
|
204
|
+
end: '',
|
|
205
|
+
}),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
number: 4,
|
|
209
|
+
source: ' * @npm/package should not be treated as tag either',
|
|
210
|
+
tokens: seedTokens({
|
|
211
|
+
start: ' ',
|
|
212
|
+
delimiter: '*',
|
|
213
|
+
postDelimiter: ' ',
|
|
214
|
+
description: '@npm/package should not be treated as tag either',
|
|
215
|
+
end: '',
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
number: 5,
|
|
220
|
+
source: ' * @param {string} value',
|
|
221
|
+
tokens: seedTokens({
|
|
222
|
+
start: ' ',
|
|
223
|
+
delimiter: '*',
|
|
224
|
+
postDelimiter: ' ',
|
|
225
|
+
description: '@param {string} value',
|
|
226
|
+
end: '',
|
|
227
|
+
}),
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
number: 6,
|
|
231
|
+
source: ' */',
|
|
232
|
+
tokens: seedTokens({
|
|
233
|
+
start: ' ',
|
|
234
|
+
delimiter: '',
|
|
235
|
+
postDelimiter: '',
|
|
236
|
+
description: '',
|
|
237
|
+
end: '*/',
|
|
238
|
+
}),
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
|
|
242
|
+
const groups: Line[][] = parser(lines);
|
|
243
|
+
|
|
244
|
+
// Should have 2 sections: description (lines 0-3) and @param tag (lines 4-5)
|
|
245
|
+
// @ember/debug and @npm/package should stay in description, not create new sections
|
|
246
|
+
expect(groups.length).toBe(2);
|
|
247
|
+
expect(groups[0]).toEqual([lines[0], lines[1], lines[2], lines[3]]);
|
|
248
|
+
expect(groups[1]).toEqual([lines[4], lines[5]]);
|
|
249
|
+
});
|