@platforma-sdk/tengo-builder 1.14.11
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/README.md +52 -0
- package/bin/run.js +7 -0
- package/dist/commands/build.d.ts +13 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/check.d.ts +11 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/dump/all.d.ts +7 -0
- package/dist/commands/dump/all.d.ts.map +1 -0
- package/dist/commands/dump/libs.d.ts +10 -0
- package/dist/commands/dump/libs.d.ts.map +1 -0
- package/dist/commands/dump/software.d.ts +7 -0
- package/dist/commands/dump/software.d.ts.map +1 -0
- package/dist/commands/dump/templates.d.ts +7 -0
- package/dist/commands/dump/templates.d.ts.map +1 -0
- package/dist/commands/dump/tests.d.ts +7 -0
- package/dist/commands/dump/tests.d.ts.map +1 -0
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/test.d.ts +11 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/compiler/artifactset.d.ts +22 -0
- package/dist/compiler/artifactset.d.ts.map +1 -0
- package/dist/compiler/compiler.d.ts +34 -0
- package/dist/compiler/compiler.d.ts.map +1 -0
- package/dist/compiler/main.d.ts +17 -0
- package/dist/compiler/main.d.ts.map +1 -0
- package/dist/compiler/package.d.ts +37 -0
- package/dist/compiler/package.d.ts.map +1 -0
- package/dist/compiler/source.d.ts +27 -0
- package/dist/compiler/source.d.ts.map +1 -0
- package/dist/compiler/template.d.ts +49 -0
- package/dist/compiler/template.d.ts.map +1 -0
- package/dist/compiler/test.artifacts.d.ts +32 -0
- package/dist/compiler/test.artifacts.d.ts.map +1 -0
- package/dist/compiler/util.d.ts +5 -0
- package/dist/compiler/util.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +851 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared/basecmd.d.ts +9 -0
- package/dist/shared/basecmd.d.ts.map +1 -0
- package/dist/shared/dump.d.ts +7 -0
- package/dist/shared/dump.d.ts.map +1 -0
- package/dist/shared/proc.d.ts +5 -0
- package/dist/shared/proc.d.ts.map +1 -0
- package/package.json +44 -0
- package/src/commands/build.ts +175 -0
- package/src/commands/check.ts +45 -0
- package/src/commands/dump/all.ts +17 -0
- package/src/commands/dump/libs.ts +24 -0
- package/src/commands/dump/software.ts +17 -0
- package/src/commands/dump/templates.ts +18 -0
- package/src/commands/dump/tests.ts +17 -0
- package/src/commands/index.ts +10 -0
- package/src/commands/test.ts +41 -0
- package/src/compiler/artifactset.ts +76 -0
- package/src/compiler/compiler.test.ts +48 -0
- package/src/compiler/compiler.ts +300 -0
- package/src/compiler/main.ts +363 -0
- package/src/compiler/package.ts +96 -0
- package/src/compiler/source.test.ts +28 -0
- package/src/compiler/source.ts +319 -0
- package/src/compiler/template.test.ts +54 -0
- package/src/compiler/template.ts +90 -0
- package/src/compiler/test.artifacts.ts +195 -0
- package/src/compiler/util.ts +38 -0
- package/src/index.ts +1 -0
- package/src/shared/basecmd.ts +28 -0
- package/src/shared/dump.ts +164 -0
- package/src/shared/proc.ts +29 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,851 @@
|
|
|
1
|
+
var ge = Object.defineProperty;
|
|
2
|
+
var he = (t, e, o) => e in t ? ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
+
var d = (t, e, o) => he(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
import { spawnSync as we, spawn as ye } from "node:child_process";
|
|
5
|
+
import { Flags as T, Command as W } from "@oclif/core";
|
|
6
|
+
import * as c from "node:path";
|
|
7
|
+
import * as u from "node:fs";
|
|
8
|
+
import { readFileSync as be } from "node:fs";
|
|
9
|
+
import { gunzipSync as ve, gzipSync as $e } from "node:zlib";
|
|
10
|
+
import Ee from "canonicalize";
|
|
11
|
+
import A from "winston";
|
|
12
|
+
import * as S from "node:fs/promises";
|
|
13
|
+
import { TengoTesterBinaryPath as te } from "@milaboratories/tengo-tester";
|
|
14
|
+
function k(t) {
|
|
15
|
+
throw new Error("Unexpected object: " + t);
|
|
16
|
+
}
|
|
17
|
+
function Ne() {
|
|
18
|
+
let t = process.cwd();
|
|
19
|
+
for (; t; ) {
|
|
20
|
+
const e = c.join(t, "node_modules");
|
|
21
|
+
if (u.existsSync(e)) return e;
|
|
22
|
+
const o = c.resolve(t, "..");
|
|
23
|
+
if (o === t) break;
|
|
24
|
+
t = o;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("Unable to find node_modules directory.");
|
|
27
|
+
}
|
|
28
|
+
function v(t) {
|
|
29
|
+
try {
|
|
30
|
+
const e = u.statSync(t);
|
|
31
|
+
return e.isDirectory() ? "dir" : e.isFile() ? "file" : e.isSymbolicLink() ? "link" : "unknown";
|
|
32
|
+
} catch (e) {
|
|
33
|
+
if (e.code == "ENOENT") return "absent";
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function Z(t) {
|
|
38
|
+
return `${t.type}||${t.pkg}||${t.id}`;
|
|
39
|
+
}
|
|
40
|
+
function m(t) {
|
|
41
|
+
return `${t.type}:${t.pkg}:${t.id}:${t.version}`;
|
|
42
|
+
}
|
|
43
|
+
function g(t) {
|
|
44
|
+
return `${t.type}:${t.pkg}:${t.id}`;
|
|
45
|
+
}
|
|
46
|
+
function K(t, e) {
|
|
47
|
+
return t.type == e.type && t.pkg == e.pkg && t.id == e.id;
|
|
48
|
+
}
|
|
49
|
+
function y(t) {
|
|
50
|
+
return `${t.pkg}:${t.id}`;
|
|
51
|
+
}
|
|
52
|
+
function F(t) {
|
|
53
|
+
return { name: y(t), version: t.version };
|
|
54
|
+
}
|
|
55
|
+
function Se(t) {
|
|
56
|
+
const e = t.name.match(/^(?<pkg>[^:]*):(?<id>[^:]*)$/);
|
|
57
|
+
if (!e)
|
|
58
|
+
throw new Error(`malformed artifact name: ${t.name}`);
|
|
59
|
+
return { pkg: e.groups.pkg, id: e.groups.id, version: t.version };
|
|
60
|
+
}
|
|
61
|
+
function X(t) {
|
|
62
|
+
return `${t.pkg}:${t.id}:${t.version}`;
|
|
63
|
+
}
|
|
64
|
+
const ke = new TextDecoder(), Te = new TextEncoder();
|
|
65
|
+
class re {
|
|
66
|
+
constructor(e, o, s) {
|
|
67
|
+
d(this, "data");
|
|
68
|
+
d(this, "content");
|
|
69
|
+
this.compileMode = e, this.fullName = o;
|
|
70
|
+
let { data: n, content: r } = s;
|
|
71
|
+
if (n === void 0 && r === void 0)
|
|
72
|
+
throw new Error("Neither data nor content is provided for template constructor");
|
|
73
|
+
if (n !== void 0 && r !== void 0)
|
|
74
|
+
throw new Error("Both data and content are provided for template constructor");
|
|
75
|
+
if (n === void 0 && (n = JSON.parse(ke.decode(ve(r))), n.type !== "pl.tengo-template.v2"))
|
|
76
|
+
throw new Error("malformed template");
|
|
77
|
+
r === void 0 && (r = $e(Te.encode(Ee(n))));
|
|
78
|
+
const i = Se(n);
|
|
79
|
+
if (i.pkg !== o.pkg || i.id !== o.id || i.version !== o.version)
|
|
80
|
+
throw new Error(`Compiled template name don't match it's package and file names: ${X(i)} != ${X(o)}`);
|
|
81
|
+
this.data = n, this.content = r;
|
|
82
|
+
}
|
|
83
|
+
toJSON() {
|
|
84
|
+
return { compileMode: this.compileMode, fullName: this.fullName, data: this.data };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
class R {
|
|
88
|
+
constructor(e) {
|
|
89
|
+
d(this, "map", /* @__PURE__ */ new Map());
|
|
90
|
+
this.nameExtractor = e;
|
|
91
|
+
}
|
|
92
|
+
add(e, o = !0) {
|
|
93
|
+
const s = Z(this.nameExtractor(e)), n = this.map.get(s);
|
|
94
|
+
return n && !o || this.map.set(s, e), n;
|
|
95
|
+
}
|
|
96
|
+
get(e) {
|
|
97
|
+
return this.map.get(Z(e));
|
|
98
|
+
}
|
|
99
|
+
get array() {
|
|
100
|
+
const e = [];
|
|
101
|
+
return this.map.forEach((o) => e.push(o)), e;
|
|
102
|
+
}
|
|
103
|
+
forEach(e) {
|
|
104
|
+
this.map.forEach((o) => e(o, this.nameExtractor(o)));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function De() {
|
|
108
|
+
return new R((t) => t);
|
|
109
|
+
}
|
|
110
|
+
class x {
|
|
111
|
+
constructor(e) {
|
|
112
|
+
d(this, "dev");
|
|
113
|
+
d(this, "dist");
|
|
114
|
+
this.nameExtractor = e, this.dev = new R(e), this.dist = new R(e);
|
|
115
|
+
}
|
|
116
|
+
add(e, o, s = !0) {
|
|
117
|
+
switch (e) {
|
|
118
|
+
case "dist":
|
|
119
|
+
return this.dist.add(o, s);
|
|
120
|
+
default:
|
|
121
|
+
k(e);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
get(e, o) {
|
|
125
|
+
switch (e) {
|
|
126
|
+
case "dist":
|
|
127
|
+
return this.dist.get(o);
|
|
128
|
+
default:
|
|
129
|
+
k(e);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
array(e) {
|
|
133
|
+
const o = [];
|
|
134
|
+
return this.forEach(e, (s) => o.push(s)), o;
|
|
135
|
+
}
|
|
136
|
+
forEach(e, o) {
|
|
137
|
+
this.dist.forEach((s, n) => o(this.get(e, n) ?? s, n));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
class Ae {
|
|
141
|
+
constructor(e) {
|
|
142
|
+
d(this, "libs", new x((e) => e.fullName));
|
|
143
|
+
d(this, "software", new x((e) => e.fullName));
|
|
144
|
+
d(this, "templates", new x((e) => e.fullName));
|
|
145
|
+
this.compileMode = e;
|
|
146
|
+
}
|
|
147
|
+
populateTemplateDataFromDependencies(e, o, s, n) {
|
|
148
|
+
for (const r of s)
|
|
149
|
+
switch (r.type) {
|
|
150
|
+
case "library":
|
|
151
|
+
const i = this.getLibOrError(r), a = n.indexOf(y(r));
|
|
152
|
+
if (a >= 0) {
|
|
153
|
+
let p = `library import recursion detected: ${n.slice(a).join(" -> ")} -> ${y(r)}`;
|
|
154
|
+
throw new Error(p);
|
|
155
|
+
}
|
|
156
|
+
o.libs[y(r)] = {
|
|
157
|
+
...F(i.fullName),
|
|
158
|
+
src: i.src
|
|
159
|
+
}, this.populateTemplateDataFromDependencies(e, o, i.dependencies, [...n, y(r)]);
|
|
160
|
+
break;
|
|
161
|
+
case "software":
|
|
162
|
+
const l = this.getSoftwareOrError(r);
|
|
163
|
+
o.software[y(r)] = {
|
|
164
|
+
...F(l.fullName),
|
|
165
|
+
src: l.src
|
|
166
|
+
};
|
|
167
|
+
break;
|
|
168
|
+
case "template":
|
|
169
|
+
if (K(e, r))
|
|
170
|
+
continue;
|
|
171
|
+
const f = this.getTemplateOrError(r);
|
|
172
|
+
o.templates[y(r)] = f.data;
|
|
173
|
+
break;
|
|
174
|
+
case "test":
|
|
175
|
+
throw new Error(
|
|
176
|
+
`dependencies tree error: tests should never be part of template: ${g(r)} is dependency of ${y(e)}`
|
|
177
|
+
);
|
|
178
|
+
default:
|
|
179
|
+
k(r.type);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** This method assumes that all dependencies are already added to the compiler's context */
|
|
183
|
+
compileAndAddTemplate(e) {
|
|
184
|
+
if (e.fullName.type !== "template")
|
|
185
|
+
throw new Error("unexpected source type");
|
|
186
|
+
const o = {
|
|
187
|
+
type: "pl.tengo-template.v2",
|
|
188
|
+
...F(e.fullName),
|
|
189
|
+
templates: {},
|
|
190
|
+
libs: {},
|
|
191
|
+
software: {},
|
|
192
|
+
src: e.src
|
|
193
|
+
};
|
|
194
|
+
this.populateTemplateDataFromDependencies(e.fullName, o, e.dependencies, []);
|
|
195
|
+
const s = new re(e.compileMode, e.fullName, { data: o });
|
|
196
|
+
return this.addTemplate(s), s;
|
|
197
|
+
}
|
|
198
|
+
addLib(e) {
|
|
199
|
+
const o = this.libs.add(e.compileMode, e, !1);
|
|
200
|
+
if (o)
|
|
201
|
+
throw new Error(
|
|
202
|
+
`compiler already contain such library: adding = ${m(e.fullName)}, contains = ${m(o.fullName)}`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
allLibs() {
|
|
206
|
+
return this.libs.array(this.compileMode);
|
|
207
|
+
}
|
|
208
|
+
getLib(e) {
|
|
209
|
+
if (e.type !== "library")
|
|
210
|
+
throw new Error(`illegal artifact type: got ${e.type} instead of 'library`);
|
|
211
|
+
return this.libs.get(this.compileMode, e);
|
|
212
|
+
}
|
|
213
|
+
getLibOrError(e) {
|
|
214
|
+
const o = this.getLib(e);
|
|
215
|
+
if (!o)
|
|
216
|
+
throw new Error(`library not found: ${y(e)}`);
|
|
217
|
+
return o;
|
|
218
|
+
}
|
|
219
|
+
addSoftware(e) {
|
|
220
|
+
const o = this.software.add(e.compileMode, e, !1);
|
|
221
|
+
if (o)
|
|
222
|
+
throw new Error(
|
|
223
|
+
`compiler already contain info for software: adding = ${m(e.fullName)}, contains = ${m(o.fullName)}`
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
allSoftware() {
|
|
227
|
+
return this.software.array(this.compileMode);
|
|
228
|
+
}
|
|
229
|
+
getSoftware(e) {
|
|
230
|
+
if (e.type !== "software")
|
|
231
|
+
throw new Error(`illegal artifact type: got ${e.type} instead of 'software`);
|
|
232
|
+
return this.software.get(this.compileMode, e);
|
|
233
|
+
}
|
|
234
|
+
getSoftwareOrError(e) {
|
|
235
|
+
const o = this.getSoftware(e);
|
|
236
|
+
if (!o)
|
|
237
|
+
throw new Error(`software info not found: ${y(e)}`);
|
|
238
|
+
return o;
|
|
239
|
+
}
|
|
240
|
+
addTemplate(e) {
|
|
241
|
+
const o = this.templates.add(e.compileMode, e, !1);
|
|
242
|
+
if (o)
|
|
243
|
+
throw new Error(
|
|
244
|
+
`compiler already contain such template: adding = ${m(e.fullName)}, contains = ${m(o.fullName)}`
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
allTemplates() {
|
|
248
|
+
return this.templates.array(this.compileMode);
|
|
249
|
+
}
|
|
250
|
+
getTemplate(e) {
|
|
251
|
+
if (e.type !== "template")
|
|
252
|
+
throw new Error(`illegal artifact type: got ${e.type} instead of 'template`);
|
|
253
|
+
return this.templates.get(this.compileMode, e);
|
|
254
|
+
}
|
|
255
|
+
getTemplateOrError(e) {
|
|
256
|
+
const o = this.getTemplate(e);
|
|
257
|
+
if (!o)
|
|
258
|
+
throw new Error(`template not found: ${y(e)}`);
|
|
259
|
+
return o;
|
|
260
|
+
}
|
|
261
|
+
getArtefact(e) {
|
|
262
|
+
switch (e.type) {
|
|
263
|
+
case "template":
|
|
264
|
+
return this.getTemplate(e);
|
|
265
|
+
case "library":
|
|
266
|
+
return this.getLib(e);
|
|
267
|
+
case "software":
|
|
268
|
+
return this.getSoftware(e);
|
|
269
|
+
case "test":
|
|
270
|
+
return;
|
|
271
|
+
default:
|
|
272
|
+
k(e.type);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
checkLibs() {
|
|
276
|
+
this.libs.forEach(this.compileMode, (e) => {
|
|
277
|
+
for (const o of e.dependencies) {
|
|
278
|
+
if (o.type === "test")
|
|
279
|
+
throw new Error(`test should never be dependency of production code: ${g(o)} test is dependency of ${m(e.fullName)}`);
|
|
280
|
+
if (!this.getArtefact(o))
|
|
281
|
+
throw new Error(`unresolved dependency ${g(o)} for ${m(e.fullName)}`);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
compileAndAdd(e) {
|
|
286
|
+
const o = { templates: [], libs: [], software: [] };
|
|
287
|
+
let s = [];
|
|
288
|
+
for (const n of e)
|
|
289
|
+
n.fullName.type === "library" ? (this.addLib(n), o.libs.push(n)) : n.fullName.type === "software" ? (this.addSoftware(n), o.software.push(n)) : s.push(n);
|
|
290
|
+
for (; s.length > 0; ) {
|
|
291
|
+
const n = [];
|
|
292
|
+
for (const r of s) {
|
|
293
|
+
const i = r.dependencies.filter(
|
|
294
|
+
(a) => !this.getArtefact(a) && // allow self reference for templates
|
|
295
|
+
!(r.fullName.type === "template" && K(r.fullName, a))
|
|
296
|
+
);
|
|
297
|
+
if (i.length > 0) {
|
|
298
|
+
let a = `Unsatisfied dependencies in ${m(r.fullName)}:
|
|
299
|
+
`;
|
|
300
|
+
for (const l of i)
|
|
301
|
+
a += ` - ${g(l)}
|
|
302
|
+
`;
|
|
303
|
+
n.push({ src: r, err: Error(a) });
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
switch (r.fullName.type) {
|
|
307
|
+
case "library":
|
|
308
|
+
this.addLib(r), o.libs.push(r);
|
|
309
|
+
break;
|
|
310
|
+
case "software":
|
|
311
|
+
this.addSoftware(r), o.software.push(r);
|
|
312
|
+
break;
|
|
313
|
+
case "template":
|
|
314
|
+
try {
|
|
315
|
+
const a = this.compileAndAddTemplate(r);
|
|
316
|
+
o.templates.push(a);
|
|
317
|
+
} catch (a) {
|
|
318
|
+
let l = `Unsatisfied dependencies in ${m(r.fullName)}:
|
|
319
|
+
`;
|
|
320
|
+
l += ` - ${a.message}
|
|
321
|
+
`, n.push({ src: r, err: Error(l) });
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
case "test":
|
|
325
|
+
break;
|
|
326
|
+
default:
|
|
327
|
+
k(r.fullName.type);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (s.length === n.length) {
|
|
331
|
+
let r = "";
|
|
332
|
+
for (const i of n)
|
|
333
|
+
r += `
|
|
334
|
+
${i.err.message}`;
|
|
335
|
+
throw new Error(r);
|
|
336
|
+
}
|
|
337
|
+
s = n.map(({ src: r }) => r);
|
|
338
|
+
}
|
|
339
|
+
return o;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const H = "[_a-zA-Z][_a-zA-Z0-9]*", D = (t, e) => new RegExp(
|
|
343
|
+
`\\b${t}\\.(?<fnCall>(?<fnName>` + e + ')\\s*\\(\\s*"(?<templateName>[^"]+)"\\s*\\))'
|
|
344
|
+
), Fe = (t) => D(t, "getTemplateId"), xe = (t) => D(t, "getSoftwareInfo"), Q = (t) => D(t, "importTemplate"), Y = (t) => D(t, "importSoftware"), Re = /^\s*(\/\/)|(\/\*.*\*\/)/, Me = /^\s*\/\*/, je = /\*\//, oe = /\s*:=\s*import\s*\(\s*"(?<moduleName>[^"]+)"\s*\)/, Le = new RegExp(
|
|
345
|
+
`\\b(?<importName>${H}(\\.${H})*)${oe.source}`
|
|
346
|
+
), Oe = /(?<pkgName>[^"]+)?:(?<depID>[^"]+)/;
|
|
347
|
+
class se {
|
|
348
|
+
constructor(e, o, s, n, r) {
|
|
349
|
+
this.compileMode = e, this.fullName = o, this.src = s, this.srcName = n, this.dependencies = r;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function ne(t, e, o, s) {
|
|
353
|
+
const n = be(e).toString(), { deps: r, normalized: i } = Ie(n, o, s);
|
|
354
|
+
return new se(t, o, i, e, r.array);
|
|
355
|
+
}
|
|
356
|
+
function Ie(t, e, o) {
|
|
357
|
+
const s = De(), n = t.split(`
|
|
358
|
+
`), r = [];
|
|
359
|
+
let i = {
|
|
360
|
+
isInCommentBlock: !1,
|
|
361
|
+
tplDepREs: /* @__PURE__ */ new Map()
|
|
362
|
+
}, a = 0;
|
|
363
|
+
for (const l of n) {
|
|
364
|
+
a++;
|
|
365
|
+
try {
|
|
366
|
+
const f = Ce(
|
|
367
|
+
l,
|
|
368
|
+
i,
|
|
369
|
+
e.pkg,
|
|
370
|
+
o
|
|
371
|
+
);
|
|
372
|
+
r.push(f.line), i = f.context, f.artifact && s.add(f.artifact);
|
|
373
|
+
} catch (f) {
|
|
374
|
+
throw new Error(`[line ${a}]: ${f.message}
|
|
375
|
+
${l}`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
normalized: r.join(`
|
|
380
|
+
`),
|
|
381
|
+
deps: s
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function Ce(t, e, o, s) {
|
|
385
|
+
if (e.isInCommentBlock)
|
|
386
|
+
return je.exec(t) && (e.isInCommentBlock = !1), { line: t, context: e, artifact: void 0 };
|
|
387
|
+
if (Re.exec(t))
|
|
388
|
+
return { line: t, context: e, artifact: void 0 };
|
|
389
|
+
if (Me.exec(t))
|
|
390
|
+
return e.isInCommentBlock = !0, { line: t, context: e, artifact: void 0 };
|
|
391
|
+
const n = oe.exec(t);
|
|
392
|
+
if (n) {
|
|
393
|
+
const r = Ge(t);
|
|
394
|
+
if (r.module === "plapi")
|
|
395
|
+
return e.tplDepREs.has(r.module) || e.tplDepREs.set(r.module, [
|
|
396
|
+
["template", Fe(r.alias)],
|
|
397
|
+
["software", xe(r.alias)]
|
|
398
|
+
]), { line: t, context: e, artifact: void 0 };
|
|
399
|
+
(r.module === "@milaboratory/tengo-sdk:ll" || r.module === "@platforma-sdk/workflow-tengo:ll" || (o === "@milaboratory/tengo-sdk" || o === "@platforma-sdk/workflow-tengo") && r.module === ":ll") && (e.tplDepREs.has(r.module) || e.tplDepREs.set(r.module, [
|
|
400
|
+
["template", Q(r.alias)],
|
|
401
|
+
["software", Y(r.alias)]
|
|
402
|
+
])), (r.module === "@milaboratory/tengo-sdk:assets" || r.module === "@platforma-sdk/workflow-tengo:assets" || (o === "@milaboratory/tengo-sdk" || o === "@platforma-sdk/workflow-tengo") && r.module === ":assets") && (e.tplDepREs.has(r.module) || e.tplDepREs.set(r.module, [
|
|
403
|
+
["template", Q(r.alias)],
|
|
404
|
+
["software", Y(r.alias)]
|
|
405
|
+
]));
|
|
406
|
+
const i = _(r.module, "library", o);
|
|
407
|
+
return i ? (t = t.replace(n[0], ` := import("${i.pkg}:${i.id}")`), { line: t, context: e, artifact: i }) : { line: t, context: e, artifact: void 0 };
|
|
408
|
+
}
|
|
409
|
+
if (e.tplDepREs.size > 0)
|
|
410
|
+
for (const [r, i] of e.tplDepREs)
|
|
411
|
+
for (const [a, l] of i) {
|
|
412
|
+
const f = l.exec(t);
|
|
413
|
+
if (!f || !f.groups)
|
|
414
|
+
continue;
|
|
415
|
+
const { fnCall: p, templateName: b, fnName: h } = f.groups;
|
|
416
|
+
if (!p || !b || !h)
|
|
417
|
+
throw Error("failed to parse template import statement");
|
|
418
|
+
const w = _(b, a, o);
|
|
419
|
+
if (!w)
|
|
420
|
+
throw Error(`failed to parse artifact name in ${h} import statement`);
|
|
421
|
+
return t = t.replace(p, `${h}("${w.pkg}:${w.id}")`), { line: t, context: e, artifact: w };
|
|
422
|
+
}
|
|
423
|
+
return { line: t, context: e, artifact: void 0 };
|
|
424
|
+
}
|
|
425
|
+
function Ge(t) {
|
|
426
|
+
const e = Le.exec(t);
|
|
427
|
+
if (!e || !e.groups)
|
|
428
|
+
throw Error("failed to parse 'import' statement");
|
|
429
|
+
const { importName: o, moduleName: s } = e.groups;
|
|
430
|
+
if (!o || !s)
|
|
431
|
+
throw Error("failed to parse 'import' statement");
|
|
432
|
+
return {
|
|
433
|
+
module: s,
|
|
434
|
+
alias: o
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function _(t, e, o) {
|
|
438
|
+
const s = Oe.exec(t);
|
|
439
|
+
if (!s)
|
|
440
|
+
return;
|
|
441
|
+
if (!s.groups)
|
|
442
|
+
throw Error(
|
|
443
|
+
"failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'"
|
|
444
|
+
);
|
|
445
|
+
const { pkgName: n, depID: r } = s.groups;
|
|
446
|
+
if (!r)
|
|
447
|
+
throw Error(
|
|
448
|
+
"failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'"
|
|
449
|
+
);
|
|
450
|
+
return { type: e, pkg: n ?? o, id: r };
|
|
451
|
+
}
|
|
452
|
+
const M = ".plj.gz", j = ".lib.tengo", L = ".sw.json", ee = ".test.tengo", O = ".tpl.tengo", I = ".lib.tengo", C = ".sw.json", ze = [I, O, C];
|
|
453
|
+
function J(t = "debug") {
|
|
454
|
+
return A.createLogger({
|
|
455
|
+
level: t,
|
|
456
|
+
format: A.format.printf(({ level: e, message: o }) => `${e.padStart(6, " ")}: ${o}`),
|
|
457
|
+
transports: [
|
|
458
|
+
new A.transports.Console({
|
|
459
|
+
stderrLevels: ["error", "warn", "info", "debug"],
|
|
460
|
+
handleExceptions: !0
|
|
461
|
+
})
|
|
462
|
+
]
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
function U() {
|
|
466
|
+
return JSON.parse(u.readFileSync("package.json").toString());
|
|
467
|
+
}
|
|
468
|
+
function ie(t, e) {
|
|
469
|
+
return c.resolve(e, t, "tengo", "lib");
|
|
470
|
+
}
|
|
471
|
+
function ae(t, e) {
|
|
472
|
+
return c.resolve(e, t, "tengo", "tpl");
|
|
473
|
+
}
|
|
474
|
+
function le(t, e) {
|
|
475
|
+
return c.resolve(e, t, "tengo", "software");
|
|
476
|
+
}
|
|
477
|
+
function ce(t, e, o, s, n = !1) {
|
|
478
|
+
const r = c.resolve(s, "package.json");
|
|
479
|
+
if (v(r) !== "file") {
|
|
480
|
+
for (const w of u.readdirSync(s)) {
|
|
481
|
+
const me = v(c.join(s, w)) === "link", V = c.resolve(s, w);
|
|
482
|
+
v(V) === "dir" && ce(t, e, o, V, me);
|
|
483
|
+
}
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const i = ie("dist", s), a = ae("dist", s), l = le("dist", s), f = v(i) === "dir", p = v(a) === "dir", b = v(l) === "dir";
|
|
487
|
+
if (!f && !p && !b)
|
|
488
|
+
return;
|
|
489
|
+
const h = JSON.parse(u.readFileSync(r).toString());
|
|
490
|
+
if (h.name !== o.name) {
|
|
491
|
+
if (v(c.resolve(s, "node_modules")) === "dir" && n)
|
|
492
|
+
throw new Error(
|
|
493
|
+
`nested node_modules is a sign of library dependencies version incompatibility in ${s}`
|
|
494
|
+
);
|
|
495
|
+
f && Pe(t, h, "dist", i, e), p && We(t, h, "dist", a, e), b && Je(t, h, "dist", l, e);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
function Pe(t, e, o, s, n) {
|
|
499
|
+
for (const r of u.readdirSync(s)) {
|
|
500
|
+
const i = c.resolve(s, r);
|
|
501
|
+
if (!r.endsWith(j)) throw new Error(`unexpected file in 'lib' folder: ${i}`);
|
|
502
|
+
const a = {
|
|
503
|
+
type: "library",
|
|
504
|
+
pkg: e.name,
|
|
505
|
+
id: r.slice(0, r.length - j.length),
|
|
506
|
+
version: e.version
|
|
507
|
+
}, l = ne(o, i, a, !0);
|
|
508
|
+
if (n.addLib(l), t.debug(`Adding dependency ${m(a)} from ${i}`), l.dependencies.length > 0) {
|
|
509
|
+
t.debug("Dependencies:");
|
|
510
|
+
for (const f of l.dependencies) t.debug(` - ${g(f)}`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function We(t, e, o, s, n) {
|
|
515
|
+
for (const r of u.readdirSync(s)) {
|
|
516
|
+
const i = c.resolve(s, r);
|
|
517
|
+
if (!r.endsWith(M)) throw new Error(`unexpected file in 'tpl' folder: ${i}`);
|
|
518
|
+
const a = {
|
|
519
|
+
type: "template",
|
|
520
|
+
pkg: e.name,
|
|
521
|
+
id: r.slice(0, r.length - M.length),
|
|
522
|
+
version: e.version
|
|
523
|
+
}, l = new re(o, a, { content: u.readFileSync(i) });
|
|
524
|
+
n.addTemplate(l), t.debug(`Adding dependency ${m(a)} from ${i}`);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function Je(t, e, o, s, n) {
|
|
528
|
+
for (const r of u.readdirSync(s)) {
|
|
529
|
+
const i = c.resolve(s, r);
|
|
530
|
+
if (!r.endsWith(L))
|
|
531
|
+
throw new Error(`unexpected file in 'software' folder: ${i}`);
|
|
532
|
+
const a = {
|
|
533
|
+
type: "software",
|
|
534
|
+
pkg: e.name,
|
|
535
|
+
id: r.slice(0, r.length - L.length),
|
|
536
|
+
version: e.version
|
|
537
|
+
}, l = new se(o, a, u.readFileSync(i).toString(), i, []);
|
|
538
|
+
n.addSoftware(l), t.debug(`Adding dependency ${m(a)} from ${i}`);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function q(t, e, o, s, n) {
|
|
542
|
+
const r = [];
|
|
543
|
+
for (const i of u.readdirSync(c.join(s, n))) {
|
|
544
|
+
const a = c.join(n, i), l = c.join(s, a);
|
|
545
|
+
if (v(l) === "dir") {
|
|
546
|
+
const w = q(t, e, o, s, a);
|
|
547
|
+
r.push(...w);
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
const f = i === "index.lib.tengo" ? `${c.basename(n)}.lib.tengo` : a, p = Ue(e, f.replaceAll(c.sep, "."));
|
|
551
|
+
if (!p)
|
|
552
|
+
continue;
|
|
553
|
+
const b = c.resolve(s, a);
|
|
554
|
+
t.debug(`Parsing ${m(p)} from ${b}`);
|
|
555
|
+
const h = ne(o, b, p, !0);
|
|
556
|
+
if (h.dependencies.length > 0) {
|
|
557
|
+
t.debug("Detected dependencies:");
|
|
558
|
+
for (const w of h.dependencies) t.debug(` - ${g(w)}`);
|
|
559
|
+
}
|
|
560
|
+
r.push(h);
|
|
561
|
+
}
|
|
562
|
+
return r;
|
|
563
|
+
}
|
|
564
|
+
function fe(t, e, o) {
|
|
565
|
+
const s = new Ae(o);
|
|
566
|
+
return ce(t, s, e, Ne()), s;
|
|
567
|
+
}
|
|
568
|
+
function Ue(t, e) {
|
|
569
|
+
const o = { pkg: t.name, version: t.version };
|
|
570
|
+
return e.endsWith(I) ? {
|
|
571
|
+
...o,
|
|
572
|
+
id: e.substring(0, e.length - I.length),
|
|
573
|
+
type: "library"
|
|
574
|
+
} : e.endsWith(O) ? {
|
|
575
|
+
...o,
|
|
576
|
+
id: e.substring(0, e.length - O.length),
|
|
577
|
+
type: "template"
|
|
578
|
+
} : e.endsWith(C) ? {
|
|
579
|
+
...o,
|
|
580
|
+
id: e.substring(0, e.length - C.length),
|
|
581
|
+
type: "software"
|
|
582
|
+
} : e.endsWith(ee) ? {
|
|
583
|
+
...o,
|
|
584
|
+
id: e.substring(0, e.length - ee.length),
|
|
585
|
+
type: "test"
|
|
586
|
+
} : null;
|
|
587
|
+
}
|
|
588
|
+
function qe(t, e) {
|
|
589
|
+
const o = U(), s = fe(t, o, e), n = q(t, o, e, "src", "");
|
|
590
|
+
if (n.length === 0) {
|
|
591
|
+
const i = [];
|
|
592
|
+
for (const a of ze)
|
|
593
|
+
i.push(`*${a}`);
|
|
594
|
+
t.error(`Nothing to compile. Looked for ${i.join(", ")}`), process.exit(1);
|
|
595
|
+
}
|
|
596
|
+
t.info(`Compiling '${e}'...`);
|
|
597
|
+
const r = s.compileAndAdd(n);
|
|
598
|
+
return t.debug("Done."), r;
|
|
599
|
+
}
|
|
600
|
+
function Be(t, e, o) {
|
|
601
|
+
if (e.libs.length > 0) {
|
|
602
|
+
const s = ie(o, ".");
|
|
603
|
+
u.mkdirSync(s, { recursive: !0 });
|
|
604
|
+
for (const n of e.libs) {
|
|
605
|
+
const r = c.resolve(s, n.fullName.id + j);
|
|
606
|
+
t.info(` - writing ${r}`), u.writeFileSync(r, n.src);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (e.templates.length > 0) {
|
|
610
|
+
const s = ae(o, ".");
|
|
611
|
+
u.mkdirSync(s, { recursive: !0 });
|
|
612
|
+
for (const n of e.templates) {
|
|
613
|
+
const r = c.resolve(s, n.fullName.id + M);
|
|
614
|
+
t.info(` - writing ${r}`), u.writeFileSync(r, n.content);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (e.software.length > 0) {
|
|
618
|
+
const s = le(o, ".");
|
|
619
|
+
u.mkdirSync(s, { recursive: !0 });
|
|
620
|
+
for (const n of e.software) {
|
|
621
|
+
const r = c.resolve(s, n.fullName.id + L);
|
|
622
|
+
t.info(` - writing ${r}`), u.writeFileSync(r, n.src);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const B = {
|
|
627
|
+
"log-level": T.string({
|
|
628
|
+
description: "logging level",
|
|
629
|
+
default: "info",
|
|
630
|
+
options: ["error", "warn", "info", "debug"]
|
|
631
|
+
})
|
|
632
|
+
}, Ve = {
|
|
633
|
+
"generate-tags": T.boolean({
|
|
634
|
+
description: "generate tags, default false",
|
|
635
|
+
default: !1
|
|
636
|
+
}),
|
|
637
|
+
"tags-file": T.file({
|
|
638
|
+
description: 'where to put ".tags" file, it should be a root of VS Code project',
|
|
639
|
+
default: "../../.tags"
|
|
640
|
+
// usually a user opens a directory with all blocks
|
|
641
|
+
}),
|
|
642
|
+
"tags-additional-args": T.string({
|
|
643
|
+
description: "additional flags for universal-ctags command: e.g. -e for emacs",
|
|
644
|
+
default: [],
|
|
645
|
+
multiple: !0,
|
|
646
|
+
delimiter: ","
|
|
647
|
+
})
|
|
648
|
+
}, N = class N extends W {
|
|
649
|
+
async run() {
|
|
650
|
+
const { flags: e } = await this.parse(N), o = J(e["log-level"]), s = U(), n = qe(o, "dist");
|
|
651
|
+
Be(o, n, "dist"), o.info("");
|
|
652
|
+
let r = `declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
|
|
653
|
+
`;
|
|
654
|
+
r += `declare type TplName = ${n.templates.map((p) => '"' + p.fullName.id + '"').join(" | ")};
|
|
655
|
+
`, r += `declare const Templates: Record<TplName, TemplateFromFile>;
|
|
656
|
+
`, r += `export { Templates };
|
|
657
|
+
`;
|
|
658
|
+
let i = `module.exports = { Templates: {
|
|
659
|
+
`, a = `import { resolve } from 'node:path';
|
|
660
|
+
export const Templates = {
|
|
661
|
+
`;
|
|
662
|
+
const l = n.templates.map(
|
|
663
|
+
(p) => ` '${p.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${p.fullName.id}.plj.gz') }`
|
|
664
|
+
).join(`,
|
|
665
|
+
`), f = n.templates.map(
|
|
666
|
+
(p) => ` '${p.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${p.fullName.id}.plj.gz') }`
|
|
667
|
+
).join(`,
|
|
668
|
+
`);
|
|
669
|
+
i += l, a += f, i += `
|
|
670
|
+
}};
|
|
671
|
+
`, a += `
|
|
672
|
+
};
|
|
673
|
+
`, await S.writeFile("dist/index.d.ts", r), s.type === "module" ? (await S.writeFile("dist/index.cjs", i), await S.writeFile("dist/index.js", a)) : (await S.writeFile("dist/index.js", i), await S.writeFile("dist/index.mjs", a)), Ze(e), e["generate-tags"] && Ke(o, e), o.info("Template Pack build done.");
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
d(N, "description", "build tengo sources into single distributable pack file"), d(N, "examples", ["<%= config.bin %> <%= command.id %>"]), d(N, "flags", {
|
|
677
|
+
...B,
|
|
678
|
+
...Ve
|
|
679
|
+
});
|
|
680
|
+
let G = N;
|
|
681
|
+
function Ze(t) {
|
|
682
|
+
process.env.GENERATE_TAGS != null && (t["generate-tags"] = process.env.GENERATE_TAGS == "true"), process.env.TAGS_FILE != null && (t["tags-file"] = process.env.TAGS_FILE), process.env.TAGS_ADDITIONAL_ARGS != null && (t["tags-additional-args"] = process.env.TAGS_ADDITIONAL_ARGS.split(","));
|
|
683
|
+
}
|
|
684
|
+
function Ke(t, e) {
|
|
685
|
+
var a;
|
|
686
|
+
const o = c.resolve(e["tags-file"]), s = c.dirname(o), n = e["tags-additional-args"], r = Xe(s);
|
|
687
|
+
t.info(
|
|
688
|
+
`Generating tags for tengo autocompletion from "${s}" in "${o}", additional arguments: "${n}".
|
|
689
|
+
Found ${r.length} tengo files...`
|
|
690
|
+
);
|
|
691
|
+
const i = we(
|
|
692
|
+
"ctags",
|
|
693
|
+
[
|
|
694
|
+
"-f",
|
|
695
|
+
o,
|
|
696
|
+
...n,
|
|
697
|
+
"--langdef=tengo",
|
|
698
|
+
"--map-tengo=+.tengo",
|
|
699
|
+
"--kinddef-tengo=f,function,function",
|
|
700
|
+
"--regex-tengo=/^\\s*(.*)(:| :=| =) ?func.*/\\1/f/",
|
|
701
|
+
"--kinddef-tengo=c,constant,constant",
|
|
702
|
+
'--regex-tengo=/^\\s*(.*) := ("|\\{).*/\\1/c/',
|
|
703
|
+
"-R",
|
|
704
|
+
...r
|
|
705
|
+
],
|
|
706
|
+
{
|
|
707
|
+
env: process.env,
|
|
708
|
+
stdio: "inherit",
|
|
709
|
+
cwd: s
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
if ((a = i.error) != null && a.message.includes("ENOENT")) {
|
|
713
|
+
console.log(`
|
|
714
|
+
pl-tengo can create tags for tengo autocompletion,
|
|
715
|
+
but the program should be installed
|
|
716
|
+
with "brew install universal-ctags" on OSX
|
|
717
|
+
or "sudo apt install universal-ctags" on Ubuntu.
|
|
718
|
+
|
|
719
|
+
For vscode, you should also install ctags extension:
|
|
720
|
+
https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support`);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
He(i, "failed to generate ctags"), t.info("Generation of tags is done.");
|
|
724
|
+
}
|
|
725
|
+
function Xe(t) {
|
|
726
|
+
const e = u.readdirSync(t, { withFileTypes: !0, recursive: !0 }), o = [];
|
|
727
|
+
return e.forEach((s) => {
|
|
728
|
+
if (!s.isDirectory() && s.name.endsWith(".tengo")) {
|
|
729
|
+
const n = c.join(s.parentPath, s.name).replace(t, ".");
|
|
730
|
+
o.push(n);
|
|
731
|
+
}
|
|
732
|
+
}), o;
|
|
733
|
+
}
|
|
734
|
+
function He(t, e) {
|
|
735
|
+
t.error && console.log(t.error);
|
|
736
|
+
const o = e;
|
|
737
|
+
t.status !== 0 && console.log(`WARN: ${o} the build will continue as-is`);
|
|
738
|
+
}
|
|
739
|
+
function de(t, e) {
|
|
740
|
+
const o = U(), s = q(t, o, "dist", "src", ""), n = fe(t, o, "dist");
|
|
741
|
+
for (const r of n.allLibs())
|
|
742
|
+
t.debug(
|
|
743
|
+
`Dumping to pl-tester: ${g(r.fullName)}`
|
|
744
|
+
), e.write(JSON.stringify(r) + `
|
|
745
|
+
`);
|
|
746
|
+
for (const r of s)
|
|
747
|
+
r.fullName.type === "library" && (t.debug(
|
|
748
|
+
`Dumping to pl-tester: ${g(r.fullName)}`
|
|
749
|
+
), e.write(JSON.stringify(r) + `
|
|
750
|
+
`));
|
|
751
|
+
for (const r of n.allTemplates())
|
|
752
|
+
t.debug(
|
|
753
|
+
`Dumping to pl-tester: ${g(r.fullName)}`
|
|
754
|
+
), e.write(JSON.stringify(r) + `
|
|
755
|
+
`);
|
|
756
|
+
for (const r of s)
|
|
757
|
+
r.fullName.type === "template" && (t.debug(
|
|
758
|
+
`Dumping to pl-tester: ${g(r.fullName)} ${r.srcName}`
|
|
759
|
+
), e.write(JSON.stringify(r) + `
|
|
760
|
+
`));
|
|
761
|
+
for (const r of n.allSoftware())
|
|
762
|
+
t.debug(
|
|
763
|
+
`Dumping to pl-tester: ${g(r.fullName)}`
|
|
764
|
+
), e.write(JSON.stringify(r) + `
|
|
765
|
+
`);
|
|
766
|
+
for (const r of s)
|
|
767
|
+
r.fullName.type === "software" && (t.debug(
|
|
768
|
+
`Dumping to pl-tester: ${g(r.fullName)}`
|
|
769
|
+
), e.write(JSON.stringify(r) + `
|
|
770
|
+
`));
|
|
771
|
+
for (const r of s)
|
|
772
|
+
r.fullName.type === "test" && (t.debug(
|
|
773
|
+
`Dumping to pl-tester: ${g(r.fullName)} ${r.srcName}`
|
|
774
|
+
), e.write(JSON.stringify(r) + `
|
|
775
|
+
`));
|
|
776
|
+
}
|
|
777
|
+
function pe(t, ...e) {
|
|
778
|
+
const o = ye(t, e, { stdio: ["pipe", "inherit", "inherit"] });
|
|
779
|
+
return o.stdin.on("error", (s) => {
|
|
780
|
+
s.code;
|
|
781
|
+
}), o;
|
|
782
|
+
}
|
|
783
|
+
function ue(t) {
|
|
784
|
+
return new Promise((e, o) => {
|
|
785
|
+
t.on("close", (s) => {
|
|
786
|
+
e(s);
|
|
787
|
+
}), t.on("error", (s) => {
|
|
788
|
+
o(s);
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
const $ = class $ extends W {
|
|
793
|
+
async run() {
|
|
794
|
+
const { flags: e, argv: o } = await this.parse($), s = J(e["log-level"]), n = o.length == 0 ? ["./src"] : o, r = pe(
|
|
795
|
+
te,
|
|
796
|
+
"check",
|
|
797
|
+
"--log-level",
|
|
798
|
+
e["log-level"],
|
|
799
|
+
"--artifacts",
|
|
800
|
+
"-",
|
|
801
|
+
...n
|
|
802
|
+
);
|
|
803
|
+
try {
|
|
804
|
+
de(s, r.stdin);
|
|
805
|
+
} catch (i) {
|
|
806
|
+
s.error(i);
|
|
807
|
+
} finally {
|
|
808
|
+
r.stdin.end();
|
|
809
|
+
const i = await ue(r);
|
|
810
|
+
process.exit(i);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
d($, "description", "check tengo sources for language processor an"), // static override args = {
|
|
815
|
+
// "log-level": Args.string({description: 'logging level'}),
|
|
816
|
+
// }
|
|
817
|
+
d($, "strict", !1), d($, "flags", { ...B }), d($, "examples", ["<%= config.bin %> <%= command.id %>"]);
|
|
818
|
+
let z = $;
|
|
819
|
+
const E = class E extends W {
|
|
820
|
+
async run() {
|
|
821
|
+
const { flags: e } = await this.parse(E), o = J(e["log-level"]), s = this.argv.length == 0 ? ["./src"] : this.argv, n = pe(
|
|
822
|
+
te,
|
|
823
|
+
"run",
|
|
824
|
+
"--log-level",
|
|
825
|
+
e["log-level"],
|
|
826
|
+
"--artifacts",
|
|
827
|
+
"-",
|
|
828
|
+
...s
|
|
829
|
+
);
|
|
830
|
+
try {
|
|
831
|
+
de(o, n.stdin);
|
|
832
|
+
} catch (r) {
|
|
833
|
+
o.error(r);
|
|
834
|
+
} finally {
|
|
835
|
+
n.stdin.end();
|
|
836
|
+
const r = await ue(n);
|
|
837
|
+
process.exit(r);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
d(E, "description", "run tengo unit tests (.test.tengo)"), d(E, "strict", !1), d(E, "flags", { ...B }), d(E, "examples", ["<%= config.bin %> <%= command.id %>"]);
|
|
842
|
+
let P = E;
|
|
843
|
+
const it = {
|
|
844
|
+
build: G,
|
|
845
|
+
check: z,
|
|
846
|
+
test: P
|
|
847
|
+
};
|
|
848
|
+
export {
|
|
849
|
+
it as COMMANDS
|
|
850
|
+
};
|
|
851
|
+
//# sourceMappingURL=index.mjs.map
|