@speleotica/frcsdata 4.3.1 → 5.0.0-beta.1
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/ParseIssue.d.ts +98 -0
- package/ParseIssue.d.ts.map +1 -0
- package/ParseIssue.js +17 -0
- package/ParseIssue.js.map +1 -0
- package/SourceLoc.d.ts +67 -0
- package/SourceLoc.d.ts.map +1 -0
- package/SourceLoc.js +18 -0
- package/SourceLoc.js.map +1 -0
- package/chunksToLines.d.ts +5 -0
- package/chunksToLines.d.ts.map +1 -0
- package/chunksToLines.js +139 -0
- package/chunksToLines.js.map +1 -0
- package/cli/check-survey.d.ts +2 -0
- package/cli/check-survey.d.ts.map +1 -0
- package/cli/check-survey.js +88 -0
- package/cli/check-survey.js.map +1 -0
- package/cli/parse-survey.d.ts +2 -0
- package/cli/parse-survey.d.ts.map +1 -0
- package/cli/parse-survey.js +37 -0
- package/cli/parse-survey.js.map +1 -0
- package/cli.d.ts +2 -0
- package/cli.d.ts.map +1 -0
- package/cli.js +83 -0
- package/cli.js.map +1 -0
- package/index.d.ts +5 -7
- package/index.d.ts.map +1 -1
- package/index.js +3 -36
- package/index.js.map +1 -1
- package/node/index.d.ts +1 -1
- package/node/index.d.ts.map +1 -1
- package/node/index.js +13 -5
- package/node/index.js.map +1 -1
- package/package.json +8 -6
- package/src/ParseIssue.ts +19 -0
- package/src/SourceLoc.ts +13 -0
- package/src/chunksToLines.ts +26 -0
- package/src/cli/check-survey.ts +84 -0
- package/src/cli/parse-survey.ts +10 -0
- package/src/cli.ts +30 -0
- package/src/index.ts +9 -7
- package/src/node/index.ts +18 -5
- package/src/string/index.ts +18 -5
- package/src/survey/FrcsSurveyFile.ts +217 -0
- package/src/survey/FrcsSurveyFileJson.ts +46 -0
- package/src/survey/ZodFrcsSurveyFileJson.ts +260 -0
- package/src/survey/ZodFrcsSurveyFileToJson.ts +297 -0
- package/src/{formatFrcsShot.ts → survey/formatFrcsShot.ts} +39 -22
- package/src/{formatFrcsSurveyFile.ts → survey/formatFrcsSurveyFile.ts} +4 -5
- package/src/survey/getColumnRanges.ts +82 -0
- package/src/survey/normalizeTeamMemberName.ts +10 -0
- package/src/survey/parseFrcsSurveyFile.ts +862 -0
- package/src/survey/parsers.ts +128 -0
- package/src/survey/validators.ts +24 -0
- package/src/underlineSource.ts +34 -0
- package/src/web/index.ts +27 -21
- package/string/index.d.ts +1 -1
- package/string/index.d.ts.map +1 -1
- package/string/index.js +13 -5
- package/string/index.js.map +1 -1
- package/survey/FrcsSurveyFile.d.ts +172 -0
- package/survey/FrcsSurveyFile.d.ts.map +1 -0
- package/{FrcsSurveyFile.js → survey/FrcsSurveyFile.js} +2 -0
- package/survey/FrcsSurveyFile.js.map +1 -0
- package/survey/FrcsSurveyFileJson.d.ts +15 -0
- package/survey/FrcsSurveyFileJson.d.ts.map +1 -0
- package/{FrcsTrip.js → survey/FrcsSurveyFileJson.js} +1 -1
- package/survey/FrcsSurveyFileJson.js.map +1 -0
- package/survey/ZodFrcsSurveyFileJson.d.ts +60549 -0
- package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -0
- package/survey/ZodFrcsSurveyFileJson.js +188 -0
- package/survey/ZodFrcsSurveyFileJson.js.map +1 -0
- package/survey/ZodFrcsSurveyFileToJson.d.ts +60390 -0
- package/survey/ZodFrcsSurveyFileToJson.d.ts.map +1 -0
- package/survey/ZodFrcsSurveyFileToJson.js +219 -0
- package/survey/ZodFrcsSurveyFileToJson.js.map +1 -0
- package/{formatFrcsShot.d.ts → survey/formatFrcsShot.d.ts} +2 -3
- package/survey/formatFrcsShot.d.ts.map +1 -0
- package/{formatFrcsShot.js → survey/formatFrcsShot.js} +15 -6
- package/survey/formatFrcsShot.js.map +1 -0
- package/survey/formatFrcsSurveyFile.d.ts +3 -0
- package/survey/formatFrcsSurveyFile.d.ts.map +1 -0
- package/{formatFrcsSurveyFile.js → survey/formatFrcsSurveyFile.js} +4 -4
- package/survey/formatFrcsSurveyFile.js.map +1 -0
- package/survey/getColumnRanges.d.ts +24 -0
- package/survey/getColumnRanges.d.ts.map +1 -0
- package/survey/getColumnRanges.js +70 -0
- package/survey/getColumnRanges.js.map +1 -0
- package/survey/normalizeTeamMemberName.d.ts +2 -0
- package/survey/normalizeTeamMemberName.d.ts.map +1 -0
- package/survey/normalizeTeamMemberName.js +16 -0
- package/survey/normalizeTeamMemberName.js.map +1 -0
- package/{parseFrcsSurveyFile.d.ts → survey/parseFrcsSurveyFile.d.ts} +2 -5
- package/survey/parseFrcsSurveyFile.d.ts.map +1 -0
- package/survey/parseFrcsSurveyFile.js +818 -0
- package/survey/parseFrcsSurveyFile.js.map +1 -0
- package/survey/parsers.d.ts +11 -0
- package/survey/parsers.d.ts.map +1 -0
- package/survey/parsers.js +119 -0
- package/survey/parsers.js.map +1 -0
- package/survey/validators.d.ts +7 -0
- package/survey/validators.d.ts.map +1 -0
- package/survey/validators.js +36 -0
- package/survey/validators.js.map +1 -0
- package/underlineSource.d.ts +6 -0
- package/underlineSource.d.ts.map +1 -0
- package/underlineSource.js +30 -0
- package/underlineSource.js.map +1 -0
- package/web/index.d.ts +6 -6
- package/web/index.d.ts.map +1 -1
- package/web/index.js +9 -7
- package/web/index.js.map +1 -1
- package/FrcsShot.d.ts +0 -57
- package/FrcsShot.d.ts.map +0 -1
- package/FrcsShot.js +0 -13
- package/FrcsShot.js.map +0 -1
- package/FrcsSurveyFile.d.ts +0 -29
- package/FrcsSurveyFile.d.ts.map +0 -1
- package/FrcsSurveyFile.js.map +0 -1
- package/FrcsTrip.d.ts +0 -23
- package/FrcsTrip.d.ts.map +0 -1
- package/FrcsTrip.js.map +0 -1
- package/formatFrcsShot.d.ts.map +0 -1
- package/formatFrcsShot.js.map +0 -1
- package/formatFrcsSurveyFile.d.ts +0 -3
- package/formatFrcsSurveyFile.d.ts.map +0 -1
- package/formatFrcsSurveyFile.js.map +0 -1
- package/parseFrcsSurveyFile.d.ts.map +0 -1
- package/parseFrcsSurveyFile.js +0 -812
- package/parseFrcsSurveyFile.js.map +0 -1
- package/src/FrcsShot.ts +0 -56
- package/src/FrcsSurveyFile.ts +0 -47
- package/src/FrcsTrip.ts +0 -25
- package/src/parseFrcsSurveyFile.ts +0 -788
package/ParseIssue.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { SourceLoc } from './SourceLoc';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
export declare const ParseIssueSeverity: z.ZodEnum<["error", "warning"]>;
|
|
4
|
+
export type ParseIssueSeverity = z.output<typeof ParseIssueSeverity>;
|
|
5
|
+
export declare const ParseIssue: z.ZodObject<{
|
|
6
|
+
type: z.ZodEnum<["error", "warning"]>;
|
|
7
|
+
code: z.ZodString;
|
|
8
|
+
message: z.ZodOptional<z.ZodString>;
|
|
9
|
+
loc: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
start: z.ZodObject<{
|
|
11
|
+
line: z.ZodNumber;
|
|
12
|
+
column: z.ZodNumber;
|
|
13
|
+
index: z.ZodNumber;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
line: number;
|
|
16
|
+
column: number;
|
|
17
|
+
index: number;
|
|
18
|
+
}, {
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
index: number;
|
|
22
|
+
}>;
|
|
23
|
+
end: z.ZodObject<{
|
|
24
|
+
line: z.ZodNumber;
|
|
25
|
+
column: z.ZodNumber;
|
|
26
|
+
index: z.ZodNumber;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
index: number;
|
|
31
|
+
}, {
|
|
32
|
+
line: number;
|
|
33
|
+
column: number;
|
|
34
|
+
index: number;
|
|
35
|
+
}>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
start: {
|
|
38
|
+
line: number;
|
|
39
|
+
column: number;
|
|
40
|
+
index: number;
|
|
41
|
+
};
|
|
42
|
+
end: {
|
|
43
|
+
line: number;
|
|
44
|
+
column: number;
|
|
45
|
+
index: number;
|
|
46
|
+
};
|
|
47
|
+
}, {
|
|
48
|
+
start: {
|
|
49
|
+
line: number;
|
|
50
|
+
column: number;
|
|
51
|
+
index: number;
|
|
52
|
+
};
|
|
53
|
+
end: {
|
|
54
|
+
line: number;
|
|
55
|
+
column: number;
|
|
56
|
+
index: number;
|
|
57
|
+
};
|
|
58
|
+
}>>;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
code: string;
|
|
61
|
+
type: "error" | "warning";
|
|
62
|
+
message?: string | undefined;
|
|
63
|
+
loc?: {
|
|
64
|
+
start: {
|
|
65
|
+
line: number;
|
|
66
|
+
column: number;
|
|
67
|
+
index: number;
|
|
68
|
+
};
|
|
69
|
+
end: {
|
|
70
|
+
line: number;
|
|
71
|
+
column: number;
|
|
72
|
+
index: number;
|
|
73
|
+
};
|
|
74
|
+
} | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
code: string;
|
|
77
|
+
type: "error" | "warning";
|
|
78
|
+
message?: string | undefined;
|
|
79
|
+
loc?: {
|
|
80
|
+
start: {
|
|
81
|
+
line: number;
|
|
82
|
+
column: number;
|
|
83
|
+
index: number;
|
|
84
|
+
};
|
|
85
|
+
end: {
|
|
86
|
+
line: number;
|
|
87
|
+
column: number;
|
|
88
|
+
index: number;
|
|
89
|
+
};
|
|
90
|
+
} | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
export type ParseIssue = {
|
|
93
|
+
type: ParseIssueSeverity;
|
|
94
|
+
code: string;
|
|
95
|
+
message?: string;
|
|
96
|
+
loc?: SourceLoc;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=ParseIssue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParseIssue.d.ts","sourceRoot":"","sources":["src/ParseIssue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,eAAO,MAAM,kBAAkB,iCAA+B,CAAA;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEpE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKrB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,kBAAkB,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,SAAS,CAAA;CAChB,CAAA"}
|
package/ParseIssue.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ParseIssueSeverity = exports.ParseIssue = void 0;
|
|
8
|
+
var _SourceLoc = require("./SourceLoc.js");
|
|
9
|
+
var _zod = _interopRequireDefault(require("zod"));
|
|
10
|
+
var ParseIssueSeverity = exports.ParseIssueSeverity = _zod["default"]["enum"](['error', 'warning']);
|
|
11
|
+
var ParseIssue = exports.ParseIssue = _zod["default"].strictObject({
|
|
12
|
+
type: ParseIssueSeverity,
|
|
13
|
+
code: _zod["default"].string().nonempty(),
|
|
14
|
+
message: _zod["default"].string().optional(),
|
|
15
|
+
loc: _SourceLoc.SourceLoc.optional()
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=ParseIssue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParseIssue.js","names":["_SourceLoc","require","_zod","_interopRequireDefault","ParseIssueSeverity","exports","z","ParseIssue","strictObject","type","code","string","nonempty","message","optional","loc","SourceLoc"],"sources":["src/ParseIssue.ts"],"sourcesContent":["import { SourceLoc } from './SourceLoc'\nimport z from 'zod'\n\nexport const ParseIssueSeverity = z.enum(['error', 'warning'])\nexport type ParseIssueSeverity = z.output<typeof ParseIssueSeverity>\n\nexport const ParseIssue = z.strictObject({\n type: ParseIssueSeverity,\n code: z.string().nonempty(),\n message: z.string().optional(),\n loc: SourceLoc.optional(),\n})\n\nexport type ParseIssue = {\n type: ParseIssueSeverity\n code: string\n message?: string\n loc?: SourceLoc\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,IAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,eAAC,QAAK,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAGvD,IAAMC,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAGD,eAAC,CAACE,YAAY,CAAC;EACvCC,IAAI,EAAEL,kBAAkB;EACxBM,IAAI,EAAEJ,eAAC,CAACK,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC3BC,OAAO,EAAEP,eAAC,CAACK,MAAM,CAAC,CAAC,CAACG,QAAQ,CAAC,CAAC;EAC9BC,GAAG,EAAEC,oBAAS,CAACF,QAAQ,CAAC;AAC1B,CAAC,CAAC","ignoreList":[]}
|
package/SourceLoc.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const SourcePos: z.ZodObject<{
|
|
3
|
+
line: z.ZodNumber;
|
|
4
|
+
column: z.ZodNumber;
|
|
5
|
+
index: z.ZodNumber;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
line: number;
|
|
8
|
+
column: number;
|
|
9
|
+
index: number;
|
|
10
|
+
}, {
|
|
11
|
+
line: number;
|
|
12
|
+
column: number;
|
|
13
|
+
index: number;
|
|
14
|
+
}>;
|
|
15
|
+
export type SourcePos = z.output<typeof SourcePos>;
|
|
16
|
+
export declare const SourceLoc: z.ZodObject<{
|
|
17
|
+
start: z.ZodObject<{
|
|
18
|
+
line: z.ZodNumber;
|
|
19
|
+
column: z.ZodNumber;
|
|
20
|
+
index: z.ZodNumber;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
index: number;
|
|
25
|
+
}, {
|
|
26
|
+
line: number;
|
|
27
|
+
column: number;
|
|
28
|
+
index: number;
|
|
29
|
+
}>;
|
|
30
|
+
end: z.ZodObject<{
|
|
31
|
+
line: z.ZodNumber;
|
|
32
|
+
column: z.ZodNumber;
|
|
33
|
+
index: z.ZodNumber;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
line: number;
|
|
36
|
+
column: number;
|
|
37
|
+
index: number;
|
|
38
|
+
}, {
|
|
39
|
+
line: number;
|
|
40
|
+
column: number;
|
|
41
|
+
index: number;
|
|
42
|
+
}>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
start: {
|
|
45
|
+
line: number;
|
|
46
|
+
column: number;
|
|
47
|
+
index: number;
|
|
48
|
+
};
|
|
49
|
+
end: {
|
|
50
|
+
line: number;
|
|
51
|
+
column: number;
|
|
52
|
+
index: number;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
start: {
|
|
56
|
+
line: number;
|
|
57
|
+
column: number;
|
|
58
|
+
index: number;
|
|
59
|
+
};
|
|
60
|
+
end: {
|
|
61
|
+
line: number;
|
|
62
|
+
column: number;
|
|
63
|
+
index: number;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
export type SourceLoc = z.output<typeof SourceLoc>;
|
|
67
|
+
//# sourceMappingURL=SourceLoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceLoc.d.ts","sourceRoot":"","sources":["src/SourceLoc.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,eAAO,MAAM,SAAS;;;;;;;;;;;;EAIpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA;AAElD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAiD,CAAA;AAEvE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
package/SourceLoc.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.SourcePos = exports.SourceLoc = void 0;
|
|
8
|
+
var _zod = _interopRequireDefault(require("zod"));
|
|
9
|
+
var SourcePos = exports.SourcePos = _zod["default"].object({
|
|
10
|
+
line: _zod["default"].number()["int"]().nonnegative(),
|
|
11
|
+
column: _zod["default"].number()["int"]().nonnegative(),
|
|
12
|
+
index: _zod["default"].number()["int"]().nonnegative()
|
|
13
|
+
});
|
|
14
|
+
var SourceLoc = exports.SourceLoc = _zod["default"].object({
|
|
15
|
+
start: SourcePos,
|
|
16
|
+
end: SourcePos
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=SourceLoc.js.map
|
package/SourceLoc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceLoc.js","names":["_zod","_interopRequireDefault","require","SourcePos","exports","z","object","line","number","nonnegative","column","index","SourceLoc","start","end"],"sources":["src/SourceLoc.ts"],"sourcesContent":["import z from 'zod'\n\nexport const SourcePos = z.object({\n line: z.number().int().nonnegative(),\n column: z.number().int().nonnegative(),\n index: z.number().int().nonnegative(),\n})\n\nexport type SourcePos = z.output<typeof SourcePos>\n\nexport const SourceLoc = z.object({ start: SourcePos, end: SourcePos })\n\nexport type SourceLoc = z.output<typeof SourceLoc>\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,IAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAGE,eAAC,CAACC,MAAM,CAAC;EAChCC,IAAI,EAAEF,eAAC,CAACG,MAAM,CAAC,CAAC,OAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EACpCC,MAAM,EAAEL,eAAC,CAACG,MAAM,CAAC,CAAC,OAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EACtCE,KAAK,EAAEN,eAAC,CAACG,MAAM,CAAC,CAAC,OAAI,CAAC,CAAC,CAACC,WAAW,CAAC;AACtC,CAAC,CAAC;AAIK,IAAMG,SAAS,GAAAR,OAAA,CAAAQ,SAAA,GAAGP,eAAC,CAACC,MAAM,CAAC;EAAEO,KAAK,EAAEV,SAAS;EAAEW,GAAG,EAAEX;AAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunksToLines.d.ts","sourceRoot":"","sources":["src/chunksToLines.ts"],"names":[],"mappings":"AAAA,wBAAuB,aAAa,CAClC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC;;;kBAwBjD"}
|
package/chunksToLines.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.chunksToLines = chunksToLines;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator"));
|
|
10
|
+
var _wrapAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapAsyncGenerator"));
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
15
|
+
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
16
|
+
function chunksToLines(_x) {
|
|
17
|
+
return _chunksToLines.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
function _chunksToLines() {
|
|
20
|
+
_chunksToLines = (0, _wrapAsyncGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(chunks) {
|
|
21
|
+
var chunkStartIndex, remainder, prevChunkEndedWithCarriageReturn, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, end, rx, _iterator2, _step2, match, line;
|
|
22
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
chunkStartIndex = 0;
|
|
26
|
+
remainder = '';
|
|
27
|
+
prevChunkEndedWithCarriageReturn = false;
|
|
28
|
+
_iteratorAbruptCompletion = false;
|
|
29
|
+
_didIteratorError = false;
|
|
30
|
+
_context.prev = 5;
|
|
31
|
+
_iterator = _asyncIterator(chunks);
|
|
32
|
+
case 7:
|
|
33
|
+
_context.next = 9;
|
|
34
|
+
return (0, _awaitAsyncGenerator2["default"])(_iterator.next());
|
|
35
|
+
case 9:
|
|
36
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
|
|
37
|
+
_context.next = 42;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
chunk = _step.value;
|
|
41
|
+
if (chunk.length) {
|
|
42
|
+
_context.next = 13;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return _context.abrupt("continue", 39);
|
|
46
|
+
case 13:
|
|
47
|
+
if (remainder) {
|
|
48
|
+
chunk = remainder + chunk;
|
|
49
|
+
remainder = '';
|
|
50
|
+
}
|
|
51
|
+
end = prevChunkEndedWithCarriageReturn && chunk[0] === '\n' ? 1 : 0;
|
|
52
|
+
rx = /\r\n?|\n/gm;
|
|
53
|
+
rx.lastIndex = end;
|
|
54
|
+
_iterator2 = _createForOfIteratorHelper(chunk.matchAll(rx));
|
|
55
|
+
_context.prev = 18;
|
|
56
|
+
_iterator2.s();
|
|
57
|
+
case 20:
|
|
58
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
59
|
+
_context.next = 28;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
match = _step2.value;
|
|
63
|
+
line = chunk.substring(end, match.index);
|
|
64
|
+
_context.next = 25;
|
|
65
|
+
return {
|
|
66
|
+
line: line,
|
|
67
|
+
startIndex: chunkStartIndex + end
|
|
68
|
+
};
|
|
69
|
+
case 25:
|
|
70
|
+
end = match.index + match[0].length;
|
|
71
|
+
case 26:
|
|
72
|
+
_context.next = 20;
|
|
73
|
+
break;
|
|
74
|
+
case 28:
|
|
75
|
+
_context.next = 33;
|
|
76
|
+
break;
|
|
77
|
+
case 30:
|
|
78
|
+
_context.prev = 30;
|
|
79
|
+
_context.t0 = _context["catch"](18);
|
|
80
|
+
_iterator2.e(_context.t0);
|
|
81
|
+
case 33:
|
|
82
|
+
_context.prev = 33;
|
|
83
|
+
_iterator2.f();
|
|
84
|
+
return _context.finish(33);
|
|
85
|
+
case 36:
|
|
86
|
+
if (end < chunk.length) remainder = chunk.substring(end);
|
|
87
|
+
chunkStartIndex += end;
|
|
88
|
+
prevChunkEndedWithCarriageReturn = chunk[chunk.length - 1] === '\r';
|
|
89
|
+
case 39:
|
|
90
|
+
_iteratorAbruptCompletion = false;
|
|
91
|
+
_context.next = 7;
|
|
92
|
+
break;
|
|
93
|
+
case 42:
|
|
94
|
+
_context.next = 48;
|
|
95
|
+
break;
|
|
96
|
+
case 44:
|
|
97
|
+
_context.prev = 44;
|
|
98
|
+
_context.t1 = _context["catch"](5);
|
|
99
|
+
_didIteratorError = true;
|
|
100
|
+
_iteratorError = _context.t1;
|
|
101
|
+
case 48:
|
|
102
|
+
_context.prev = 48;
|
|
103
|
+
_context.prev = 49;
|
|
104
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
105
|
+
_context.next = 53;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
_context.next = 53;
|
|
109
|
+
return (0, _awaitAsyncGenerator2["default"])(_iterator["return"]());
|
|
110
|
+
case 53:
|
|
111
|
+
_context.prev = 53;
|
|
112
|
+
if (!_didIteratorError) {
|
|
113
|
+
_context.next = 56;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
throw _iteratorError;
|
|
117
|
+
case 56:
|
|
118
|
+
return _context.finish(53);
|
|
119
|
+
case 57:
|
|
120
|
+
return _context.finish(48);
|
|
121
|
+
case 58:
|
|
122
|
+
if (!remainder) {
|
|
123
|
+
_context.next = 61;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
_context.next = 61;
|
|
127
|
+
return {
|
|
128
|
+
line: remainder,
|
|
129
|
+
startIndex: chunkStartIndex
|
|
130
|
+
};
|
|
131
|
+
case 61:
|
|
132
|
+
case "end":
|
|
133
|
+
return _context.stop();
|
|
134
|
+
}
|
|
135
|
+
}, _callee, null, [[5, 44, 48, 58], [18, 30, 33, 36], [49,, 53, 57]]);
|
|
136
|
+
}));
|
|
137
|
+
return _chunksToLines.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=chunksToLines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunksToLines.js","names":["chunksToLines","_x","_chunksToLines","apply","arguments","_wrapAsyncGenerator2","_regenerator","mark","_callee","chunks","chunkStartIndex","remainder","prevChunkEndedWithCarriageReturn","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","chunk","end","rx","_iterator2","_step2","match","line","wrap","_callee$","_context","prev","next","_asyncIterator","_awaitAsyncGenerator2","sent","done","value","length","abrupt","lastIndex","_createForOfIteratorHelper","matchAll","s","n","substring","index","startIndex","t0","e","f","finish","t1","stop"],"sources":["src/chunksToLines.ts"],"sourcesContent":["export async function* chunksToLines(\n chunks: Iterable<string> | AsyncIterable<string>\n) {\n let chunkStartIndex = 0\n let remainder = ''\n let prevChunkEndedWithCarriageReturn = false\n for await (let chunk of chunks) {\n if (!chunk.length) continue\n if (remainder) {\n chunk = remainder + chunk\n remainder = ''\n }\n let end = prevChunkEndedWithCarriageReturn && chunk[0] === '\\n' ? 1 : 0\n const rx = /\\r\\n?|\\n/gm\n rx.lastIndex = end\n for (const match of chunk.matchAll(rx)) {\n const line = chunk.substring(end, match.index)\n yield { line, startIndex: chunkStartIndex + end }\n end = match.index + match[0].length\n }\n if (end < chunk.length) remainder = chunk.substring(end)\n chunkStartIndex += end\n prevChunkEndedWithCarriageReturn = chunk[chunk.length - 1] === '\\r'\n }\n if (remainder) yield { line: remainder, startIndex: chunkStartIndex }\n}\n"],"mappings":";;;;;;;;;;;;;;;SAAuBA,aAAaA,CAAAC,EAAA;EAAA,OAAAC,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,eAAA;EAAAA,cAAA,OAAAG,oBAAA,2BAAAC,YAAA,YAAAC,IAAA,CAA7B,SAAAC,QACLC,MAAgD;IAAA,IAAAC,eAAA,EAAAC,SAAA,EAAAC,gCAAA,EAAAC,yBAAA,EAAAC,iBAAA,EAAAC,cAAA,EAAAC,SAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,GAAA,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A,aAAAf,SAAA;QAAA;UAAAW,QAAA,CAAAC,IAAA;UAAA,KAAAd,iBAAA;YAAAa,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,MAAAd,cAAA;QAAA;UAAA,OAAAY,QAAA,CAAAqB,MAAA;QAAA;UAAA,OAAArB,QAAA,CAAAqB,MAAA;QAAA;UAAA,KAEjErC,SAAS;YAAAgB,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAAF,QAAA,CAAAE,IAAA;UAAE,OAAM;YAAEL,IAAI,EAAEb,SAAS;YAAEiC,UAAU,EAAElC;UAAgB,CAAC;QAAA;QAAA;UAAA,OAAAiB,QAAA,CAAAuB,IAAA;MAAA;IAAA,GAAA1C,OAAA;EAAA,CACtE;EAAA,OAAAN,cAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-survey.d.ts","sourceRoot":"","sources":["../../src/cli/check-survey.ts"],"names":[],"mappings":"AAMA,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,iBA6E7C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.checkSurvey = checkSurvey;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _promises = _interopRequireDefault(require("fs/promises"));
|
|
11
|
+
var _parseFrcsSurveyFile = _interopRequireDefault(require("../survey/parseFrcsSurveyFile.js"));
|
|
12
|
+
var _underlineSource = require("../underlineSource.js");
|
|
13
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
14
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
15
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /* eslint-disable no-console */
|
|
17
|
+
function checkSurvey(_x) {
|
|
18
|
+
return _checkSurvey.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
function _checkSurvey() {
|
|
21
|
+
_checkSurvey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
22
|
+
var source, parsed, issues, _iterator, _step, _loc$start, _loc$start2, issue, type, loc, message, style, errorCount, warningCount, trips, tripCount, shotCount, fmtErrorCount, fmtWarningCount, fmtTripCount, fmtShotCount, countWidth;
|
|
23
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
_context.next = 2;
|
|
27
|
+
return _promises["default"].readFile(file, 'utf8');
|
|
28
|
+
case 2:
|
|
29
|
+
source = _context.sent;
|
|
30
|
+
_context.next = 5;
|
|
31
|
+
return (0, _parseFrcsSurveyFile["default"])(file, [source]);
|
|
32
|
+
case 5:
|
|
33
|
+
parsed = _context.sent;
|
|
34
|
+
issues = parsed.issues || [];
|
|
35
|
+
_iterator = _createForOfIteratorHelper(issues);
|
|
36
|
+
try {
|
|
37
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
38
|
+
issue = _step.value;
|
|
39
|
+
type = issue.type, loc = issue.loc, message = issue.message;
|
|
40
|
+
style = type === 'error' ? _chalk["default"].red : _chalk["default"].yellow;
|
|
41
|
+
console.log("".concat(style("".concat(type === 'error' ? _chalk["default"].red('✘') : _chalk["default"].yellow('⚠'), " ").concat("".concat(type[0].toUpperCase()).concat(type.substring(1), ":").padEnd(8), " ").concat(message === null || message === void 0 ? void 0 : message.padEnd(40))), " (").concat(file, ":").concat(loc === null || loc === void 0 || (_loc$start = loc.start) === null || _loc$start === void 0 ? void 0 : _loc$start.line, ":").concat(loc === null || loc === void 0 || (_loc$start2 = loc.start) === null || _loc$start2 === void 0 ? void 0 : _loc$start2.column, ")"));
|
|
42
|
+
if (loc) {
|
|
43
|
+
console.log((0, _underlineSource.underlineSource)(source, loc, {
|
|
44
|
+
underlineStyle: style
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} catch (err) {
|
|
49
|
+
_iterator.e(err);
|
|
50
|
+
} finally {
|
|
51
|
+
_iterator.f();
|
|
52
|
+
}
|
|
53
|
+
errorCount = issues.reduce(function (count, i) {
|
|
54
|
+
return i.type === 'error' ? count + 1 : count;
|
|
55
|
+
}, 0);
|
|
56
|
+
warningCount = issues.reduce(function (count, i) {
|
|
57
|
+
return i.type === 'warning' ? count + 1 : count;
|
|
58
|
+
}, 0);
|
|
59
|
+
trips = 'INVALID' in parsed ? parsed.INVALID.trips : parsed.trips;
|
|
60
|
+
tripCount = trips.length;
|
|
61
|
+
shotCount = trips.reduce(function (count, trip) {
|
|
62
|
+
return count + ('INVALID' in trip ? trip.INVALID.shots.length : trip.shots.length);
|
|
63
|
+
}, 0);
|
|
64
|
+
fmtErrorCount = "\u2718 ".concat(errorCount);
|
|
65
|
+
fmtWarningCount = "\u26A0 ".concat(warningCount);
|
|
66
|
+
fmtTripCount = "".concat(tripCount);
|
|
67
|
+
fmtShotCount = "".concat(shotCount);
|
|
68
|
+
countWidth = Math.max(fmtErrorCount.length, fmtWarningCount.length, fmtTripCount.length, fmtShotCount.length);
|
|
69
|
+
if (errorCount) {
|
|
70
|
+
console.log(_chalk["default"].red("".concat(fmtErrorCount.padStart(countWidth), " error").concat(errorCount === 1 ? '' : 's')));
|
|
71
|
+
}
|
|
72
|
+
if (warningCount) {
|
|
73
|
+
console.log(_chalk["default"].yellow("".concat(fmtWarningCount.padStart(countWidth), " warning").concat(warningCount === 1 ? '' : 's')));
|
|
74
|
+
}
|
|
75
|
+
console.log("".concat(fmtTripCount.padStart(countWidth), " trip").concat(tripCount === 1 ? '' : 's'));
|
|
76
|
+
console.log("".concat(fmtShotCount.padStart(countWidth), " shot").concat(shotCount === 1 ? '' : 's'));
|
|
77
|
+
process.exit(issues.some(function (i) {
|
|
78
|
+
return i.type === 'error';
|
|
79
|
+
}) ? 1 : 0);
|
|
80
|
+
case 24:
|
|
81
|
+
case "end":
|
|
82
|
+
return _context.stop();
|
|
83
|
+
}
|
|
84
|
+
}, _callee);
|
|
85
|
+
}));
|
|
86
|
+
return _checkSurvey.apply(this, arguments);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=check-survey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-survey.js","names":["_promises","_interopRequireDefault","require","_parseFrcsSurveyFile","_underlineSource","_chalk","_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","_arrayLikeToArray","toString","slice","constructor","name","from","test","checkSurvey","_x","_checkSurvey","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","file","source","parsed","issues","_iterator","_step","_loc$start","_loc$start2","issue","type","loc","message","style","errorCount","warningCount","trips","tripCount","shotCount","fmtErrorCount","fmtWarningCount","fmtTripCount","fmtShotCount","countWidth","wrap","_callee$","_context","prev","fs","readFile","sent","parseFrcsSurveyFile","chalk","red","yellow","console","log","concat","toUpperCase","substring","padEnd","start","line","column","underlineSource","underlineStyle","err","reduce","count","i","INVALID","trip","shots","Math","max","padStart","process","exit","some","stop"],"sources":["../../src/cli/check-survey.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport fs from 'fs/promises'\nimport parseFrcsSurveyFile from '../survey/parseFrcsSurveyFile'\nimport { underlineSource } from '../underlineSource.js'\nimport chalk from 'chalk'\n\nexport async function checkSurvey(file: string) {\n const source = await fs.readFile(file, 'utf8')\n const parsed = await parseFrcsSurveyFile(file, [source])\n\n const issues = parsed.issues || []\n for (const issue of issues) {\n const { type, loc, message } = issue\n const style = type === 'error' ? chalk.red : chalk.yellow\n console.log(\n `${style(\n `${\n type === 'error' ? chalk.red('✘') : chalk.yellow('⚠')\n } ${`${type[0].toUpperCase()}${type.substring(1)}:`.padEnd(\n 8\n )} ${message?.padEnd(40)}`\n )} (${file}:${loc?.start?.line}:${loc?.start?.column})`\n )\n if (loc) {\n console.log(underlineSource(source, loc, { underlineStyle: style }))\n }\n }\n\n const errorCount = issues.reduce(\n (count, i) => (i.type === 'error' ? count + 1 : count),\n 0\n )\n const warningCount = issues.reduce(\n (count, i) => (i.type === 'warning' ? count + 1 : count),\n 0\n )\n const trips = 'INVALID' in parsed ? parsed.INVALID.trips : parsed.trips\n const tripCount = trips.length\n const shotCount = trips.reduce(\n (count, trip) =>\n count +\n ('INVALID' in trip ? trip.INVALID.shots.length : trip.shots.length),\n 0\n )\n\n const fmtErrorCount = `✘ ${errorCount}`\n const fmtWarningCount = `⚠ ${warningCount}`\n const fmtTripCount = `${tripCount}`\n const fmtShotCount = `${shotCount}`\n\n const countWidth = Math.max(\n fmtErrorCount.length,\n fmtWarningCount.length,\n fmtTripCount.length,\n fmtShotCount.length\n )\n\n if (errorCount) {\n console.log(\n chalk.red(\n `${fmtErrorCount.padStart(countWidth)} error${\n errorCount === 1 ? '' : 's'\n }`\n )\n )\n }\n if (warningCount) {\n console.log(\n chalk.yellow(\n `${fmtWarningCount.padStart(countWidth)} warning${\n warningCount === 1 ? '' : 's'\n }`\n )\n )\n }\n console.log(\n `${fmtTripCount.padStart(countWidth)} trip${tripCount === 1 ? '' : 's'}`\n )\n console.log(\n `${fmtShotCount.padStart(countWidth)} shot${shotCount === 1 ? '' : 's'}`\n )\n\n process.exit(issues.some((i) => i.type === 'error') ? 1 : 0)\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAyB,SAAAI,2BAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,yBAAAC,MAAA,IAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,KAAAJ,CAAA,qBAAAE,CAAA,QAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,MAAAE,CAAA,GAAAK,2BAAA,CAAAP,CAAA,MAAAC,CAAA,IAAAD,CAAA,uBAAAA,CAAA,CAAAQ,MAAA,IAAAN,CAAA,KAAAF,CAAA,GAAAE,CAAA,OAAAO,EAAA,MAAAC,CAAA,YAAAA,EAAA,eAAAC,CAAA,EAAAD,CAAA,EAAAE,CAAA,WAAAA,EAAA,WAAAH,EAAA,IAAAT,CAAA,CAAAQ,MAAA,KAAAK,IAAA,WAAAA,IAAA,MAAAC,KAAA,EAAAd,CAAA,CAA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EAAE,GAAG,GAAG,CAE/B,CACF,CAAC;UACH;UACA,IAAIC,YAAY,EAAE;YAChBoB,OAAO,CAACC,GAAG,CACTJ,iBAAK,CAACE,MAAM,IAAAG,MAAA,CACPjB,eAAe,CAACmC,QAAQ,CAAChC,UAAU,CAAC,cAAAc,MAAA,CACrCtB,YAAY,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,CAEjC,CACF,CAAC;UACH;UACAoB,OAAO,CAACC,GAAG,IAAAC,MAAA,CACNhB,YAAY,CAACkC,QAAQ,CAAChC,UAAU,CAAC,WAAAc,MAAA,CAAQpB,SAAS,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,CACxE,CAAC;UACDkB,OAAO,CAACC,GAAG,IAAAC,MAAA,CACNf,YAAY,CAACiC,QAAQ,CAAChC,UAAU,CAAC,WAAAc,MAAA,CAAQnB,SAAS,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,CACxE,CAAC;UAEDsC,OAAO,CAACC,IAAI,CAACrD,MAAM,CAACsD,IAAI,CAAC,UAACT,CAAC;YAAA,OAAKA,CAAC,CAACvC,IAAI,KAAK,OAAO;UAAA,EAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAAA;QAAA;UAAA,OAAAgB,QAAA,CAAAiC,IAAA;MAAA;IAAA,GAAA3D,OAAA;EAAA,CAC7D;EAAA,OAAAN,YAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-survey.d.ts","sourceRoot":"","sources":["../../src/cli/parse-survey.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,iBAK7C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.parseSurvey = parseSurvey;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _index = require("../node/index.js");
|
|
11
|
+
var _ZodFrcsSurveyFileToJson = require("../survey/ZodFrcsSurveyFileToJson.js");
|
|
12
|
+
/* eslint-disable no-console */
|
|
13
|
+
function parseSurvey(_x) {
|
|
14
|
+
return _parseSurvey.apply(this, arguments);
|
|
15
|
+
}
|
|
16
|
+
function _parseSurvey() {
|
|
17
|
+
_parseSurvey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
18
|
+
var parsed;
|
|
19
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
20
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
_context.t0 = _ZodFrcsSurveyFileToJson.ZodValidOrInvalidFrcsSurveyFileToJson;
|
|
23
|
+
_context.next = 3;
|
|
24
|
+
return (0, _index.parseFrcsSurveyFile)(file);
|
|
25
|
+
case 3:
|
|
26
|
+
_context.t1 = _context.sent;
|
|
27
|
+
parsed = _context.t0.parse.call(_context.t0, _context.t1);
|
|
28
|
+
console.log(JSON.stringify(parsed));
|
|
29
|
+
case 6:
|
|
30
|
+
case "end":
|
|
31
|
+
return _context.stop();
|
|
32
|
+
}
|
|
33
|
+
}, _callee);
|
|
34
|
+
}));
|
|
35
|
+
return _parseSurvey.apply(this, arguments);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=parse-survey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-survey.js","names":["_index","require","_ZodFrcsSurveyFileToJson","parseSurvey","_x","_parseSurvey","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","file","parsed","wrap","_callee$","_context","prev","next","t0","ZodValidOrInvalidFrcsSurveyFileToJson","parseFrcsSurveyFile","t1","sent","parse","call","console","log","JSON","stringify","stop"],"sources":["../../src/cli/parse-survey.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { parseFrcsSurveyFile } from '../node/index'\nimport { ZodValidOrInvalidFrcsSurveyFileToJson } from '../survey/ZodFrcsSurveyFileToJson'\n\nexport async function parseSurvey(file: string) {\n const parsed = ZodValidOrInvalidFrcsSurveyFileToJson.parse(\n await parseFrcsSurveyFile(file)\n )\n console.log(JSON.stringify(parsed))\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AAFA;AAAA,SAIsBE,WAAWA,CAAAC,EAAA;EAAA,OAAAC,YAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,aAAA;EAAAA,YAAA,OAAAG,kBAAA,2BAAAC,YAAA,YAAAC,IAAA,CAA1B,SAAAC,QAA2BC,IAAY;IAAA,IAAAC,MAAA;IAAA,OAAAJ,YAAA,YAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAAF,QAAA,CAAAG,EAAA,GAC7BC,8DAAqC;UAAAJ,QAAA,CAAAE,IAAA;UAAA,OAC5C,IAAAG,0BAAmB,EAACT,IAAI,CAAC;QAAA;UAAAI,QAAA,CAAAM,EAAA,GAAAN,QAAA,CAAAO,IAAA;UAD3BV,MAAM,GAAAG,QAAA,CAAAG,EAAA,CAAyCK,KAAK,CAAAC,IAAA,CAAAT,QAAA,CAAAG,EAAA,EAAAH,QAAA,CAAAM,EAAA;UAG1DI,OAAO,CAACC,GAAG,CAACC,IAAI,CAACC,SAAS,CAAChB,MAAM,CAAC,CAAC;QAAA;QAAA;UAAA,OAAAG,QAAA,CAAAc,IAAA;MAAA;IAAA,GAAAnB,OAAA;EAAA,CACpC;EAAA,OAAAN,YAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
|
package/cli.d.ts
ADDED
package/cli.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["src/cli.ts"],"names":[],"mappings":""}
|
package/cli.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
7
|
+
var _yargs = _interopRequireDefault(require("yargs/yargs"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
10
|
+
void (0, _yargs["default"])(process.argv.slice(2)).command({
|
|
11
|
+
command: 'check-survey <file>',
|
|
12
|
+
describe: 'check survey file for errors or warnings',
|
|
13
|
+
builder: function builder(yargs) {
|
|
14
|
+
return yargs.positional('file', {
|
|
15
|
+
type: 'string',
|
|
16
|
+
demandOption: true
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
handler: function () {
|
|
20
|
+
var _handler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
|
|
21
|
+
var file, _yield$import, checkSurvey;
|
|
22
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
file = _ref.file;
|
|
26
|
+
_context.next = 3;
|
|
27
|
+
return Promise.resolve().then(function () {
|
|
28
|
+
return _interopRequireWildcard(require("./cli/check-survey.js"));
|
|
29
|
+
});
|
|
30
|
+
case 3:
|
|
31
|
+
_yield$import = _context.sent;
|
|
32
|
+
checkSurvey = _yield$import.checkSurvey;
|
|
33
|
+
_context.next = 7;
|
|
34
|
+
return checkSurvey(file);
|
|
35
|
+
case 7:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
}));
|
|
41
|
+
function handler(_x) {
|
|
42
|
+
return _handler.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
return handler;
|
|
45
|
+
}()
|
|
46
|
+
}).command({
|
|
47
|
+
command: 'parse-survey <file>',
|
|
48
|
+
describe: 'parse survey file and output JSON parse tree',
|
|
49
|
+
builder: function builder(yargs) {
|
|
50
|
+
return yargs.positional('file', {
|
|
51
|
+
type: 'string',
|
|
52
|
+
demandOption: true
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
handler: function () {
|
|
56
|
+
var _handler2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_ref2) {
|
|
57
|
+
var file, _yield$import2, parseSurvey;
|
|
58
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
59
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
file = _ref2.file;
|
|
62
|
+
_context2.next = 3;
|
|
63
|
+
return Promise.resolve().then(function () {
|
|
64
|
+
return _interopRequireWildcard(require("./cli/parse-survey.js"));
|
|
65
|
+
});
|
|
66
|
+
case 3:
|
|
67
|
+
_yield$import2 = _context2.sent;
|
|
68
|
+
parseSurvey = _yield$import2.parseSurvey;
|
|
69
|
+
_context2.next = 7;
|
|
70
|
+
return parseSurvey(file);
|
|
71
|
+
case 7:
|
|
72
|
+
case "end":
|
|
73
|
+
return _context2.stop();
|
|
74
|
+
}
|
|
75
|
+
}, _callee2);
|
|
76
|
+
}));
|
|
77
|
+
function handler(_x2) {
|
|
78
|
+
return _handler2.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
return handler;
|
|
81
|
+
}()
|
|
82
|
+
}).demandCommand().argv;
|
|
83
|
+
//# sourceMappingURL=cli.js.map
|