podlite 0.0.83 → 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.
- package/CHANGELOG.podlite +90 -0
- package/esm/assemble/async.d.ts +31 -0
- package/esm/assemble/async.js +113 -0
- package/esm/assemble/async.js.map +1 -0
- package/esm/assemble/files.d.ts +2 -0
- package/esm/assemble/files.js +77 -0
- package/esm/assemble/files.js.map +1 -0
- package/esm/assemble/index.d.ts +59 -0
- package/esm/assemble/index.js +1003 -0
- package/esm/assemble/index.js.map +1 -0
- package/esm/cli.js +151 -26
- package/esm/cli.js.map +1 -1
- package/esm/file-format.d.ts +3 -0
- package/esm/file-format.js +53 -0
- package/esm/file-format.js.map +1 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -1
- package/esm/lint/grammar/scan.d.ts +1 -1
- package/esm/lint/grammar/scan.js +2 -1
- package/esm/lint/grammar/scan.js.map +1 -1
- package/esm/lint/index.d.ts +1 -1
- package/esm/lint/index.js +3 -3
- package/esm/lint/index.js.map +1 -1
- package/esm/lint/loader.js +5 -4
- package/esm/lint/loader.js.map +1 -1
- package/esm/lint/mute.js +2 -1
- package/esm/lint/mute.js.map +1 -1
- package/esm/lint/rules/include-resolves.d.ts +6 -0
- package/esm/lint/rules/include-resolves.js +89 -0
- package/esm/lint/rules/include-resolves.js.map +1 -0
- package/esm/lint/rules/index.js +2 -0
- package/esm/lint/rules/index.js.map +1 -1
- package/esm/lint/rules/table-shape.js +7 -1
- package/esm/lint/rules/table-shape.js.map +1 -1
- package/esm/lint/types.d.ts +6 -1
- package/esm/lint/types.js.map +1 -1
- package/esm/query-blocks.d.ts +6 -0
- package/esm/query-blocks.js +127 -0
- package/esm/query-blocks.js.map +1 -0
- package/esm/query.d.ts +2 -0
- package/esm/query.js +233 -26
- package/esm/query.js.map +1 -1
- package/esm/reader.d.ts +15 -0
- package/esm/reader.js +119 -0
- package/esm/reader.js.map +1 -0
- package/esm/refresh-tocs.d.ts +2 -0
- package/esm/refresh-tocs.js +52 -0
- package/esm/refresh-tocs.js.map +1 -0
- package/esm/resolve-includes.d.ts +27 -1
- package/esm/resolve-includes.js +80 -40
- package/esm/resolve-includes.js.map +1 -1
- package/esm/test/collect.d.ts +16 -0
- package/esm/test/collect.js +368 -0
- package/esm/test/collect.js.map +1 -0
- package/esm/test/documents.d.ts +47 -0
- package/esm/test/documents.js +211 -0
- package/esm/test/documents.js.map +1 -0
- package/esm/test/evaluate.d.ts +41 -0
- package/esm/test/evaluate.js +104 -0
- package/esm/test/evaluate.js.map +1 -0
- package/esm/test/formatters/json.d.ts +2 -0
- package/esm/test/formatters/json.js +11 -0
- package/esm/test/formatters/json.js.map +1 -0
- package/esm/test/formatters/text.d.ts +2 -0
- package/esm/test/formatters/text.js +104 -0
- package/esm/test/formatters/text.js.map +1 -0
- package/esm/test/index.d.ts +11 -0
- package/esm/test/index.js +19 -0
- package/esm/test/index.js.map +1 -0
- package/esm/test/resources.d.ts +5 -0
- package/esm/test/resources.js +45 -0
- package/esm/test/resources.js.map +1 -0
- package/esm/test/run.d.ts +52 -0
- package/esm/test/run.js +91 -0
- package/esm/test/run.js.map +1 -0
- package/esm/test/sources.d.ts +48 -0
- package/esm/test/sources.js +162 -0
- package/esm/test/sources.js.map +1 -0
- package/esm/test/types.d.ts +104 -0
- package/esm/test/types.js +3 -0
- package/esm/test/types.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/assemble/async.d.ts +31 -0
- package/lib/assemble/async.js +118 -0
- package/lib/assemble/async.js.map +1 -0
- package/lib/assemble/files.d.ts +2 -0
- package/lib/assemble/files.js +81 -0
- package/lib/assemble/files.js.map +1 -0
- package/lib/assemble/index.d.ts +59 -0
- package/lib/assemble/index.js +1013 -0
- package/lib/assemble/index.js.map +1 -0
- package/lib/cli.js +149 -24
- package/lib/cli.js.map +1 -1
- package/lib/file-format.d.ts +3 -0
- package/lib/file-format.js +58 -0
- package/lib/file-format.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +22 -1
- package/lib/index.js.map +1 -1
- package/lib/lint/grammar/scan.d.ts +1 -1
- package/lib/lint/grammar/scan.js +2 -1
- package/lib/lint/grammar/scan.js.map +1 -1
- package/lib/lint/index.d.ts +1 -1
- package/lib/lint/index.js +3 -3
- package/lib/lint/index.js.map +1 -1
- package/lib/lint/loader.js +5 -4
- package/lib/lint/loader.js.map +1 -1
- package/lib/lint/mute.js +2 -1
- package/lib/lint/mute.js.map +1 -1
- package/lib/lint/rules/include-resolves.d.ts +6 -0
- package/lib/lint/rules/include-resolves.js +92 -0
- package/lib/lint/rules/include-resolves.js.map +1 -0
- package/lib/lint/rules/index.js +2 -0
- package/lib/lint/rules/index.js.map +1 -1
- package/lib/lint/rules/table-shape.js +7 -1
- package/lib/lint/rules/table-shape.js.map +1 -1
- package/lib/lint/types.d.ts +6 -1
- package/lib/lint/types.js.map +1 -1
- package/lib/query-blocks.d.ts +6 -0
- package/lib/query-blocks.js +136 -0
- package/lib/query-blocks.js.map +1 -0
- package/lib/query.d.ts +2 -0
- package/lib/query.js +232 -25
- package/lib/query.js.map +1 -1
- package/lib/reader.d.ts +15 -0
- package/lib/reader.js +124 -0
- package/lib/reader.js.map +1 -0
- package/lib/refresh-tocs.d.ts +2 -0
- package/lib/refresh-tocs.js +56 -0
- package/lib/refresh-tocs.js.map +1 -0
- package/lib/resolve-includes.d.ts +27 -1
- package/lib/resolve-includes.js +84 -40
- package/lib/resolve-includes.js.map +1 -1
- package/lib/test/collect.d.ts +16 -0
- package/lib/test/collect.js +374 -0
- package/lib/test/collect.js.map +1 -0
- package/lib/test/documents.d.ts +47 -0
- package/lib/test/documents.js +250 -0
- package/lib/test/documents.js.map +1 -0
- package/lib/test/evaluate.d.ts +41 -0
- package/lib/test/evaluate.js +142 -0
- package/lib/test/evaluate.js.map +1 -0
- package/lib/test/formatters/json.d.ts +2 -0
- package/lib/test/formatters/json.js +15 -0
- package/lib/test/formatters/json.js.map +1 -0
- package/lib/test/formatters/text.d.ts +2 -0
- package/lib/test/formatters/text.js +141 -0
- package/lib/test/formatters/text.js.map +1 -0
- package/lib/test/index.d.ts +11 -0
- package/lib/test/index.js +31 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/resources.d.ts +5 -0
- package/lib/test/resources.js +83 -0
- package/lib/test/resources.js.map +1 -0
- package/lib/test/run.d.ts +52 -0
- package/lib/test/run.js +95 -0
- package/lib/test/run.js.map +1 -0
- package/lib/test/sources.d.ts +48 -0
- package/lib/test/sources.js +200 -0
- package/lib/test/sources.js.map +1 -0
- package/lib/test/types.d.ts +104 -0
- package/lib/test/types.js +8 -0
- package/lib/test/types.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +28 -7
|
@@ -0,0 +1,200 @@
|
|
|
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.inputsFor = exports.prepareSupplied = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const schema_1 = require("@podlite/schema");
|
|
39
|
+
const file_format_1 = require("../file-format");
|
|
40
|
+
const resolve_includes_1 = require("../resolve-includes");
|
|
41
|
+
const documents_1 = require("./documents");
|
|
42
|
+
const resources_1 = require("./resources");
|
|
43
|
+
const types_1 = require("./types");
|
|
44
|
+
const hasMask = (target) => /[*?]/.test(target);
|
|
45
|
+
// A source written without a scheme is a file.
|
|
46
|
+
const readSourceExpression = (source) => {
|
|
47
|
+
const withScheme = source.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.*)$/);
|
|
48
|
+
const scheme = withScheme ? withScheme[1] : 'file';
|
|
49
|
+
const rest = withScheme ? withScheme[2] : source;
|
|
50
|
+
const hash = rest.indexOf('#');
|
|
51
|
+
return hash === -1
|
|
52
|
+
? { scheme, document: rest }
|
|
53
|
+
: { scheme, document: rest.slice(0, hash), address: rest.slice(hash + 1) || undefined };
|
|
54
|
+
};
|
|
55
|
+
const whole = (document, input) => {
|
|
56
|
+
if (document.errors.length > 0)
|
|
57
|
+
return (0, types_1.err)({ kind: 'input-error', input, problems: document.errors });
|
|
58
|
+
const [unread] = document.unread;
|
|
59
|
+
if (unread) {
|
|
60
|
+
return (0, types_1.err)({
|
|
61
|
+
kind: 'source-unsupported',
|
|
62
|
+
input,
|
|
63
|
+
source: unread.source,
|
|
64
|
+
message: unread.message,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return (0, types_1.ok)(document);
|
|
68
|
+
};
|
|
69
|
+
// A document with an include that lost content is not the document the author
|
|
70
|
+
// wrote; nothing it lacks may pass for nothing having matched.
|
|
71
|
+
const complete = (prepared, input) => {
|
|
72
|
+
if (prepared.ok === false)
|
|
73
|
+
return (0, types_1.err)({ kind: 'implementation-error', input, message: prepared.error });
|
|
74
|
+
return whole(prepared.value, input);
|
|
75
|
+
};
|
|
76
|
+
const prepareSupplied = (file, profile) => {
|
|
77
|
+
const read = (0, documents_1.readDocument)(file);
|
|
78
|
+
if (read.ok === false) {
|
|
79
|
+
return (0, types_1.err)({
|
|
80
|
+
kind: 'source-unavailable',
|
|
81
|
+
input: 'supplied',
|
|
82
|
+
source: file,
|
|
83
|
+
base: process.cwd(),
|
|
84
|
+
message: read.error,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return complete((0, documents_1.prepareDocument)(read.value, { profile }), 'supplied');
|
|
88
|
+
};
|
|
89
|
+
exports.prepareSupplied = prepareSupplied;
|
|
90
|
+
const isNode = (value) => typeof value === 'object' && value !== null && 'type' in value && typeof value.type === 'string';
|
|
91
|
+
const addressed = (document, input, source, address) => {
|
|
92
|
+
if (!address)
|
|
93
|
+
return (0, types_1.ok)(document.tree);
|
|
94
|
+
const binding = (0, schema_1.bindTarget)(address, (0, schema_1.buildBindingIndex)(document.tree));
|
|
95
|
+
return binding.found && isNode(binding.node)
|
|
96
|
+
? (0, types_1.ok)(binding.node)
|
|
97
|
+
: (0, types_1.err)({ kind: 'address-unresolved', input, source, address });
|
|
98
|
+
};
|
|
99
|
+
// The directory a source named in the test is read from: the file the test is
|
|
100
|
+
// written in, not the document it was included into.
|
|
101
|
+
const baseOf = (test, env) => {
|
|
102
|
+
const holder = env.containing(test.obtainedFrom);
|
|
103
|
+
return holder && test.place.file === holder.name ? holder.baseDir : path.dirname(test.place.file);
|
|
104
|
+
};
|
|
105
|
+
// One test run: fixtures are read the first time an assertion needs them, and
|
|
106
|
+
// what one test declares is seen by no other.
|
|
107
|
+
/*
|
|
108
|
+
=begin pod :kind<export>
|
|
109
|
+
|
|
110
|
+
=head2 inputsFor
|
|
111
|
+
|
|
112
|
+
The document each assertion of one test run is read against: the source it names,
|
|
113
|
+
else the supplied document, else the fixture nearest before it, else the document the
|
|
114
|
+
test is in. A fixture is read the first time it is needed, and the resources of the
|
|
115
|
+
test are seen by that fixture only.
|
|
116
|
+
|
|
117
|
+
=end pod
|
|
118
|
+
*/
|
|
119
|
+
const inputsFor = (test, context, env) => {
|
|
120
|
+
const fixtures = new Map();
|
|
121
|
+
const named = new Map();
|
|
122
|
+
const provider = (0, resources_1.resourceProvider)(test.resources);
|
|
123
|
+
const fixtureDocument = (fixture) => {
|
|
124
|
+
const known = fixtures.get(fixture.index);
|
|
125
|
+
if (known)
|
|
126
|
+
return known;
|
|
127
|
+
const name = `${test.place.file}#fixture-${fixture.index}`;
|
|
128
|
+
const prepared = complete((0, documents_1.prepareDocument)({ name, text: fixture.body, baseDir: resources_1.RESOURCE_ROOT }, { profile: env.profile, provider }), 'fixture');
|
|
129
|
+
fixtures.set(fixture.index, prepared);
|
|
130
|
+
return prepared;
|
|
131
|
+
};
|
|
132
|
+
const readNamed = (document, source, base) => {
|
|
133
|
+
const file = path.resolve(base, document);
|
|
134
|
+
const key = (0, documents_1.canonical)(file);
|
|
135
|
+
let prepared = named.get(key);
|
|
136
|
+
if (!prepared) {
|
|
137
|
+
const text = resolve_includes_1.diskProvider.read(file);
|
|
138
|
+
prepared =
|
|
139
|
+
text === null
|
|
140
|
+
? (0, types_1.err)({ kind: 'source-unavailable', input: 'named', source, base, message: `cannot read ${document}` })
|
|
141
|
+
: complete((0, documents_1.prepareDocument)({ name: key, text, baseDir: path.dirname(file), self: file, format: (0, file_format_1.formatOfFile)(file) }, { profile: env.profile }), 'named');
|
|
142
|
+
named.set(key, prepared);
|
|
143
|
+
}
|
|
144
|
+
return prepared;
|
|
145
|
+
};
|
|
146
|
+
const readFile = (document) => {
|
|
147
|
+
if (hasMask(document))
|
|
148
|
+
return undefined;
|
|
149
|
+
const prepared = readNamed(document, `file:${document}`, baseOf(test, env));
|
|
150
|
+
return prepared.ok ? [{ file: prepared.value.name, node: prepared.value.tree }] : undefined;
|
|
151
|
+
};
|
|
152
|
+
const namedDocument = (source) => {
|
|
153
|
+
const base = baseOf(test, env);
|
|
154
|
+
const { scheme, document, address } = readSourceExpression(source);
|
|
155
|
+
if (scheme !== 'file') {
|
|
156
|
+
return (0, types_1.err)({ kind: 'source-unsupported', input: 'named', source, message: `scheme ${scheme}: is not read` });
|
|
157
|
+
}
|
|
158
|
+
if (hasMask(document)) {
|
|
159
|
+
return (0, types_1.err)({ kind: 'source-unsupported', input: 'named', source, message: 'a mask is not read as a source' });
|
|
160
|
+
}
|
|
161
|
+
const prepared = readNamed(document, source, base);
|
|
162
|
+
if (prepared.ok === false)
|
|
163
|
+
return prepared;
|
|
164
|
+
const target = addressed(prepared.value, 'named', source, address);
|
|
165
|
+
if (target.ok === false)
|
|
166
|
+
return target;
|
|
167
|
+
return (0, types_1.ok)({ kind: 'named', document: prepared.value, target: target.value, source, base });
|
|
168
|
+
};
|
|
169
|
+
const input = (assert) => {
|
|
170
|
+
if (assert.source !== undefined)
|
|
171
|
+
return namedDocument(assert.source);
|
|
172
|
+
if (context.kind === 'supplied') {
|
|
173
|
+
const supplied = env.supplied[context.document];
|
|
174
|
+
if (!supplied)
|
|
175
|
+
return (0, types_1.err)({ kind: 'implementation-error', input: 'supplied', message: 'no such document' });
|
|
176
|
+
if (supplied.ok === false)
|
|
177
|
+
return supplied;
|
|
178
|
+
return (0, types_1.ok)({ kind: 'supplied', document: supplied.value, target: supplied.value.tree, supplied: context.document });
|
|
179
|
+
}
|
|
180
|
+
if (assert.fixture) {
|
|
181
|
+
const fixture = fixtureDocument(assert.fixture);
|
|
182
|
+
if (fixture.ok === false)
|
|
183
|
+
return fixture;
|
|
184
|
+
return (0, types_1.ok)({ kind: 'fixture', document: fixture.value, target: fixture.value.tree, fixture: assert.fixture });
|
|
185
|
+
}
|
|
186
|
+
const holder = env.containing(context.kind === 'containing' ? context.source : test.obtainedFrom);
|
|
187
|
+
if (!holder)
|
|
188
|
+
return (0, types_1.err)({ kind: 'implementation-error', input: 'containing', message: 'the source of the test is gone' });
|
|
189
|
+
const checked = whole(holder, 'containing');
|
|
190
|
+
if (checked.ok === false)
|
|
191
|
+
return checked;
|
|
192
|
+
return (0, types_1.ok)({ kind: 'containing', document: holder, target: holder.tree });
|
|
193
|
+
};
|
|
194
|
+
return (assert) => {
|
|
195
|
+
const found = input(assert);
|
|
196
|
+
return found.ok ? (0, types_1.ok)({ ...found.value, readFile }) : found;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
exports.inputsFor = inputsFor;
|
|
200
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/test/sources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAC5B,4CAA+D;AAE/D,gDAA6C;AAE7C,0DAAkD;AAClD,2CAAsE;AAEtE,2CAA6D;AAE7D,mCAAiC;AAmCjC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAEhE,+CAA+C;AAC/C,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAA0D,EAAE;IACtG,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAA;IACnE,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,C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podlite/schema';
|
|
2
|
+
import type { IncludeProblem } from '../resolve-includes';
|
|
3
|
+
export type Result<T, E> = {
|
|
4
|
+
ok: true;
|
|
5
|
+
value: T;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
error: E;
|
|
9
|
+
};
|
|
10
|
+
export declare const ok: <T>(value: T) => {
|
|
11
|
+
ok: true;
|
|
12
|
+
value: T;
|
|
13
|
+
};
|
|
14
|
+
export declare const err: <E>(error: E) => {
|
|
15
|
+
ok: false;
|
|
16
|
+
error: E;
|
|
17
|
+
};
|
|
18
|
+
export type TestSource = {
|
|
19
|
+
kind: 'file';
|
|
20
|
+
path: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'text';
|
|
23
|
+
name: string;
|
|
24
|
+
text: string;
|
|
25
|
+
baseDir: string;
|
|
26
|
+
};
|
|
27
|
+
export type Place = {
|
|
28
|
+
file: string;
|
|
29
|
+
location?: Location;
|
|
30
|
+
};
|
|
31
|
+
export type FixtureDecl = {
|
|
32
|
+
index: number;
|
|
33
|
+
body: string;
|
|
34
|
+
place: Place;
|
|
35
|
+
};
|
|
36
|
+
export type ResourceDecl = {
|
|
37
|
+
name: string;
|
|
38
|
+
body: string;
|
|
39
|
+
place: Place;
|
|
40
|
+
};
|
|
41
|
+
export type AssertDecl = {
|
|
42
|
+
index: number;
|
|
43
|
+
expression: string;
|
|
44
|
+
absent: boolean;
|
|
45
|
+
caption?: string;
|
|
46
|
+
place: Place;
|
|
47
|
+
source?: string;
|
|
48
|
+
fixture?: FixtureDecl;
|
|
49
|
+
};
|
|
50
|
+
export type TestShape = {
|
|
51
|
+
kind: 'runnable';
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'no-assertions';
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'unknown-child';
|
|
56
|
+
name: string;
|
|
57
|
+
place: Place;
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'malformed';
|
|
60
|
+
message: string;
|
|
61
|
+
place: Place;
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'invalid';
|
|
64
|
+
message: string;
|
|
65
|
+
place: Place;
|
|
66
|
+
};
|
|
67
|
+
export type CollectedTest = {
|
|
68
|
+
key: string;
|
|
69
|
+
id?: string;
|
|
70
|
+
caption?: string;
|
|
71
|
+
place: Place;
|
|
72
|
+
obtainedFrom: number;
|
|
73
|
+
shape: TestShape;
|
|
74
|
+
asserts: AssertDecl[];
|
|
75
|
+
resources: ResourceDecl[];
|
|
76
|
+
};
|
|
77
|
+
export type CollectionProblem = {
|
|
78
|
+
kind: 'unreadable-source';
|
|
79
|
+
source: string;
|
|
80
|
+
message: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: 'include';
|
|
83
|
+
severity: 'error' | 'warning';
|
|
84
|
+
source: string;
|
|
85
|
+
problem: IncludeProblem;
|
|
86
|
+
} | {
|
|
87
|
+
kind: 'implementation-error';
|
|
88
|
+
source: string;
|
|
89
|
+
message: string;
|
|
90
|
+
};
|
|
91
|
+
export type RunContext = {
|
|
92
|
+
kind: 'fixture-or-named';
|
|
93
|
+
} | {
|
|
94
|
+
kind: 'supplied';
|
|
95
|
+
document: number;
|
|
96
|
+
} | {
|
|
97
|
+
kind: 'containing';
|
|
98
|
+
source: number;
|
|
99
|
+
};
|
|
100
|
+
export type PlannedRun = {
|
|
101
|
+
test: CollectedTest;
|
|
102
|
+
obtained: CollectedTest[];
|
|
103
|
+
context: RunContext;
|
|
104
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.err = exports.ok = void 0;
|
|
4
|
+
const ok = (value) => ({ ok: true, value });
|
|
5
|
+
exports.ok = ok;
|
|
6
|
+
const err = (error) => ({ ok: false, error });
|
|
7
|
+
exports.err = err;
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/test/types.ts"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,GAAG,CAAI,KAAQ,EAA0B,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;AAAnE,QAAA,EAAE,MAAiE;AACzE,MAAM,GAAG,GAAG,CAAI,KAAQ,EAA2B,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AAAtE,QAAA,GAAG,OAAmE"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.0.
|
|
1
|
+
export declare const version = "0.0.84";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podlite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.84",
|
|
4
4
|
"description": "Podlite markup language parser — Markdown-compatible, with native support for diagrams, formulas, and custom blocks",
|
|
5
5
|
"homepage": "https://podlite.org",
|
|
6
6
|
"repository": {
|
|
@@ -17,16 +17,36 @@
|
|
|
17
17
|
"require": "./lib/index.js",
|
|
18
18
|
"default": "./lib/index.js"
|
|
19
19
|
},
|
|
20
|
+
"./assemble": {
|
|
21
|
+
"types": "./lib/assemble/index.d.ts",
|
|
22
|
+
"import": "./esm/assemble/index.js",
|
|
23
|
+
"require": "./lib/assemble/index.js",
|
|
24
|
+
"default": "./lib/assemble/index.js"
|
|
25
|
+
},
|
|
20
26
|
"./lint": {
|
|
21
27
|
"types": "./lib/lint/index.d.ts",
|
|
22
28
|
"import": "./esm/lint/index.js",
|
|
23
29
|
"require": "./lib/lint/index.js",
|
|
24
30
|
"default": "./lib/lint/index.js"
|
|
25
31
|
},
|
|
32
|
+
"./test": {
|
|
33
|
+
"types": "./lib/test/index.d.ts",
|
|
34
|
+
"import": "./esm/test/index.js",
|
|
35
|
+
"require": "./lib/test/index.js",
|
|
36
|
+
"default": "./lib/test/index.js"
|
|
37
|
+
},
|
|
26
38
|
"./package.json": "./package.json",
|
|
27
39
|
"./lib/lint/*": {
|
|
28
40
|
"types": "./lib/lint/*.d.ts",
|
|
29
41
|
"default": "./lib/lint/*.js"
|
|
42
|
+
},
|
|
43
|
+
"./lib/query-blocks": {
|
|
44
|
+
"types": "./lib/query-blocks.d.ts",
|
|
45
|
+
"default": "./lib/query-blocks.js"
|
|
46
|
+
},
|
|
47
|
+
"./lib/refresh-tocs": {
|
|
48
|
+
"types": "./lib/refresh-tocs.d.ts",
|
|
49
|
+
"default": "./lib/refresh-tocs.js"
|
|
30
50
|
}
|
|
31
51
|
},
|
|
32
52
|
"funding": {
|
|
@@ -80,17 +100,18 @@
|
|
|
80
100
|
"url": "https://github.com/podlite/podlite/issues"
|
|
81
101
|
},
|
|
82
102
|
"dependencies": {
|
|
83
|
-
"@podlite/diagram": "^0.0.
|
|
84
|
-
"@podlite/formula": "0.0.
|
|
85
|
-
"@podlite/image": "^0.0.
|
|
86
|
-
"@podlite/markdown": "0.0.
|
|
87
|
-
"@podlite/schema": "^0.0.
|
|
88
|
-
"@podlite/toc": "0.0.
|
|
103
|
+
"@podlite/diagram": "^0.0.75",
|
|
104
|
+
"@podlite/formula": "0.0.53",
|
|
105
|
+
"@podlite/image": "^0.0.70",
|
|
106
|
+
"@podlite/markdown": "0.0.64",
|
|
107
|
+
"@podlite/schema": "^0.0.71",
|
|
108
|
+
"@podlite/toc": "0.0.64",
|
|
89
109
|
"nanoid": "3.1.30"
|
|
90
110
|
},
|
|
91
111
|
"devDependencies": {
|
|
92
112
|
"@types/jest": "^26.0.21",
|
|
93
113
|
"@types/node": "^17.0.7",
|
|
114
|
+
"esbuild": "^0.15.16",
|
|
94
115
|
"npm-run-all": "^4.1.5",
|
|
95
116
|
"pegmill": "0.1.2",
|
|
96
117
|
"typescript": "4.5.5"
|