@platforma-sdk/tengo-builder 1.16.1 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/commands/build.d.ts.map +1 -1
  2. package/dist/compiler/compiler.d.ts.map +1 -1
  3. package/dist/compiler/compileroptions.d.ts +6 -0
  4. package/dist/compiler/compileroptions.d.ts.map +1 -0
  5. package/dist/compiler/main.d.ts +0 -1
  6. package/dist/compiler/main.d.ts.map +1 -1
  7. package/dist/compiler/package.d.ts +6 -0
  8. package/dist/compiler/package.d.ts.map +1 -1
  9. package/dist/compiler/source.d.ts +9 -4
  10. package/dist/compiler/source.d.ts.map +1 -1
  11. package/dist/compiler/template.d.ts +5 -0
  12. package/dist/compiler/template.d.ts.map +1 -1
  13. package/dist/compiler/test.artifacts.d.ts +9 -0
  14. package/dist/compiler/test.artifacts.d.ts.map +1 -1
  15. package/dist/compiler/util.d.ts +3 -0
  16. package/dist/compiler/util.d.ts.map +1 -1
  17. package/dist/index.js +28 -28
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +572 -513
  20. package/dist/index.mjs.map +1 -1
  21. package/package.json +4 -4
  22. package/src/commands/build.ts +2 -1
  23. package/src/commands/check.ts +1 -1
  24. package/src/commands/dump/all.ts +1 -1
  25. package/src/commands/dump/assets.ts +1 -1
  26. package/src/commands/dump/libs.ts +1 -1
  27. package/src/commands/dump/software.ts +1 -1
  28. package/src/commands/dump/templates.ts +1 -1
  29. package/src/commands/dump/tests.ts +1 -1
  30. package/src/commands/test.ts +1 -1
  31. package/src/compiler/compiler.test.ts +51 -20
  32. package/src/compiler/compiler.ts +10 -4
  33. package/src/compiler/compileroptions.ts +51 -0
  34. package/src/compiler/main.ts +4 -19
  35. package/src/compiler/package.ts +21 -13
  36. package/src/compiler/source.test.ts +18 -4
  37. package/src/compiler/source.ts +94 -20
  38. package/src/compiler/template.ts +6 -0
  39. package/src/compiler/test.artifacts.ts +66 -8
  40. package/src/compiler/util.ts +21 -0
package/dist/index.mjs CHANGED
@@ -1,85 +1,99 @@
1
- var De = Object.defineProperty;
2
- var Fe = (t, e, r) => e in t ? De(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var l = (t, e, r) => Fe(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { spawnSync as Me, spawn as Oe } from "node:child_process";
5
- import { Flags as F, Command as v } from "@oclif/core";
1
+ var xe = Object.defineProperty;
2
+ var Oe = (s, e, t) => e in s ? xe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var l = (s, e, t) => Oe(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { spawnSync as Fe, spawn as Re } from "node:child_process";
5
+ import { Flags as O, Command as $ } from "@oclif/core";
6
6
  import * as f from "node:path";
7
7
  import * as p from "node:fs";
8
- import { readFileSync as Re } from "node:fs";
9
- import { gunzipSync as je, gzipSync as Le } from "node:zlib";
8
+ import { readFileSync as Me } from "node:fs";
9
+ import * as G from "winston";
10
+ import { gunzipSync as Le, gzipSync as je } from "node:zlib";
10
11
  import Ie from "canonicalize";
11
- import G from "winston";
12
- import * as D from "node:fs/promises";
12
+ import * as x from "node:fs/promises";
13
13
  import { TengoTesterBinaryPath as we } from "@milaboratories/tengo-tester";
14
- import { stdout as T } from "node:process";
15
- function M(t) {
16
- throw new Error("Unexpected object: " + t);
14
+ import { stdout as D } from "node:process";
15
+ function F(s) {
16
+ throw new Error("Unexpected object: " + s);
17
+ }
18
+ function N(s = "debug") {
19
+ return G.createLogger({
20
+ level: s,
21
+ format: G.format.printf(({ level: e, message: t }) => `${e.padStart(6, " ")}: ${t}`),
22
+ transports: [
23
+ new G.transports.Console({
24
+ stderrLevels: ["error", "warn", "info", "debug"],
25
+ handleExceptions: !0
26
+ })
27
+ ]
28
+ });
17
29
  }
18
30
  function Ce() {
19
- let t = process.cwd();
20
- for (; t; ) {
21
- const e = f.join(t, "node_modules");
31
+ let s = process.cwd();
32
+ for (; s; ) {
33
+ const e = f.join(s, "node_modules");
22
34
  if (p.existsSync(e)) return e;
23
- const r = f.resolve(t, "..");
24
- if (r === t) break;
25
- t = r;
35
+ const t = f.resolve(s, "..");
36
+ if (t === s) break;
37
+ s = t;
26
38
  }
27
39
  throw new Error("Unable to find node_modules directory.");
28
40
  }
29
- function $(t) {
41
+ function E(s) {
30
42
  try {
31
- const e = p.statSync(t);
43
+ const e = p.statSync(s);
32
44
  return e.isDirectory() ? "dir" : e.isFile() ? "file" : e.isSymbolicLink() ? "link" : "unknown";
33
45
  } catch (e) {
34
46
  if (e.code == "ENOENT") return "absent";
35
47
  throw e;
36
48
  }
37
49
  }
38
- function ce(t) {
39
- return `${t.type}||${t.pkg}||${t.id}`;
50
+ function Ge(s) {
51
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(s.toLowerCase());
52
+ }
53
+ function ce(s) {
54
+ return `${s.type}||${s.pkg}||${s.id}`;
40
55
  }
41
- function m(t) {
42
- return `${t.type}:${t.pkg}:${t.id}:${t.version}`;
56
+ function m(s) {
57
+ return `${s.type}:${s.pkg}:${s.id}:${s.version}`;
43
58
  }
44
- function g(t) {
45
- return `${t.type}:${t.pkg}:${t.id}`;
59
+ function g(s) {
60
+ return `${s.type}:${s.pkg}:${s.id}`;
46
61
  }
47
- function fe(t, e) {
48
- return t.type == e.type && t.pkg == e.pkg && t.id == e.id;
62
+ function de(s, e) {
63
+ return s.type == e.type && s.pkg == e.pkg && s.id == e.id;
49
64
  }
50
- function h(t) {
51
- return `${t.pkg}:${t.id}`;
65
+ function h(s) {
66
+ return `${s.pkg}:${s.id}`;
52
67
  }
53
- function L(t) {
54
- return { name: h(t), version: t.version };
68
+ function j(s) {
69
+ return { name: h(s), version: s.version };
55
70
  }
56
- function Ge(t) {
57
- const e = t.name.match(/^(?<pkg>[^:]*):(?<id>[^:]*)$/);
58
- if (!e)
59
- throw new Error(`malformed artifact name: ${t.name}`);
60
- return { pkg: e.groups.pkg, id: e.groups.id, version: t.version };
71
+ function Je(s) {
72
+ const e = s.name.match(/^(?<pkg>[^:]*):(?<id>[^:]*)$/);
73
+ if (!e) throw new Error(`malformed artifact name: ${s.name}`);
74
+ return { pkg: e.groups.pkg, id: e.groups.id, version: s.version };
61
75
  }
62
- function de(t) {
63
- return `${t.pkg}:${t.id}:${t.version}`;
76
+ function fe(s) {
77
+ return `${s.pkg}:${s.id}:${s.version}`;
64
78
  }
65
- const Je = new TextDecoder(), ze = new TextEncoder();
79
+ const Ue = new TextDecoder(), ze = new TextEncoder();
66
80
  class ye {
67
- constructor(e, r, o) {
81
+ constructor(e, t, r) {
68
82
  l(this, "data");
69
83
  l(this, "content");
70
- this.compileMode = e, this.fullName = r;
71
- let { data: n, content: s } = o;
72
- if (n === void 0 && s === void 0)
84
+ this.compileMode = e, this.fullName = t;
85
+ let { data: n, content: o } = r;
86
+ if (n === void 0 && o === void 0)
73
87
  throw new Error("Neither data nor content is provided for template constructor");
74
- if (n !== void 0 && s !== void 0)
88
+ if (n !== void 0 && o !== void 0)
75
89
  throw new Error("Both data and content are provided for template constructor");
76
- if (n === void 0 && (n = JSON.parse(Je.decode(je(s))), n.type !== "pl.tengo-template.v2"))
90
+ if (n === void 0 && (n = JSON.parse(Ue.decode(Le(o))), n.type !== "pl.tengo-template.v2"))
77
91
  throw new Error("malformed template");
78
- s === void 0 && (s = Le(ze.encode(Ie(n))));
79
- const i = Ge(n);
80
- if (i.pkg !== r.pkg || i.id !== r.id || i.version !== r.version)
81
- throw new Error(`Compiled template name don't match it's package and file names: ${de(i)} != ${de(r)}`);
82
- this.data = n, this.content = s;
92
+ o === void 0 && (o = je(ze.encode(Ie(n))));
93
+ const i = Je(n);
94
+ if (i.pkg !== t.pkg || i.id !== t.id || i.version !== t.version)
95
+ throw new Error(`Compiled template name don't match it's package and file names: ${fe(i)} != ${fe(t)}`);
96
+ this.data = n, this.content = o;
83
97
  }
84
98
  toJSON() {
85
99
  return { compileMode: this.compileMode, fullName: this.fullName, data: this.data };
@@ -90,23 +104,23 @@ class J {
90
104
  l(this, "map", /* @__PURE__ */ new Map());
91
105
  this.nameExtractor = e;
92
106
  }
93
- add(e, r = !0) {
94
- const o = ce(this.nameExtractor(e)), n = this.map.get(o);
95
- return n && !r || this.map.set(o, e), n;
107
+ add(e, t = !0) {
108
+ const r = ce(this.nameExtractor(e)), n = this.map.get(r);
109
+ return n && !t || this.map.set(r, e), n;
96
110
  }
97
111
  get(e) {
98
112
  return this.map.get(ce(e));
99
113
  }
100
114
  get array() {
101
115
  const e = [];
102
- return this.map.forEach((r) => e.push(r)), e;
116
+ return this.map.forEach((t) => e.push(t)), e;
103
117
  }
104
118
  forEach(e) {
105
- this.map.forEach((r) => e(r, this.nameExtractor(r)));
119
+ this.map.forEach((t) => e(t, this.nameExtractor(t)));
106
120
  }
107
121
  }
108
- function We() {
109
- return new J((t) => t);
122
+ function Pe() {
123
+ return new J((s) => s);
110
124
  }
111
125
  class I {
112
126
  constructor(e) {
@@ -114,31 +128,61 @@ class I {
114
128
  l(this, "dist");
115
129
  this.nameExtractor = e, this.dev = new J(e), this.dist = new J(e);
116
130
  }
117
- add(e, r, o = !0) {
131
+ add(e, t, r = !0) {
118
132
  switch (e) {
119
133
  case "dist":
120
- return this.dist.add(r, o);
134
+ return this.dist.add(t, r);
121
135
  default:
122
- M(e);
136
+ F(e);
123
137
  }
124
138
  }
125
- get(e, r) {
139
+ get(e, t) {
126
140
  switch (e) {
127
141
  case "dist":
128
- return this.dist.get(r);
142
+ return this.dist.get(t);
129
143
  default:
130
- M(e);
144
+ F(e);
131
145
  }
132
146
  }
133
147
  array(e) {
134
- const r = [];
135
- return this.forEach(e, (o) => r.push(o)), r;
148
+ const t = [];
149
+ return this.forEach(e, (r) => t.push(r)), t;
136
150
  }
137
- forEach(e, r) {
138
- this.dist.forEach((o, n) => r(this.get(e, n) ?? o, n));
151
+ forEach(e, t) {
152
+ this.dist.forEach((r, n) => t(this.get(e, n) ?? r, n));
139
153
  }
140
154
  }
141
- class Pe {
155
+ function We(s, e) {
156
+ for (const t of s)
157
+ switch (t.name) {
158
+ case "hash_override": {
159
+ e.hashOverride = qe(t.args);
160
+ break;
161
+ }
162
+ }
163
+ }
164
+ function _e(s, e) {
165
+ for (const t of s)
166
+ switch (t.name) {
167
+ case "hash_override":
168
+ throw new Error(
169
+ "hash_override compiler option can be used ONLY on template level. Even in templates it is already dangerous enough to potentially break everything in Platforma Backend. In libraries with the transitive dependencies resolution and flattening of libraries list on template level, it becomes so unpredictibally disasterous, that we are doomed to never find the ends of a knot if anything goes wrong."
170
+ );
171
+ }
172
+ }
173
+ function qe(s) {
174
+ if (s.length != 1)
175
+ throw new Error(
176
+ "hash_override compiler option expects exactly one argument: hash_override <some string>. Note, you can use only UUID as a value."
177
+ );
178
+ const e = s[0].toLowerCase();
179
+ if (!Ge(e))
180
+ throw new Error(
181
+ `hash_override must contain valid UUID as an override. As hash_override affects deduplication, it becomes completely not possible to distinguish several different templates from each other on backend's side. This means, if you set hash_override to a simple value (say, letter "a") on two completely different templates, they will be marked as interchangeable on backend's side with unpredictable consequences. UUID looks like a safe enough tradeoff between the feature usage simplicity and duplication safety`
182
+ );
183
+ return e;
184
+ }
185
+ class Be {
142
186
  constructor(e) {
143
187
  l(this, "libs", new I((e) => e.fullName));
144
188
  l(this, "software", new I((e) => e.fullName));
@@ -146,70 +190,72 @@ class Pe {
146
190
  l(this, "templates", new I((e) => e.fullName));
147
191
  this.compileMode = e;
148
192
  }
149
- populateTemplateDataFromDependencies(e, r, o, n) {
150
- for (const s of o)
151
- switch (s.type) {
152
- case "library":
153
- const i = this.getLibOrError(s), a = n.indexOf(h(s));
154
- if (a >= 0) {
155
- let y = `library import recursion detected: ${n.slice(a).join(" -> ")} -> ${h(s)}`;
156
- throw new Error(y);
193
+ populateTemplateDataFromDependencies(e, t, r, n) {
194
+ for (const o of r)
195
+ switch (o.type) {
196
+ case "library": {
197
+ const u = this.getLibOrError(o), d = n.indexOf(h(o));
198
+ if (d >= 0) {
199
+ let w = `library import recursion detected: ${n.slice(d).join(" -> ")} -> ${h(o)}`;
200
+ throw new Error(w);
157
201
  }
158
- r.libs[h(s)] = {
159
- ...L(i.fullName),
160
- src: i.src
161
- }, this.populateTemplateDataFromDependencies(e, r, i.dependencies, [...n, h(s)]);
202
+ const y = {
203
+ ...j(u.fullName),
204
+ src: u.src
205
+ };
206
+ _e(u.compilerOptions), t.libs[h(o)] = y, this.populateTemplateDataFromDependencies(e, t, u.dependencies, [...n, h(o)]);
162
207
  break;
208
+ }
163
209
  case "software":
164
- const c = this.getSoftwareOrError(s);
165
- r.software[h(s)] = {
166
- ...L(c.fullName),
167
- src: c.src
210
+ const i = this.getSoftwareOrError(o);
211
+ t.software[h(o)] = {
212
+ ...j(i.fullName),
213
+ src: i.src
168
214
  };
169
215
  break;
170
216
  case "asset":
171
- const d = this.getAssetOrError(s);
172
- r.software[h(s)] = {
173
- ...L(d.fullName),
174
- src: d.src
217
+ const a = this.getAssetOrError(o);
218
+ t.software[h(o)] = {
219
+ ...j(a.fullName),
220
+ src: a.src
175
221
  };
176
222
  break;
177
223
  case "template":
178
- if (fe(e, s))
224
+ if (de(e, o))
179
225
  continue;
180
- const u = this.getTemplateOrError(s);
181
- r.templates[h(s)] = u.data;
226
+ const c = this.getTemplateOrError(o);
227
+ t.templates[h(o)] = c.data;
182
228
  break;
183
229
  case "test":
184
230
  throw new Error(
185
- `dependencies tree error: tests should never be part of template: ${g(s)} is dependency of ${h(e)}`
231
+ `dependencies tree error: tests should never be part of template: ${g(o)} is dependency of ${h(e)}`
186
232
  );
187
233
  default:
188
- M(s.type);
234
+ F(o.type);
189
235
  }
190
236
  }
191
237
  /** This method assumes that all dependencies are already added to the compiler's context */
192
238
  compileAndAddTemplate(e) {
193
239
  if (e.fullName.type !== "template")
194
240
  throw new Error("unexpected source type");
195
- const r = {
241
+ const t = {
196
242
  type: "pl.tengo-template.v2",
197
- ...L(e.fullName),
243
+ ...j(e.fullName),
198
244
  templates: {},
199
245
  libs: {},
200
246
  software: {},
201
247
  assets: {},
202
248
  src: e.src
203
249
  };
204
- this.populateTemplateDataFromDependencies(e.fullName, r, e.dependencies, []);
205
- const o = new ye(e.compileMode, e.fullName, { data: r });
206
- return this.addTemplate(o), o;
250
+ We(e.compilerOptions, t), this.populateTemplateDataFromDependencies(e.fullName, t, e.dependencies, []);
251
+ const r = new ye(e.compileMode, e.fullName, { data: t });
252
+ return this.addTemplate(r), r;
207
253
  }
208
254
  addLib(e) {
209
- const r = this.libs.add(e.compileMode, e, !1);
210
- if (r)
255
+ const t = this.libs.add(e.compileMode, e, !1);
256
+ if (t)
211
257
  throw new Error(
212
- `compiler already contain such library: adding = ${m(e.fullName)}, contains = ${m(r.fullName)}`
258
+ `compiler already contain such library: adding = ${m(e.fullName)}, contains = ${m(t.fullName)}`
213
259
  );
214
260
  }
215
261
  allLibs() {
@@ -221,16 +267,16 @@ class Pe {
221
267
  return this.libs.get(this.compileMode, e);
222
268
  }
223
269
  getLibOrError(e) {
224
- const r = this.getLib(e);
225
- if (!r)
270
+ const t = this.getLib(e);
271
+ if (!t)
226
272
  throw new Error(`library not found: ${h(e)}`);
227
- return r;
273
+ return t;
228
274
  }
229
275
  addSoftware(e) {
230
- const r = this.software.add(e.compileMode, e, !1);
231
- if (r)
276
+ const t = this.software.add(e.compileMode, e, !1);
277
+ if (t)
232
278
  throw new Error(
233
- `compiler already contain info for software: adding = ${m(e.fullName)}, contains = ${m(r.fullName)}`
279
+ `compiler already contain info for software: adding = ${m(e.fullName)}, contains = ${m(t.fullName)}`
234
280
  );
235
281
  }
236
282
  allSoftware() {
@@ -242,16 +288,16 @@ class Pe {
242
288
  return this.software.get(this.compileMode, e);
243
289
  }
244
290
  getSoftwareOrError(e) {
245
- const r = this.getSoftware(e);
246
- if (!r)
291
+ const t = this.getSoftware(e);
292
+ if (!t)
247
293
  throw new Error(`software info not found: ${h(e)}`);
248
- return r;
294
+ return t;
249
295
  }
250
296
  addAsset(e) {
251
- const r = this.assets.add(e.compileMode, e, !1);
252
- if (r)
297
+ const t = this.assets.add(e.compileMode, e, !1);
298
+ if (t)
253
299
  throw new Error(
254
- `compiler already contain info for asset: adding = ${m(e.fullName)}, contains = ${m(r.fullName)}`
300
+ `compiler already contain info for asset: adding = ${m(e.fullName)}, contains = ${m(t.fullName)}`
255
301
  );
256
302
  }
257
303
  allAssets() {
@@ -263,16 +309,16 @@ class Pe {
263
309
  return this.assets.get(this.compileMode, e);
264
310
  }
265
311
  getAssetOrError(e) {
266
- const r = this.getAsset(e);
267
- if (!r)
312
+ const t = this.getAsset(e);
313
+ if (!t)
268
314
  throw new Error(`asset info not found: ${h(e)}`);
269
- return r;
315
+ return t;
270
316
  }
271
317
  addTemplate(e) {
272
- const r = this.templates.add(e.compileMode, e, !1);
273
- if (r)
318
+ const t = this.templates.add(e.compileMode, e, !1);
319
+ if (t)
274
320
  throw new Error(
275
- `compiler already contain such template: adding = ${m(e.fullName)}, contains = ${m(r.fullName)}`
321
+ `compiler already contain such template: adding = ${m(e.fullName)}, contains = ${m(t.fullName)}`
276
322
  );
277
323
  }
278
324
  allTemplates() {
@@ -284,10 +330,10 @@ class Pe {
284
330
  return this.templates.get(this.compileMode, e);
285
331
  }
286
332
  getTemplateOrError(e) {
287
- const r = this.getTemplate(e);
288
- if (!r)
333
+ const t = this.getTemplate(e);
334
+ if (!t)
289
335
  throw new Error(`template not found: ${h(e)}`);
290
- return r;
336
+ return t;
291
337
  }
292
338
  getArtefact(e) {
293
339
  switch (e.type) {
@@ -302,463 +348,476 @@ class Pe {
302
348
  case "test":
303
349
  return;
304
350
  default:
305
- M(e.type);
351
+ F(e.type);
306
352
  }
307
353
  }
308
354
  checkLibs() {
309
355
  this.libs.forEach(this.compileMode, (e) => {
310
- for (const r of e.dependencies) {
311
- if (r.type === "test")
312
- throw new Error(`test should never be dependency of production code: ${g(r)} test is dependency of ${m(e.fullName)}`);
313
- if (!this.getArtefact(r))
314
- throw new Error(`unresolved dependency ${g(r)} for ${m(e.fullName)}`);
356
+ for (const t of e.dependencies) {
357
+ if (t.type === "test")
358
+ throw new Error(`test should never be dependency of production code: ${g(t)} test is dependency of ${m(e.fullName)}`);
359
+ if (!this.getArtefact(t))
360
+ throw new Error(`unresolved dependency ${g(t)} for ${m(e.fullName)}`);
315
361
  }
316
362
  });
317
363
  }
318
364
  compileAndAdd(e) {
319
- const r = { templates: [], libs: [], software: [], assets: [] };
320
- let o = [];
365
+ const t = { templates: [], libs: [], software: [], assets: [] };
366
+ let r = [];
321
367
  for (const n of e)
322
- n.fullName.type === "library" ? (this.addLib(n), r.libs.push(n)) : n.fullName.type === "software" ? (this.addSoftware(n), r.software.push(n)) : n.fullName.type === "asset" ? (this.addAsset(n), r.assets.push(n)) : o.push(n);
323
- for (; o.length > 0; ) {
368
+ n.fullName.type === "library" ? (this.addLib(n), t.libs.push(n)) : n.fullName.type === "software" ? (this.addSoftware(n), t.software.push(n)) : n.fullName.type === "asset" ? (this.addAsset(n), t.assets.push(n)) : r.push(n);
369
+ for (; r.length > 0; ) {
324
370
  const n = [];
325
- for (const s of o) {
326
- const i = s.dependencies.filter(
371
+ for (const o of r) {
372
+ const i = o.dependencies.filter(
327
373
  (a) => !this.getArtefact(a) && // allow self reference for templates
328
- !(s.fullName.type === "template" && fe(s.fullName, a))
374
+ !(o.fullName.type === "template" && de(o.fullName, a))
329
375
  );
330
376
  if (i.length > 0) {
331
- let a = `Unsatisfied dependencies in ${m(s.fullName)}:
377
+ let a = `Unsatisfied dependencies in ${m(o.fullName)}:
332
378
  `;
333
379
  for (const c of i)
334
380
  a += ` - ${g(c)}
335
381
  `;
336
- n.push({ src: s, err: Error(a) });
382
+ n.push({ src: o, err: Error(a) });
337
383
  continue;
338
384
  }
339
- switch (s.fullName.type) {
385
+ switch (o.fullName.type) {
340
386
  case "library":
341
- this.addLib(s), r.libs.push(s);
387
+ this.addLib(o), t.libs.push(o);
342
388
  break;
343
389
  case "software":
344
- this.addSoftware(s), r.software.push(s);
390
+ this.addSoftware(o), t.software.push(o);
345
391
  break;
346
392
  case "asset":
347
- this.addAsset(s), r.assets.push(s);
393
+ this.addAsset(o), t.assets.push(o);
348
394
  break;
349
395
  case "template":
350
396
  try {
351
- const a = this.compileAndAddTemplate(s);
352
- r.templates.push(a);
397
+ const a = this.compileAndAddTemplate(o);
398
+ t.templates.push(a);
353
399
  } catch (a) {
354
- let c = `Unsatisfied dependencies in ${m(s.fullName)}:
400
+ let c = `Unsatisfied dependencies in ${m(o.fullName)}:
355
401
  `;
356
402
  c += ` - ${a.message}
357
- `, n.push({ src: s, err: Error(c) });
403
+ `, n.push({ src: o, err: Error(c) });
358
404
  }
359
405
  break;
360
406
  case "test":
361
407
  break;
362
408
  default:
363
- M(s.fullName.type);
409
+ F(o.fullName.type);
364
410
  }
365
411
  }
366
- if (o.length === n.length) {
367
- let s = "";
412
+ if (r.length === n.length) {
413
+ let o = "";
368
414
  for (const i of n)
369
- s += `
415
+ o += `
370
416
  ${i.err.message}`;
371
- throw new Error(s);
417
+ throw new Error(o);
372
418
  }
373
- o = n.map(({ src: s }) => s);
419
+ r = n.map(({ src: o }) => o);
374
420
  }
375
- return r;
421
+ return t;
376
422
  }
377
423
  }
378
- const pe = "[_a-zA-Z][_a-zA-Z0-9]*", O = (t, e) => new RegExp(
379
- `\\b${t}\\.(?<fnCall>(?<fnName>` + e + ')\\s*\\(\\s*"(?<templateName>[^"]+)"\\s*\\))'
380
- ), Ue = (t) => O(t, "getTemplateId"), qe = (t) => O(t, "getSoftwareInfo"), ue = (t) => O(t, "importTemplate"), me = (t) => O(t, "importSoftware"), Be = (t) => O(t, "importAsset"), Ve = /^\s*(\/\/)|(\/\*.*\*\/)/, Ze = /^\s*\/\*/, Ke = /\*\//, be = /\s*:=\s*import\s*\(\s*"(?<moduleName>[^"]+)"\s*\)/, Xe = new RegExp(
424
+ const pe = "[_a-zA-Z][_a-zA-Z0-9]*", R = (s, e) => new RegExp(
425
+ `\\b${s}\\.(?<fnCall>(?<fnName>` + e + ')\\s*\\(\\s*"(?<templateName>[^"]+)"\\s*\\))'
426
+ ), Ve = (s) => R(s, "getTemplateId"), Ze = (s) => R(s, "getSoftwareInfo"), ue = (s) => R(s, "importTemplate"), me = (s) => R(s, "importSoftware"), Ke = (s) => R(s, "importAsset"), Xe = /^\s*$/, Ye = /^\/\/tengo:/, He = /^\s*\/\/\s+tengo:/, Qe = /^\s*(\/\/)|(\/\*.*\*\/)/, et = /^\s*\/\*/, tt = /\*\//, be = /\s*:=\s*import\s*\(\s*"(?<moduleName>[^"]+)"\s*\)/, st = new RegExp(
381
427
  `\\b(?<importName>${pe}(\\.${pe})*)${be.source}`
382
- ), He = /(?<pkgName>[^"]+)?:(?<depID>[^"]+)/;
383
- class re {
384
- constructor(e, r, o, n, s) {
385
- this.compileMode = e, this.fullName = r, this.src = o, this.srcName = n, this.dependencies = s;
428
+ ), ot = /(?<pkgName>[^"]+)?:(?<depID>[^"]+)/, rt = (s) => {
429
+ const e = s.split(" "), t = e[0].split(":");
430
+ if (t.length != 2)
431
+ throw new Error(
432
+ "compiler option format is wrong: expect to have option name after 'tengo:' prefix, like 'tengo:MyOption'"
433
+ );
434
+ return {
435
+ name: t[1],
436
+ args: e.slice(1)
437
+ };
438
+ };
439
+ class oe {
440
+ constructor(e, t, r, n, o, i) {
441
+ this.compileMode = e, this.fullName = t, this.src = r, this.srcName = n, this.dependencies = o, this.compilerOptions = i;
386
442
  }
387
443
  }
388
- function $e(t, e, r, o) {
389
- const n = Re(e).toString(), { deps: s, normalized: i } = Qe(n, r, o);
390
- return new re(t, r, i, e, s.array);
444
+ function ve(s, e, t, r, n) {
445
+ const o = Me(t).toString(), { deps: i, normalized: a, opts: c } = nt(s, o, r, n);
446
+ return new oe(e, r, a, t, i.array, c);
391
447
  }
392
- function Qe(t, e, r) {
393
- const o = We(), n = t.split(`
394
- `), s = [];
395
- let i = {
448
+ function nt(s, e, t, r) {
449
+ const n = Pe(), o = [], i = e.split(`
450
+ `), a = [];
451
+ let c = {
396
452
  isInCommentBlock: !1,
397
- tplDepREs: /* @__PURE__ */ new Map()
398
- }, a = 0;
399
- for (const c of n) {
400
- a++;
453
+ canDetectOptions: !0,
454
+ tplDepREs: /* @__PURE__ */ new Map(),
455
+ lineNo: 0
456
+ };
457
+ for (const u of i) {
458
+ c.lineNo++;
401
459
  try {
402
- const d = Ye(
460
+ const d = it(
461
+ s,
462
+ u,
403
463
  c,
404
- i,
405
- e.pkg,
464
+ t.pkg,
406
465
  r
407
466
  );
408
- s.push(d.line), i = d.context, d.artifact && o.add(d.artifact);
467
+ a.push(d.line), c = d.context, d.artifact && n.add(d.artifact), d.option && o.push(d.option);
409
468
  } catch (d) {
410
- throw new Error(`[line ${a}]: ${d.message}
411
- ${c}`);
469
+ throw new Error(`[line ${c.lineNo}]: ${d.message}
470
+ ${u}`);
412
471
  }
413
472
  }
414
473
  return {
415
- normalized: s.join(`
474
+ normalized: a.join(`
416
475
  `),
417
- deps: o
476
+ deps: n,
477
+ opts: o
418
478
  };
419
479
  }
420
- function Ye(t, e, r, o) {
421
- if (e.isInCommentBlock)
422
- return Ke.exec(t) && (e.isInCommentBlock = !1), { line: t, context: e, artifact: void 0 };
423
- if (Ve.exec(t))
424
- return { line: t, context: e, artifact: void 0 };
425
- if (Ze.exec(t))
426
- return e.isInCommentBlock = !0, { line: t, context: e, artifact: void 0 };
427
- const n = be.exec(t);
428
- if (n) {
429
- const s = _e(t);
430
- if (s.module === "plapi")
431
- return e.tplDepREs.has(s.module) || e.tplDepREs.set(s.module, [
432
- ["template", Ue(s.alias)],
433
- ["software", qe(s.alias)]
434
- ]), { line: t, context: e, artifact: void 0 };
435
- (s.module === "@milaboratory/tengo-sdk:ll" || s.module === "@platforma-sdk/workflow-tengo:ll" || (r === "@milaboratory/tengo-sdk" || r === "@platforma-sdk/workflow-tengo") && s.module === ":ll") && (e.tplDepREs.has(s.module) || e.tplDepREs.set(s.module, [
436
- ["template", ue(s.alias)],
437
- ["software", me(s.alias)]
438
- ])), (s.module === "@milaboratory/tengo-sdk:assets" || s.module === "@platforma-sdk/workflow-tengo:assets" || (r === "@milaboratory/tengo-sdk" || r === "@platforma-sdk/workflow-tengo") && s.module === ":assets") && (e.tplDepREs.has(s.module) || e.tplDepREs.set(s.module, [
439
- ["template", ue(s.alias)],
440
- ["software", me(s.alias)],
441
- ["asset", Be(s.alias)]
480
+ function it(s, e, t, r, n) {
481
+ if (t.isInCommentBlock)
482
+ return tt.exec(e) && (t.isInCommentBlock = !1), { line: e, context: t, artifact: void 0, option: void 0 };
483
+ if (Ye.exec(e))
484
+ return t.canDetectOptions ? { line: e, context: t, artifact: void 0, option: rt(e) } : (s.warn(
485
+ `[line ${t.lineNo}]: compiler option '//tengo:' was detected, but it cannot be applied as compiler options can be set only at the file header, before any code line'`
486
+ ), { line: e, context: t, artifact: void 0, option: void 0 });
487
+ if (He.exec(e) && t.canDetectOptions)
488
+ return s.warn(
489
+ `[line ${t.lineNo}]: text simillar to compiler option ('//tengo:...') was detected, but it has wrong format. Leave it as is, if you did not mean to use a line as compiler option. Or format it to '//tengo:<option>' otherwise (no spaces between '//' and 'tengo', no spaces between ':' and option name)`
490
+ ), { line: e, context: t, artifact: void 0, option: void 0 };
491
+ if (Qe.exec(e))
492
+ return { line: e, context: t, artifact: void 0, option: void 0 };
493
+ if (et.exec(e))
494
+ return t.isInCommentBlock = !0, { line: e, context: t, artifact: void 0, option: void 0 };
495
+ if (Xe.exec(e))
496
+ return { line: e, context: t, artifact: void 0, option: void 0 };
497
+ t.canDetectOptions = !1;
498
+ const o = be.exec(e);
499
+ if (o) {
500
+ const i = at(e);
501
+ if (i.module === "plapi")
502
+ return t.tplDepREs.has(i.module) || t.tplDepREs.set(i.module, [
503
+ ["template", Ve(i.alias)],
504
+ ["software", Ze(i.alias)]
505
+ ]), { line: e, context: t, artifact: void 0, option: void 0 };
506
+ (i.module === "@milaboratory/tengo-sdk:ll" || i.module === "@platforma-sdk/workflow-tengo:ll" || (r === "@milaboratory/tengo-sdk" || r === "@platforma-sdk/workflow-tengo") && i.module === ":ll") && (t.tplDepREs.has(i.module) || t.tplDepREs.set(i.module, [
507
+ ["template", ue(i.alias)],
508
+ ["software", me(i.alias)]
509
+ ])), (i.module === "@milaboratory/tengo-sdk:assets" || i.module === "@platforma-sdk/workflow-tengo:assets" || (r === "@milaboratory/tengo-sdk" || r === "@platforma-sdk/workflow-tengo") && i.module === ":assets") && (t.tplDepREs.has(i.module) || t.tplDepREs.set(i.module, [
510
+ ["template", ue(i.alias)],
511
+ ["software", me(i.alias)],
512
+ ["asset", Ke(i.alias)]
442
513
  ]));
443
- const i = ge(s.module, "library", r);
444
- 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 };
514
+ const a = ge(i.module, "library", r);
515
+ return a ? (e = e.replace(o[0], ` := import("${a.pkg}:${a.id}")`), { line: e, context: t, artifact: a, option: void 0 }) : { line: e, context: t, artifact: void 0, option: void 0 };
445
516
  }
446
- if (e.tplDepREs.size > 0)
447
- for (const [s, i] of e.tplDepREs)
448
- for (const [a, c] of i) {
449
- const d = c.exec(t);
517
+ if (t.tplDepREs.size > 0)
518
+ for (const [i, a] of t.tplDepREs)
519
+ for (const [c, u] of a) {
520
+ const d = u.exec(e);
450
521
  if (!d || !d.groups)
451
522
  continue;
452
- const { fnCall: u, templateName: y, fnName: b } = d.groups;
453
- if (!u || !y || !b)
523
+ const { fnCall: y, templateName: w, fnName: b } = d.groups;
524
+ if (!y || !w || !b)
454
525
  throw Error("failed to parse template import statement");
455
- const w = ge(y, a, r);
456
- if (!w)
526
+ const v = ge(w, c, r);
527
+ if (!v)
457
528
  throw Error(`failed to parse artifact name in ${b} import statement`);
458
- return t = t.replace(u, `${b}("${w.pkg}:${w.id}")`), { line: t, context: e, artifact: w };
529
+ return e = e.replace(y, `${b}("${v.pkg}:${v.id}")`), { line: e, context: t, artifact: v, option: void 0 };
459
530
  }
460
- return { line: t, context: e, artifact: void 0 };
531
+ return { line: e, context: t, artifact: void 0, option: void 0 };
461
532
  }
462
- function _e(t) {
463
- const e = Xe.exec(t);
533
+ function at(s) {
534
+ const e = st.exec(s);
464
535
  if (!e || !e.groups)
465
536
  throw Error("failed to parse 'import' statement");
466
- const { importName: r, moduleName: o } = e.groups;
467
- if (!r || !o)
537
+ const { importName: t, moduleName: r } = e.groups;
538
+ if (!t || !r)
468
539
  throw Error("failed to parse 'import' statement");
469
540
  return {
470
- module: o,
471
- alias: r
541
+ module: r,
542
+ alias: t
472
543
  };
473
544
  }
474
- function ge(t, e, r) {
475
- const o = He.exec(t);
476
- if (!o)
545
+ function ge(s, e, t) {
546
+ const r = ot.exec(s);
547
+ if (!r)
477
548
  return;
478
- if (!o.groups)
549
+ if (!r.groups)
479
550
  throw Error(
480
551
  "failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'"
481
552
  );
482
- const { pkgName: n, depID: s } = o.groups;
483
- if (!s)
553
+ const { pkgName: n, depID: o } = r.groups;
554
+ if (!o)
484
555
  throw Error(
485
556
  "failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'"
486
557
  );
487
- return { type: e, pkg: n ?? r, id: s };
488
- }
489
- const z = ".plj.gz", W = ".lib.tengo", P = ".sw.json", U = ".as.json", he = ".test.tengo", q = ".tpl.tengo", B = ".lib.tengo", V = ".sw.json", Z = ".as.json", et = [B, q, V, Z];
490
- function E(t = "debug") {
491
- return G.createLogger({
492
- level: t,
493
- format: G.format.printf(({ level: e, message: r }) => `${e.padStart(6, " ")}: ${r}`),
494
- transports: [
495
- new G.transports.Console({
496
- stderrLevels: ["error", "warn", "info", "debug"],
497
- handleExceptions: !0
498
- })
499
- ]
500
- });
558
+ return { type: e, pkg: n ?? t, id: o };
501
559
  }
502
- function R() {
560
+ const U = ".plj.gz", z = ".lib.tengo", P = ".sw.json", W = ".as.json", he = ".test.tengo", _ = ".tpl.tengo", q = ".lib.tengo", B = ".sw.json", V = ".as.json", lt = [q, _, B, V];
561
+ function M() {
503
562
  return JSON.parse(p.readFileSync("package.json").toString());
504
563
  }
505
- function ve(t, e) {
506
- return f.resolve(e, t, "tengo", "lib");
564
+ function Ee(s, e) {
565
+ return f.resolve(e, s, "tengo", "lib");
507
566
  }
508
- function Ee(t, e) {
509
- return f.resolve(e, t, "tengo", "tpl");
567
+ function $e(s, e) {
568
+ return f.resolve(e, s, "tengo", "tpl");
510
569
  }
511
- function Ne(t, e) {
512
- return f.resolve(e, t, "tengo", "software");
570
+ function Ne(s, e) {
571
+ return f.resolve(e, s, "tengo", "software");
513
572
  }
514
- function Se(t, e) {
515
- return f.resolve(e, t, "tengo", "asset");
573
+ function Se(s, e) {
574
+ return f.resolve(e, s, "tengo", "asset");
516
575
  }
517
- function ke(t, e, r, o, n = !1) {
518
- const s = f.resolve(o, "package.json");
519
- if ($(s) !== "file") {
520
- for (const ae of p.readdirSync(o)) {
521
- const xe = $(f.join(o, ae)) === "link", le = f.resolve(o, ae);
522
- $(le) === "dir" && ke(t, e, r, le, xe);
576
+ function ke(s, e, t, r, n = !1) {
577
+ const o = f.resolve(r, "package.json");
578
+ if (E(o) !== "file") {
579
+ for (const ae of p.readdirSync(r)) {
580
+ const De = E(f.join(r, ae)) === "link", le = f.resolve(r, ae);
581
+ E(le) === "dir" && ke(s, e, t, le, De);
523
582
  }
524
583
  return;
525
584
  }
526
- const i = ve("dist", o), a = Ee("dist", o), c = Ne("dist", o), d = Se("dist", o), u = $(i) === "dir", y = $(a) === "dir", b = $(c) === "dir", w = $(d) === "dir";
527
- if (!u && !y && !b && !w)
585
+ const i = Ee("dist", r), a = $e("dist", r), c = Ne("dist", r), u = Se("dist", r), d = E(i) === "dir", y = E(a) === "dir", w = E(c) === "dir", b = E(u) === "dir";
586
+ if (!d && !y && !w && !b)
528
587
  return;
529
- const x = JSON.parse(p.readFileSync(s).toString());
530
- if (x.name !== r.name) {
531
- if ($(f.resolve(o, "node_modules")) === "dir" && n)
588
+ const v = JSON.parse(p.readFileSync(o).toString());
589
+ if (v.name !== t.name) {
590
+ if (E(f.resolve(r, "node_modules")) === "dir" && n)
532
591
  throw new Error(
533
- `nested node_modules is a sign of library dependencies version incompatibility in ${o}`
592
+ `nested node_modules is a sign of library dependencies version incompatibility in ${r}`
534
593
  );
535
- u && tt(t, x, "dist", i, e), y && st(t, x, "dist", a, e), b && rt(t, x, "dist", c, e), w && ot(t, x, "dist", d, e);
594
+ d && ct(s, v, "dist", i, e), y && dt(s, v, "dist", a, e), w && ft(s, v, "dist", c, e), b && pt(s, v, "dist", u, e);
536
595
  }
537
596
  }
538
- function tt(t, e, r, o, n) {
539
- for (const s of p.readdirSync(o)) {
540
- const i = f.resolve(o, s);
541
- if (!s.endsWith(W)) throw new Error(`unexpected file in 'lib' folder: ${i}`);
597
+ function ct(s, e, t, r, n) {
598
+ for (const o of p.readdirSync(r)) {
599
+ const i = f.resolve(r, o);
600
+ if (!o.endsWith(z)) throw new Error(`unexpected file in 'lib' folder: ${i}`);
542
601
  const a = {
543
602
  type: "library",
544
603
  pkg: e.name,
545
- id: s.slice(0, s.length - W.length),
604
+ id: o.slice(0, o.length - z.length),
546
605
  version: e.version
547
- }, c = $e(r, i, a, !0);
548
- if (n.addLib(c), t.debug(`Adding dependency ${m(a)} from ${i}`), c.dependencies.length > 0) {
549
- t.debug("Dependencies:");
550
- for (const d of c.dependencies) t.debug(` - ${g(d)}`);
606
+ }, c = ve(s, t, i, a, !0);
607
+ if (n.addLib(c), s.debug(`Adding dependency ${m(a)} from ${i}`), c.dependencies.length > 0) {
608
+ s.debug("Dependencies:");
609
+ for (const u of c.dependencies) s.debug(` - ${g(u)}`);
551
610
  }
552
611
  }
553
612
  }
554
- function st(t, e, r, o, n) {
555
- for (const s of p.readdirSync(o)) {
556
- const i = f.resolve(o, s);
557
- if (!s.endsWith(z)) throw new Error(`unexpected file in 'tpl' folder: ${i}`);
613
+ function dt(s, e, t, r, n) {
614
+ for (const o of p.readdirSync(r)) {
615
+ const i = f.resolve(r, o);
616
+ if (!o.endsWith(U)) throw new Error(`unexpected file in 'tpl' folder: ${i}`);
558
617
  const a = {
559
618
  type: "template",
560
619
  pkg: e.name,
561
- id: s.slice(0, s.length - z.length),
620
+ id: o.slice(0, o.length - U.length),
562
621
  version: e.version
563
- }, c = new ye(r, a, { content: p.readFileSync(i) });
564
- n.addTemplate(c), t.debug(`Adding dependency ${m(a)} from ${i}`);
622
+ }, c = new ye(t, a, { content: p.readFileSync(i) });
623
+ n.addTemplate(c), s.debug(`Adding dependency ${m(a)} from ${i}`);
565
624
  }
566
625
  }
567
- function rt(t, e, r, o, n) {
568
- for (const s of p.readdirSync(o)) {
569
- const i = f.resolve(o, s);
570
- if (!s.endsWith(P))
626
+ function ft(s, e, t, r, n) {
627
+ for (const o of p.readdirSync(r)) {
628
+ const i = f.resolve(r, o);
629
+ if (!o.endsWith(P))
571
630
  throw new Error(`unexpected file in 'software' folder: ${i}`);
572
631
  const a = {
573
632
  type: "software",
574
633
  pkg: e.name,
575
- id: s.slice(0, s.length - P.length),
634
+ id: o.slice(0, o.length - P.length),
576
635
  version: e.version
577
- }, c = new re(r, a, p.readFileSync(i).toString(), i, []);
578
- t.debug(`Adding dependency ${m(a)} from ${i}`), n.addSoftware(c);
636
+ }, c = new oe(t, a, p.readFileSync(i).toString(), i, [], []);
637
+ s.debug(`Adding dependency ${m(a)} from ${i}`), n.addSoftware(c);
579
638
  }
580
639
  }
581
- function ot(t, e, r, o, n) {
582
- for (const s of p.readdirSync(o)) {
583
- const i = f.resolve(o, s);
584
- if (!s.endsWith(U))
640
+ function pt(s, e, t, r, n) {
641
+ for (const o of p.readdirSync(r)) {
642
+ const i = f.resolve(r, o);
643
+ if (!o.endsWith(W))
585
644
  throw new Error(`unexpected file in 'asset' folder: ${i}`);
586
645
  const a = {
587
646
  type: "asset",
588
647
  pkg: e.name,
589
- id: s.slice(0, s.length - U.length),
648
+ id: o.slice(0, o.length - W.length),
590
649
  version: e.version
591
- }, c = new re(r, a, p.readFileSync(i).toString(), i, []);
592
- t.debug(`Adding dependency ${m(a)} from ${i}`), n.addAsset(c);
650
+ }, c = new oe(t, a, p.readFileSync(i).toString(), i, [], []);
651
+ s.debug(`Adding dependency ${m(a)} from ${i}`), n.addAsset(c);
593
652
  }
594
653
  }
595
- function j(t, e, r, o, n) {
596
- const s = [];
597
- for (const i of p.readdirSync(f.join(o, n))) {
598
- const a = f.join(n, i), c = f.join(o, a);
599
- if ($(c) === "dir") {
600
- const w = j(t, e, r, o, a);
601
- s.push(...w);
654
+ function L(s, e, t, r, n) {
655
+ const o = [];
656
+ for (const i of p.readdirSync(f.join(r, n))) {
657
+ const a = f.join(n, i), c = f.join(r, a);
658
+ if (E(c) === "dir") {
659
+ const b = L(s, e, t, r, a);
660
+ o.push(...b);
602
661
  continue;
603
662
  }
604
- const d = i === "index.lib.tengo" ? `${f.basename(n)}.lib.tengo` : a, u = nt(e, d.replaceAll(f.sep, "."));
605
- if (!u)
663
+ const u = i === "index.lib.tengo" ? `${f.basename(n)}.lib.tengo` : a, d = ut(e, u.replaceAll(f.sep, "."));
664
+ if (!d)
606
665
  continue;
607
- const y = f.resolve(o, a);
608
- t.debug(`Parsing ${m(u)} from ${y}`);
609
- const b = $e(r, y, u, !0);
610
- if (b.dependencies.length > 0) {
611
- t.debug("Detected dependencies:");
612
- for (const w of b.dependencies) t.debug(` - ${g(w)}`);
666
+ const y = f.resolve(r, a);
667
+ s.debug(`Parsing ${m(d)} from ${y}`);
668
+ const w = ve(s, t, y, d, !0);
669
+ if (w.dependencies.length > 0) {
670
+ s.debug("Detected dependencies:");
671
+ for (const b of w.dependencies) s.debug(` - ${g(b)}`);
613
672
  }
614
- s.push(b);
673
+ o.push(w);
615
674
  }
616
- return s;
675
+ return o;
617
676
  }
618
- function oe(t, e, r) {
619
- const o = new Pe(r);
620
- return ke(t, o, e, Ce()), o;
677
+ function re(s, e, t) {
678
+ const r = new Be(t);
679
+ return ke(s, r, e, Ce()), r;
621
680
  }
622
- function nt(t, e) {
623
- const r = { pkg: t.name, version: t.version };
624
- return e.endsWith(B) ? {
625
- ...r,
626
- id: e.substring(0, e.length - B.length),
627
- type: "library"
628
- } : e.endsWith(q) ? {
629
- ...r,
681
+ function ut(s, e) {
682
+ const t = { pkg: s.name, version: s.version };
683
+ return e.endsWith(q) ? {
684
+ ...t,
630
685
  id: e.substring(0, e.length - q.length),
686
+ type: "library"
687
+ } : e.endsWith(_) ? {
688
+ ...t,
689
+ id: e.substring(0, e.length - _.length),
631
690
  type: "template"
691
+ } : e.endsWith(B) ? {
692
+ ...t,
693
+ id: e.substring(0, e.length - B.length),
694
+ type: "software"
632
695
  } : e.endsWith(V) ? {
633
- ...r,
696
+ ...t,
634
697
  id: e.substring(0, e.length - V.length),
635
- type: "software"
636
- } : e.endsWith(Z) ? {
637
- ...r,
638
- id: e.substring(0, e.length - Z.length),
639
698
  type: "asset"
640
699
  } : e.endsWith(he) ? {
641
- ...r,
700
+ ...t,
642
701
  id: e.substring(0, e.length - he.length),
643
702
  type: "test"
644
703
  } : null;
645
704
  }
646
- function it(t, e) {
647
- const r = R(), o = oe(t, r, e), n = j(t, r, e, "src", "");
705
+ function mt(s, e) {
706
+ const t = M(), r = re(s, t, e), n = L(s, t, e, "src", "");
648
707
  if (n.length === 0) {
649
708
  const i = [];
650
- for (const a of et)
709
+ for (const a of lt)
651
710
  i.push(`*${a}`);
652
- t.error(`Nothing to compile. Looked for ${i.join(", ")}`), process.exit(1);
711
+ s.error(`Nothing to compile. Looked for ${i.join(", ")}`), process.exit(1);
653
712
  }
654
- t.info(`Compiling '${e}'...`);
655
- const s = o.compileAndAdd(n);
656
- return t.debug("Done."), s;
713
+ s.info(`Compiling '${e}'...`);
714
+ const o = r.compileAndAdd(n);
715
+ return s.debug("Done."), o;
657
716
  }
658
- function at(t, e, r) {
717
+ function gt(s, e, t) {
659
718
  if (e.libs.length > 0) {
660
- const o = ve(r, ".");
661
- p.mkdirSync(o, { recursive: !0 });
719
+ const r = Ee(t, ".");
720
+ p.mkdirSync(r, { recursive: !0 });
662
721
  for (const n of e.libs) {
663
- const s = f.resolve(o, n.fullName.id + W);
664
- t.info(` - writing ${s}`), p.writeFileSync(s, n.src);
722
+ const o = f.resolve(r, n.fullName.id + z);
723
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
665
724
  }
666
725
  }
667
726
  if (e.templates.length > 0) {
668
- const o = Ee(r, ".");
669
- p.mkdirSync(o, { recursive: !0 });
727
+ const r = $e(t, ".");
728
+ p.mkdirSync(r, { recursive: !0 });
670
729
  for (const n of e.templates) {
671
- const s = f.resolve(o, n.fullName.id + z);
672
- t.info(` - writing ${s}`), p.writeFileSync(s, n.content);
730
+ const o = f.resolve(r, n.fullName.id + U);
731
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.content);
673
732
  }
674
733
  }
675
734
  if (e.software.length > 0) {
676
- const o = Ne(r, ".");
677
- p.mkdirSync(o, { recursive: !0 });
735
+ const r = Ne(t, ".");
736
+ p.mkdirSync(r, { recursive: !0 });
678
737
  for (const n of e.software) {
679
- const s = f.resolve(o, n.fullName.id + P);
680
- t.info(` - writing ${s}`), p.writeFileSync(s, n.src);
738
+ const o = f.resolve(r, n.fullName.id + P);
739
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
681
740
  }
682
741
  }
683
742
  if (e.assets.length > 0) {
684
- const o = Se(r, ".");
685
- p.mkdirSync(o, { recursive: !0 });
743
+ const r = Se(t, ".");
744
+ p.mkdirSync(r, { recursive: !0 });
686
745
  for (const n of e.software) {
687
- const s = f.resolve(o, n.fullName.id + U);
688
- t.info(` - writing ${s}`), p.writeFileSync(s, n.src);
746
+ const o = f.resolve(r, n.fullName.id + W);
747
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
689
748
  }
690
749
  }
691
750
  }
692
751
  const ne = {
693
- "log-level": F.string({
752
+ "log-level": O.string({
694
753
  description: "logging level",
695
754
  default: "info",
696
755
  options: ["error", "warn", "info", "debug"]
697
756
  })
698
- }, lt = {
699
- "generate-tags": F.boolean({
757
+ }, ht = {
758
+ "generate-tags": O.boolean({
700
759
  description: "generate tags, default false",
701
760
  default: !1
702
761
  }),
703
- "tags-file": F.file({
762
+ "tags-file": O.file({
704
763
  description: 'where to put ".tags" file, it should be a root of VS Code project',
705
764
  default: "../../.tags"
706
765
  // usually a user opens a directory with all blocks
707
766
  }),
708
- "tags-additional-args": F.string({
767
+ "tags-additional-args": O.string({
709
768
  description: "additional flags for universal-ctags command: e.g. -e for emacs",
710
769
  default: [],
711
770
  multiple: !0,
712
771
  delimiter: ","
713
772
  })
714
- }, k = class k extends v {
773
+ }, A = class A extends $ {
715
774
  async run() {
716
- const { flags: e } = await this.parse(k), r = E(e["log-level"]), o = R(), n = it(r, "dist");
717
- at(r, n, "dist"), r.info("");
718
- let s = `declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
775
+ const { flags: e } = await this.parse(A), t = N(e["log-level"]), r = M(), n = mt(t, "dist");
776
+ gt(t, n, "dist"), t.info("");
777
+ let o = `declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
719
778
  `;
720
- s += `declare type TplName = ${n.templates.map((u) => '"' + u.fullName.id + '"').join(" | ")};
721
- `, s += `declare const Templates: Record<TplName, TemplateFromFile>;
722
- `, s += `export { Templates };
779
+ o += `declare type TplName = ${n.templates.map((d) => '"' + d.fullName.id + '"').join(" | ")};
780
+ `, o += `declare const Templates: Record<TplName, TemplateFromFile>;
781
+ `, o += `export { Templates };
723
782
  `;
724
783
  let i = `module.exports = { Templates: {
725
784
  `, a = `import { resolve } from 'node:path';
726
785
  export const Templates = {
727
786
  `;
728
787
  const c = n.templates.map(
729
- (u) => ` '${u.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${u.fullName.id}.plj.gz') }`
788
+ (d) => ` '${d.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${d.fullName.id}.plj.gz') }`
730
789
  ).join(`,
731
- `), d = n.templates.map(
732
- (u) => ` '${u.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${u.fullName.id}.plj.gz') }`
790
+ `), u = n.templates.map(
791
+ (d) => ` '${d.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${d.fullName.id}.plj.gz') }`
733
792
  ).join(`,
734
793
  `);
735
- i += c, a += d, i += `
794
+ i += c, a += u, i += `
736
795
  }};
737
796
  `, a += `
738
797
  };
739
- `, await D.writeFile("dist/index.d.ts", s), o.type === "module" ? (await D.writeFile("dist/index.cjs", i), await D.writeFile("dist/index.js", a)) : (await D.writeFile("dist/index.js", i), await D.writeFile("dist/index.mjs", a)), ct(e), e["generate-tags"] && ft(r, e), r.info("Template Pack build done.");
798
+ `, await x.writeFile("dist/index.d.ts", o), r.type === "module" ? (await x.writeFile("dist/index.cjs", i), await x.writeFile("dist/index.js", a)) : (await x.writeFile("dist/index.js", i), await x.writeFile("dist/index.mjs", a)), wt(e), e["generate-tags"] && yt(t, e), t.info("Template Pack build done.");
740
799
  }
741
800
  };
742
- l(k, "description", "build tengo sources into single distributable pack file"), l(k, "examples", ["<%= config.bin %> <%= command.id %>"]), l(k, "flags", {
801
+ l(A, "description", "build tengo sources into single distributable pack file"), l(A, "examples", ["<%= config.bin %> <%= command.id %>"]), l(A, "flags", {
743
802
  ...ne,
744
- ...lt
803
+ ...ht
745
804
  });
746
- let K = k;
747
- function ct(t) {
748
- 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(","));
805
+ let Z = A;
806
+ function wt(s) {
807
+ process.env.GENERATE_TAGS != null && (s["generate-tags"] = process.env.GENERATE_TAGS == "true"), process.env.TAGS_FILE != null && (s["tags-file"] = process.env.TAGS_FILE), process.env.TAGS_ADDITIONAL_ARGS != null && (s["tags-additional-args"] = process.env.TAGS_ADDITIONAL_ARGS.split(","));
749
808
  }
750
- function ft(t, e) {
809
+ function yt(s, e) {
751
810
  var a;
752
- const r = f.resolve(e["tags-file"]), o = f.dirname(r), n = e["tags-additional-args"], s = dt(o);
753
- t.info(
754
- `Generating tags for tengo autocompletion from "${o}" in "${r}", additional arguments: "${n}".
755
- Found ${s.length} tengo files...`
811
+ const t = f.resolve(e["tags-file"]), r = f.dirname(t), n = e["tags-additional-args"], o = bt(r);
812
+ s.info(
813
+ `Generating tags for tengo autocompletion from "${r}" in "${t}", additional arguments: "${n}".
814
+ Found ${o.length} tengo files...`
756
815
  );
757
- const i = Me(
816
+ const i = Fe(
758
817
  "ctags",
759
818
  [
760
819
  "-f",
761
- r,
820
+ t,
762
821
  ...n,
763
822
  "--langdef=tengo",
764
823
  "--map-tengo=+.tengo",
@@ -767,12 +826,12 @@ Found ${s.length} tengo files...`
767
826
  "--kinddef-tengo=c,constant,constant",
768
827
  '--regex-tengo=/^\\s*(.*) := ("|\\{).*/\\1/c/',
769
828
  "-R",
770
- ...s
829
+ ...o
771
830
  ],
772
831
  {
773
832
  env: process.env,
774
833
  stdio: "inherit",
775
- cwd: o
834
+ cwd: r
776
835
  }
777
836
  );
778
837
  if ((a = i.error) != null && a.message.includes("ENOENT")) {
@@ -786,121 +845,121 @@ For vscode, you should also install ctags extension:
786
845
  https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support`);
787
846
  return;
788
847
  }
789
- pt(i, "failed to generate ctags"), t.info("Generation of tags is done.");
848
+ vt(i, "failed to generate ctags"), s.info("Generation of tags is done.");
790
849
  }
791
- function dt(t) {
792
- const e = p.readdirSync(t, { withFileTypes: !0, recursive: !0 }), r = [];
793
- return e.forEach((o) => {
794
- if (!o.isDirectory() && o.name.endsWith(".tengo")) {
795
- const n = f.join(o.parentPath, o.name).replace(t, ".");
796
- r.push(n);
850
+ function bt(s) {
851
+ const e = p.readdirSync(s, { withFileTypes: !0, recursive: !0 }), t = [];
852
+ return e.forEach((r) => {
853
+ if (!r.isDirectory() && r.name.endsWith(".tengo")) {
854
+ const n = f.join(r.parentPath, r.name).replace(s, ".");
855
+ t.push(n);
797
856
  }
798
- }), r;
799
- }
800
- function pt(t, e) {
801
- t.error && console.log(t.error);
802
- const r = e;
803
- t.status !== 0 && console.log(`WARN: ${r} the build will continue as-is`);
804
- }
805
- function ie(t, e) {
806
- const r = R(), o = j(t, r, "dist", "src", ""), n = oe(t, r, "dist");
807
- for (const s of n.allLibs())
808
- t.debug(
809
- `Dumping to pl-tester: ${g(s.fullName)}`
810
- ), e.write(JSON.stringify(s) + `
857
+ }), t;
858
+ }
859
+ function vt(s, e) {
860
+ s.error && console.log(s.error);
861
+ const t = e;
862
+ s.status !== 0 && console.log(`WARN: ${t} the build will continue as-is`);
863
+ }
864
+ function ie(s, e) {
865
+ const t = M(), r = L(s, t, "dist", "src", ""), n = re(s, t, "dist");
866
+ for (const o of n.allLibs())
867
+ s.debug(
868
+ `Dumping to pl-tester: ${g(o.fullName)}`
869
+ ), e.write(JSON.stringify(o) + `
811
870
  `);
812
- for (const s of o)
813
- s.fullName.type === "library" && (t.debug(
814
- `Dumping to pl-tester: ${g(s.fullName)}`
815
- ), e.write(JSON.stringify(s) + `
871
+ for (const o of r)
872
+ o.fullName.type === "library" && (s.debug(
873
+ `Dumping to pl-tester: ${g(o.fullName)}`
874
+ ), e.write(JSON.stringify(o) + `
816
875
  `));
817
- for (const s of n.allTemplates())
818
- t.debug(
819
- `Dumping to pl-tester: ${g(s.fullName)}`
820
- ), e.write(JSON.stringify(s) + `
876
+ for (const o of n.allTemplates())
877
+ s.debug(
878
+ `Dumping to pl-tester: ${g(o.fullName)}`
879
+ ), e.write(JSON.stringify(o) + `
821
880
  `);
822
- for (const s of o)
823
- s.fullName.type === "template" && (t.debug(
824
- `Dumping to pl-tester: ${g(s.fullName)} ${s.srcName}`
825
- ), e.write(JSON.stringify(s) + `
881
+ for (const o of r)
882
+ o.fullName.type === "template" && (s.debug(
883
+ `Dumping to pl-tester: ${g(o.fullName)} ${o.srcName}`
884
+ ), e.write(JSON.stringify(o) + `
826
885
  `));
827
- for (const s of n.allSoftware())
828
- t.debug(
829
- `Dumping to pl-tester: ${g(s.fullName)}`
830
- ), e.write(JSON.stringify(s) + `
886
+ for (const o of n.allSoftware())
887
+ s.debug(
888
+ `Dumping to pl-tester: ${g(o.fullName)}`
889
+ ), e.write(JSON.stringify(o) + `
831
890
  `);
832
- for (const s of o)
833
- s.fullName.type === "software" && (t.debug(
834
- `Dumping to pl-tester: ${g(s.fullName)}`
835
- ), e.write(JSON.stringify(s) + `
891
+ for (const o of r)
892
+ o.fullName.type === "software" && (s.debug(
893
+ `Dumping to pl-tester: ${g(o.fullName)}`
894
+ ), e.write(JSON.stringify(o) + `
836
895
  `));
837
- for (const s of n.allAssets())
838
- t.debug(
839
- `Dumping to pl-tester: ${g(s.fullName)}`
840
- ), e.write(JSON.stringify(s) + `
896
+ for (const o of n.allAssets())
897
+ s.debug(
898
+ `Dumping to pl-tester: ${g(o.fullName)}`
899
+ ), e.write(JSON.stringify(o) + `
841
900
  `);
842
- for (const s of o)
843
- s.fullName.type === "asset" && (t.debug(
844
- `Dumping to pl-tester: ${g(s.fullName)}`
845
- ), e.write(JSON.stringify(s) + `
901
+ for (const o of r)
902
+ o.fullName.type === "asset" && (s.debug(
903
+ `Dumping to pl-tester: ${g(o.fullName)}`
904
+ ), e.write(JSON.stringify(o) + `
846
905
  `));
847
- for (const s of o)
848
- s.fullName.type === "test" && (t.debug(
849
- `Dumping to pl-tester: ${g(s.fullName)} ${s.srcName}`
850
- ), e.write(JSON.stringify(s) + `
906
+ for (const o of r)
907
+ o.fullName.type === "test" && (s.debug(
908
+ `Dumping to pl-tester: ${g(o.fullName)} ${o.srcName}`
909
+ ), e.write(JSON.stringify(o) + `
851
910
  `));
852
911
  }
853
- function ut(t, e, r) {
854
- const o = R(), n = j(t, o, "dist", "src", "");
912
+ function Et(s, e, t) {
913
+ const r = M(), n = L(s, r, "dist", "src", "");
855
914
  if (!e) {
856
915
  for (const i of n)
857
- i.fullName.type === "library" && r.write(JSON.stringify(i) + `
916
+ i.fullName.type === "library" && t.write(JSON.stringify(i) + `
858
917
  `);
859
918
  return;
860
919
  }
861
- const s = oe(t, o, "dist");
920
+ const o = re(s, r, "dist");
862
921
  for (const i of n)
863
- i.fullName.type === "library" && s.addLib(i);
864
- for (const i of s.allLibs())
865
- r.write(JSON.stringify(i) + `
922
+ i.fullName.type === "library" && o.addLib(i);
923
+ for (const i of o.allLibs())
924
+ t.write(JSON.stringify(i) + `
866
925
  `);
867
926
  }
868
- function C(t, e, r) {
869
- const o = R(), n = j(t, o, "dist", "src", "");
870
- for (const s of n)
871
- s.fullName.type === r && e.write(JSON.stringify(s) + `
927
+ function C(s, e, t) {
928
+ const r = M(), n = L(s, r, "dist", "src", "");
929
+ for (const o of n)
930
+ o.fullName.type === t && e.write(JSON.stringify(o) + `
872
931
  `);
873
932
  }
874
- function mt(t, e) {
875
- C(t, e, "template");
933
+ function $t(s, e) {
934
+ C(s, e, "template");
876
935
  }
877
- function gt(t, e) {
878
- C(t, e, "software");
936
+ function Nt(s, e) {
937
+ C(s, e, "software");
879
938
  }
880
- function ht(t, e) {
881
- C(t, e, "asset");
939
+ function St(s, e) {
940
+ C(s, e, "asset");
882
941
  }
883
- function wt(t, e) {
884
- C(t, e, "test");
942
+ function kt(s, e) {
943
+ C(s, e, "test");
885
944
  }
886
- function Ae(t, ...e) {
887
- const r = Oe(t, e, { stdio: ["pipe", "inherit", "inherit"] });
888
- return r.stdin.on("error", (o) => {
889
- o.code;
890
- }), r;
945
+ function Ae(s, ...e) {
946
+ const t = Re(s, e, { stdio: ["pipe", "inherit", "inherit"] });
947
+ return t.stdin.on("error", (r) => {
948
+ r.code;
949
+ }), t;
891
950
  }
892
- function Te(t) {
893
- return new Promise((e, r) => {
894
- t.on("close", (o) => {
895
- e(o);
896
- }), t.on("error", (o) => {
897
- r(o);
951
+ function Te(s) {
952
+ return new Promise((e, t) => {
953
+ s.on("close", (r) => {
954
+ e(r);
955
+ }), s.on("error", (r) => {
956
+ t(r);
898
957
  });
899
958
  });
900
959
  }
901
- const N = class N extends v {
960
+ const S = class S extends $ {
902
961
  async run() {
903
- const { flags: e, argv: r } = await this.parse(N), o = E(e["log-level"]), n = r.length == 0 ? ["./src"] : r, s = Ae(
962
+ const { flags: e, argv: t } = await this.parse(S), r = N(e["log-level"]), n = t.length == 0 ? ["./src"] : t, o = Ae(
904
963
  we,
905
964
  "check",
906
965
  "--log-level",
@@ -910,114 +969,114 @@ const N = class N extends v {
910
969
  ...n
911
970
  );
912
971
  try {
913
- ie(o, s.stdin);
972
+ ie(r, o.stdin);
914
973
  } catch (i) {
915
- o.error(i);
974
+ r.error(i);
916
975
  } finally {
917
- s.stdin.end();
918
- const i = await Te(s);
976
+ o.stdin.end();
977
+ const i = await Te(o);
919
978
  process.exit(i);
920
979
  }
921
980
  }
922
981
  };
923
- l(N, "description", "check tengo sources for language processor an"), // static override args = {
982
+ l(S, "description", "check tengo sources for language processor an"), // static override args = {
924
983
  // "log-level": Args.string({description: 'logging level'}),
925
984
  // }
926
- l(N, "strict", !1), l(N, "flags", { ...ne }), l(N, "examples", ["<%= config.bin %> <%= command.id %>"]);
927
- let X = N;
928
- const S = class S extends v {
985
+ l(S, "strict", !1), l(S, "flags", { ...ne }), l(S, "examples", ["<%= config.bin %> <%= command.id %>"]);
986
+ let K = S;
987
+ const k = class k extends $ {
929
988
  async run() {
930
- const { flags: e } = await this.parse(S), r = E(e["log-level"]), o = this.argv.length == 0 ? ["./src"] : this.argv, n = Ae(
989
+ const { flags: e } = await this.parse(k), t = N(e["log-level"]), r = this.argv.length == 0 ? ["./src"] : this.argv, n = Ae(
931
990
  we,
932
991
  "run",
933
992
  "--log-level",
934
993
  e["log-level"],
935
994
  "--artifacts",
936
995
  "-",
937
- ...o
996
+ ...r
938
997
  );
939
998
  try {
940
- ie(r, n.stdin);
941
- } catch (s) {
942
- r.error(s);
999
+ ie(t, n.stdin);
1000
+ } catch (o) {
1001
+ t.error(o);
943
1002
  } finally {
944
1003
  n.stdin.end();
945
- const s = await Te(n);
946
- process.exit(s);
1004
+ const o = await Te(n);
1005
+ process.exit(o);
947
1006
  }
948
1007
  }
949
1008
  };
950
- l(S, "description", "run tengo unit tests (.test.tengo)"), l(S, "strict", !1), l(S, "flags", { ...ne }), l(S, "examples", ["<%= config.bin %> <%= command.id %>"]);
951
- let H = S;
952
- class Q extends v {
1009
+ l(k, "description", "run tengo unit tests (.test.tengo)"), l(k, "strict", !1), l(k, "flags", { ...ne }), l(k, "examples", ["<%= config.bin %> <%= command.id %>"]);
1010
+ let X = k;
1011
+ class Y extends $ {
953
1012
  async run() {
954
- const e = E();
955
- ie(e, T);
1013
+ const e = N();
1014
+ ie(e, D);
956
1015
  }
957
1016
  }
958
- l(Q, "description", "parse sources in current package and dump all found artifacts to stdout"), l(Q, "examples", [
1017
+ l(Y, "description", "parse sources in current package and dump all found artifacts to stdout"), l(Y, "examples", [
959
1018
  "<%= config.bin %> <%= command.id %>"
960
1019
  ]);
961
- class Y extends v {
1020
+ class H extends $ {
962
1021
  async run() {
963
- const e = E();
964
- ht(e, T);
1022
+ const e = N();
1023
+ St(e, D);
965
1024
  }
966
1025
  }
967
- l(Y, "description", "parse sources in current package and dump all found tests to stdout"), l(Y, "examples", [
1026
+ l(H, "description", "parse sources in current package and dump all found tests to stdout"), l(H, "examples", [
968
1027
  "<%= config.bin %> <%= command.id %>"
969
1028
  ]);
970
- const A = class A extends v {
1029
+ const T = class T extends $ {
971
1030
  async run() {
972
- const { flags: e } = await this.parse(A), r = E();
973
- ut(r, e.deps, T);
1031
+ const { flags: e } = await this.parse(T), t = N();
1032
+ Et(t, e.deps, D);
974
1033
  }
975
1034
  };
976
- l(A, "description", "parse sources in current package and dump all found templates to stdout"), l(A, "examples", [
1035
+ l(T, "description", "parse sources in current package and dump all found templates to stdout"), l(T, "examples", [
977
1036
  "<%= config.bin %> <%= command.id %>"
978
- ]), l(A, "flags", {
979
- deps: F.boolean({ name: "deps", description: "add also all libraries found in node_modules" })
1037
+ ]), l(T, "flags", {
1038
+ deps: O.boolean({ name: "deps", description: "add also all libraries found in node_modules" })
980
1039
  });
981
- let _ = A;
982
- class ee extends v {
1040
+ let Q = T;
1041
+ class ee extends $ {
983
1042
  async run() {
984
- const e = E();
985
- gt(e, T);
1043
+ const e = N();
1044
+ Nt(e, D);
986
1045
  }
987
1046
  }
988
1047
  l(ee, "description", "parse sources in current package and dump all found tests to stdout"), l(ee, "examples", [
989
1048
  "<%= config.bin %> <%= command.id %>"
990
1049
  ]);
991
- class te extends v {
1050
+ class te extends $ {
992
1051
  async run() {
993
- const e = E();
994
- mt(e, T);
1052
+ const e = N();
1053
+ $t(e, D);
995
1054
  }
996
1055
  }
997
1056
  l(te, "description", "parse sources in current package and dump all found templates to stdout"), l(te, "examples", [
998
1057
  "<%= config.bin %> <%= command.id %>"
999
1058
  ]);
1000
- class se extends v {
1059
+ class se extends $ {
1001
1060
  async run() {
1002
- const e = E();
1003
- wt(e, T);
1061
+ const e = N();
1062
+ kt(e, D);
1004
1063
  }
1005
1064
  }
1006
1065
  l(se, "description", "parse sources in current package and dump all found tests to stdout"), l(se, "examples", [
1007
1066
  "<%= config.bin %> <%= command.id %>"
1008
1067
  ]);
1009
- const xt = {
1010
- build: K,
1011
- check: X,
1012
- test: H,
1013
- "dump:all": Q,
1014
- "dump:assets": Y,
1015
- "dump:libs": _,
1068
+ const jt = {
1069
+ build: Z,
1070
+ check: K,
1071
+ test: X,
1072
+ "dump:all": Y,
1073
+ "dump:assets": H,
1074
+ "dump:libs": Q,
1016
1075
  "dump:software": ee,
1017
1076
  "dump:templates": te,
1018
1077
  "dump:tests": se
1019
1078
  };
1020
1079
  export {
1021
- xt as COMMANDS
1080
+ jt as COMMANDS
1022
1081
  };
1023
1082
  //# sourceMappingURL=index.mjs.map