podlite 0.0.82 → 0.0.84

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 (178) hide show
  1. package/CHANGELOG.podlite +95 -0
  2. package/esm/assemble/async.d.ts +31 -0
  3. package/esm/assemble/async.js +113 -0
  4. package/esm/assemble/async.js.map +1 -0
  5. package/esm/assemble/files.d.ts +2 -0
  6. package/esm/assemble/files.js +77 -0
  7. package/esm/assemble/files.js.map +1 -0
  8. package/esm/assemble/index.d.ts +59 -0
  9. package/esm/assemble/index.js +1003 -0
  10. package/esm/assemble/index.js.map +1 -0
  11. package/esm/cli.js +160 -30
  12. package/esm/cli.js.map +1 -1
  13. package/esm/file-format.d.ts +3 -0
  14. package/esm/file-format.js +53 -0
  15. package/esm/file-format.js.map +1 -0
  16. package/esm/index.d.ts +4 -0
  17. package/esm/index.js +5 -2
  18. package/esm/index.js.map +1 -1
  19. package/esm/lint/config.js +6 -2
  20. package/esm/lint/config.js.map +1 -1
  21. package/esm/lint/engine.js +1 -1
  22. package/esm/lint/grammar/scan.d.ts +1 -1
  23. package/esm/lint/grammar/scan.js +7 -6
  24. package/esm/lint/grammar/scan.js.map +1 -1
  25. package/esm/lint/index.d.ts +1 -1
  26. package/esm/lint/index.js +14 -14
  27. package/esm/lint/index.js.map +1 -1
  28. package/esm/lint/loader.js +5 -4
  29. package/esm/lint/loader.js.map +1 -1
  30. package/esm/lint/mute.js +2 -1
  31. package/esm/lint/mute.js.map +1 -1
  32. package/esm/lint/parallel.js +1 -1
  33. package/esm/lint/rules/include-resolves.d.ts +6 -0
  34. package/esm/lint/rules/include-resolves.js +89 -0
  35. package/esm/lint/rules/include-resolves.js.map +1 -0
  36. package/esm/lint/rules/index.js +12 -10
  37. package/esm/lint/rules/index.js.map +1 -1
  38. package/esm/lint/rules/link-file-resolves.js +2 -2
  39. package/esm/lint/rules/link-not-empty.js +1 -1
  40. package/esm/lint/rules/link-target-resolves.js +1 -1
  41. package/esm/lint/rules/table-shape.js +7 -1
  42. package/esm/lint/rules/table-shape.js.map +1 -1
  43. package/esm/lint/types.d.ts +6 -1
  44. package/esm/lint/types.js.map +1 -1
  45. package/esm/lint/worker.js +1 -1
  46. package/esm/query-blocks.d.ts +6 -0
  47. package/esm/query-blocks.js +127 -0
  48. package/esm/query-blocks.js.map +1 -0
  49. package/esm/query.d.ts +2 -0
  50. package/esm/query.js +233 -26
  51. package/esm/query.js.map +1 -1
  52. package/esm/reader.d.ts +15 -0
  53. package/esm/reader.js +119 -0
  54. package/esm/reader.js.map +1 -0
  55. package/esm/refresh-tocs.d.ts +2 -0
  56. package/esm/refresh-tocs.js +52 -0
  57. package/esm/refresh-tocs.js.map +1 -0
  58. package/esm/resolve-includes.d.ts +27 -1
  59. package/esm/resolve-includes.js +80 -40
  60. package/esm/resolve-includes.js.map +1 -1
  61. package/esm/test/collect.d.ts +16 -0
  62. package/esm/test/collect.js +368 -0
  63. package/esm/test/collect.js.map +1 -0
  64. package/esm/test/documents.d.ts +47 -0
  65. package/esm/test/documents.js +211 -0
  66. package/esm/test/documents.js.map +1 -0
  67. package/esm/test/evaluate.d.ts +41 -0
  68. package/esm/test/evaluate.js +104 -0
  69. package/esm/test/evaluate.js.map +1 -0
  70. package/esm/test/formatters/json.d.ts +2 -0
  71. package/esm/test/formatters/json.js +11 -0
  72. package/esm/test/formatters/json.js.map +1 -0
  73. package/esm/test/formatters/text.d.ts +2 -0
  74. package/esm/test/formatters/text.js +104 -0
  75. package/esm/test/formatters/text.js.map +1 -0
  76. package/esm/test/index.d.ts +11 -0
  77. package/esm/test/index.js +19 -0
  78. package/esm/test/index.js.map +1 -0
  79. package/esm/test/resources.d.ts +5 -0
  80. package/esm/test/resources.js +45 -0
  81. package/esm/test/resources.js.map +1 -0
  82. package/esm/test/run.d.ts +52 -0
  83. package/esm/test/run.js +91 -0
  84. package/esm/test/run.js.map +1 -0
  85. package/esm/test/sources.d.ts +48 -0
  86. package/esm/test/sources.js +162 -0
  87. package/esm/test/sources.js.map +1 -0
  88. package/esm/test/types.d.ts +104 -0
  89. package/esm/test/types.js +3 -0
  90. package/esm/test/types.js.map +1 -0
  91. package/esm/version.d.ts +1 -1
  92. package/esm/version.js +1 -1
  93. package/lib/assemble/async.d.ts +31 -0
  94. package/lib/assemble/async.js +118 -0
  95. package/lib/assemble/async.js.map +1 -0
  96. package/lib/assemble/files.d.ts +2 -0
  97. package/lib/assemble/files.js +81 -0
  98. package/lib/assemble/files.js.map +1 -0
  99. package/lib/assemble/index.d.ts +59 -0
  100. package/lib/assemble/index.js +1013 -0
  101. package/lib/assemble/index.js.map +1 -0
  102. package/lib/cli.js +154 -24
  103. package/lib/cli.js.map +1 -1
  104. package/lib/file-format.d.ts +3 -0
  105. package/lib/file-format.js +58 -0
  106. package/lib/file-format.js.map +1 -0
  107. package/lib/index.d.ts +4 -0
  108. package/lib/index.js +22 -1
  109. package/lib/index.js.map +1 -1
  110. package/lib/lint/config.js +6 -2
  111. package/lib/lint/config.js.map +1 -1
  112. package/lib/lint/grammar/scan.d.ts +1 -1
  113. package/lib/lint/grammar/scan.js +7 -3
  114. package/lib/lint/grammar/scan.js.map +1 -1
  115. package/lib/lint/index.d.ts +1 -1
  116. package/lib/lint/index.js +3 -3
  117. package/lib/lint/index.js.map +1 -1
  118. package/lib/lint/loader.js +5 -4
  119. package/lib/lint/loader.js.map +1 -1
  120. package/lib/lint/mute.js +2 -1
  121. package/lib/lint/mute.js.map +1 -1
  122. package/lib/lint/rules/include-resolves.d.ts +6 -0
  123. package/lib/lint/rules/include-resolves.js +92 -0
  124. package/lib/lint/rules/include-resolves.js.map +1 -0
  125. package/lib/lint/rules/index.js +2 -0
  126. package/lib/lint/rules/index.js.map +1 -1
  127. package/lib/lint/rules/table-shape.js +7 -1
  128. package/lib/lint/rules/table-shape.js.map +1 -1
  129. package/lib/lint/types.d.ts +6 -1
  130. package/lib/lint/types.js.map +1 -1
  131. package/lib/query-blocks.d.ts +6 -0
  132. package/lib/query-blocks.js +136 -0
  133. package/lib/query-blocks.js.map +1 -0
  134. package/lib/query.d.ts +2 -0
  135. package/lib/query.js +232 -25
  136. package/lib/query.js.map +1 -1
  137. package/lib/reader.d.ts +15 -0
  138. package/lib/reader.js +124 -0
  139. package/lib/reader.js.map +1 -0
  140. package/lib/refresh-tocs.d.ts +2 -0
  141. package/lib/refresh-tocs.js +56 -0
  142. package/lib/refresh-tocs.js.map +1 -0
  143. package/lib/resolve-includes.d.ts +27 -1
  144. package/lib/resolve-includes.js +84 -40
  145. package/lib/resolve-includes.js.map +1 -1
  146. package/lib/test/collect.d.ts +16 -0
  147. package/lib/test/collect.js +374 -0
  148. package/lib/test/collect.js.map +1 -0
  149. package/lib/test/documents.d.ts +47 -0
  150. package/lib/test/documents.js +250 -0
  151. package/lib/test/documents.js.map +1 -0
  152. package/lib/test/evaluate.d.ts +41 -0
  153. package/lib/test/evaluate.js +142 -0
  154. package/lib/test/evaluate.js.map +1 -0
  155. package/lib/test/formatters/json.d.ts +2 -0
  156. package/lib/test/formatters/json.js +15 -0
  157. package/lib/test/formatters/json.js.map +1 -0
  158. package/lib/test/formatters/text.d.ts +2 -0
  159. package/lib/test/formatters/text.js +141 -0
  160. package/lib/test/formatters/text.js.map +1 -0
  161. package/lib/test/index.d.ts +11 -0
  162. package/lib/test/index.js +31 -0
  163. package/lib/test/index.js.map +1 -0
  164. package/lib/test/resources.d.ts +5 -0
  165. package/lib/test/resources.js +83 -0
  166. package/lib/test/resources.js.map +1 -0
  167. package/lib/test/run.d.ts +52 -0
  168. package/lib/test/run.js +95 -0
  169. package/lib/test/run.js.map +1 -0
  170. package/lib/test/sources.d.ts +48 -0
  171. package/lib/test/sources.js +200 -0
  172. package/lib/test/sources.js.map +1 -0
  173. package/lib/test/types.d.ts +104 -0
  174. package/lib/test/types.js +8 -0
  175. package/lib/test/types.js.map +1 -0
  176. package/lib/version.d.ts +1 -1
  177. package/lib/version.js +1 -1
  178. package/package.json +28 -7
@@ -0,0 +1,47 @@
1
+ import type { ConfigScope, Location, ParseDiagnostic, PodliteDocument, PodNode, RecognitionEvent } from '@podlite/schema';
2
+ import type { ReadFormat } from '../file-format';
3
+ import { IncludeOrigin, IncludeProblem, SourceProvider } from '../resolve-includes';
4
+ import type { Result } from './types';
5
+ type Reader = {
6
+ toTree: (text: string, recognition: RecognitionEvent[], diagnostics: ParseDiagnostic[], config?: ConfigScope, file?: string, format?: ReadFormat) => unknown;
7
+ written: (text: string, format?: ReadFormat) => unknown;
8
+ };
9
+ export type Profile = {
10
+ name: string;
11
+ reader: () => Reader;
12
+ supports?: (selection: string) => boolean;
13
+ };
14
+ export declare const coreProfile: Profile;
15
+ export declare const schemaProfile: Profile;
16
+ export type PreparedDocument = {
17
+ name: string;
18
+ text: string;
19
+ baseDir: string;
20
+ tree: PodNode | PodliteDocument;
21
+ origin: WeakMap<object, IncludeOrigin>;
22
+ recognition: Map<string, RecognitionEvent[]>;
23
+ identify: (file: string) => string;
24
+ errors: IncludeProblem[];
25
+ warnings: IncludeProblem[];
26
+ sections: WeakMap<object, Record<string, unknown>>;
27
+ unread: Array<{
28
+ source: string;
29
+ message: string;
30
+ location?: Location;
31
+ }>;
32
+ profile: string;
33
+ };
34
+ export type DocumentText = {
35
+ name: string;
36
+ text: string;
37
+ baseDir: string;
38
+ self?: string;
39
+ format?: ReadFormat;
40
+ };
41
+ export declare const canonical: (file: string) => string;
42
+ export declare const prepareDocument: (input: DocumentText, opts: {
43
+ profile: Profile;
44
+ provider?: SourceProvider;
45
+ }) => Result<PreparedDocument, string>;
46
+ export declare const readDocument: (file: string) => Result<DocumentText, string>;
47
+ export {};
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.readDocument = exports.prepareDocument = exports.canonical = exports.schemaProfile = exports.coreProfile = void 0;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const schema_1 = require("@podlite/schema");
40
+ const index_1 = require("../index");
41
+ const refresh_tocs_1 = require("../refresh-tocs");
42
+ const reader_1 = require("../reader");
43
+ const file_format_1 = require("../file-format");
44
+ const resolve_includes_1 = require("../resolve-includes");
45
+ const types_1 = require("./types");
46
+ const readerOf = (importPlugins) => () => {
47
+ const p = (0, index_1.podlite)({ importPlugins });
48
+ const read = (0, reader_1.readerFor)(p);
49
+ return {
50
+ toTree: (text, recognition, diagnostics, config, file = '', format) => read(text, file, config, { recognition, diagnostics, format }),
51
+ written: (text, format) => (0, reader_1.writtenTree)(p, text, format),
52
+ };
53
+ };
54
+ /*
55
+ =begin pod :kind<export>
56
+
57
+ =head2 coreProfile
58
+
59
+ The profile the command uses: the plugins of this package, so a Markdown section is
60
+ read into blocks.
61
+
62
+ =end pod
63
+ */
64
+ exports.coreProfile = { name: 'core', reader: readerOf(true) };
65
+ // without the plugins of other packages: Markdown, diagrams, images
66
+ /*
67
+ =begin pod :kind<export>
68
+
69
+ =head2 schemaProfile
70
+
71
+ The parser alone, without plugins of other packages. A Markdown section stays one
72
+ block, so a test that reads into one does not hold under it.
73
+
74
+ =end pod
75
+ */
76
+ exports.schemaProfile = { name: 'schema', reader: readerOf(false) };
77
+ const canonical = (file) => {
78
+ try {
79
+ return fs.realpathSync.native(file);
80
+ }
81
+ catch {
82
+ return path.resolve(file);
83
+ }
84
+ };
85
+ exports.canonical = canonical;
86
+ // A problem that loses included content fails the input. An ambiguous address
87
+ // still brings a block, and so does a block placed as its file reads on its
88
+ // own; a =set with no target and a cycle reported for the assignments it lost
89
+ // leave the content as it was.
90
+ const isLosing = (problem) => problem.kind !== 'ambiguous' &&
91
+ problem.kind !== 'set-target' &&
92
+ problem.kind !== 'cycle' &&
93
+ problem.kind !== 'include-reading-differs' &&
94
+ problem.kind !== 'external';
95
+ const isObject = (value) => typeof value === 'object' && value !== null;
96
+ const isLocation = (value) => isObject(value) && isObject(value.start) && typeof value.start.offset === 'number';
97
+ // What in the assembled tree holds no data it should: a data table whose source
98
+ // the runner does not read, and a table whose data could not be had. A block an
99
+ // include left out does not count.
100
+ const unreadIn = (tree, place, lost, sections) => {
101
+ const found = [];
102
+ const visit = (node) => {
103
+ if (Array.isArray(node))
104
+ return node.forEach(visit);
105
+ if (!isObject(node))
106
+ return;
107
+ const location = isLocation(node.location) ? node.location : undefined;
108
+ // only a table reports lost data, and a block read out of a Markdown section
109
+ // counts its place from the section, so it matches nothing here
110
+ const table = node.type === 'block' && (node.name === 'table' || node.name === 'data-table') && !sections.has(node);
111
+ const message = table && location ? lost.get(node) : undefined;
112
+ if (message)
113
+ found.push({ source: place(node) ?? '', message, location });
114
+ if (node.type === 'block' && node.name === 'data-table') {
115
+ // the source is read the way the plugin reads it
116
+ const src = (0, schema_1.makeAttrs)(node, {}).getFirstValue('src');
117
+ if (src !== undefined && src !== null && String(src) !== '') {
118
+ found.push({
119
+ source: String(src),
120
+ message: 'a data table reads a source the runner does not read',
121
+ location,
122
+ });
123
+ }
124
+ }
125
+ visit(node.content);
126
+ };
127
+ visit(tree);
128
+ return found;
129
+ };
130
+ // The stages convert goes through: each file read and transformed on its own,
131
+ // then the includes, then the tables of contents of the document itself.
132
+ const prepareDocument = (input, opts) => {
133
+ const { name, text, baseDir } = input;
134
+ const reader = opts.profile.reader();
135
+ const recognition = new Map();
136
+ const identify = (file) => (file === name ? name : (0, exports.canonical)(file));
137
+ // Tables whose data could not be had. A file is read once for each place it
138
+ // is brought to, and the settings there decide whether its table is read, so
139
+ // the loss is kept with the table of that reading.
140
+ const lost = new WeakMap();
141
+ const markLost = (node, at) => {
142
+ if (Array.isArray(node))
143
+ return node.forEach(n => markLost(n, at));
144
+ if (!isObject(node))
145
+ return;
146
+ const message = isLocation(node.location) ? at.get(node.location.start.offset) : undefined;
147
+ if (message && node.type === 'block' && (node.name === 'table' || node.name === 'data-table')) {
148
+ lost.set(node, message);
149
+ }
150
+ markLost(node.content, at);
151
+ };
152
+ const sections = new WeakMap();
153
+ // marked per file before the includes: an address may bring in a block
154
+ // without the section around it
155
+ const markSections = (node, section) => {
156
+ if (Array.isArray(node))
157
+ return node.forEach(n => markSections(n, section));
158
+ if (!isObject(node))
159
+ return;
160
+ if (section)
161
+ sections.set(node, section);
162
+ const own = node.type === 'block' && (node.name === 'markdown' || node.name === 'Markdown') ? node : section;
163
+ markSections(node.content, own);
164
+ };
165
+ const toTree = (body, file, config, how) => {
166
+ const events = [];
167
+ const diagnostics = [];
168
+ const tree = reader.toTree(body, events, diagnostics, config, file, how?.format);
169
+ recognition.set(identify(file), events);
170
+ markSections(tree, undefined);
171
+ const at = new Map();
172
+ for (const d of diagnostics) {
173
+ if (d.code === 'table-source-unreadable' || d.code === 'table-source-deferred') {
174
+ at.set(d.location.start.offset, d.message);
175
+ }
176
+ }
177
+ if (at.size)
178
+ markLost(tree, at);
179
+ return tree;
180
+ };
181
+ const carry = (from, to) => {
182
+ const section = sections.get(from);
183
+ if (section)
184
+ sections.set(to, section);
185
+ const message = lost.get(from);
186
+ if (message)
187
+ lost.set(to, message);
188
+ };
189
+ const origin = new WeakMap();
190
+ const errors = [];
191
+ const warnings = [];
192
+ const note = (problem) => {
193
+ ;
194
+ (isLosing(problem) ? errors : warnings).push(problem);
195
+ };
196
+ try {
197
+ const resolved = (0, resolve_includes_1.resolveIncludes)(toTree(text, name, undefined, { format: input.format }), {
198
+ baseDir,
199
+ parse: toTree,
200
+ file: name,
201
+ text,
202
+ self: input.self,
203
+ origin,
204
+ onCopy: carry,
205
+ provider: opts.provider,
206
+ onError: note,
207
+ onWarning: note,
208
+ });
209
+ const tree = (0, refresh_tocs_1.refreshTocs)(resolved, reader.written(text, input.format), name, origin, carry);
210
+ const place = (node) => {
211
+ const where = origin.get(node);
212
+ return where ? identify(where.file) : undefined;
213
+ };
214
+ return (0, types_1.ok)({
215
+ name,
216
+ text,
217
+ baseDir,
218
+ tree,
219
+ origin,
220
+ recognition,
221
+ identify,
222
+ errors,
223
+ warnings,
224
+ sections,
225
+ unread: unreadIn(tree, place, lost, sections),
226
+ profile: opts.profile.name,
227
+ });
228
+ }
229
+ catch (e) {
230
+ return (0, types_1.err)(e instanceof Error ? e.message : String(e));
231
+ }
232
+ };
233
+ exports.prepareDocument = prepareDocument;
234
+ const readDocument = (file) => {
235
+ try {
236
+ const text = fs.readFileSync(file, 'utf-8');
237
+ return (0, types_1.ok)({
238
+ name: (0, exports.canonical)(file),
239
+ text,
240
+ baseDir: path.dirname(path.resolve(file)),
241
+ self: file,
242
+ format: (0, file_format_1.formatOfFile)(file),
243
+ });
244
+ }
245
+ catch (e) {
246
+ return (0, types_1.err)(e instanceof Error ? e.message : String(e));
247
+ }
248
+ };
249
+ exports.readDocument = readDocument;
250
+ //# sourceMappingUR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AI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC3C,OAAO,IAAA,UAAE,EAAC;YACR,IAAI,EAAE,IAAA,iBAAS,EAAC,IAAI,CAAC;YACrB,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAA,0BAAY,EAAC,IAAI,CAAC;SAC3B,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,IAAA,WAAG,EAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACxD,CAAC;AACH,CAAC,CAAA;AAbY,QAAA,YAAY,gBAaxB"}
@@ -0,0 +1,41 @@
1
+ import { SelectorError } from '@podlite/schema';
2
+ import type { Location } from '@podlite/schema';
3
+ import type { Profile } from './documents';
4
+ import type { AssertionInput, InputFailure, InputKind } from './sources';
5
+ import type { AssertDecl, Place, Result } from './types';
6
+ export type AssertionReason = {
7
+ kind: 'assertion-false';
8
+ } | {
9
+ kind: 'unsupported-selector';
10
+ selector: string;
11
+ } | {
12
+ kind: 'operand-unresolved';
13
+ error: SelectorError['kind'];
14
+ message: string;
15
+ } | InputFailure;
16
+ export type Evidence = {
17
+ name: string;
18
+ file: string;
19
+ location?: Location;
20
+ precision?: 'section';
21
+ };
22
+ export type AssertionResult = {
23
+ index: number;
24
+ expression: string;
25
+ absent: boolean;
26
+ caption?: string;
27
+ place: Place;
28
+ held: boolean;
29
+ input?: {
30
+ kind: InputKind;
31
+ document: string;
32
+ source?: string;
33
+ base?: string;
34
+ fixture?: Place;
35
+ };
36
+ matches?: number;
37
+ evidence: Evidence[];
38
+ reason?: AssertionReason;
39
+ };
40
+ export declare const selectionOf: (expression: string) => string;
41
+ export declare const evaluateAssertion: (assert: AssertDecl, input: Result<AssertionInput, InputFailure>, profile: Profile) => AssertionResult;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.evaluateAssertion = exports.selectionOf = void 0;
37
+ const path = __importStar(require("path"));
38
+ const schema_1 = require("@podlite/schema");
39
+ const collect_1 = require("./collect");
40
+ const resources_1 = require("./resources");
41
+ const isObject = (value) => typeof value === 'object' && value !== null;
42
+ const isLocation = (value) => isObject(value) && isObject(value.start) && typeof value.start.offset === 'number';
43
+ // A resource lives in no directory of the disk; it is shown by the name the
44
+ // test gave it.
45
+ const shownFile = (file) => {
46
+ const rel = path.relative(resources_1.RESOURCE_ROOT, file);
47
+ return rel && !rel.startsWith('..') && !path.isAbsolute(rel) ? `resource:${rel.split(path.sep).join('/')}` : file;
48
+ };
49
+ const selectionOf = (expression) => (0, collect_1.splitSource)(expression).selection;
50
+ exports.selectionOf = selectionOf;
51
+ // A selection the implementation cannot read is not a selection of nothing:
52
+ // under :absent that would pass for a test that never looked.
53
+ const usable = (selection, profile) => selection === '' || ((0, schema_1.parseSelector)(selection) !== undefined && (profile.supports?.(selection) ?? true));
54
+ const describeInput = (input) => ({
55
+ kind: input.kind,
56
+ document: input.document.name,
57
+ source: input.source,
58
+ base: input.base,
59
+ fixture: input.fixture?.place,
60
+ });
61
+ /*
62
+ =begin pod :kind<export>
63
+
64
+ =head2 evaluateAssertion
65
+
66
+ Runs one assertion over the input C<inputsFor> resolved for it. A selection the
67
+ profile cannot run and an input that could not be read both fail the assertion,
68
+ C<:absent> or not: neither is a document in which nothing matched.
69
+
70
+ =end pod
71
+ */
72
+ const evaluateAssertion = (assert, input, profile) => {
73
+ const base = {
74
+ index: assert.index,
75
+ expression: assert.expression,
76
+ absent: assert.absent,
77
+ caption: assert.caption,
78
+ place: assert.place,
79
+ };
80
+ const selection = (0, exports.selectionOf)(assert.expression);
81
+ if (!usable(selection, profile)) {
82
+ return {
83
+ ...base,
84
+ held: false,
85
+ input: input.ok === true ? describeInput(input.value) : undefined,
86
+ evidence: [],
87
+ reason: { kind: 'unsupported-selector', selector: selection },
88
+ };
89
+ }
90
+ if (input.ok === false)
91
+ return { ...base, held: false, evidence: [], reason: input.error };
92
+ const { document, target, readFile } = input.value;
93
+ let blocks;
94
+ try {
95
+ // the current document of the selection is the one the assertion is read against
96
+ const home = [{ file: document.name, node: document.tree }];
97
+ const found = selection === '' ? [target] : (0, schema_1.runSelector)(selection, [{ file: document.name, node: target }], { home, readFile });
98
+ // a selection may hand back a document it was given; only blocks count
99
+ blocks = found.filter((item) => isObject(item) && !('file' in item));
100
+ }
101
+ catch (e) {
102
+ if (e instanceof schema_1.SelectorError) {
103
+ return {
104
+ ...base,
105
+ held: false,
106
+ input: describeInput(input.value),
107
+ evidence: [],
108
+ reason: { kind: 'operand-unresolved', error: e.kind, message: e.message },
109
+ };
110
+ }
111
+ const message = e instanceof Error ? e.message : String(e);
112
+ return {
113
+ ...base,
114
+ held: false,
115
+ input: describeInput(input.value),
116
+ evidence: [],
117
+ reason: { kind: 'implementation-error', input: input.value.kind, message },
118
+ };
119
+ }
120
+ const evidence = blocks.map((block) => {
121
+ const section = document.sections.get(block);
122
+ const placed = section ?? block;
123
+ const where = document.origin.get(placed);
124
+ return {
125
+ name: typeof block.name === 'string' ? block.name : String(block.type),
126
+ file: shownFile(where ? document.identify(where.file) : document.name),
127
+ location: isLocation(placed.location) ? placed.location : undefined,
128
+ ...(section ? { precision: 'section' } : {}),
129
+ };
130
+ });
131
+ const held = assert.absent ? blocks.length === 0 : blocks.length > 0;
132
+ return {
133
+ ...base,
134
+ held,
135
+ input: describeInput(input.value),
136
+ matches: blocks.length,
137
+ evidence,
138
+ reason: held ? undefined : { kind: 'assertion-false' },
139
+ };
140
+ };
141
+ exports.evaluateAssertion = evaluateAssertion;
142
+ //# sourceMappingURL=evaluate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/test/evaluate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAC5B,4CAA2E;AAE3E,uCAAuC;AAEvC,2CAA2C;AAmD3C,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAA;AAElH,MAAM,UAAU,GAAG,CAAC,KAAc,EAAqB,EAAE,CACvD,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,KAAK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defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatJson = void 0;
4
+ /*
5
+ =begin pod :kind<export>
6
+
7
+ =head2 formatJson
8
+
9
+ The report as one JSON document.
10
+
11
+ =end pod
12
+ */
13
+ const formatJson = (report) => `${JSON.stringify(report, null, 2)}\n`;
14
+ exports.formatJson = formatJson;
15
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/test/formatters/json.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;EAQE;AACK,MAAM,UAAU,GAAG,CAAC,MAAiB,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAA;AAAlF,QAAA,UAAU,cAAwE"}
@@ -0,0 +1,2 @@
1
+ import type { RunReport } from '../run';
2
+ export declare const formatText: (report: RunReport, cwd?: string) => string;