comment-parser 1.4.2 → 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 +6 -0
- package/browser/index.js +671 -0
- 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 +4 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = tagTokenizer;
|
|
7
|
+
/**
|
|
8
|
+
* Splits the `@prefix` from remaining `Spec.lines[].token.description` into the `tag` token,
|
|
9
|
+
* and populates `spec.tag`
|
|
10
|
+
*/
|
|
11
|
+
function tagTokenizer() {
|
|
12
|
+
return spec => {
|
|
13
|
+
const {
|
|
14
|
+
tokens
|
|
15
|
+
} = spec.source[0];
|
|
16
|
+
const match = tokens.description.match(/\s*(@(\S+))(\s*)/);
|
|
17
|
+
if (match === null) {
|
|
18
|
+
spec.problems.push({
|
|
19
|
+
code: 'spec:tag:prefix',
|
|
20
|
+
message: 'tag should start with "@" symbol',
|
|
21
|
+
line: spec.source[0].number,
|
|
22
|
+
critical: true
|
|
23
|
+
});
|
|
24
|
+
return spec;
|
|
25
|
+
}
|
|
26
|
+
if (match[1].includes('/')) {
|
|
27
|
+
return spec;
|
|
28
|
+
}
|
|
29
|
+
tokens.tag = match[1];
|
|
30
|
+
tokens.postTag = match[3];
|
|
31
|
+
tokens.description = tokens.description.slice(match[0].length);
|
|
32
|
+
spec.tag = match[2];
|
|
33
|
+
return spec;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=tag.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.cjs","names":["Object","defineProperty","exports","value","default","tagTokenizer","spec","tokens","source","match","description","problems","push","code","message","line","number","critical","includes","tag","postTag","slice","length"],"sources":["tag.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = tagTokenizer;\n/**\n * Splits the `@prefix` from remaining `Spec.lines[].token.description` into the `tag` token,\n * and populates `spec.tag`\n */\nfunction tagTokenizer() {\n return (spec) => {\n const { tokens } = spec.source[0];\n const match = tokens.description.match(/\\s*(@(\\S+))(\\s*)/);\n if (match === null) {\n spec.problems.push({\n code: 'spec:tag:prefix',\n message: 'tag should start with \"@\" symbol',\n line: spec.source[0].number,\n critical: true,\n });\n return spec;\n }\n if (match[1].includes('/')) {\n return spec;\n }\n tokens.tag = match[1];\n tokens.postTag = match[3];\n tokens.description = tokens.description.slice(match[0].length);\n spec.tag = match[2];\n return spec;\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,YAAY;AAC9B;AACA;AACA;AACA;AACA,SAASA,YAAYA,CAAA,EAAG;EACpB,OAAQC,IAAI,IAAK;IACb,MAAM;MAAEC;IAAO,CAAC,GAAGD,IAAI,CAACE,MAAM,CAAC,CAAC,CAAC;IACjC,MAAMC,KAAK,GAAGF,MAAM,CAACG,WAAW,CAACD,KAAK,CAAC,kBAAkB,CAAC;IAC1D,IAAIA,KAAK,KAAK,IAAI,EAAE;MAChBH,IAAI,CAACK,QAAQ,CAACC,IAAI,CAAC;QACfC,IAAI,EAAE,iBAAiB;QACvBC,OAAO,EAAE,kCAAkC;QAC3CC,IAAI,EAAET,IAAI,CAACE,MAAM,CAAC,CAAC,CAAC,CAACQ,MAAM;QAC3BC,QAAQ,EAAE;MACd,CAAC,CAAC;MACF,OAAOX,IAAI;IACf;IACA,IAAIG,KAAK,CAAC,CAAC,CAAC,CAACS,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxB,OAAOZ,IAAI;IACf;IACAC,MAAM,CAACY,GAAG,GAAGV,KAAK,CAAC,CAAC,CAAC;IACrBF,MAAM,CAACa,OAAO,GAAGX,KAAK,CAAC,CAAC,CAAC;IACzBF,MAAM,CAACG,WAAW,GAAGH,MAAM,CAACG,WAAW,CAACW,KAAK,CAACZ,KAAK,CAAC,CAAC,CAAC,CAACa,MAAM,CAAC;IAC9DhB,IAAI,CAACa,GAAG,GAAGV,KAAK,CAAC,CAAC,CAAC;IACnB,OAAOH,IAAI;EACf,CAAC;AACL","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = typeTokenizer;
|
|
7
|
+
const util_js_1 = require("../../util.cjs");
|
|
8
|
+
/**
|
|
9
|
+
* Sets splits remaining `Spec.lines[].tokens.description` into `type` and `description`
|
|
10
|
+
* tokens and populates Spec.type`
|
|
11
|
+
*
|
|
12
|
+
* @param {Spacing} spacing tells how to deal with a whitespace
|
|
13
|
+
* for type values going over multiple lines
|
|
14
|
+
*/
|
|
15
|
+
function typeTokenizer(spacing = 'compact') {
|
|
16
|
+
const join = getJoiner(spacing);
|
|
17
|
+
return spec => {
|
|
18
|
+
let curlies = 0;
|
|
19
|
+
let lines = [];
|
|
20
|
+
let descriptionBegun = false;
|
|
21
|
+
let firstTypeIteration = true;
|
|
22
|
+
for (const {
|
|
23
|
+
tokens
|
|
24
|
+
} of spec.source.values()) {
|
|
25
|
+
let type = '';
|
|
26
|
+
if (!descriptionBegun && tokens.description.trim()) {
|
|
27
|
+
descriptionBegun = true;
|
|
28
|
+
} else if (!descriptionBegun) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (firstTypeIteration && tokens.description[0] !== '{') return spec;
|
|
32
|
+
firstTypeIteration = false;
|
|
33
|
+
for (const ch of tokens.description) {
|
|
34
|
+
if (ch === '{') curlies++;
|
|
35
|
+
if (ch === '}') curlies--;
|
|
36
|
+
type += ch;
|
|
37
|
+
if (curlies === 0) break;
|
|
38
|
+
}
|
|
39
|
+
lines.push([tokens, type]);
|
|
40
|
+
if (curlies === 0) break;
|
|
41
|
+
}
|
|
42
|
+
if (!descriptionBegun) {
|
|
43
|
+
return spec;
|
|
44
|
+
}
|
|
45
|
+
if (curlies !== 0) {
|
|
46
|
+
spec.problems.push({
|
|
47
|
+
code: 'spec:type:unpaired-curlies',
|
|
48
|
+
message: 'unpaired curlies',
|
|
49
|
+
line: spec.source[0].number,
|
|
50
|
+
critical: true
|
|
51
|
+
});
|
|
52
|
+
return spec;
|
|
53
|
+
}
|
|
54
|
+
const parts = [];
|
|
55
|
+
const offset = lines[0][0].postDelimiter.length;
|
|
56
|
+
for (const [i, [tokens, type]] of lines.entries()) {
|
|
57
|
+
tokens.type = type;
|
|
58
|
+
if (i > 0) {
|
|
59
|
+
tokens.type = tokens.postDelimiter.slice(offset) + type;
|
|
60
|
+
tokens.postDelimiter = tokens.postDelimiter.slice(0, offset);
|
|
61
|
+
}
|
|
62
|
+
[tokens.postType, tokens.description] = (0, util_js_1.splitSpace)(tokens.description.slice(type.length));
|
|
63
|
+
parts.push(tokens.type);
|
|
64
|
+
}
|
|
65
|
+
parts[0] = parts[0].slice(1);
|
|
66
|
+
parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1);
|
|
67
|
+
spec.type = join(parts);
|
|
68
|
+
return spec;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const trim = x => x.trim();
|
|
72
|
+
function getJoiner(spacing) {
|
|
73
|
+
if (spacing === 'compact') return t => t.map(trim).join('');else if (spacing === 'preserve') return t => t.join('\n');else return spacing;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=type.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.cjs","names":["Object","defineProperty","exports","value","default","typeTokenizer","util_js_1","require","spacing","join","getJoiner","spec","curlies","lines","descriptionBegun","firstTypeIteration","tokens","source","values","type","description","trim","ch","push","problems","code","message","line","number","critical","parts","offset","postDelimiter","length","i","entries","slice","postType","splitSpace","x","t","map"],"sources":["type.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = typeTokenizer;\nconst util_js_1 = require(\"../../util.js\");\n/**\n * Sets splits remaining `Spec.lines[].tokens.description` into `type` and `description`\n * tokens and populates Spec.type`\n *\n * @param {Spacing} spacing tells how to deal with a whitespace\n * for type values going over multiple lines\n */\nfunction typeTokenizer(spacing = 'compact') {\n const join = getJoiner(spacing);\n return (spec) => {\n let curlies = 0;\n let lines = [];\n let descriptionBegun = false;\n let firstTypeIteration = true;\n for (const { tokens } of spec.source.values()) {\n let type = '';\n if (!descriptionBegun && tokens.description.trim()) {\n descriptionBegun = true;\n }\n else if (!descriptionBegun) {\n continue;\n }\n if (firstTypeIteration && tokens.description[0] !== '{')\n return spec;\n firstTypeIteration = false;\n for (const ch of tokens.description) {\n if (ch === '{')\n curlies++;\n if (ch === '}')\n curlies--;\n type += ch;\n if (curlies === 0)\n break;\n }\n lines.push([tokens, type]);\n if (curlies === 0)\n break;\n }\n if (!descriptionBegun) {\n return spec;\n }\n if (curlies !== 0) {\n spec.problems.push({\n code: 'spec:type:unpaired-curlies',\n message: 'unpaired curlies',\n line: spec.source[0].number,\n critical: true,\n });\n return spec;\n }\n const parts = [];\n const offset = lines[0][0].postDelimiter.length;\n for (const [i, [tokens, type]] of lines.entries()) {\n tokens.type = type;\n if (i > 0) {\n tokens.type = tokens.postDelimiter.slice(offset) + type;\n tokens.postDelimiter = tokens.postDelimiter.slice(0, offset);\n }\n [tokens.postType, tokens.description] = (0, util_js_1.splitSpace)(tokens.description.slice(type.length));\n parts.push(tokens.type);\n }\n parts[0] = parts[0].slice(1);\n parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1);\n spec.type = join(parts);\n return spec;\n };\n}\nconst trim = (x) => x.trim();\nfunction getJoiner(spacing) {\n if (spacing === 'compact')\n return (t) => t.map(trim).join('');\n else if (spacing === 'preserve')\n return (t) => t.join('\\n');\n else\n return spacing;\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,aAAa;AAC/B,MAAMC,SAAS,GAAGC,OAAO,kBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASF,aAAaA,CAACG,OAAO,GAAG,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGC,SAAS,CAACF,OAAO,CAAC;EAC/B,OAAQG,IAAI,IAAK;IACb,IAAIC,OAAO,GAAG,CAAC;IACf,IAAIC,KAAK,GAAG,EAAE;IACd,IAAIC,gBAAgB,GAAG,KAAK;IAC5B,IAAIC,kBAAkB,GAAG,IAAI;IAC7B,KAAK,MAAM;MAAEC;IAAO,CAAC,IAAIL,IAAI,CAACM,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MAC3C,IAAIC,IAAI,GAAG,EAAE;MACb,IAAI,CAACL,gBAAgB,IAAIE,MAAM,CAACI,WAAW,CAACC,IAAI,CAAC,CAAC,EAAE;QAChDP,gBAAgB,GAAG,IAAI;MAC3B,CAAC,MACI,IAAI,CAACA,gBAAgB,EAAE;QACxB;MACJ;MACA,IAAIC,kBAAkB,IAAIC,MAAM,CAACI,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,EACnD,OAAOT,IAAI;MACfI,kBAAkB,GAAG,KA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AAW,CAAC,GAAG,CAAC,CAAC,EAAEd,SAAS,CAACgC,UAAU,EAAEtB,MAAM,CAACI,WAAW,CAACgB,KAAK,CAACjB,IAAI,CAACc,MAAM,CAAC,CAAC;MACxGH,KAAK,CAACP,IAAI,CAACP,MAAM,CAACG,IAAI,CAAC;IAC3B;IACAW,KAAK,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,CAACM,KAAK,CAAC,CAAC,CAAC;IAC5BN,KAAK,CAACA,KAAK,CAACG,MAAM,GAAG,CAAC,CAAC,GAAGH,KAAK,CAACA,KAAK,CAACG,MAAM,GAAG,CAAC,CAAC,CAACG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9DzB,IAAI,CAACQ,IAAI,GAAGV,IAAI,CAACqB,KAAK,CAAC;IACvB,OAAOnB,IAAI;EACf,CAAC;AACL;AACA,MAAMU,IAAI,GAAIkB,CAAC,IAAKA,CAAC,CAAClB,IAAI,CAAC,CAAC;AAC5B,SAASX,SAASA,CAACF,OAAO,EAAE;EACxB,IAAIA,OAAO,KAAK,SAAS,EACrB,OAAQgC,CAAC,IAAKA,CAAC,CAACC,GAAG,CAACpB,IAAI,CAAC,CAACZ,IAAI,CAAC,EAAE,CAAC,CAAC,KAClC,IAAID,OAAO,KAAK,UAAU,EAC3B,OAAQgC,CAAC,IAAKA,CAAC,CAAC/B,IAAI,CAAC,IAAI,CAAC,CAAC,KAE3B,OAAOD,OAAO;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Tokenizer } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Joiner is a function taking collected type token string parts,
|
|
4
|
+
* and joining them together. In most of the cases this will be
|
|
5
|
+
* a single piece like {type-name}, but type may go over multipe line
|
|
6
|
+
* ```
|
|
7
|
+
* @tag {function(
|
|
8
|
+
* number,
|
|
9
|
+
* string
|
|
10
|
+
* )}
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export type Joiner = (parts: string[]) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Shortcut for standard Joiners
|
|
16
|
+
* compact - trim surrounding space, replace line breaks with a single space
|
|
17
|
+
* preserve - concat as is
|
|
18
|
+
*/
|
|
19
|
+
export type Spacing = 'compact' | 'preserve' | Joiner;
|
|
20
|
+
/**
|
|
21
|
+
* Sets splits remaining `Spec.lines[].tokens.description` into `type` and `description`
|
|
22
|
+
* tokens and populates Spec.type`
|
|
23
|
+
*
|
|
24
|
+
* @param {Spacing} spacing tells how to deal with a whitespace
|
|
25
|
+
* for type values going over multiple lines
|
|
26
|
+
*/
|
|
27
|
+
export default function typeTokenizer(spacing?: Spacing): Tokenizer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Markers = void 0;
|
|
7
|
+
/** @deprecated */
|
|
8
|
+
var Markers;
|
|
9
|
+
(function (Markers) {
|
|
10
|
+
Markers["start"] = "/**";
|
|
11
|
+
Markers["nostart"] = "/***";
|
|
12
|
+
Markers["delim"] = "*";
|
|
13
|
+
Markers["end"] = "*/";
|
|
14
|
+
})(Markers || (exports.Markers = Markers = {}));
|
|
15
|
+
//# sourceMappingURL=primitives.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.cjs","names":["Object","defineProperty","exports","value","Markers"],"sources":["primitives.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Markers = void 0;\n/** @deprecated */\nvar Markers;\n(function (Markers) {\n Markers[\"start\"] = \"/**\";\n Markers[\"nostart\"] = \"/***\";\n Markers[\"delim\"] = \"*\";\n Markers[\"end\"] = \"*/\";\n})(Markers || (exports.Markers = Markers = {}));\n"],"mappings":"AAAA,YAAY;;AACZA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,OAAO,GAAG,KAAK,CAAC;AACxB;AACA,IAAIA,OAAO;AACX,CAAC,UAAUA,OAAO,EAAE;EAChBA,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK;EACxBA,OAAO,CAAC,SAAS,CAAC,GAAG,MAAM;EAC3BA,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG;EACtBA,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;AACzB,CAAC,EAAEA,OAAO,KAAKF,OAAO,CAACE,OAAO,GAAGA,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @deprecated */
|
|
2
|
+
export declare enum Markers {
|
|
3
|
+
start = "/**",
|
|
4
|
+
nostart = "/***",
|
|
5
|
+
delim = "*",
|
|
6
|
+
end = "*/"
|
|
7
|
+
}
|
|
8
|
+
export interface BlockMarkers {
|
|
9
|
+
start: string;
|
|
10
|
+
nostart: string;
|
|
11
|
+
delim: string;
|
|
12
|
+
end: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Block {
|
|
15
|
+
description: string;
|
|
16
|
+
tags: Spec[];
|
|
17
|
+
source: Line[];
|
|
18
|
+
problems: Problem[];
|
|
19
|
+
}
|
|
20
|
+
export interface Spec {
|
|
21
|
+
tag: string;
|
|
22
|
+
name: string;
|
|
23
|
+
default?: string;
|
|
24
|
+
type: string;
|
|
25
|
+
optional: boolean;
|
|
26
|
+
description: string;
|
|
27
|
+
problems: Problem[];
|
|
28
|
+
source: Line[];
|
|
29
|
+
}
|
|
30
|
+
export interface Line {
|
|
31
|
+
number: number;
|
|
32
|
+
source: string;
|
|
33
|
+
tokens: Tokens;
|
|
34
|
+
}
|
|
35
|
+
export interface Tokens {
|
|
36
|
+
start: string;
|
|
37
|
+
delimiter: string;
|
|
38
|
+
postDelimiter: string;
|
|
39
|
+
tag: string;
|
|
40
|
+
postTag: string;
|
|
41
|
+
name: string;
|
|
42
|
+
postName: string;
|
|
43
|
+
type: string;
|
|
44
|
+
postType: string;
|
|
45
|
+
description: string;
|
|
46
|
+
end: string;
|
|
47
|
+
lineEnd: string;
|
|
48
|
+
}
|
|
49
|
+
export interface Problem {
|
|
50
|
+
code: 'unhandled' | 'custom' | 'source:startline' | 'spec:tag:prefix' | 'spec:type:unpaired-curlies' | 'spec:name:unpaired-brackets' | 'spec:name:empty-name' | 'spec:name:invalid-default' | 'spec:name:empty-default';
|
|
51
|
+
message: string;
|
|
52
|
+
line: number;
|
|
53
|
+
critical: boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getStringifier;
|
|
7
|
+
function join(tokens) {
|
|
8
|
+
return tokens.start + tokens.delimiter + tokens.postDelimiter + tokens.tag + tokens.postTag + tokens.type + tokens.postType + tokens.name + tokens.postName + tokens.description + tokens.end + tokens.lineEnd;
|
|
9
|
+
}
|
|
10
|
+
function getStringifier() {
|
|
11
|
+
return block => block.source.map(({
|
|
12
|
+
tokens
|
|
13
|
+
}) => join(tokens)).join('\n');
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Object","defineProperty","exports","value","default","getStringifier","join","tokens","start","delimiter","postDelimiter","tag","postTag","type","postType","name","postName","description","end","lineEnd","block","source","map"],"sources":["index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = getStringifier;\nfunction join(tokens) {\n return (tokens.start +\n tokens.delimiter +\n tokens.postDelimiter +\n tokens.tag +\n tokens.postTag +\n tokens.type +\n tokens.postType +\n tokens.name +\n tokens.postName +\n tokens.description +\n tokens.end +\n tokens.lineEnd);\n}\nfunction getStringifier() {\n return (block) => block.source.map(({ tokens }) => join(tokens)).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,cAAc;AAChC,SAASC,IAAIA,CAACC,MAAM,EAAE;EAClB,OAAQA,MAAM,CAACC,KAAK,GAChBD,MAAM,CAACE,SAAS,GAChBF,MAAM,CAACG,aAAa,GACpBH,MAAM,CAACI,GAAG,GACVJ,MAAM,CAACK,OAAO,GACdL,MAAM,CAACM,IAAI,GACXN,MAAM,CAACO,QAAQ,GACfP,MAAM,CAACQ,IAAI,GACXR,MAAM,CAACS,QAAQ,GACfT,MAAM,CAACU,WAAW,GAClBV,MAAM,CAACW,GAAG,GACVX,MAAM,CAACY,OAAO;AACtB;AACA,SAASd,cAAcA,CAAA,EAAG;EACtB,OAAQe,KAAK,IAAKA,KAAK,CAACC,MAAM,CAACC,GAAG,CAAC,CAAC;IAAEf;EAAO,CAAC,KAAKD,IAAI,CAACC,MAAM,CAAC,CAAC,CAACD,IAAI,CAAC,IAAI,CAAC;AAC/E","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = inspect;
|
|
7
|
+
const util_js_1 = require("../util.cjs");
|
|
8
|
+
const zeroWidth = {
|
|
9
|
+
line: 0,
|
|
10
|
+
start: 0,
|
|
11
|
+
delimiter: 0,
|
|
12
|
+
postDelimiter: 0,
|
|
13
|
+
tag: 0,
|
|
14
|
+
postTag: 0,
|
|
15
|
+
name: 0,
|
|
16
|
+
postName: 0,
|
|
17
|
+
type: 0,
|
|
18
|
+
postType: 0,
|
|
19
|
+
description: 0,
|
|
20
|
+
end: 0,
|
|
21
|
+
lineEnd: 0
|
|
22
|
+
};
|
|
23
|
+
const headers = {
|
|
24
|
+
lineEnd: 'CR'
|
|
25
|
+
};
|
|
26
|
+
const fields = Object.keys(zeroWidth);
|
|
27
|
+
const repr = x => (0, util_js_1.isSpace)(x) ? `{${x.length}}` : x;
|
|
28
|
+
const frame = line => '|' + line.join('|') + '|';
|
|
29
|
+
const align = (width, tokens) => Object.keys(tokens).map(k => repr(tokens[k]).padEnd(width[k]));
|
|
30
|
+
function inspect({
|
|
31
|
+
source
|
|
32
|
+
}) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (source.length === 0) return '';
|
|
35
|
+
const width = Object.assign({}, zeroWidth);
|
|
36
|
+
for (const f of fields) width[f] = ((_a = headers[f]) !== null && _a !== void 0 ? _a : f).length;
|
|
37
|
+
for (const {
|
|
38
|
+
number,
|
|
39
|
+
tokens
|
|
40
|
+
} of source) {
|
|
41
|
+
width.line = Math.max(width.line, number.toString().length);
|
|
42
|
+
for (const k in tokens) width[k] = Math.max(width[k], repr(tokens[k]).length);
|
|
43
|
+
}
|
|
44
|
+
const lines = [[], []];
|
|
45
|
+
for (const f of fields) lines[0].push(((_b = headers[f]) !== null && _b !== void 0 ? _b : f).padEnd(width[f]));
|
|
46
|
+
for (const f of fields) lines[1].push('-'.padEnd(width[f], '-'));
|
|
47
|
+
for (const {
|
|
48
|
+
number,
|
|
49
|
+
tokens
|
|
50
|
+
} of source) {
|
|
51
|
+
const line = number.toString().padStart(width.line);
|
|
52
|
+
lines.push([line, ...align(width, tokens)]);
|
|
53
|
+
}
|
|
54
|
+
return lines.map(frame).join('\n');
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=inspect.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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ACC,KAAK,EAAEC,MAAM,CAAC,CAAC,CAAC;EAC/C;EACA,OAAOa,KAAK,CAACZ,GAAG,CAACL,KAAK,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACtC","ignoreList":[]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.default = align;
|
|
15
|
+
const primitives_js_1 = require("../primitives.cjs");
|
|
16
|
+
const util_js_1 = require("../util.cjs");
|
|
17
|
+
const zeroWidth = {
|
|
18
|
+
start: 0,
|
|
19
|
+
tag: 0,
|
|
20
|
+
type: 0,
|
|
21
|
+
name: 0
|
|
22
|
+
};
|
|
23
|
+
const getWidth = (markers = primitives_js_1.Markers) => (w, {
|
|
24
|
+
tokens: t
|
|
25
|
+
}) => ({
|
|
26
|
+
start: t.delimiter === markers.start ? t.start.length : w.start,
|
|
27
|
+
tag: Math.max(w.tag, t.tag.length),
|
|
28
|
+
type: Math.max(w.type, t.type.length),
|
|
29
|
+
name: Math.max(w.name, t.name.length)
|
|
30
|
+
});
|
|
31
|
+
const space = len => ''.padStart(len, ' ');
|
|
32
|
+
function align(markers = primitives_js_1.Markers) {
|
|
33
|
+
let intoTags = false;
|
|
34
|
+
let w;
|
|
35
|
+
function update(line) {
|
|
36
|
+
const tokens = Object.assign({}, line.tokens);
|
|
37
|
+
if (tokens.tag !== '') intoTags = true;
|
|
38
|
+
const isEmpty = tokens.tag === '' && tokens.name === '' && tokens.type === '' && tokens.description === '';
|
|
39
|
+
// dangling '*/'
|
|
40
|
+
if (tokens.end === markers.end && isEmpty) {
|
|
41
|
+
tokens.start = space(w.start + 1);
|
|
42
|
+
return Object.assign(Object.assign({}, line), {
|
|
43
|
+
tokens
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
switch (tokens.delimiter) {
|
|
47
|
+
case markers.start:
|
|
48
|
+
tokens.start = space(w.start);
|
|
49
|
+
break;
|
|
50
|
+
case markers.delim:
|
|
51
|
+
tokens.start = space(w.start + 1);
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
tokens.delimiter = '';
|
|
55
|
+
tokens.start = space(w.start + 2);
|
|
56
|
+
// compensate delimiter
|
|
57
|
+
}
|
|
58
|
+
if (!intoTags) {
|
|
59
|
+
tokens.postDelimiter = tokens.description === '' ? '' : ' ';
|
|
60
|
+
return Object.assign(Object.assign({}, line), {
|
|
61
|
+
tokens
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const nothingAfter = {
|
|
65
|
+
delim: false,
|
|
66
|
+
tag: false,
|
|
67
|
+
type: false,
|
|
68
|
+
name: false
|
|
69
|
+
};
|
|
70
|
+
if (tokens.description === '') {
|
|
71
|
+
nothingAfter.name = true;
|
|
72
|
+
tokens.postName = '';
|
|
73
|
+
if (tokens.name === '') {
|
|
74
|
+
nothingAfter.type = true;
|
|
75
|
+
tokens.postType = '';
|
|
76
|
+
if (tokens.type === '') {
|
|
77
|
+
nothingAfter.tag = true;
|
|
78
|
+
tokens.postTag = '';
|
|
79
|
+
if (tokens.tag === '') {
|
|
80
|
+
nothingAfter.delim = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
tokens.postDelimiter = nothingAfter.delim ? '' : ' ';
|
|
86
|
+
if (!nothingAfter.tag) tokens.postTag = space(w.tag - tokens.tag.length + 1);
|
|
87
|
+
if (!nothingAfter.type) tokens.postType = space(w.type - tokens.type.length + 1);
|
|
88
|
+
if (!nothingAfter.name) tokens.postName = space(w.name - tokens.name.length + 1);
|
|
89
|
+
return Object.assign(Object.assign({}, line), {
|
|
90
|
+
tokens
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return _a => {
|
|
94
|
+
var {
|
|
95
|
+
source
|
|
96
|
+
} = _a,
|
|
97
|
+
fields = __rest(_a, ["source"]);
|
|
98
|
+
w = source.reduce(getWidth(markers), Object.assign({}, zeroWidth));
|
|
99
|
+
return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), {
|
|
100
|
+
source: source.map(update)
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=align.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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) }));\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,KAAK;AACv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,GAAGD,EAAE;MAAEE,MAAM,GAAGrD,MAAM,CAACmD,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACpDrB,CAAC,GAAGsB,MAAM,CAACE,MAAM,CAAC3B,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":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.default = crlf;
|
|
15
|
+
const util_js_1 = require("../util.cjs");
|
|
16
|
+
const order = ['end', 'description', 'postType', 'type', 'postName', 'name', 'postTag', 'tag', 'postDelimiter', 'delimiter', 'start'];
|
|
17
|
+
function crlf(ending) {
|
|
18
|
+
function update(line) {
|
|
19
|
+
return Object.assign(Object.assign({}, line), {
|
|
20
|
+
tokens: Object.assign(Object.assign({}, line.tokens), {
|
|
21
|
+
lineEnd: ending === 'LF' ? '' : '\r'
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return _a => {
|
|
26
|
+
var {
|
|
27
|
+
source
|
|
28
|
+
} = _a,
|
|
29
|
+
fields = __rest(_a, ["source"]);
|
|
30
|
+
return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), {
|
|
31
|
+
source: source.map(update)
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=crlf.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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.rewire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AAM,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":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.default = indent;
|
|
15
|
+
const util_js_1 = require("../util.cjs");
|
|
16
|
+
const pull = offset => str => str.slice(offset);
|
|
17
|
+
const push = offset => {
|
|
18
|
+
const space = ''.padStart(offset, ' ');
|
|
19
|
+
return str => str + space;
|
|
20
|
+
};
|
|
21
|
+
function indent(pos) {
|
|
22
|
+
let shift;
|
|
23
|
+
const pad = start => {
|
|
24
|
+
if (shift === undefined) {
|
|
25
|
+
const offset = pos - start.length;
|
|
26
|
+
shift = offset > 0 ? push(offset) : pull(-offset);
|
|
27
|
+
}
|
|
28
|
+
return shift(start);
|
|
29
|
+
};
|
|
30
|
+
const update = line => Object.assign(Object.assign({}, line), {
|
|
31
|
+
tokens: Object.assign(Object.assign({}, line.tokens), {
|
|
32
|
+
start: pad(line.tokens.start)
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
return _a => {
|
|
36
|
+
var {
|
|
37
|
+
source
|
|
38
|
+
} = _a,
|
|
39
|
+
fields = __rest(_a, ["source"]);
|
|
40
|
+
return (0, util_js_1.rewireSource)(Object.assign(Object.assign({}, fields), {
|
|
41
|
+
source: source.map(update)
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=indent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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,qBAA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AAC8B,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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|