@platforma-sdk/tengo-builder 1.17.3 → 1.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -68,7 +68,7 @@ function h(s) {
68
68
  function j(s) {
69
69
  return { name: h(s), version: s.version };
70
70
  }
71
- function Je(s) {
71
+ function ze(s) {
72
72
  const e = s.name.match(/^(?<pkg>[^:]*):(?<id>[^:]*)$/);
73
73
  if (!e) throw new Error(`malformed artifact name: ${s.name}`);
74
74
  return { pkg: e.groups.pkg, id: e.groups.id, version: s.version };
@@ -76,7 +76,7 @@ function Je(s) {
76
76
  function fe(s) {
77
77
  return `${s.pkg}:${s.id}:${s.version}`;
78
78
  }
79
- const Ue = new TextDecoder(), ze = new TextEncoder();
79
+ const Je = new TextDecoder(), Ue = new TextEncoder();
80
80
  class ye {
81
81
  constructor(e, t, r) {
82
82
  l(this, "data");
@@ -87,10 +87,10 @@ class ye {
87
87
  throw new Error("Neither data nor content is provided for template constructor");
88
88
  if (n !== void 0 && o !== void 0)
89
89
  throw new Error("Both data and content are provided for template constructor");
90
- if (n === void 0 && (n = JSON.parse(Ue.decode(Le(o))), n.type !== "pl.tengo-template.v2"))
90
+ if (n === void 0 && (n = JSON.parse(Je.decode(Le(o))), n.type !== "pl.tengo-template.v2"))
91
91
  throw new Error("malformed template");
92
- o === void 0 && (o = je(ze.encode(Ie(n))));
93
- const i = Je(n);
92
+ o === void 0 && (o = je(Ue.encode(Ie(n)), { chunkSize: 256 * 1024, level: 9 }));
93
+ const i = ze(n);
94
94
  if (i.pkg !== t.pkg || i.id !== t.id || i.version !== t.version)
95
95
  throw new Error(`Compiled template name don't match it's package and file names: ${fe(i)} != ${fe(t)}`);
96
96
  this.data = n, this.content = o;
@@ -99,7 +99,7 @@ class ye {
99
99
  return { compileMode: this.compileMode, fullName: this.fullName, data: this.data };
100
100
  }
101
101
  }
102
- class J {
102
+ class z {
103
103
  constructor(e) {
104
104
  l(this, "map", /* @__PURE__ */ new Map());
105
105
  this.nameExtractor = e;
@@ -120,13 +120,13 @@ class J {
120
120
  }
121
121
  }
122
122
  function Pe() {
123
- return new J((s) => s);
123
+ return new z((s) => s);
124
124
  }
125
125
  class I {
126
126
  constructor(e) {
127
127
  l(this, "dev");
128
128
  l(this, "dist");
129
- this.nameExtractor = e, this.dev = new J(e), this.dist = new J(e);
129
+ this.nameExtractor = e, this.dev = new z(e), this.dist = new z(e);
130
130
  }
131
131
  add(e, t, r = !0) {
132
132
  switch (e) {
@@ -560,7 +560,7 @@ function ge(s, e, t) {
560
560
  );
561
561
  return { type: e, pkg: n ?? t, id: o };
562
562
  }
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];
563
+ const J = ".plj.gz", U = ".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
564
  function M() {
565
565
  return JSON.parse(p.readFileSync("package.json").toString());
566
566
  }
@@ -600,11 +600,11 @@ function ke(s, e, t, r, n = !1) {
600
600
  function ct(s, e, t, r, n) {
601
601
  for (const o of p.readdirSync(r)) {
602
602
  const i = f.resolve(r, o);
603
- if (!o.endsWith(z)) throw new Error(`unexpected file in 'lib' folder: ${i}`);
603
+ if (!o.endsWith(U)) throw new Error(`unexpected file in 'lib' folder: ${i}`);
604
604
  const a = {
605
605
  type: "library",
606
606
  pkg: e.name,
607
- id: o.slice(0, o.length - z.length),
607
+ id: o.slice(0, o.length - U.length),
608
608
  version: e.version
609
609
  }, c = ve(s, t, i, a, !0);
610
610
  if (n.addLib(c), s.debug(`Adding dependency ${m(a)} from ${i}`), c.dependencies.length > 0) {
@@ -616,11 +616,11 @@ function ct(s, e, t, r, n) {
616
616
  function dt(s, e, t, r, n) {
617
617
  for (const o of p.readdirSync(r)) {
618
618
  const i = f.resolve(r, o);
619
- if (!o.endsWith(U)) throw new Error(`unexpected file in 'tpl' folder: ${i}`);
619
+ if (!o.endsWith(J)) throw new Error(`unexpected file in 'tpl' folder: ${i}`);
620
620
  const a = {
621
621
  type: "template",
622
622
  pkg: e.name,
623
- id: o.slice(0, o.length - U.length),
623
+ id: o.slice(0, o.length - J.length),
624
624
  version: e.version
625
625
  }, c = new ye(t, a, { content: p.readFileSync(i) });
626
626
  n.addTemplate(c), s.debug(`Adding dependency ${m(a)} from ${i}`);
@@ -722,7 +722,7 @@ function gt(s, e, t) {
722
722
  const r = Ee(t, ".");
723
723
  p.mkdirSync(r, { recursive: !0 });
724
724
  for (const n of e.libs) {
725
- const o = f.resolve(r, n.fullName.id + z);
725
+ const o = f.resolve(r, n.fullName.id + U);
726
726
  s.info(` - writing ${o}`), p.writeFileSync(o, n.src);
727
727
  }
728
728
  }
@@ -730,7 +730,7 @@ function gt(s, e, t) {
730
730
  const r = $e(t, ".");
731
731
  p.mkdirSync(r, { recursive: !0 });
732
732
  for (const n of e.templates) {
733
- const o = f.resolve(r, n.fullName.id + U);
733
+ const o = f.resolve(r, n.fullName.id + J);
734
734
  s.info(` - writing ${o}`), p.writeFileSync(o, n.content);
735
735
  }
736
736
  }