@platforma-sdk/tengo-builder 1.16.1 → 1.17.1

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 +575 -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,479 @@ 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:[\w]/, He = /^\s*\/\/\s*tengo:\s*./, 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
+ if (!t.canDetectOptions)
485
+ throw s.error(
486
+ `[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'`
487
+ ), new Error("tengo compiler options ('//tengo:' comments) can be set only in file header");
488
+ return { line: e, context: t, artifact: void 0, option: rt(e) };
489
+ }
490
+ if (He.exec(e) && t.canDetectOptions)
491
+ return s.warn(
492
+ `[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)`
493
+ ), { line: e, context: t, artifact: void 0, option: void 0 };
494
+ if (Qe.exec(e))
495
+ return { line: e, context: t, artifact: void 0, option: void 0 };
496
+ if (et.exec(e))
497
+ return t.isInCommentBlock = !0, { line: e, context: t, artifact: void 0, option: void 0 };
498
+ if (Xe.exec(e))
499
+ return { line: e, context: t, artifact: void 0, option: void 0 };
500
+ t.canDetectOptions = !1;
501
+ const o = be.exec(e);
502
+ if (o) {
503
+ const i = at(e);
504
+ if (i.module === "plapi")
505
+ return t.tplDepREs.has(i.module) || t.tplDepREs.set(i.module, [
506
+ ["template", Ve(i.alias)],
507
+ ["software", Ze(i.alias)]
508
+ ]), { line: e, context: t, artifact: void 0, option: void 0 };
509
+ (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, [
510
+ ["template", ue(i.alias)],
511
+ ["software", me(i.alias)]
512
+ ])), (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, [
513
+ ["template", ue(i.alias)],
514
+ ["software", me(i.alias)],
515
+ ["asset", Ke(i.alias)]
442
516
  ]));
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 };
517
+ const a = ge(i.module, "library", r);
518
+ 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
519
  }
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);
520
+ if (t.tplDepREs.size > 0)
521
+ for (const [i, a] of t.tplDepREs)
522
+ for (const [c, u] of a) {
523
+ const d = u.exec(e);
450
524
  if (!d || !d.groups)
451
525
  continue;
452
- const { fnCall: u, templateName: y, fnName: b } = d.groups;
453
- if (!u || !y || !b)
526
+ const { fnCall: y, templateName: w, fnName: b } = d.groups;
527
+ if (!y || !w || !b)
454
528
  throw Error("failed to parse template import statement");
455
- const w = ge(y, a, r);
456
- if (!w)
529
+ const v = ge(w, c, r);
530
+ if (!v)
457
531
  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 };
532
+ return e = e.replace(y, `${b}("${v.pkg}:${v.id}")`), { line: e, context: t, artifact: v, option: void 0 };
459
533
  }
460
- return { line: t, context: e, artifact: void 0 };
534
+ return { line: e, context: t, artifact: void 0, option: void 0 };
461
535
  }
462
- function _e(t) {
463
- const e = Xe.exec(t);
536
+ function at(s) {
537
+ const e = st.exec(s);
464
538
  if (!e || !e.groups)
465
539
  throw Error("failed to parse 'import' statement");
466
- const { importName: r, moduleName: o } = e.groups;
467
- if (!r || !o)
540
+ const { importName: t, moduleName: r } = e.groups;
541
+ if (!t || !r)
468
542
  throw Error("failed to parse 'import' statement");
469
543
  return {
470
- module: o,
471
- alias: r
544
+ module: r,
545
+ alias: t
472
546
  };
473
547
  }
474
- function ge(t, e, r) {
475
- const o = He.exec(t);
476
- if (!o)
548
+ function ge(s, e, t) {
549
+ const r = ot.exec(s);
550
+ if (!r)
477
551
  return;
478
- if (!o.groups)
552
+ if (!r.groups)
479
553
  throw Error(
480
554
  "failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'"
481
555
  );
482
- const { pkgName: n, depID: s } = o.groups;
483
- if (!s)
556
+ const { pkgName: n, depID: o } = r.groups;
557
+ if (!o)
484
558
  throw Error(
485
559
  "failed to parse dependency name inside 'import' statement. The dependency name should have format '<package>:<templateName>'"
486
560
  );
487
- return { type: e, pkg: n ?? r, id: s };
561
+ return { type: e, pkg: n ?? t, id: o };
488
562
  }
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
- });
501
- }
502
- function R() {
563
+ 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];
564
+ function M() {
503
565
  return JSON.parse(p.readFileSync("package.json").toString());
504
566
  }
505
- function ve(t, e) {
506
- return f.resolve(e, t, "tengo", "lib");
567
+ function Ee(s, e) {
568
+ return f.resolve(e, s, "tengo", "lib");
507
569
  }
508
- function Ee(t, e) {
509
- return f.resolve(e, t, "tengo", "tpl");
570
+ function $e(s, e) {
571
+ return f.resolve(e, s, "tengo", "tpl");
510
572
  }
511
- function Ne(t, e) {
512
- return f.resolve(e, t, "tengo", "software");
573
+ function Ne(s, e) {
574
+ return f.resolve(e, s, "tengo", "software");
513
575
  }
514
- function Se(t, e) {
515
- return f.resolve(e, t, "tengo", "asset");
576
+ function Se(s, e) {
577
+ return f.resolve(e, s, "tengo", "asset");
516
578
  }
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);
579
+ function ke(s, e, t, r, n = !1) {
580
+ const o = f.resolve(r, "package.json");
581
+ if (E(o) !== "file") {
582
+ for (const ae of p.readdirSync(r)) {
583
+ const De = E(f.join(r, ae)) === "link", le = f.resolve(r, ae);
584
+ E(le) === "dir" && ke(s, e, t, le, De);
523
585
  }
524
586
  return;
525
587
  }
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)
588
+ 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";
589
+ if (!d && !y && !w && !b)
528
590
  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)
591
+ const v = JSON.parse(p.readFileSync(o).toString());
592
+ if (v.name !== t.name) {
593
+ if (E(f.resolve(r, "node_modules")) === "dir" && n)
532
594
  throw new Error(
533
- `nested node_modules is a sign of library dependencies version incompatibility in ${o}`
595
+ `nested node_modules is a sign of library dependencies version incompatibility in ${r}`
534
596
  );
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);
597
+ 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
598
  }
537
599
  }
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}`);
600
+ function ct(s, e, t, r, n) {
601
+ for (const o of p.readdirSync(r)) {
602
+ const i = f.resolve(r, o);
603
+ if (!o.endsWith(z)) throw new Error(`unexpected file in 'lib' folder: ${i}`);
542
604
  const a = {
543
605
  type: "library",
544
606
  pkg: e.name,
545
- id: s.slice(0, s.length - W.length),
607
+ id: o.slice(0, o.length - z.length),
546
608
  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)}`);
609
+ }, c = ve(s, t, i, a, !0);
610
+ if (n.addLib(c), s.debug(`Adding dependency ${m(a)} from ${i}`), c.dependencies.length > 0) {
611
+ s.debug("Dependencies:");
612
+ for (const u of c.dependencies) s.debug(` - ${g(u)}`);
551
613
  }
552
614
  }
553
615
  }
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}`);
616
+ function dt(s, e, t, r, n) {
617
+ for (const o of p.readdirSync(r)) {
618
+ const i = f.resolve(r, o);
619
+ if (!o.endsWith(U)) throw new Error(`unexpected file in 'tpl' folder: ${i}`);
558
620
  const a = {
559
621
  type: "template",
560
622
  pkg: e.name,
561
- id: s.slice(0, s.length - z.length),
623
+ id: o.slice(0, o.length - U.length),
562
624
  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}`);
625
+ }, c = new ye(t, a, { content: p.readFileSync(i) });
626
+ n.addTemplate(c), s.debug(`Adding dependency ${m(a)} from ${i}`);
565
627
  }
566
628
  }
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))
629
+ function ft(s, e, t, r, n) {
630
+ for (const o of p.readdirSync(r)) {
631
+ const i = f.resolve(r, o);
632
+ if (!o.endsWith(P))
571
633
  throw new Error(`unexpected file in 'software' folder: ${i}`);
572
634
  const a = {
573
635
  type: "software",
574
636
  pkg: e.name,
575
- id: s.slice(0, s.length - P.length),
637
+ id: o.slice(0, o.length - P.length),
576
638
  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);
639
+ }, c = new oe(t, a, p.readFileSync(i).toString(), i, [], []);
640
+ s.debug(`Adding dependency ${m(a)} from ${i}`), n.addSoftware(c);
579
641
  }
580
642
  }
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))
643
+ function pt(s, e, t, r, n) {
644
+ for (const o of p.readdirSync(r)) {
645
+ const i = f.resolve(r, o);
646
+ if (!o.endsWith(W))
585
647
  throw new Error(`unexpected file in 'asset' folder: ${i}`);
586
648
  const a = {
587
649
  type: "asset",
588
650
  pkg: e.name,
589
- id: s.slice(0, s.length - U.length),
651
+ id: o.slice(0, o.length - W.length),
590
652
  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);
653
+ }, c = new oe(t, a, p.readFileSync(i).toString(), i, [], []);
654
+ s.debug(`Adding dependency ${m(a)} from ${i}`), n.addAsset(c);
593
655
  }
594
656
  }
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);
657
+ function L(s, e, t, r, n) {
658
+ const o = [];
659
+ for (const i of p.readdirSync(f.join(r, n))) {
660
+ const a = f.join(n, i), c = f.join(r, a);
661
+ if (E(c) === "dir") {
662
+ const b = L(s, e, t, r, a);
663
+ o.push(...b);
602
664
  continue;
603
665
  }
604
- const d = i === "index.lib.tengo" ? `${f.basename(n)}.lib.tengo` : a, u = nt(e, d.replaceAll(f.sep, "."));
605
- if (!u)
666
+ const u = i === "index.lib.tengo" ? `${f.basename(n)}.lib.tengo` : a, d = ut(e, u.replaceAll(f.sep, "."));
667
+ if (!d)
606
668
  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)}`);
669
+ const y = f.resolve(r, a);
670
+ s.debug(`Parsing ${m(d)} from ${y}`);
671
+ const w = ve(s, t, y, d, !0);
672
+ if (w.dependencies.length > 0) {
673
+ s.debug("Detected dependencies:");
674
+ for (const b of w.dependencies) s.debug(` - ${g(b)}`);
613
675
  }
614
- s.push(b);
676
+ o.push(w);
615
677
  }
616
- return s;
678
+ return o;
617
679
  }
618
- function oe(t, e, r) {
619
- const o = new Pe(r);
620
- return ke(t, o, e, Ce()), o;
680
+ function re(s, e, t) {
681
+ const r = new Be(t);
682
+ return ke(s, r, e, Ce()), r;
621
683
  }
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,
684
+ function ut(s, e) {
685
+ const t = { pkg: s.name, version: s.version };
686
+ return e.endsWith(q) ? {
687
+ ...t,
630
688
  id: e.substring(0, e.length - q.length),
689
+ type: "library"
690
+ } : e.endsWith(_) ? {
691
+ ...t,
692
+ id: e.substring(0, e.length - _.length),
631
693
  type: "template"
694
+ } : e.endsWith(B) ? {
695
+ ...t,
696
+ id: e.substring(0, e.length - B.length),
697
+ type: "software"
632
698
  } : e.endsWith(V) ? {
633
- ...r,
699
+ ...t,
634
700
  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
701
  type: "asset"
640
702
  } : e.endsWith(he) ? {
641
- ...r,
703
+ ...t,
642
704
  id: e.substring(0, e.length - he.length),
643
705
  type: "test"
644
706
  } : null;
645
707
  }
646
- function it(t, e) {
647
- const r = R(), o = oe(t, r, e), n = j(t, r, e, "src", "");
708
+ function mt(s, e) {
709
+ const t = M(), r = re(s, t, e), n = L(s, t, e, "src", "");
648
710
  if (n.length === 0) {
649
711
  const i = [];
650
- for (const a of et)
712
+ for (const a of lt)
651
713
  i.push(`*${a}`);
652
- t.error(`Nothing to compile. Looked for ${i.join(", ")}`), process.exit(1);
714
+ s.error(`Nothing to compile. Looked for ${i.join(", ")}`), process.exit(1);
653
715
  }
654
- t.info(`Compiling '${e}'...`);
655
- const s = o.compileAndAdd(n);
656
- return t.debug("Done."), s;
716
+ s.info(`Compiling '${e}'...`);
717
+ const o = r.compileAndAdd(n);
718
+ return s.debug("Done."), o;
657
719
  }
658
- function at(t, e, r) {
720
+ function gt(s, e, t) {
659
721
  if (e.libs.length > 0) {
660
- const o = ve(r, ".");
661
- p.mkdirSync(o, { recursive: !0 });
722
+ const r = Ee(t, ".");
723
+ p.mkdirSync(r, { recursive: !0 });
662
724
  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);
725
+ const o = f.resolve(r, n.fullName.id + z);
726
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
665
727
  }
666
728
  }
667
729
  if (e.templates.length > 0) {
668
- const o = Ee(r, ".");
669
- p.mkdirSync(o, { recursive: !0 });
730
+ const r = $e(t, ".");
731
+ p.mkdirSync(r, { recursive: !0 });
670
732
  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);
733
+ const o = f.resolve(r, n.fullName.id + U);
734
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.content);
673
735
  }
674
736
  }
675
737
  if (e.software.length > 0) {
676
- const o = Ne(r, ".");
677
- p.mkdirSync(o, { recursive: !0 });
738
+ const r = Ne(t, ".");
739
+ p.mkdirSync(r, { recursive: !0 });
678
740
  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);
741
+ const o = f.resolve(r, n.fullName.id + P);
742
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
681
743
  }
682
744
  }
683
745
  if (e.assets.length > 0) {
684
- const o = Se(r, ".");
685
- p.mkdirSync(o, { recursive: !0 });
746
+ const r = Se(t, ".");
747
+ p.mkdirSync(r, { recursive: !0 });
686
748
  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);
749
+ const o = f.resolve(r, n.fullName.id + W);
750
+ s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
689
751
  }
690
752
  }
691
753
  }
692
754
  const ne = {
693
- "log-level": F.string({
755
+ "log-level": O.string({
694
756
  description: "logging level",
695
757
  default: "info",
696
758
  options: ["error", "warn", "info", "debug"]
697
759
  })
698
- }, lt = {
699
- "generate-tags": F.boolean({
760
+ }, ht = {
761
+ "generate-tags": O.boolean({
700
762
  description: "generate tags, default false",
701
763
  default: !1
702
764
  }),
703
- "tags-file": F.file({
765
+ "tags-file": O.file({
704
766
  description: 'where to put ".tags" file, it should be a root of VS Code project',
705
767
  default: "../../.tags"
706
768
  // usually a user opens a directory with all blocks
707
769
  }),
708
- "tags-additional-args": F.string({
770
+ "tags-additional-args": O.string({
709
771
  description: "additional flags for universal-ctags command: e.g. -e for emacs",
710
772
  default: [],
711
773
  multiple: !0,
712
774
  delimiter: ","
713
775
  })
714
- }, k = class k extends v {
776
+ }, A = class A extends $ {
715
777
  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; };
778
+ const { flags: e } = await this.parse(A), t = N(e["log-level"]), r = M(), n = mt(t, "dist");
779
+ gt(t, n, "dist"), t.info("");
780
+ let o = `declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };
719
781
  `;
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 };
782
+ o += `declare type TplName = ${n.templates.map((d) => '"' + d.fullName.id + '"').join(" | ")};
783
+ `, o += `declare const Templates: Record<TplName, TemplateFromFile>;
784
+ `, o += `export { Templates };
723
785
  `;
724
786
  let i = `module.exports = { Templates: {
725
787
  `, a = `import { resolve } from 'node:path';
726
788
  export const Templates = {
727
789
  `;
728
790
  const c = n.templates.map(
729
- (u) => ` '${u.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${u.fullName.id}.plj.gz') }`
791
+ (d) => ` '${d.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${d.fullName.id}.plj.gz') }`
730
792
  ).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') }`
793
+ `), u = n.templates.map(
794
+ (d) => ` '${d.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${d.fullName.id}.plj.gz') }`
733
795
  ).join(`,
734
796
  `);
735
- i += c, a += d, i += `
797
+ i += c, a += u, i += `
736
798
  }};
737
799
  `, a += `
738
800
  };
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.");
801
+ `, 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
802
  }
741
803
  };
742
- l(k, "description", "build tengo sources into single distributable pack file"), l(k, "examples", ["<%= config.bin %> <%= command.id %>"]), l(k, "flags", {
804
+ l(A, "description", "build tengo sources into single distributable pack file"), l(A, "examples", ["<%= config.bin %> <%= command.id %>"]), l(A, "flags", {
743
805
  ...ne,
744
- ...lt
806
+ ...ht
745
807
  });
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(","));
808
+ let Z = A;
809
+ function wt(s) {
810
+ 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
811
  }
750
- function ft(t, e) {
812
+ function yt(s, e) {
751
813
  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...`
814
+ const t = f.resolve(e["tags-file"]), r = f.dirname(t), n = e["tags-additional-args"], o = bt(r);
815
+ s.info(
816
+ `Generating tags for tengo autocompletion from "${r}" in "${t}", additional arguments: "${n}".
817
+ Found ${o.length} tengo files...`
756
818
  );
757
- const i = Me(
819
+ const i = Fe(
758
820
  "ctags",
759
821
  [
760
822
  "-f",
761
- r,
823
+ t,
762
824
  ...n,
763
825
  "--langdef=tengo",
764
826
  "--map-tengo=+.tengo",
@@ -767,12 +829,12 @@ Found ${s.length} tengo files...`
767
829
  "--kinddef-tengo=c,constant,constant",
768
830
  '--regex-tengo=/^\\s*(.*) := ("|\\{).*/\\1/c/',
769
831
  "-R",
770
- ...s
832
+ ...o
771
833
  ],
772
834
  {
773
835
  env: process.env,
774
836
  stdio: "inherit",
775
- cwd: o
837
+ cwd: r
776
838
  }
777
839
  );
778
840
  if ((a = i.error) != null && a.message.includes("ENOENT")) {
@@ -786,121 +848,121 @@ For vscode, you should also install ctags extension:
786
848
  https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support`);
787
849
  return;
788
850
  }
789
- pt(i, "failed to generate ctags"), t.info("Generation of tags is done.");
851
+ vt(i, "failed to generate ctags"), s.info("Generation of tags is done.");
790
852
  }
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);
853
+ function bt(s) {
854
+ const e = p.readdirSync(s, { withFileTypes: !0, recursive: !0 }), t = [];
855
+ return e.forEach((r) => {
856
+ if (!r.isDirectory() && r.name.endsWith(".tengo")) {
857
+ const n = f.join(r.parentPath, r.name).replace(s, ".");
858
+ t.push(n);
797
859
  }
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) + `
860
+ }), t;
861
+ }
862
+ function vt(s, e) {
863
+ s.error && console.log(s.error);
864
+ const t = e;
865
+ s.status !== 0 && console.log(`WARN: ${t} the build will continue as-is`);
866
+ }
867
+ function ie(s, e) {
868
+ const t = M(), r = L(s, t, "dist", "src", ""), n = re(s, t, "dist");
869
+ for (const o of n.allLibs())
870
+ s.debug(
871
+ `Dumping to pl-tester: ${g(o.fullName)}`
872
+ ), e.write(JSON.stringify(o) + `
811
873
  `);
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) + `
874
+ for (const o of r)
875
+ o.fullName.type === "library" && (s.debug(
876
+ `Dumping to pl-tester: ${g(o.fullName)}`
877
+ ), e.write(JSON.stringify(o) + `
816
878
  `));
817
- for (const s of n.allTemplates())
818
- t.debug(
819
- `Dumping to pl-tester: ${g(s.fullName)}`
820
- ), e.write(JSON.stringify(s) + `
879
+ for (const o of n.allTemplates())
880
+ s.debug(
881
+ `Dumping to pl-tester: ${g(o.fullName)}`
882
+ ), e.write(JSON.stringify(o) + `
821
883
  `);
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) + `
884
+ for (const o of r)
885
+ o.fullName.type === "template" && (s.debug(
886
+ `Dumping to pl-tester: ${g(o.fullName)} ${o.srcName}`
887
+ ), e.write(JSON.stringify(o) + `
826
888
  `));
827
- for (const s of n.allSoftware())
828
- t.debug(
829
- `Dumping to pl-tester: ${g(s.fullName)}`
830
- ), e.write(JSON.stringify(s) + `
889
+ for (const o of n.allSoftware())
890
+ s.debug(
891
+ `Dumping to pl-tester: ${g(o.fullName)}`
892
+ ), e.write(JSON.stringify(o) + `
831
893
  `);
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) + `
894
+ for (const o of r)
895
+ o.fullName.type === "software" && (s.debug(
896
+ `Dumping to pl-tester: ${g(o.fullName)}`
897
+ ), e.write(JSON.stringify(o) + `
836
898
  `));
837
- for (const s of n.allAssets())
838
- t.debug(
839
- `Dumping to pl-tester: ${g(s.fullName)}`
840
- ), e.write(JSON.stringify(s) + `
899
+ for (const o of n.allAssets())
900
+ s.debug(
901
+ `Dumping to pl-tester: ${g(o.fullName)}`
902
+ ), e.write(JSON.stringify(o) + `
841
903
  `);
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) + `
904
+ for (const o of r)
905
+ o.fullName.type === "asset" && (s.debug(
906
+ `Dumping to pl-tester: ${g(o.fullName)}`
907
+ ), e.write(JSON.stringify(o) + `
846
908
  `));
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) + `
909
+ for (const o of r)
910
+ o.fullName.type === "test" && (s.debug(
911
+ `Dumping to pl-tester: ${g(o.fullName)} ${o.srcName}`
912
+ ), e.write(JSON.stringify(o) + `
851
913
  `));
852
914
  }
853
- function ut(t, e, r) {
854
- const o = R(), n = j(t, o, "dist", "src", "");
915
+ function Et(s, e, t) {
916
+ const r = M(), n = L(s, r, "dist", "src", "");
855
917
  if (!e) {
856
918
  for (const i of n)
857
- i.fullName.type === "library" && r.write(JSON.stringify(i) + `
919
+ i.fullName.type === "library" && t.write(JSON.stringify(i) + `
858
920
  `);
859
921
  return;
860
922
  }
861
- const s = oe(t, o, "dist");
923
+ const o = re(s, r, "dist");
862
924
  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) + `
925
+ i.fullName.type === "library" && o.addLib(i);
926
+ for (const i of o.allLibs())
927
+ t.write(JSON.stringify(i) + `
866
928
  `);
867
929
  }
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) + `
930
+ function C(s, e, t) {
931
+ const r = M(), n = L(s, r, "dist", "src", "");
932
+ for (const o of n)
933
+ o.fullName.type === t && e.write(JSON.stringify(o) + `
872
934
  `);
873
935
  }
874
- function mt(t, e) {
875
- C(t, e, "template");
936
+ function $t(s, e) {
937
+ C(s, e, "template");
876
938
  }
877
- function gt(t, e) {
878
- C(t, e, "software");
939
+ function Nt(s, e) {
940
+ C(s, e, "software");
879
941
  }
880
- function ht(t, e) {
881
- C(t, e, "asset");
942
+ function St(s, e) {
943
+ C(s, e, "asset");
882
944
  }
883
- function wt(t, e) {
884
- C(t, e, "test");
945
+ function kt(s, e) {
946
+ C(s, e, "test");
885
947
  }
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;
948
+ function Ae(s, ...e) {
949
+ const t = Re(s, e, { stdio: ["pipe", "inherit", "inherit"] });
950
+ return t.stdin.on("error", (r) => {
951
+ r.code;
952
+ }), t;
891
953
  }
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);
954
+ function Te(s) {
955
+ return new Promise((e, t) => {
956
+ s.on("close", (r) => {
957
+ e(r);
958
+ }), s.on("error", (r) => {
959
+ t(r);
898
960
  });
899
961
  });
900
962
  }
901
- const N = class N extends v {
963
+ const S = class S extends $ {
902
964
  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(
965
+ const { flags: e, argv: t } = await this.parse(S), r = N(e["log-level"]), n = t.length == 0 ? ["./src"] : t, o = Ae(
904
966
  we,
905
967
  "check",
906
968
  "--log-level",
@@ -910,114 +972,114 @@ const N = class N extends v {
910
972
  ...n
911
973
  );
912
974
  try {
913
- ie(o, s.stdin);
975
+ ie(r, o.stdin);
914
976
  } catch (i) {
915
- o.error(i);
977
+ r.error(i);
916
978
  } finally {
917
- s.stdin.end();
918
- const i = await Te(s);
979
+ o.stdin.end();
980
+ const i = await Te(o);
919
981
  process.exit(i);
920
982
  }
921
983
  }
922
984
  };
923
- l(N, "description", "check tengo sources for language processor an"), // static override args = {
985
+ l(S, "description", "check tengo sources for language processor an"), // static override args = {
924
986
  // "log-level": Args.string({description: 'logging level'}),
925
987
  // }
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 {
988
+ l(S, "strict", !1), l(S, "flags", { ...ne }), l(S, "examples", ["<%= config.bin %> <%= command.id %>"]);
989
+ let K = S;
990
+ const k = class k extends $ {
929
991
  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(
992
+ const { flags: e } = await this.parse(k), t = N(e["log-level"]), r = this.argv.length == 0 ? ["./src"] : this.argv, n = Ae(
931
993
  we,
932
994
  "run",
933
995
  "--log-level",
934
996
  e["log-level"],
935
997
  "--artifacts",
936
998
  "-",
937
- ...o
999
+ ...r
938
1000
  );
939
1001
  try {
940
- ie(r, n.stdin);
941
- } catch (s) {
942
- r.error(s);
1002
+ ie(t, n.stdin);
1003
+ } catch (o) {
1004
+ t.error(o);
943
1005
  } finally {
944
1006
  n.stdin.end();
945
- const s = await Te(n);
946
- process.exit(s);
1007
+ const o = await Te(n);
1008
+ process.exit(o);
947
1009
  }
948
1010
  }
949
1011
  };
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 {
1012
+ l(k, "description", "run tengo unit tests (.test.tengo)"), l(k, "strict", !1), l(k, "flags", { ...ne }), l(k, "examples", ["<%= config.bin %> <%= command.id %>"]);
1013
+ let X = k;
1014
+ class Y extends $ {
953
1015
  async run() {
954
- const e = E();
955
- ie(e, T);
1016
+ const e = N();
1017
+ ie(e, D);
956
1018
  }
957
1019
  }
958
- l(Q, "description", "parse sources in current package and dump all found artifacts to stdout"), l(Q, "examples", [
1020
+ l(Y, "description", "parse sources in current package and dump all found artifacts to stdout"), l(Y, "examples", [
959
1021
  "<%= config.bin %> <%= command.id %>"
960
1022
  ]);
961
- class Y extends v {
1023
+ class H extends $ {
962
1024
  async run() {
963
- const e = E();
964
- ht(e, T);
1025
+ const e = N();
1026
+ St(e, D);
965
1027
  }
966
1028
  }
967
- l(Y, "description", "parse sources in current package and dump all found tests to stdout"), l(Y, "examples", [
1029
+ l(H, "description", "parse sources in current package and dump all found tests to stdout"), l(H, "examples", [
968
1030
  "<%= config.bin %> <%= command.id %>"
969
1031
  ]);
970
- const A = class A extends v {
1032
+ const T = class T extends $ {
971
1033
  async run() {
972
- const { flags: e } = await this.parse(A), r = E();
973
- ut(r, e.deps, T);
1034
+ const { flags: e } = await this.parse(T), t = N();
1035
+ Et(t, e.deps, D);
974
1036
  }
975
1037
  };
976
- l(A, "description", "parse sources in current package and dump all found templates to stdout"), l(A, "examples", [
1038
+ l(T, "description", "parse sources in current package and dump all found templates to stdout"), l(T, "examples", [
977
1039
  "<%= config.bin %> <%= command.id %>"
978
- ]), l(A, "flags", {
979
- deps: F.boolean({ name: "deps", description: "add also all libraries found in node_modules" })
1040
+ ]), l(T, "flags", {
1041
+ deps: O.boolean({ name: "deps", description: "add also all libraries found in node_modules" })
980
1042
  });
981
- let _ = A;
982
- class ee extends v {
1043
+ let Q = T;
1044
+ class ee extends $ {
983
1045
  async run() {
984
- const e = E();
985
- gt(e, T);
1046
+ const e = N();
1047
+ Nt(e, D);
986
1048
  }
987
1049
  }
988
1050
  l(ee, "description", "parse sources in current package and dump all found tests to stdout"), l(ee, "examples", [
989
1051
  "<%= config.bin %> <%= command.id %>"
990
1052
  ]);
991
- class te extends v {
1053
+ class te extends $ {
992
1054
  async run() {
993
- const e = E();
994
- mt(e, T);
1055
+ const e = N();
1056
+ $t(e, D);
995
1057
  }
996
1058
  }
997
1059
  l(te, "description", "parse sources in current package and dump all found templates to stdout"), l(te, "examples", [
998
1060
  "<%= config.bin %> <%= command.id %>"
999
1061
  ]);
1000
- class se extends v {
1062
+ class se extends $ {
1001
1063
  async run() {
1002
- const e = E();
1003
- wt(e, T);
1064
+ const e = N();
1065
+ kt(e, D);
1004
1066
  }
1005
1067
  }
1006
1068
  l(se, "description", "parse sources in current package and dump all found tests to stdout"), l(se, "examples", [
1007
1069
  "<%= config.bin %> <%= command.id %>"
1008
1070
  ]);
1009
- const xt = {
1010
- build: K,
1011
- check: X,
1012
- test: H,
1013
- "dump:all": Q,
1014
- "dump:assets": Y,
1015
- "dump:libs": _,
1071
+ const jt = {
1072
+ build: Z,
1073
+ check: K,
1074
+ test: X,
1075
+ "dump:all": Y,
1076
+ "dump:assets": H,
1077
+ "dump:libs": Q,
1016
1078
  "dump:software": ee,
1017
1079
  "dump:templates": te,
1018
1080
  "dump:tests": se
1019
1081
  };
1020
1082
  export {
1021
- xt as COMMANDS
1083
+ jt as COMMANDS
1022
1084
  };
1023
1085
  //# sourceMappingURL=index.mjs.map