@inka-project/inka-evidence 0.0.0-stage → 0.0.2
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +136 -2
- package/dist/merge-cli.d.ts +10 -0
- package/dist/merge-cli.js +118 -0
- package/dist/vitest.d.ts +82 -0
- package/dist/vitest.js +404 -0
- package/package.json +69 -4
- package/pkg/LICENSE-APACHE +202 -0
- package/pkg/LICENSE-MIT +21 -0
- package/pkg/README.md +137 -0
- package/pkg/inka_evidence_wasm.d.ts +117 -0
- package/pkg/inka_evidence_wasm.js +354 -0
- package/pkg/inka_evidence_wasm_bg.wasm +0 -0
- package/pkg/inka_evidence_wasm_bg.wasm.d.ts +19 -0
- package/pkg/package.json +17 -0
package/dist/vitest.js
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vitest reporter emitting inka test evidence v1.
|
|
4
|
+
*
|
|
5
|
+
* Configure it in the vitest config, which must also enable task
|
|
6
|
+
* locations so contract bodies can be sliced from the source:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* export default defineConfig({
|
|
10
|
+
* test: {
|
|
11
|
+
* includeTaskLocation: true,
|
|
12
|
+
* reporters: [
|
|
13
|
+
* ["default"],
|
|
14
|
+
* ["@inka-project/inka-evidence/vitest", { output: "evidence.json" }],
|
|
15
|
+
* ],
|
|
16
|
+
* },
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The declared set is the run's collected tests, never inferred from
|
|
21
|
+
* results: an interrupted or bailed run leaves declared executions with a
|
|
22
|
+
* missing outcome. Whenever the declared set would be unreliable — a test
|
|
23
|
+
* file that failed to collect — nothing is emitted and the reason is
|
|
24
|
+
* printed; the output path is removed when the run starts, so a leftover
|
|
25
|
+
* file can never pass for this run's evidence.
|
|
26
|
+
*
|
|
27
|
+
* The test-id is `[project] <relative path> > <describe chain> > <name>`
|
|
28
|
+
* (the project prefix only when the project is named), matching Vitest's
|
|
29
|
+
* own display. Each `test.each` instance is its own test under its
|
|
30
|
+
* formatted name. One execution per run, labeled by the `case` option
|
|
31
|
+
* (default `default`).
|
|
32
|
+
*
|
|
33
|
+
* Bodies are the whole test call expression — declaration and callback,
|
|
34
|
+
* for `test.each` the full chain including the table — sliced verbatim
|
|
35
|
+
* from the original source at the task's reported location. The resolved
|
|
36
|
+
* call is cross-checked against the task: a literal test name must match
|
|
37
|
+
* (each patterns are matched placeholder-wise), and the tagged-template
|
|
38
|
+
* `each` form is rejected outright because Vitest reports untrustworthy
|
|
39
|
+
* locations for it. Anything the slicer cannot resolve or verify is an
|
|
40
|
+
* explicit error, never a guess.
|
|
41
|
+
*/
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.SourceCache = void 0;
|
|
44
|
+
exports.patternMatches = patternMatches;
|
|
45
|
+
const node_fs_1 = require("node:fs");
|
|
46
|
+
const node_path_1 = require("node:path");
|
|
47
|
+
const parser_1 = require("@babel/parser");
|
|
48
|
+
const inka_evidence_wasm_js_1 = require("../pkg/inka_evidence_wasm.js");
|
|
49
|
+
const DEFAULT_CASE = "default";
|
|
50
|
+
class InkaEvidenceReporter {
|
|
51
|
+
options;
|
|
52
|
+
vitest;
|
|
53
|
+
constructor(options) {
|
|
54
|
+
if (!options || typeof options.output !== "string" || options.output === "") {
|
|
55
|
+
throw new TypeError("inka-evidence: the reporter needs an `output` path option");
|
|
56
|
+
}
|
|
57
|
+
this.options = { ...options, output: options.output };
|
|
58
|
+
}
|
|
59
|
+
onInit(vitest) {
|
|
60
|
+
this.vitest = vitest;
|
|
61
|
+
// A leftover file from an earlier run must never pass for this run's
|
|
62
|
+
// evidence: after a suppressed emission the path stays absent.
|
|
63
|
+
(0, node_fs_1.rmSync)(this.outputPath(), { force: true });
|
|
64
|
+
(0, node_fs_1.rmSync)(`${this.outputPath()}.tmp`, { force: true });
|
|
65
|
+
}
|
|
66
|
+
onTestRunEnd(testModules, unhandledErrors) {
|
|
67
|
+
const uncollected = testModules.filter((module) => module.errors().length > 0);
|
|
68
|
+
if (uncollected.length > 0) {
|
|
69
|
+
const names = uncollected.map((module) => module.moduleId).join(", ");
|
|
70
|
+
this.announce(`collection errors in ${names}: the declared set is unreliable, ` +
|
|
71
|
+
"no evidence was emitted");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (unhandledErrors.length > 0) {
|
|
75
|
+
// An error outside any test (an unhandled rejection, a worker crash)
|
|
76
|
+
// makes the recorded outcomes untrustworthy.
|
|
77
|
+
this.announce(`${unhandledErrors.length} unhandled error(s) outside the tests: ` +
|
|
78
|
+
"the results are unreliable, no evidence was emitted");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (!testModules.some((module) => !module.children.allTests().next().done)) {
|
|
82
|
+
this.announce("the run selected no tests, no evidence was emitted");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.emit(testModules);
|
|
86
|
+
this.announce(`wrote ${this.outputPath()}`);
|
|
87
|
+
}
|
|
88
|
+
emit(testModules) {
|
|
89
|
+
const builder = new inka_evidence_wasm_js_1.EvidenceBuilder();
|
|
90
|
+
builder.capsulaRunId(process.env.CAPSULA_RUN_ID);
|
|
91
|
+
for (const [key, value] of Object.entries(this.options.provenance ?? {})) {
|
|
92
|
+
builder.provenance(key, value);
|
|
93
|
+
}
|
|
94
|
+
const caseId = this.options.case ?? DEFAULT_CASE;
|
|
95
|
+
const sources = new SourceCache();
|
|
96
|
+
for (const module of testModules) {
|
|
97
|
+
const project = module.project.name;
|
|
98
|
+
const prefix = project ? `[${project}] ` : "";
|
|
99
|
+
const file = relativeToRoot(this.root(), module.moduleId);
|
|
100
|
+
for (const test of module.children.allTests()) {
|
|
101
|
+
const testId = `${prefix}${file} > ${test.fullName}`;
|
|
102
|
+
const location = test.location;
|
|
103
|
+
if (!location) {
|
|
104
|
+
throw new Error(`inka-evidence: ${testId} carries no location; set ` +
|
|
105
|
+
"`test.includeTaskLocation: true` in the vitest config");
|
|
106
|
+
}
|
|
107
|
+
const body = sources.slice(module.moduleId, location, testId, test.name);
|
|
108
|
+
builder.addTest(testId, body, [
|
|
109
|
+
{ case: caseId, outcome: mapOutcome(test.result().state, testId) },
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Atomic: a crash mid-write cannot leave a half-written file.
|
|
114
|
+
const output = this.outputPath();
|
|
115
|
+
const scratch = `${output}.tmp`;
|
|
116
|
+
(0, node_fs_1.writeFileSync)(scratch, builder.finish(), "utf8");
|
|
117
|
+
(0, node_fs_1.renameSync)(scratch, output);
|
|
118
|
+
}
|
|
119
|
+
root() {
|
|
120
|
+
if (this.vitest === undefined) {
|
|
121
|
+
throw new Error("inka-evidence: the reporter was never initialized");
|
|
122
|
+
}
|
|
123
|
+
return this.vitest.config.root;
|
|
124
|
+
}
|
|
125
|
+
outputPath() {
|
|
126
|
+
const output = this.options.output;
|
|
127
|
+
return (0, node_path_1.isAbsolute)(output) ? output : (0, node_path_1.join)(this.root(), output);
|
|
128
|
+
}
|
|
129
|
+
announce(message) {
|
|
130
|
+
this.vitest?.logger.log(`inka-evidence: ${message}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.default = InkaEvidenceReporter;
|
|
134
|
+
/**
|
|
135
|
+
* Maps Vitest's final state onto the wire vocabulary; `pending` means the
|
|
136
|
+
* run never reported the test (bail, interrupt) — a missing result.
|
|
137
|
+
*/
|
|
138
|
+
function mapOutcome(state, testId) {
|
|
139
|
+
switch (state) {
|
|
140
|
+
case "passed":
|
|
141
|
+
return "pass";
|
|
142
|
+
case "failed":
|
|
143
|
+
return "fail";
|
|
144
|
+
case "skipped":
|
|
145
|
+
return "skip";
|
|
146
|
+
case "pending":
|
|
147
|
+
return undefined;
|
|
148
|
+
default:
|
|
149
|
+
throw new Error(`inka-evidence: ${testId} reports the unknown state \`${state}\``);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function relativeToRoot(root, moduleId) {
|
|
153
|
+
const prefix = root.endsWith("/") ? root : `${root}/`;
|
|
154
|
+
if (!moduleId.startsWith(prefix)) {
|
|
155
|
+
// An absolute fallback would make the test-id machine-specific.
|
|
156
|
+
throw new Error(`inka-evidence: ${moduleId} lies outside the vitest root ${root}; ` +
|
|
157
|
+
"its test-id would not be stable");
|
|
158
|
+
}
|
|
159
|
+
return moduleId.slice(prefix.length);
|
|
160
|
+
}
|
|
161
|
+
class SourceCache {
|
|
162
|
+
cache = new Map();
|
|
163
|
+
/**
|
|
164
|
+
* The verbatim text of the test call expression at `location`.
|
|
165
|
+
*
|
|
166
|
+
* The resolved call is verified against the task's name: Vitest has been
|
|
167
|
+
* observed to report a wrong location for the tagged-template `each`
|
|
168
|
+
* form, which can land on a neighboring test — a body mismatch must be
|
|
169
|
+
* an error, never silently recorded evidence.
|
|
170
|
+
*/
|
|
171
|
+
slice(moduleId, location, testId, testName) {
|
|
172
|
+
const source = this.load(moduleId);
|
|
173
|
+
const lineStart = source.lineStarts[location.line - 1];
|
|
174
|
+
if (lineStart === undefined) {
|
|
175
|
+
throw new Error(`inka-evidence: ${testId} points at ${moduleId}:${location.line}, ` +
|
|
176
|
+
"which is past the end of the file");
|
|
177
|
+
}
|
|
178
|
+
const offset = lineStart + location.column - 1;
|
|
179
|
+
const call = testCallAt(source.ast, offset);
|
|
180
|
+
if (call === null || call.start === null || call.end === null) {
|
|
181
|
+
throw new Error(`inka-evidence: no call expression at ${moduleId}:${location.line}:` +
|
|
182
|
+
`${location.column} for ${testId}`);
|
|
183
|
+
}
|
|
184
|
+
verifyCall(call, testId, testName);
|
|
185
|
+
return source.text.slice(call.start, call.end);
|
|
186
|
+
}
|
|
187
|
+
load(moduleId) {
|
|
188
|
+
const cached = this.cache.get(moduleId);
|
|
189
|
+
if (cached !== undefined) {
|
|
190
|
+
return cached;
|
|
191
|
+
}
|
|
192
|
+
const text = (0, node_fs_1.readFileSync)(moduleId, "utf8");
|
|
193
|
+
const ast = (0, parser_1.parse)(text, {
|
|
194
|
+
sourceType: "unambiguous",
|
|
195
|
+
plugins: pluginsFor(moduleId),
|
|
196
|
+
attachComment: false,
|
|
197
|
+
});
|
|
198
|
+
const lineStarts = [0];
|
|
199
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
200
|
+
if (text[index] === "\n") {
|
|
201
|
+
lineStarts.push(index + 1);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const parsed = { text, lineStarts, ast };
|
|
205
|
+
this.cache.set(moduleId, parsed);
|
|
206
|
+
return parsed;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.SourceCache = SourceCache;
|
|
210
|
+
function pluginsFor(path) {
|
|
211
|
+
if (path.endsWith(".tsx")) {
|
|
212
|
+
return ["typescript", "jsx"];
|
|
213
|
+
}
|
|
214
|
+
if (/\.(ts|mts|cts)$/.test(path)) {
|
|
215
|
+
return ["typescript"];
|
|
216
|
+
}
|
|
217
|
+
if (path.endsWith(".jsx")) {
|
|
218
|
+
return ["jsx"];
|
|
219
|
+
}
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The test call expression owning `offset`.
|
|
224
|
+
*
|
|
225
|
+
* Vitest's task location points inside the call — at the callee for
|
|
226
|
+
* `test(...)`, at the modifier for `test.skip(...)`, at the argument
|
|
227
|
+
* parenthesis for `test.each(...)(...)`. Walking down to the deepest node
|
|
228
|
+
* containing the offset and climbing back out of the callee chain lands
|
|
229
|
+
* on the outermost call of that chain without ever escaping into the
|
|
230
|
+
* enclosing `describe` call, whose span also contains the offset but only
|
|
231
|
+
* through an argument.
|
|
232
|
+
*/
|
|
233
|
+
function testCallAt(root, offset) {
|
|
234
|
+
const path = [];
|
|
235
|
+
let node = contains(root, offset) ? root : null;
|
|
236
|
+
while (node !== null) {
|
|
237
|
+
path.push(node);
|
|
238
|
+
node = childNodes(node).find((child) => contains(child, offset)) ?? null;
|
|
239
|
+
}
|
|
240
|
+
let index = path.length - 1;
|
|
241
|
+
while (index > 0) {
|
|
242
|
+
const parent = path[index - 1];
|
|
243
|
+
const current = path[index];
|
|
244
|
+
if (parent.type === "MemberExpression" ||
|
|
245
|
+
(parent.type === "CallExpression" && parent.callee === current) ||
|
|
246
|
+
(parent.type === "TaggedTemplateExpression" && parent.tag === current)) {
|
|
247
|
+
index -= 1;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
const found = path[index];
|
|
253
|
+
return found !== undefined && found.type === "CallExpression" ? found : null;
|
|
254
|
+
}
|
|
255
|
+
function contains(node, offset) {
|
|
256
|
+
return (node.start !== null && node.end !== null && offset >= node.start && offset < node.end);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Verifies that the resolved call belongs to the task. A literal first
|
|
260
|
+
* argument must equal the task's name — or, for an `each`/`for` chain,
|
|
261
|
+
* match it placeholder-wise. A dynamic (non-literal) name cannot be
|
|
262
|
+
* verified and is accepted as collected. The tagged-template `each` form
|
|
263
|
+
* is rejected outright: Vitest reports untrustworthy locations for it.
|
|
264
|
+
*/
|
|
265
|
+
function verifyCall(call, testId, testName) {
|
|
266
|
+
const chain = calleeChain(call);
|
|
267
|
+
if (chain.some((node) => node.type === "TaggedTemplateExpression")) {
|
|
268
|
+
throw new Error(`inka-evidence: ${testId} uses a tagged-template each table, whose ` +
|
|
269
|
+
"reported location is untrustworthy; use the array form of each");
|
|
270
|
+
}
|
|
271
|
+
const argumentList = call.arguments;
|
|
272
|
+
const first = Array.isArray(argumentList) ? argumentList[0] : undefined;
|
|
273
|
+
if (!isNode(first)) {
|
|
274
|
+
throw new Error(`inka-evidence: the call resolved for ${testId} takes no arguments, ` +
|
|
275
|
+
"so it cannot be a test declaration; the reported location is " +
|
|
276
|
+
"untrustworthy");
|
|
277
|
+
}
|
|
278
|
+
const literal = literalValue(first);
|
|
279
|
+
if (literal === null) {
|
|
280
|
+
// A template with substitutions is a legitimate dynamic name; every
|
|
281
|
+
// other literal kind (a number, boolean, regexp, ...) cannot be one.
|
|
282
|
+
if (first.type.endsWith("Literal") && first.type !== "TemplateLiteral") {
|
|
283
|
+
throw new Error(`inka-evidence: the call resolved for ${testId} does not look like ` +
|
|
284
|
+
"a test declaration; the reported location is untrustworthy");
|
|
285
|
+
}
|
|
286
|
+
// A dynamic name (a variable, a helper call) cannot be verified and
|
|
287
|
+
// is accepted as collected.
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const eachForm = chain.some((node) => node.type === "MemberExpression" &&
|
|
291
|
+
isNode(node.property) &&
|
|
292
|
+
node.property.type === "Identifier" &&
|
|
293
|
+
(node.property.name === "each" || node.property.name === "for"));
|
|
294
|
+
const matches = eachForm
|
|
295
|
+
? patternMatches(literal, testName)
|
|
296
|
+
: literal === testName;
|
|
297
|
+
if (!matches) {
|
|
298
|
+
throw new Error(`inka-evidence: the call resolved for ${testId} declares ` +
|
|
299
|
+
`${JSON.stringify(literal)}, which does not match the task name ` +
|
|
300
|
+
`${JSON.stringify(testName)}; the reported location is untrustworthy`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/** The nodes along a call's callee chain: `test.skip.each(t)("n", f)`. */
|
|
304
|
+
function calleeChain(call) {
|
|
305
|
+
const chain = [];
|
|
306
|
+
let node = call;
|
|
307
|
+
while (node !== undefined) {
|
|
308
|
+
chain.push(node);
|
|
309
|
+
let next;
|
|
310
|
+
if (node.type === "CallExpression") {
|
|
311
|
+
next = node.callee;
|
|
312
|
+
}
|
|
313
|
+
else if (node.type === "MemberExpression") {
|
|
314
|
+
next = node.object;
|
|
315
|
+
}
|
|
316
|
+
else if (node.type === "TaggedTemplateExpression") {
|
|
317
|
+
next = node.tag;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
node = isNode(next) ? next : undefined;
|
|
323
|
+
}
|
|
324
|
+
return chain;
|
|
325
|
+
}
|
|
326
|
+
/** The compile-time value of a string literal argument, if it has one. */
|
|
327
|
+
function literalValue(node) {
|
|
328
|
+
if (node.type === "StringLiteral" && typeof node.value === "string") {
|
|
329
|
+
return node.value;
|
|
330
|
+
}
|
|
331
|
+
if (node.type === "TemplateLiteral" &&
|
|
332
|
+
Array.isArray(node.expressions) &&
|
|
333
|
+
node.expressions.length === 0 &&
|
|
334
|
+
Array.isArray(node.quasis) &&
|
|
335
|
+
node.quasis.length === 1) {
|
|
336
|
+
const quasi = node.quasis[0];
|
|
337
|
+
if (isNode(quasi)) {
|
|
338
|
+
const value = quasi.value?.cooked;
|
|
339
|
+
if (typeof value === "string") {
|
|
340
|
+
return value;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Whether an `each` name pattern can produce `name`: printf tokens and
|
|
348
|
+
* `$property` accesses match any text, everything else matches verbatim.
|
|
349
|
+
*/
|
|
350
|
+
function patternMatches(pattern, name) {
|
|
351
|
+
const printfTokens = "idfsjoc#";
|
|
352
|
+
let regex = "^";
|
|
353
|
+
let index = 0;
|
|
354
|
+
while (index < pattern.length) {
|
|
355
|
+
const char = pattern[index];
|
|
356
|
+
const next = pattern[index + 1];
|
|
357
|
+
if (char === "%" && next === "%") {
|
|
358
|
+
regex += "%";
|
|
359
|
+
index += 2;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (char === "%" && next !== undefined && printfTokens.includes(next)) {
|
|
363
|
+
regex += "[\\s\\S]*";
|
|
364
|
+
index += 2;
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (char === "$") {
|
|
368
|
+
const access = /^(#|[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*)/.exec(pattern.slice(index + 1));
|
|
369
|
+
if (access !== null) {
|
|
370
|
+
regex += "[\\s\\S]*";
|
|
371
|
+
index += 1 + access[0].length;
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
regex += char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
376
|
+
index += 1;
|
|
377
|
+
}
|
|
378
|
+
regex += "$";
|
|
379
|
+
return new RegExp(regex).test(name);
|
|
380
|
+
}
|
|
381
|
+
function childNodes(node) {
|
|
382
|
+
const children = [];
|
|
383
|
+
for (const [key, value] of Object.entries(node)) {
|
|
384
|
+
if (key === "loc") {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if (Array.isArray(value)) {
|
|
388
|
+
for (const entry of value) {
|
|
389
|
+
if (isNode(entry)) {
|
|
390
|
+
children.push(entry);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else if (isNode(value)) {
|
|
395
|
+
children.push(value);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return children;
|
|
399
|
+
}
|
|
400
|
+
function isNode(value) {
|
|
401
|
+
return (typeof value === "object" &&
|
|
402
|
+
value !== null &&
|
|
403
|
+
typeof value.type === "string");
|
|
404
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inka-project/inka-evidence",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Emit inka test evidence v1 JSON from JavaScript test adapters",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ut-issl/inka.git",
|
|
9
|
+
"directory": "crate/inka-evidence-wasm"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/ut-issl/inka/tree/main/crate/inka-evidence-wasm#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ut-issl/inka/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"inka",
|
|
17
|
+
"test-evidence",
|
|
18
|
+
"vitest",
|
|
19
|
+
"wasm"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"vitest": ">=5"
|
|
26
|
+
},
|
|
27
|
+
"peerDependenciesMeta": {
|
|
28
|
+
"vitest": {
|
|
29
|
+
"optional": true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"main": "pkg/inka_evidence_wasm.js",
|
|
33
|
+
"types": "pkg/inka_evidence_wasm.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./pkg/inka_evidence_wasm.d.ts",
|
|
37
|
+
"default": "./pkg/inka_evidence_wasm.js"
|
|
38
|
+
},
|
|
39
|
+
"./vitest": {
|
|
40
|
+
"types": "./dist/vitest.d.ts",
|
|
41
|
+
"default": "./dist/vitest.js"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "wasm-pack build --release --target nodejs && node -e \"require('node:fs').rmSync('pkg/.gitignore', { force: true })\" && tsc -p tsconfig.build.json",
|
|
46
|
+
"test": "npm run build && vitest run",
|
|
47
|
+
"typecheck": "npm run build && tsc --noEmit"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "26.6.6",
|
|
51
|
+
"ajv": "8.20.0",
|
|
52
|
+
"typescript": "7.0.2",
|
|
53
|
+
"vitest": "5.1.0",
|
|
54
|
+
"wasm-pack": "0.15.1"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@babel/parser": "8.1.2"
|
|
58
|
+
},
|
|
59
|
+
"bin": {
|
|
60
|
+
"inka-evidence-merge": "dist/merge-cli.js"
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"pkg/",
|
|
64
|
+
"dist/",
|
|
65
|
+
"LICENSE-MIT",
|
|
66
|
+
"LICENSE-APACHE"
|
|
67
|
+
],
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|