@speleotica/frcsdata 4.3.0 → 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.
Files changed (147) hide show
  1. package/FrcsPlotFile.d.ts +1 -0
  2. package/FrcsPlotFile.d.ts.map +1 -0
  3. package/FrcsPlotFile.js +2 -1
  4. package/FrcsPlotFile.js.map +1 -0
  5. package/FrcsPlotShot.d.ts +1 -0
  6. package/FrcsPlotShot.d.ts.map +1 -0
  7. package/FrcsPlotShot.js +2 -1
  8. package/FrcsPlotShot.js.map +1 -0
  9. package/FrcsTripSummary.d.ts +1 -0
  10. package/FrcsTripSummary.d.ts.map +1 -0
  11. package/FrcsTripSummary.js +2 -1
  12. package/FrcsTripSummary.js.map +1 -0
  13. package/FrcsTripSummaryFile.d.ts +1 -0
  14. package/FrcsTripSummaryFile.d.ts.map +1 -0
  15. package/FrcsTripSummaryFile.js +2 -1
  16. package/FrcsTripSummaryFile.js.map +1 -0
  17. package/ParseIssue.d.ts +98 -0
  18. package/ParseIssue.d.ts.map +1 -0
  19. package/ParseIssue.js +17 -0
  20. package/ParseIssue.js.map +1 -0
  21. package/SourceLoc.d.ts +67 -0
  22. package/SourceLoc.d.ts.map +1 -0
  23. package/SourceLoc.js +18 -0
  24. package/SourceLoc.js.map +1 -0
  25. package/chunksToLines.d.ts +5 -0
  26. package/chunksToLines.d.ts.map +1 -0
  27. package/chunksToLines.js +139 -0
  28. package/chunksToLines.js.map +1 -0
  29. package/cli/check-survey.d.ts +2 -0
  30. package/cli/check-survey.d.ts.map +1 -0
  31. package/cli/check-survey.js +88 -0
  32. package/cli/check-survey.js.map +1 -0
  33. package/cli/parse-survey.d.ts +2 -0
  34. package/cli/parse-survey.d.ts.map +1 -0
  35. package/cli/parse-survey.js +37 -0
  36. package/cli/parse-survey.js.map +1 -0
  37. package/cli.d.ts +2 -0
  38. package/cli.d.ts.map +1 -0
  39. package/cli.js +83 -0
  40. package/cli.js.map +1 -0
  41. package/index.d.ts +6 -7
  42. package/index.d.ts.map +1 -0
  43. package/index.js +4 -36
  44. package/index.js.map +1 -0
  45. package/node/index.d.ts +2 -1
  46. package/node/index.d.ts.map +1 -0
  47. package/node/index.js +14 -5
  48. package/node/index.js.map +1 -0
  49. package/package.json +12 -7
  50. package/parseFrcsPlotFile.d.ts +1 -0
  51. package/parseFrcsPlotFile.d.ts.map +1 -0
  52. package/parseFrcsPlotFile.js +2 -1
  53. package/parseFrcsPlotFile.js.map +1 -0
  54. package/parseFrcsTripSummaryFile.d.ts +1 -0
  55. package/parseFrcsTripSummaryFile.d.ts.map +1 -0
  56. package/parseFrcsTripSummaryFile.js +2 -1
  57. package/parseFrcsTripSummaryFile.js.map +1 -0
  58. package/src/FrcsPlotFile.ts +9 -0
  59. package/src/FrcsPlotShot.ts +18 -0
  60. package/src/FrcsTripSummary.ts +14 -0
  61. package/src/FrcsTripSummaryFile.ts +7 -0
  62. package/src/ParseIssue.ts +19 -0
  63. package/src/SourceLoc.ts +13 -0
  64. package/src/chunksToLines.ts +26 -0
  65. package/src/cli/check-survey.ts +84 -0
  66. package/src/cli/parse-survey.ts +10 -0
  67. package/src/cli.ts +30 -0
  68. package/src/index.ts +31 -0
  69. package/src/node/index.ts +33 -0
  70. package/src/parseFrcsPlotFile.ts +168 -0
  71. package/src/parseFrcsTripSummaryFile.ts +76 -0
  72. package/src/string/index.ts +34 -0
  73. package/src/survey/FrcsSurveyFile.ts +217 -0
  74. package/src/survey/FrcsSurveyFileJson.ts +46 -0
  75. package/src/survey/ZodFrcsSurveyFileJson.ts +260 -0
  76. package/src/survey/ZodFrcsSurveyFileToJson.ts +297 -0
  77. package/src/survey/formatFrcsShot.ts +185 -0
  78. package/src/survey/formatFrcsSurveyFile.ts +96 -0
  79. package/src/survey/getColumnRanges.ts +82 -0
  80. package/src/survey/normalizeTeamMemberName.ts +10 -0
  81. package/src/survey/parseFrcsSurveyFile.ts +862 -0
  82. package/src/survey/parsers.ts +128 -0
  83. package/src/survey/validators.ts +24 -0
  84. package/src/underlineSource.ts +34 -0
  85. package/src/web/index.ts +125 -0
  86. package/string/index.d.ts +2 -1
  87. package/string/index.d.ts.map +1 -0
  88. package/string/index.js +14 -5
  89. package/string/index.js.map +1 -0
  90. package/survey/FrcsSurveyFile.d.ts +172 -0
  91. package/survey/FrcsSurveyFile.d.ts.map +1 -0
  92. package/{FrcsSurveyFile.js → survey/FrcsSurveyFile.js} +4 -1
  93. package/survey/FrcsSurveyFile.js.map +1 -0
  94. package/survey/FrcsSurveyFileJson.d.ts +15 -0
  95. package/survey/FrcsSurveyFileJson.d.ts.map +1 -0
  96. package/{FrcsTrip.js → survey/FrcsSurveyFileJson.js} +2 -1
  97. package/survey/FrcsSurveyFileJson.js.map +1 -0
  98. package/survey/ZodFrcsSurveyFileJson.d.ts +60549 -0
  99. package/survey/ZodFrcsSurveyFileJson.d.ts.map +1 -0
  100. package/survey/ZodFrcsSurveyFileJson.js +188 -0
  101. package/survey/ZodFrcsSurveyFileJson.js.map +1 -0
  102. package/survey/ZodFrcsSurveyFileToJson.d.ts +60390 -0
  103. package/survey/ZodFrcsSurveyFileToJson.d.ts.map +1 -0
  104. package/survey/ZodFrcsSurveyFileToJson.js +219 -0
  105. package/survey/ZodFrcsSurveyFileToJson.js.map +1 -0
  106. package/{formatFrcsShot.d.ts → survey/formatFrcsShot.d.ts} +3 -3
  107. package/survey/formatFrcsShot.d.ts.map +1 -0
  108. package/{formatFrcsShot.js → survey/formatFrcsShot.js} +13 -4
  109. package/survey/formatFrcsShot.js.map +1 -0
  110. package/survey/formatFrcsSurveyFile.d.ts +3 -0
  111. package/survey/formatFrcsSurveyFile.d.ts.map +1 -0
  112. package/{formatFrcsSurveyFile.js → survey/formatFrcsSurveyFile.js} +6 -5
  113. package/survey/formatFrcsSurveyFile.js.map +1 -0
  114. package/survey/getColumnRanges.d.ts +24 -0
  115. package/survey/getColumnRanges.d.ts.map +1 -0
  116. package/survey/getColumnRanges.js +70 -0
  117. package/survey/getColumnRanges.js.map +1 -0
  118. package/survey/normalizeTeamMemberName.d.ts +2 -0
  119. package/survey/normalizeTeamMemberName.d.ts.map +1 -0
  120. package/survey/normalizeTeamMemberName.js +16 -0
  121. package/survey/normalizeTeamMemberName.js.map +1 -0
  122. package/{parseFrcsSurveyFile.d.ts → survey/parseFrcsSurveyFile.d.ts} +3 -5
  123. package/survey/parseFrcsSurveyFile.d.ts.map +1 -0
  124. package/survey/parseFrcsSurveyFile.js +818 -0
  125. package/survey/parseFrcsSurveyFile.js.map +1 -0
  126. package/survey/parsers.d.ts +11 -0
  127. package/survey/parsers.d.ts.map +1 -0
  128. package/survey/parsers.js +119 -0
  129. package/survey/parsers.js.map +1 -0
  130. package/survey/validators.d.ts +7 -0
  131. package/survey/validators.d.ts.map +1 -0
  132. package/survey/validators.js +36 -0
  133. package/survey/validators.js.map +1 -0
  134. package/underlineSource.d.ts +6 -0
  135. package/underlineSource.d.ts.map +1 -0
  136. package/underlineSource.js +30 -0
  137. package/underlineSource.js.map +1 -0
  138. package/web/index.d.ts +7 -6
  139. package/web/index.d.ts.map +1 -0
  140. package/web/index.js +13 -10
  141. package/web/index.js.map +1 -0
  142. package/FrcsShot.d.ts +0 -56
  143. package/FrcsShot.js +0 -12
  144. package/FrcsSurveyFile.d.ts +0 -28
  145. package/FrcsTrip.d.ts +0 -22
  146. package/formatFrcsSurveyFile.d.ts +0 -2
  147. package/parseFrcsSurveyFile.js +0 -811
package/FrcsPlotFile.d.ts CHANGED
@@ -6,3 +6,4 @@ export type FrcsPlotFile = {
6
6
  shots: Array<FrcsPlotShot>;
7
7
  errors?: Array<SegmentParseError> | null;
8
8
  };
9
+ //# sourceMappingURL=FrcsPlotFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsPlotFile.d.ts","sourceRoot":"","sources":["src/FrcsPlotFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACnC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAA;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;CACzC,CAAA"}
package/FrcsPlotFile.js CHANGED
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ //# sourceMappingURL=FrcsPlotFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsPlotFile.js","names":[],"sources":["src/FrcsPlotFile.ts"],"sourcesContent":["import { UnitizedNumber, Length } from '@speleotica/unitized'\nimport { FrcsPlotShot } from './FrcsPlotShot'\nimport { SegmentParseError } from 'parse-segment'\n\nexport type FrcsPlotFile = {\n totalLength: UnitizedNumber<Length>\n shots: Array<FrcsPlotShot>\n errors?: Array<SegmentParseError> | null\n}\n"],"mappings":"","ignoreList":[]}
package/FrcsPlotShot.d.ts CHANGED
@@ -15,3 +15,4 @@ export type FrcsPlotShot = {
15
15
  down: UnitizedNumber<Length>;
16
16
  tripNumber?: number | null;
17
17
  };
18
+ //# sourceMappingURL=FrcsPlotShot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsPlotShot.d.ts","sourceRoot":"","sources":["src/FrcsPlotShot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC/B,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAChC,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACjC,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACnC,YAAY,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACpC,YAAY,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACpC,aAAa,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACrC,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC1B,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B,CAAA"}
package/FrcsPlotShot.js CHANGED
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ //# sourceMappingURL=FrcsPlotShot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsPlotShot.js","names":[],"sources":["src/FrcsPlotShot.ts"],"sourcesContent":["import { UnitizedNumber, Length } from '@speleotica/unitized'\n\nexport type FrcsPlotShot = {\n toName: string\n isSurface?: boolean | null\n fromNumber: number\n toNumber: number\n easting: UnitizedNumber<Length>\n northing: UnitizedNumber<Length>\n elevation: UnitizedNumber<Length>\n leftEasting: UnitizedNumber<Length>\n leftNorthing: UnitizedNumber<Length>\n rightEasting: UnitizedNumber<Length>\n rightNorthing: UnitizedNumber<Length>\n up: UnitizedNumber<Length>\n down: UnitizedNumber<Length>\n tripNumber?: number | null\n}\n"],"mappings":"","ignoreList":[]}
@@ -11,3 +11,4 @@ export type FrcsTripSummary = {
11
11
  team: Array<string>;
12
12
  shots: Array<string>;
13
13
  };
14
+ //# sourceMappingURL=FrcsTripSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsTripSummary.d.ts","sourceRoot":"","sources":["src/FrcsTripSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,IAAI,CAAA;IACV,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IACtC,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACnB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CACrB,CAAA"}
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ //# sourceMappingURL=FrcsTripSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsTripSummary.js","names":[],"sources":["src/FrcsTripSummary.ts"],"sourcesContent":["import { UnitizedNumber, Length } from '@speleotica/unitized'\n\nexport type FrcsTripSummary = {\n tripNumber: number\n tripIndex: number\n date: Date\n totalLength: UnitizedNumber<Length>\n numShots: number\n name: string\n excludedLength: UnitizedNumber<Length>\n numExcludedShots: number\n team: Array<string>\n shots: Array<string>\n}\n"],"mappings":"","ignoreList":[]}
@@ -4,3 +4,4 @@ export type FrcsTripSummaryFile = {
4
4
  errors?: Array<SegmentParseError> | null;
5
5
  tripSummaries: Array<FrcsTripSummary | undefined>;
6
6
  };
7
+ //# sourceMappingURL=FrcsTripSummaryFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsTripSummaryFile.d.ts","sourceRoot":"","sources":["src/FrcsTripSummaryFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACxC,aAAa,EAAE,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,CAAA;CAClD,CAAA"}
@@ -2,4 +2,5 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+ //# sourceMappingURL=FrcsTripSummaryFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FrcsTripSummaryFile.js","names":[],"sources":["src/FrcsTripSummaryFile.ts"],"sourcesContent":["import { FrcsTripSummary } from './FrcsTripSummary'\nimport { SegmentParseError } from 'parse-segment'\n\nexport type FrcsTripSummaryFile = {\n errors?: Array<SegmentParseError> | null\n tripSummaries: Array<FrcsTripSummary | undefined>\n}\n"],"mappings":"","ignoreList":[]}
@@ -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
@@ -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,5 @@
1
+ export declare function chunksToLines(chunks: Iterable<string> | AsyncIterable<string>): AsyncGenerator<{
2
+ line: string;
3
+ startIndex: number;
4
+ }, void, unknown>;
5
+ //# sourceMappingURL=chunksToLines.d.ts.map
@@ -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"}
@@ -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,EAAAC,EAAA,EAAAC,UAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,IAAA;IAAA,OAAAlB,YAAA,YAAAmB,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAE5CnB,eAAe,GAAG,CAAC;UACnBC,SAAS,GAAG,EAAE;UACdC,gCAAgC,GAAG,KAAK;UAAAC,yBAAA;UAAAC,iBAAA;UAAAa,QAAA,CAAAC,IAAA;UAAAZ,SAAA,GAAAc,cAAA,CACpBrB,MAAM;QAAA;UAAAkB,QAAA,CAAAE,IAAA;UAAA,WAAAE,qBAAA,aAAAf,SAAA,CAAAa,IAAA;QAAA;UAAA,MAAAhB,yBAAA,KAAAI,KAAA,GAAAU,QAAA,CAAAK,IAAA,EAAAC,IAAA;YAAAN,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAfX,KAAK,GAAAD,KAAA,CAAAiB,KAAA;UAAA,IACbhB,KAAK,CAACiB,MAAM;YAAAR,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,OAAAF,QAAA,CAAAS,MAAA;QAAA;UACjB,IAAIzB,SAAS,EAAE;YACbO,KAA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tBP,gCAAgC,GAAGM,KAAK,CAACA,KAAK,CAACiB,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI;QAAA;UAAAtB,yBAAA;UAAAc,QAAA,CAAAE,IAAA;UAAA;QAAA;UAAAF,QAAA,CAAAE,IAAA;UAAA;QAAA;UAAAF,QAAA,CAAAC,IAAA;UAAAD,QAAA,CAAAsB,EAAA,GAAAtB,QAAA;UAAAb,iBAAA;UAAAC,cAAA,GAAAY,QAAA,CAAAsB,EAAA;QAAA;UAAAtB,QAAA,CAAAC,IAAA;UAAAD,QAAA,CAAAC,IAAA;UAAA,MAAAf,yBAAA,IAAAG,SAAA;YAAAW,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAAF,QAAA,CAAAE,IAAA;UAAA,WAAAE,qBAAA,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,2 @@
1
+ export declare function checkSurvey(file: string): Promise<void>;
2
+ //# sourceMappingURL=check-survey.d.ts.map
@@ -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,CAAAS,EAAA,UAAAR,CAAA,WAAAA,EAAAD,CAAA,UAAAA,CAAA,KAAAe,CAAA,EAAAL,CAAA,gBAAAM,SAAA,iJAAAC,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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,2 @@
1
+ export declare function parseSurvey(file: string): Promise<void>;
2
+ //# sourceMappingURL=parse-survey.d.ts.map
@@ -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"}