@platforma-sdk/tengo-builder 2.4.13 → 2.4.15

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 (123) hide show
  1. package/README.md +4 -4
  2. package/bin/run.js +5 -5
  3. package/dist/commands/build.cjs +36 -36
  4. package/dist/commands/build.cjs.map +1 -1
  5. package/dist/commands/build.d.ts +5 -5
  6. package/dist/commands/build.js +36 -36
  7. package/dist/commands/build.js.map +1 -1
  8. package/dist/commands/check.cjs +5 -5
  9. package/dist/commands/check.cjs.map +1 -1
  10. package/dist/commands/check.d.ts +2 -2
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +5 -5
  13. package/dist/commands/check.js.map +1 -1
  14. package/dist/commands/dump/artifacts.cjs +4 -6
  15. package/dist/commands/dump/artifacts.cjs.map +1 -1
  16. package/dist/commands/dump/artifacts.d.ts +2 -2
  17. package/dist/commands/dump/artifacts.d.ts.map +1 -1
  18. package/dist/commands/dump/artifacts.js +4 -6
  19. package/dist/commands/dump/artifacts.js.map +1 -1
  20. package/dist/commands/dump/software.cjs +3 -5
  21. package/dist/commands/dump/software.cjs.map +1 -1
  22. package/dist/commands/dump/software.d.ts +2 -2
  23. package/dist/commands/dump/software.d.ts.map +1 -1
  24. package/dist/commands/dump/software.js +3 -5
  25. package/dist/commands/dump/software.js.map +1 -1
  26. package/dist/commands/test.cjs +5 -5
  27. package/dist/commands/test.cjs.map +1 -1
  28. package/dist/commands/test.d.ts +2 -2
  29. package/dist/commands/test.d.ts.map +1 -1
  30. package/dist/commands/test.js +5 -5
  31. package/dist/commands/test.js.map +1 -1
  32. package/dist/compiler/artifactset.cjs +2 -2
  33. package/dist/compiler/artifactset.cjs.map +1 -1
  34. package/dist/compiler/artifactset.d.ts +1 -1
  35. package/dist/compiler/artifactset.d.ts.map +1 -1
  36. package/dist/compiler/artifactset.js +2 -2
  37. package/dist/compiler/artifactset.js.map +1 -1
  38. package/dist/compiler/compiler.cjs +37 -34
  39. package/dist/compiler/compiler.cjs.map +1 -1
  40. package/dist/compiler/compiler.d.ts +3 -3
  41. package/dist/compiler/compiler.d.ts.map +1 -1
  42. package/dist/compiler/compiler.js +37 -34
  43. package/dist/compiler/compiler.js.map +1 -1
  44. package/dist/compiler/compileroptions.cjs +12 -12
  45. package/dist/compiler/compileroptions.cjs.map +1 -1
  46. package/dist/compiler/compileroptions.d.ts +2 -2
  47. package/dist/compiler/compileroptions.js +12 -12
  48. package/dist/compiler/compileroptions.js.map +1 -1
  49. package/dist/compiler/main.cjs +58 -58
  50. package/dist/compiler/main.cjs.map +1 -1
  51. package/dist/compiler/main.d.ts +6 -6
  52. package/dist/compiler/main.d.ts.map +1 -1
  53. package/dist/compiler/main.js +58 -58
  54. package/dist/compiler/main.js.map +1 -1
  55. package/dist/compiler/package.cjs +5 -2
  56. package/dist/compiler/package.cjs.map +1 -1
  57. package/dist/compiler/package.d.ts +6 -6
  58. package/dist/compiler/package.d.ts.map +1 -1
  59. package/dist/compiler/package.js +5 -2
  60. package/dist/compiler/package.js.map +1 -1
  61. package/dist/compiler/source.cjs +50 -52
  62. package/dist/compiler/source.cjs.map +1 -1
  63. package/dist/compiler/source.d.ts +2 -2
  64. package/dist/compiler/source.d.ts.map +1 -1
  65. package/dist/compiler/source.js +50 -52
  66. package/dist/compiler/source.js.map +1 -1
  67. package/dist/compiler/template.cjs +7 -7
  68. package/dist/compiler/template.cjs.map +1 -1
  69. package/dist/compiler/template.d.ts +2 -2
  70. package/dist/compiler/template.d.ts.map +1 -1
  71. package/dist/compiler/template.js +7 -7
  72. package/dist/compiler/template.js.map +1 -1
  73. package/dist/compiler/test.artifacts.d.ts +1 -1
  74. package/dist/compiler/test.artifacts.d.ts.map +1 -1
  75. package/dist/compiler/util.cjs +12 -12
  76. package/dist/compiler/util.cjs.map +1 -1
  77. package/dist/compiler/util.d.ts +2 -2
  78. package/dist/compiler/util.js +12 -12
  79. package/dist/compiler/util.js.map +1 -1
  80. package/dist/index.cjs +5 -5
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.ts +7 -7
  83. package/dist/index.js +5 -5
  84. package/dist/index.js.map +1 -1
  85. package/dist/shared/basecmd.cjs +15 -15
  86. package/dist/shared/basecmd.cjs.map +1 -1
  87. package/dist/shared/basecmd.d.ts +4 -4
  88. package/dist/shared/basecmd.js +15 -15
  89. package/dist/shared/basecmd.js.map +1 -1
  90. package/dist/shared/dump.cjs +28 -28
  91. package/dist/shared/dump.cjs.map +1 -1
  92. package/dist/shared/dump.d.ts +2 -2
  93. package/dist/shared/dump.d.ts.map +1 -1
  94. package/dist/shared/dump.js +28 -28
  95. package/dist/shared/dump.js.map +1 -1
  96. package/dist/shared/proc.cjs +5 -5
  97. package/dist/shared/proc.cjs.map +1 -1
  98. package/dist/shared/proc.d.ts +2 -2
  99. package/dist/shared/proc.js +5 -5
  100. package/dist/shared/proc.js.map +1 -1
  101. package/package.json +21 -19
  102. package/src/commands/build.ts +57 -55
  103. package/src/commands/check.ts +15 -12
  104. package/src/commands/dump/artifacts.ts +11 -15
  105. package/src/commands/dump/software.ts +9 -10
  106. package/src/commands/test.ts +15 -12
  107. package/src/compiler/artifactset.ts +7 -9
  108. package/src/compiler/compiler.test.ts +134 -137
  109. package/src/compiler/compiler.ts +62 -62
  110. package/src/compiler/compileroptions.ts +15 -15
  111. package/src/compiler/main.test.ts +23 -23
  112. package/src/compiler/main.ts +83 -100
  113. package/src/compiler/package.ts +14 -12
  114. package/src/compiler/source.test.ts +191 -183
  115. package/src/compiler/source.ts +106 -79
  116. package/src/compiler/template.test.ts +50 -49
  117. package/src/compiler/template.ts +11 -21
  118. package/src/compiler/test.artifacts.ts +47 -47
  119. package/src/compiler/util.ts +17 -17
  120. package/src/index.ts +10 -10
  121. package/src/shared/basecmd.ts +16 -16
  122. package/src/shared/dump.ts +49 -70
  123. package/src/shared/proc.ts +8 -8
@@ -3,8 +3,8 @@ import { typedArtifactNameToString } from '../compiler/package.js';
3
3
 
4
4
  function dumpArtifacts(logger, stream, aType) {
5
5
  const packageInfo = getPackageInfo(process.cwd(), logger);
6
- const sources = parseSources(logger, packageInfo, 'dist', 'src', '');
7
- const compiler = newCompiler(logger, packageInfo, 'dist');
6
+ const sources = parseSources(logger, packageInfo, "dist", "src", "");
7
+ const compiler = newCompiler(logger, packageInfo, "dist");
8
8
  // group output by type:
9
9
  // - all libs
10
10
  // - all templates
@@ -12,86 +12,86 @@ function dumpArtifacts(logger, stream, aType) {
12
12
  // - all assets
13
13
  // - all tests
14
14
  // Libs
15
- if (!aType || aType === 'library') {
15
+ if (!aType || aType === "library") {
16
16
  for (const lib of compiler.allLibs()) {
17
17
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(lib.fullName)}`);
18
- stream.write(JSON.stringify(lib) + '\n');
18
+ stream.write(JSON.stringify(lib) + "\n");
19
19
  }
20
20
  for (const src of sources) {
21
- if (src.fullName.type === 'library') {
21
+ if (src.fullName.type === "library") {
22
22
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
23
- stream.write(JSON.stringify(src) + '\n');
23
+ stream.write(JSON.stringify(src) + "\n");
24
24
  }
25
25
  }
26
26
  }
27
27
  // Templates
28
- if (!aType || aType === 'template') {
28
+ if (!aType || aType === "template") {
29
29
  for (const tpl of compiler.allTemplates()) {
30
30
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(tpl.fullName)}`);
31
- stream.write(JSON.stringify(tpl) + '\n');
31
+ stream.write(JSON.stringify(tpl) + "\n");
32
32
  }
33
33
  for (const src of sources) {
34
- if (src.fullName.type === 'template') {
34
+ if (src.fullName.type === "template") {
35
35
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${src.srcName}`);
36
- stream.write(JSON.stringify(src) + '\n');
36
+ stream.write(JSON.stringify(src) + "\n");
37
37
  }
38
38
  }
39
39
  }
40
40
  // Software
41
- if (!aType || aType === 'software') {
41
+ if (!aType || aType === "software") {
42
42
  for (const sw of compiler.allSoftware()) {
43
43
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(sw.fullName)}`);
44
- stream.write(JSON.stringify(sw) + '\n');
44
+ stream.write(JSON.stringify(sw) + "\n");
45
45
  }
46
46
  for (const src of sources) {
47
- if (src.fullName.type === 'software') {
47
+ if (src.fullName.type === "software") {
48
48
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
49
- stream.write(JSON.stringify(src) + '\n');
49
+ stream.write(JSON.stringify(src) + "\n");
50
50
  }
51
51
  }
52
52
  }
53
53
  // Assets
54
- if (!aType || aType === 'asset') {
54
+ if (!aType || aType === "asset") {
55
55
  for (const asset of compiler.allAssets()) {
56
56
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(asset.fullName)}`);
57
- stream.write(JSON.stringify(asset) + '\n');
57
+ stream.write(JSON.stringify(asset) + "\n");
58
58
  }
59
59
  for (const src of sources) {
60
- if (src.fullName.type === 'asset') {
60
+ if (src.fullName.type === "asset") {
61
61
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
62
- stream.write(JSON.stringify(src) + '\n');
62
+ stream.write(JSON.stringify(src) + "\n");
63
63
  }
64
64
  }
65
65
  }
66
66
  // Tests
67
- if (!aType || aType === 'test') {
67
+ if (!aType || aType === "test") {
68
68
  for (const src of sources) {
69
- if (src.fullName.type === 'test') {
69
+ if (src.fullName.type === "test") {
70
70
  logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${src.srcName}`);
71
- stream.write(JSON.stringify(src) + '\n');
71
+ stream.write(JSON.stringify(src) + "\n");
72
72
  }
73
73
  }
74
74
  }
75
75
  }
76
76
  function dumpSoftware(logger, stream) {
77
77
  const packageInfo = getPackageInfo(process.cwd(), logger);
78
- const compiled = compile(logger, packageInfo, 'dist');
78
+ const compiled = compile(logger, packageInfo, "dist");
79
79
  const hashes = new Set();
80
80
  const sourceMap = new Map();
81
81
  for (const tpl of compiled.templates) {
82
82
  Object.entries(tpl.data.hashToSource).forEach(([hash, src]) => sourceMap.set(hash, src));
83
- getTemplateSoftware(stream, tpl.data.template).forEach((hash) => hashes.add(hash));
83
+ getTemplateSoftware(tpl.data.template).forEach((hash) => hashes.add(hash));
84
84
  }
85
85
  for (const hash of hashes) {
86
86
  const src = sourceMap.get(hash);
87
87
  if (src) {
88
- if (Object.hasOwn(JSON.parse(src), 'asset')) {
88
+ if (Object.hasOwn(JSON.parse(src), "asset")) {
89
89
  // Skip assets. They are kept in templates software because of backward compatibility with backend.
90
90
  continue;
91
91
  }
92
92
  stream.write(src);
93
- if (!src.endsWith('\n')) {
94
- stream.write('\n');
93
+ if (!src.endsWith("\n")) {
94
+ stream.write("\n");
95
95
  }
96
96
  }
97
97
  else {
@@ -99,13 +99,13 @@ function dumpSoftware(logger, stream) {
99
99
  }
100
100
  }
101
101
  }
102
- function getTemplateSoftware(stream, tpl) {
102
+ function getTemplateSoftware(tpl) {
103
103
  const hashes = new Set();
104
104
  for (const sw of Object.values(tpl.software)) {
105
105
  hashes.add(sw.sourceHash);
106
106
  }
107
107
  for (const subTpl of Object.values(tpl.templates)) {
108
- getTemplateSoftware(stream, subTpl).forEach((hash) => hashes.add(hash));
108
+ getTemplateSoftware(subTpl).forEach((hash) => hashes.add(hash));
109
109
  }
110
110
  return new Set(hashes);
111
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dump.js","sources":["../../src/shared/dump.ts"],"sourcesContent":["import type winston from 'winston';\nimport { getPackageInfo, newCompiler, compile, parseSources } from '../compiler/main';\nimport type { ArtifactType } from '../compiler/package';\nimport { typedArtifactNameToString } from '../compiler/package';\nimport type { TemplateDataV3 } from '@milaboratories/pl-model-backend';\n\nexport function dumpArtifacts(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n aType?: ArtifactType,\n): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n\n const sources = parseSources(logger, packageInfo, 'dist', 'src', '');\n\n const compiler = newCompiler(logger, packageInfo, 'dist');\n\n // group output by type:\n // - all libs\n // - all templates\n // - all software\n // - all assets\n // - all tests\n\n // Libs\n\n if (!aType || aType === 'library') {\n for (const lib of compiler.allLibs()) {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(lib.fullName)}`,\n );\n stream.write(JSON.stringify(lib) + '\\n');\n }\n\n for (const src of sources) {\n if (src.fullName.type === 'library') {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`,\n );\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n }\n\n // Templates\n\n if (!aType || aType === 'template') {\n for (const tpl of compiler.allTemplates()) {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(tpl.fullName)}`,\n );\n stream.write(JSON.stringify(tpl) + '\\n');\n }\n\n for (const src of sources) {\n if (src.fullName.type === 'template') {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${\n src.srcName\n }`,\n );\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n }\n\n // Software\n\n if (!aType || aType === 'software') {\n for (const sw of compiler.allSoftware()) {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(sw.fullName)}`,\n );\n stream.write(JSON.stringify(sw) + '\\n');\n }\n\n for (const src of sources) {\n if (src.fullName.type === 'software') {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`,\n );\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n }\n\n // Assets\n\n if (!aType || aType === 'asset') {\n for (const asset of compiler.allAssets()) {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(asset.fullName)}`,\n );\n stream.write(JSON.stringify(asset) + '\\n');\n }\n\n for (const src of sources) {\n if (src.fullName.type === 'asset') {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`,\n );\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n }\n\n // Tests\n\n if (!aType || aType === 'test') {\n for (const src of sources) {\n if (src.fullName.type === 'test') {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${\n src.srcName\n }`,\n );\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n }\n}\n\nexport function dumpLibs(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n recursive: boolean,\n): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n\n const sources = parseSources(logger, packageInfo, 'dist', 'src', '');\n\n if (!recursive) {\n for (const src of sources) {\n if (src.fullName.type === 'library') {\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n\n return;\n }\n\n const compiler = newCompiler(logger, packageInfo, 'dist');\n for (const src of sources) {\n if (src.fullName.type === 'library') {\n compiler.addLib(src);\n }\n }\n\n for (const lib of compiler.allLibs()) {\n stream.write(JSON.stringify(lib) + '\\n');\n }\n}\n\nexport function dumpSoftware(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n const compiled = compile(logger, packageInfo, 'dist');\n\n const hashes = new Set<string>();\n const sourceMap = new Map<string, string>();\n for (const tpl of compiled.templates) {\n Object.entries(tpl.data.hashToSource).forEach(([hash, src]) => sourceMap.set(hash, src));\n getTemplateSoftware(stream, tpl.data.template).forEach((hash) => hashes.add(hash));\n }\n\n for (const hash of hashes) {\n const src = sourceMap.get(hash);\n if (src) {\n if (Object.hasOwn(JSON.parse(src) as object, 'asset')) {\n // Skip assets. They are kept in templates software because of backward compatibility with backend.\n continue;\n }\n stream.write(src);\n if (!src.endsWith('\\n')) {\n stream.write('\\n');\n }\n } else {\n throw new Error(`Source not found for hash: ${hash}`);\n }\n }\n}\n\nfunction getTemplateSoftware(stream: NodeJS.WritableStream, tpl: TemplateDataV3): Set<string> {\n const hashes = new Set<string>();\n for (const sw of Object.values(tpl.software)) {\n hashes.add(sw.sourceHash);\n }\n for (const subTpl of Object.values(tpl.templates)) {\n getTemplateSoftware(stream, subTpl).forEach((hash) => hashes.add(hash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CAAC;IAC3B;AACA,IAAA,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QACjD,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzE;AAEA,IAAA,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC;AACxB;;;;"}
1
+ {"version":3,"file":"dump.js","sources":["../../src/shared/dump.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { getPackageInfo, newCompiler, compile, parseSources } from \"../compiler/main\";\nimport type { ArtifactType } from \"../compiler/package\";\nimport { typedArtifactNameToString } from \"../compiler/package\";\nimport type { TemplateDataV3 } from \"@milaboratories/pl-model-backend\";\n\nexport function dumpArtifacts(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n aType?: ArtifactType,\n): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n\n const sources = parseSources(logger, packageInfo, \"dist\", \"src\", \"\");\n\n const compiler = newCompiler(logger, packageInfo, \"dist\");\n\n // group output by type:\n // - all libs\n // - all templates\n // - all software\n // - all assets\n // - all tests\n\n // Libs\n\n if (!aType || aType === \"library\") {\n for (const lib of compiler.allLibs()) {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(lib.fullName)}`);\n stream.write(JSON.stringify(lib) + \"\\n\");\n }\n\n for (const src of sources) {\n if (src.fullName.type === \"library\") {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);\n stream.write(JSON.stringify(src) + \"\\n\");\n }\n }\n }\n\n // Templates\n\n if (!aType || aType === \"template\") {\n for (const tpl of compiler.allTemplates()) {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(tpl.fullName)}`);\n stream.write(JSON.stringify(tpl) + \"\\n\");\n }\n\n for (const src of sources) {\n if (src.fullName.type === \"template\") {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${src.srcName}`,\n );\n stream.write(JSON.stringify(src) + \"\\n\");\n }\n }\n }\n\n // Software\n\n if (!aType || aType === \"software\") {\n for (const sw of compiler.allSoftware()) {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(sw.fullName)}`);\n stream.write(JSON.stringify(sw) + \"\\n\");\n }\n\n for (const src of sources) {\n if (src.fullName.type === \"software\") {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);\n stream.write(JSON.stringify(src) + \"\\n\");\n }\n }\n }\n\n // Assets\n\n if (!aType || aType === \"asset\") {\n for (const asset of compiler.allAssets()) {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(asset.fullName)}`);\n stream.write(JSON.stringify(asset) + \"\\n\");\n }\n\n for (const src of sources) {\n if (src.fullName.type === \"asset\") {\n logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);\n stream.write(JSON.stringify(src) + \"\\n\");\n }\n }\n }\n\n // Tests\n\n if (!aType || aType === \"test\") {\n for (const src of sources) {\n if (src.fullName.type === \"test\") {\n logger.debug(\n `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${src.srcName}`,\n );\n stream.write(JSON.stringify(src) + \"\\n\");\n }\n }\n }\n}\n\nexport function dumpLibs(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n recursive: boolean,\n): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n\n const sources = parseSources(logger, packageInfo, \"dist\", \"src\", \"\");\n\n if (!recursive) {\n for (const src of sources) {\n if (src.fullName.type === \"library\") {\n stream.write(JSON.stringify(src) + \"\\n\");\n }\n }\n\n return;\n }\n\n const compiler = newCompiler(logger, packageInfo, \"dist\");\n for (const src of sources) {\n if (src.fullName.type === \"library\") {\n compiler.addLib(src);\n }\n }\n\n for (const lib of compiler.allLibs()) {\n stream.write(JSON.stringify(lib) + \"\\n\");\n }\n}\n\nexport function dumpSoftware(logger: winston.Logger, stream: NodeJS.WritableStream): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n const compiled = compile(logger, packageInfo, \"dist\");\n\n const hashes = new Set<string>();\n const sourceMap = new Map<string, string>();\n for (const tpl of compiled.templates) {\n Object.entries(tpl.data.hashToSource).forEach(([hash, src]) => sourceMap.set(hash, src));\n getTemplateSoftware(tpl.data.template).forEach((hash) => hashes.add(hash));\n }\n\n for (const hash of hashes) {\n const src = sourceMap.get(hash);\n if (src) {\n if (Object.hasOwn(JSON.parse(src) as object, \"asset\")) {\n // Skip assets. They are kept in templates software because of backward compatibility with backend.\n continue;\n }\n stream.write(src);\n if (!src.endsWith(\"\\n\")) {\n stream.write(\"\\n\");\n }\n } else {\n throw new Error(`Source not found for hash: ${hash}`);\n }\n }\n}\n\nfunction getTemplateSoftware(tpl: TemplateDataV3): Set<string> {\n const hashes = new Set<string>();\n for (const sw of Object.values(tpl.software)) {\n hashes.add(sw.sourceHash);\n }\n for (const subTpl of Object.values(tpl.templates)) {\n getTemplateSoftware(subTpl).forEach((hash) => hashes.add(hash));\n }\n\n return new Set(hashes);\n}\n"],"names":[],"mappings":";;;SAMgB,aAAa,CAC3B,MAAsB,EACtB,MAA6B,EAC7B,KAAoB,EAAA;IAEpB,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;AAEzD,IAAA,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;IAEpE,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;;;;;;;;AAWzD,IAAA,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,SAAS,EAAE;QACjC,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;AACpC,YAAA,MAAM,CAAC,KAAK,CAAC,CAAA,sBAAA,EAAyB,yBAAyB,CAAC,GAAG,C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G,CAAC,IAAI,CAAC;QAC/B,IAAI,GAAG,EAAE;AACP,YAAA,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAW,EAAE,OAAO,CAAC,EAAE;;gBAErD;YACF;AACA,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;YACjB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;AACvB,gBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACpB;QACF;aAAO;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAA,CAAE,CAAC;QACvD;IACF;AACF;AAEA,SAAS,mBAAmB,CAAC,GAAmB,EAAA;AAC9C,IAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU;AAChC,IAAA,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;AAC5C,QAAA,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC;IAC3B;AACA,IAAA,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;AACjD,QAAA,mBAAmB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjE;AAEA,IAAA,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC;AACxB;;;;"}
@@ -3,19 +3,19 @@
3
3
  var node_child_process = require('node:child_process');
4
4
 
5
5
  function spawnEmbed(cmd, ...args) {
6
- const p = node_child_process.spawn(cmd, args, { stdio: ['pipe', 'inherit', 'inherit'] });
7
- p.stdin.on('error', (err) => {
6
+ const p = node_child_process.spawn(cmd, args, { stdio: ["pipe", "inherit", "inherit"] });
7
+ p.stdin.on("error", (err) => {
8
8
  const systemError = err;
9
- if (systemError.code === 'EPIPE') ;
9
+ if (systemError.code === "EPIPE") ;
10
10
  });
11
11
  return p;
12
12
  }
13
13
  function waitFor(p) {
14
14
  return new Promise((resolve, reject) => {
15
- p.on('close', (code) => {
15
+ p.on("close", (code) => {
16
16
  resolve(code);
17
17
  });
18
- p.on('error', (err) => {
18
+ p.on("error", (err) => {
19
19
  reject(err);
20
20
  });
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"proc.cjs","sources":["../../src/shared/proc.ts"],"sourcesContent":["import type { ChildProcess, ChildProcessByStdio } from 'node:child_process';\nimport { spawn } from 'node:child_process';\nimport type { Writable } from 'node:stream';\n\nexport function spawnEmbed(\n cmd: string,\n ...args: string[]\n): ChildProcessByStdio<Writable, null, null> {\n const p = spawn(cmd, args, { stdio: ['pipe', 'inherit', 'inherit'] });\n\n p.stdin.on('error', (err: Error) => {\n const systemError = err as NodeJS.ErrnoException;\n if (systemError.code === 'EPIPE') {\n // ignore EPIPE error as it stands for broken command run.\n // The command will write normal problem description by itself.\n }\n });\n\n return p;\n}\n\nexport function waitFor(p: ChildProcess): Promise<number> {\n return new Promise((resolve, reject) => {\n p.on('close', (code: number) => {\n resolve(code);\n });\n p.on('error', (err) => {\n reject(err);\n });\n });\n}\n"],"names":["spawn"],"mappings":";;;;SAIgB,UAAU,CACxB,GAAW,EACX,GAAG,IAAc,EAAA;IAEjB,MAAM,CAAC,GAAGA,wBAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IAErE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,KAAI;QACjC,MAAM,WAAW,GAAG,GAA4B;AAChD,QAAA,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE;AAIpC,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,CAAC;AACV;AAEM,SAAU,OAAO,CAAC,CAAe,EAAA;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;QACrC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,KAAI;YAC7B,OAAO,CAAC,IAAI,CAAC;AACf,QAAA,CAAC,CAAC;QACF,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;YACpB,MAAM,CAAC,GAAG,CAAC;AACb,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;;"}
1
+ {"version":3,"file":"proc.cjs","sources":["../../src/shared/proc.ts"],"sourcesContent":["import type { ChildProcess, ChildProcessByStdio } from \"node:child_process\";\nimport { spawn } from \"node:child_process\";\nimport type { Writable } from \"node:stream\";\n\nexport function spawnEmbed(\n cmd: string,\n ...args: string[]\n): ChildProcessByStdio<Writable, null, null> {\n const p = spawn(cmd, args, { stdio: [\"pipe\", \"inherit\", \"inherit\"] });\n\n p.stdin.on(\"error\", (err: Error) => {\n const systemError = err as NodeJS.ErrnoException;\n if (systemError.code === \"EPIPE\") {\n // ignore EPIPE error as it stands for broken command run.\n // The command will write normal problem description by itself.\n }\n });\n\n return p;\n}\n\nexport function waitFor(p: ChildProcess): Promise<number> {\n return new Promise((resolve, reject) => {\n p.on(\"close\", (code: number) => {\n resolve(code);\n });\n p.on(\"error\", (err) => {\n reject(err);\n });\n });\n}\n"],"names":["spawn"],"mappings":";;;;SAIgB,UAAU,CACxB,GAAW,EACX,GAAG,IAAc,EAAA;IAEjB,MAAM,CAAC,GAAGA,wBAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IAErE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,KAAI;QACjC,MAAM,WAAW,GAAG,GAA4B;AAChD,QAAA,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE;AAIpC,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,CAAC;AACV;AAEM,SAAU,OAAO,CAAC,CAAe,EAAA;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;QACrC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,KAAI;YAC7B,OAAO,CAAC,IAAI,CAAC;AACf,QAAA,CAAC,CAAC;QACF,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;YACpB,MAAM,CAAC,GAAG,CAAC;AACb,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;;"}
@@ -1,5 +1,5 @@
1
- import type { ChildProcess, ChildProcessByStdio } from 'node:child_process';
2
- import type { Writable } from 'node:stream';
1
+ import type { ChildProcess, ChildProcessByStdio } from "node:child_process";
2
+ import type { Writable } from "node:stream";
3
3
  export declare function spawnEmbed(cmd: string, ...args: string[]): ChildProcessByStdio<Writable, null, null>;
4
4
  export declare function waitFor(p: ChildProcess): Promise<number>;
5
5
  //# sourceMappingURL=proc.d.ts.map
@@ -1,19 +1,19 @@
1
1
  import { spawn } from 'node:child_process';
2
2
 
3
3
  function spawnEmbed(cmd, ...args) {
4
- const p = spawn(cmd, args, { stdio: ['pipe', 'inherit', 'inherit'] });
5
- p.stdin.on('error', (err) => {
4
+ const p = spawn(cmd, args, { stdio: ["pipe", "inherit", "inherit"] });
5
+ p.stdin.on("error", (err) => {
6
6
  const systemError = err;
7
- if (systemError.code === 'EPIPE') ;
7
+ if (systemError.code === "EPIPE") ;
8
8
  });
9
9
  return p;
10
10
  }
11
11
  function waitFor(p) {
12
12
  return new Promise((resolve, reject) => {
13
- p.on('close', (code) => {
13
+ p.on("close", (code) => {
14
14
  resolve(code);
15
15
  });
16
- p.on('error', (err) => {
16
+ p.on("error", (err) => {
17
17
  reject(err);
18
18
  });
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"proc.js","sources":["../../src/shared/proc.ts"],"sourcesContent":["import type { ChildProcess, ChildProcessByStdio } from 'node:child_process';\nimport { spawn } from 'node:child_process';\nimport type { Writable } from 'node:stream';\n\nexport function spawnEmbed(\n cmd: string,\n ...args: string[]\n): ChildProcessByStdio<Writable, null, null> {\n const p = spawn(cmd, args, { stdio: ['pipe', 'inherit', 'inherit'] });\n\n p.stdin.on('error', (err: Error) => {\n const systemError = err as NodeJS.ErrnoException;\n if (systemError.code === 'EPIPE') {\n // ignore EPIPE error as it stands for broken command run.\n // The command will write normal problem description by itself.\n }\n });\n\n return p;\n}\n\nexport function waitFor(p: ChildProcess): Promise<number> {\n return new Promise((resolve, reject) => {\n p.on('close', (code: number) => {\n resolve(code);\n });\n p.on('error', (err) => {\n reject(err);\n });\n });\n}\n"],"names":[],"mappings":";;SAIgB,UAAU,CACxB,GAAW,EACX,GAAG,IAAc,EAAA;IAEjB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IAErE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,KAAI;QACjC,MAAM,WAAW,GAAG,GAA4B;AAChD,QAAA,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE;AAIpC,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,CAAC;AACV;AAEM,SAAU,OAAO,CAAC,CAAe,EAAA;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;QACrC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,KAAI;YAC7B,OAAO,CAAC,IAAI,CAAC;AACf,QAAA,CAAC,CAAC;QACF,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;YACpB,MAAM,CAAC,GAAG,CAAC;AACb,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"proc.js","sources":["../../src/shared/proc.ts"],"sourcesContent":["import type { ChildProcess, ChildProcessByStdio } from \"node:child_process\";\nimport { spawn } from \"node:child_process\";\nimport type { Writable } from \"node:stream\";\n\nexport function spawnEmbed(\n cmd: string,\n ...args: string[]\n): ChildProcessByStdio<Writable, null, null> {\n const p = spawn(cmd, args, { stdio: [\"pipe\", \"inherit\", \"inherit\"] });\n\n p.stdin.on(\"error\", (err: Error) => {\n const systemError = err as NodeJS.ErrnoException;\n if (systemError.code === \"EPIPE\") {\n // ignore EPIPE error as it stands for broken command run.\n // The command will write normal problem description by itself.\n }\n });\n\n return p;\n}\n\nexport function waitFor(p: ChildProcess): Promise<number> {\n return new Promise((resolve, reject) => {\n p.on(\"close\", (code: number) => {\n resolve(code);\n });\n p.on(\"error\", (err) => {\n reject(err);\n });\n });\n}\n"],"names":[],"mappings":";;SAIgB,UAAU,CACxB,GAAW,EACX,GAAG,IAAc,EAAA;IAEjB,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;IAErE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,KAAI;QACjC,MAAM,WAAW,GAAG,GAA4B;AAChD,QAAA,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE;AAIpC,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,CAAC;AACV;AAEM,SAAU,OAAO,CAAC,CAAe,EAAA;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;QACrC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAY,KAAI;YAC7B,OAAO,CAAC,IAAI,CAAC;AACf,QAAA,CAAC,CAAC;QACF,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;YACpB,MAAM,CAAC,GAAG,CAAC;AACb,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@platforma-sdk/tengo-builder",
3
- "version": "2.4.13",
3
+ "version": "2.4.15",
4
4
  "description": "Pl Tengo Template Builder",
5
- "type": "module",
5
+ "license": "UNLICENSED",
6
6
  "bin": {
7
7
  "pl-tengo": "./bin/run.js"
8
8
  },
@@ -11,46 +11,48 @@
11
11
  "./src/**/*",
12
12
  "README.md"
13
13
  ],
14
- "license": "UNLICENSED",
15
- "engines": {
16
- "node": ">=22"
17
- },
14
+ "type": "module",
18
15
  "dependencies": {
19
16
  "@milaboratories/tengo-tester": "^1.6.4",
20
17
  "@oclif/core": "^4.0.37",
21
18
  "canonicalize": "~2.1.0",
22
19
  "winston": "^3.17.0",
23
- "@milaboratories/ts-helpers": "1.7.0",
24
- "@milaboratories/pl-model-backend": "1.1.42",
20
+ "@milaboratories/pl-model-backend": "1.1.44",
21
+ "@milaboratories/ts-helpers": "1.7.1",
25
22
  "@milaboratories/resolve-helper": "1.1.1"
26
23
  },
27
24
  "devDependencies": {
25
+ "@types/node": "~24.5.2",
26
+ "@vitest/coverage-istanbul": "^4.0.16",
28
27
  "typescript": "~5.6.3",
29
28
  "vitest": "^4.0.16",
30
- "@vitest/coverage-istanbul": "^4.0.16",
31
- "@types/node": "~24.5.2",
32
- "@milaboratories/build-configs": "1.4.0",
33
29
  "@milaboratories/oclif-index": "1.1.1",
34
- "@milaboratories/ts-builder": "1.2.4",
35
30
  "@milaboratories/ts-configs": "1.2.0",
36
- "@milaboratories/eslint-config": "1.0.5"
31
+ "@milaboratories/build-configs": "1.4.1",
32
+ "@milaboratories/ts-builder": "1.2.5"
37
33
  },
38
34
  "oclif": {
39
35
  "bin": "pl-tengo",
40
36
  "commands": {
37
+ "identifier": "COMMANDS",
41
38
  "strategy": "explicit",
42
- "target": "./dist/index.js",
43
- "identifier": "COMMANDS"
39
+ "target": "./dist/index.js"
44
40
  },
45
41
  "dirname": "pl-tengo",
46
42
  "topicSeparator": " "
47
43
  },
44
+ "engines": {
45
+ "node": ">=22"
46
+ },
48
47
  "scripts": {
49
- "lint": "eslint .",
50
- "type-check": "ts-builder types --target node",
51
- "build": "oclif-index && ts-builder build --target node",
48
+ "build": "oclif-index && ts-builder format && ts-builder build --target node",
52
49
  "watch": "ts-builder build --target node --watch",
50
+ "check": "ts-builder check --target node",
51
+ "formatter:check": "ts-builder formatter --check",
52
+ "linter:check": "ts-builder linter --check",
53
+ "types:check": "ts-builder type-check --target node",
53
54
  "test": "vitest run --coverage",
54
- "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
55
+ "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
56
+ "fmt": "ts-builder format"
55
57
  }
56
58
  }
@@ -1,19 +1,19 @@
1
- import type { SpawnSyncReturns } from 'node:child_process';
2
- import { spawnSync } from 'node:child_process';
3
- import { Command } from '@oclif/core';
4
- import { compile, savePacks, getPackageInfo } from '../compiler/main';
5
- import { createLogger } from '../compiler/util';
6
- import * as opts from '../shared/basecmd';
7
- import * as fs from 'node:fs';
8
- import * as fsp from 'node:fs/promises';
9
- import * as path from 'node:path';
10
- import type * as winston from 'winston';
11
- import type { TemplatesAndLibs } from '../compiler/compiler';
1
+ import type { SpawnSyncReturns } from "node:child_process";
2
+ import { spawnSync } from "node:child_process";
3
+ import { Command } from "@oclif/core";
4
+ import { compile, savePacks, getPackageInfo } from "../compiler/main";
5
+ import { createLogger } from "../compiler/util";
6
+ import * as opts from "../shared/basecmd";
7
+ import * as fs from "node:fs";
8
+ import * as fsp from "node:fs/promises";
9
+ import * as path from "node:path";
10
+ import type * as winston from "winston";
11
+ import type { TemplatesAndLibs } from "../compiler/compiler";
12
12
 
13
13
  export default class Build extends Command {
14
- static override description = 'build tengo sources into single distributable pack file';
14
+ static override description = "build tengo sources into single distributable pack file";
15
15
 
16
- static override examples = ['<%= config.bin %> <%= command.id %>'];
16
+ static override examples = ["<%= config.bin %> <%= command.id %>"];
17
17
 
18
18
  static override flags = {
19
19
  ...opts.GlobalFlags,
@@ -22,28 +22,28 @@ export default class Build extends Command {
22
22
 
23
23
  public async run(): Promise<void> {
24
24
  const { flags } = await this.parse(Build);
25
- const logger = createLogger(flags['log-level']);
25
+ const logger = createLogger(flags["log-level"]);
26
26
 
27
27
  const packageInfo = getPackageInfo(process.cwd(), logger);
28
- const compiledDist = compile(logger, packageInfo, 'dist');
29
- savePacks(logger, compiledDist, 'dist');
30
- logger.info('Template Pack build done.');
28
+ const compiledDist = compile(logger, packageInfo, "dist");
29
+ savePacks(logger, compiledDist, "dist");
30
+ logger.info("Template Pack build done.");
31
31
 
32
32
  // Building TS bindings for templates
33
33
  const { dts, cjs, mjs } = generateTsBinding(compiledDist);
34
- await fsp.writeFile('dist/index.d.ts', dts);
35
- if (packageInfo.type === 'module') {
36
- await fsp.writeFile('dist/index.cjs', cjs);
37
- await fsp.writeFile('dist/index.js', mjs);
34
+ await fsp.writeFile("dist/index.d.ts", dts);
35
+ if (packageInfo.type === "module") {
36
+ await fsp.writeFile("dist/index.cjs", cjs);
37
+ await fsp.writeFile("dist/index.js", mjs);
38
38
  } else {
39
- await fsp.writeFile('dist/index.js', cjs);
40
- await fsp.writeFile('dist/index.mjs', mjs);
39
+ await fsp.writeFile("dist/index.js", cjs);
40
+ await fsp.writeFile("dist/index.mjs", mjs);
41
41
  }
42
42
 
43
43
  mergeTagsEnvs(flags);
44
- if (flags['generate-tags']) checkAndGenerateCtags(logger, flags);
44
+ if (flags["generate-tags"]) checkAndGenerateCtags(logger, flags);
45
45
 
46
- logger.info('Template Pack build done.');
46
+ logger.info("Template Pack build done.");
47
47
  }
48
48
  }
49
49
 
@@ -51,21 +51,23 @@ function generateTsBinding(compiledDist: TemplatesAndLibs) {
51
51
  let dts = `declare type TemplateFromFile = { readonly type: "from-file"; readonly path: string; };\n`;
52
52
  dts += `declare type TplName = ${compiledDist.templates
53
53
  .map((tpl) => '"' + tpl.fullName.id + '"')
54
- .join(' | ')};\n`;
54
+ .join(" | ")};\n`;
55
55
  dts += `declare const Templates: Record<TplName, TemplateFromFile>;\n`;
56
56
  dts += `export { Templates };\n`;
57
57
  let cjs = `module.exports = { Templates: {\n`;
58
58
  let mjs = `import { resolve } from 'node:path';\nexport const Templates = {\n`;
59
59
  const recordsCjs = compiledDist.templates
60
60
  .map(
61
- (tpl) => ` '${tpl.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${tpl.fullName.id}.plj.gz') }`,
61
+ (tpl) =>
62
+ ` '${tpl.fullName.id}': { type: 'from-file', path: require.resolve('./tengo/tpl/${tpl.fullName.id}.plj.gz') }`,
62
63
  )
63
- .join(',\n');
64
+ .join(",\n");
64
65
  const recordsMjs = compiledDist.templates
65
66
  .map(
66
- (tpl) => ` '${tpl.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${tpl.fullName.id}.plj.gz') }`,
67
+ (tpl) =>
68
+ ` '${tpl.fullName.id}': { type: 'from-file', path: resolve(import.meta.dirname, './tengo/tpl/${tpl.fullName.id}.plj.gz') }`,
67
69
  )
68
- .join(',\n');
70
+ .join(",\n");
69
71
  cjs += recordsCjs;
70
72
  mjs += recordsMjs;
71
73
  cjs += `\n}};\n`;
@@ -75,33 +77,33 @@ function generateTsBinding(compiledDist: TemplatesAndLibs) {
75
77
  }
76
78
 
77
79
  function mergeTagsEnvs(flags: {
78
- 'generate-tags': boolean;
79
- 'tags-file': string;
80
- 'tags-additional-args': string[] | string;
80
+ "generate-tags": boolean;
81
+ "tags-file": string;
82
+ "tags-additional-args": string[] | string;
81
83
  }) {
82
84
  if (process.env.GENERATE_TAGS != undefined) {
83
- flags['generate-tags'] = process.env.GENERATE_TAGS == 'true';
85
+ flags["generate-tags"] = process.env.GENERATE_TAGS == "true";
84
86
  }
85
87
 
86
88
  if (process.env.TAGS_FILE != undefined) {
87
- flags['tags-file'] = process.env.TAGS_FILE;
89
+ flags["tags-file"] = process.env.TAGS_FILE;
88
90
  }
89
91
 
90
92
  if (process.env.TAGS_ADDITIONAL_ARGS != undefined) {
91
- flags['tags-additional-args'] = process.env.TAGS_ADDITIONAL_ARGS.split(',');
93
+ flags["tags-additional-args"] = process.env.TAGS_ADDITIONAL_ARGS.split(",");
92
94
  }
93
95
  }
94
96
 
95
97
  function checkAndGenerateCtags(
96
98
  logger: winston.Logger,
97
99
  flags: {
98
- 'tags-file': string;
99
- 'tags-additional-args': string[];
100
+ "tags-file": string;
101
+ "tags-additional-args": string[];
100
102
  },
101
103
  ) {
102
- const fileName = path.resolve(flags['tags-file']);
104
+ const fileName = path.resolve(flags["tags-file"]);
103
105
  const rootDir = path.dirname(fileName);
104
- const additionalArgs = flags['tags-additional-args'];
106
+ const additionalArgs = flags["tags-additional-args"];
105
107
 
106
108
  // all tengo files in dirs and subdirs
107
109
  // If we don't limit the depth, it could become unbearably slow
@@ -117,28 +119,28 @@ Found ${tengoFiles.length} tengo files...`,
117
119
 
118
120
  // see https://docs.ctags.io/en/latest/man/ctags-optlib.7.html#perl-pod
119
121
  const result = spawnSync(
120
- 'ctags',
122
+ "ctags",
121
123
  [
122
- '-f',
124
+ "-f",
123
125
  fileName,
124
126
  ...additionalArgs,
125
- '--langdef=tengo',
126
- '--map-tengo=+.tengo',
127
- '--kinddef-tengo=f,function,function',
128
- '--regex-tengo=/^\\s*(.*)(:| :=| =) ?func.*/\\1/f/',
129
- '--kinddef-tengo=c,constant,constant',
127
+ "--langdef=tengo",
128
+ "--map-tengo=+.tengo",
129
+ "--kinddef-tengo=f,function,function",
130
+ "--regex-tengo=/^\\s*(.*)(:| :=| =) ?func.*/\\1/f/",
131
+ "--kinddef-tengo=c,constant,constant",
130
132
  '--regex-tengo=/^\\s*(.*) := ("|\\{).*/\\1/c/',
131
- '-R',
133
+ "-R",
132
134
  ...tengoFiles,
133
135
  ],
134
136
  {
135
137
  env: process.env,
136
- stdio: 'inherit',
138
+ stdio: "inherit",
137
139
  cwd: rootDir,
138
140
  },
139
141
  );
140
142
 
141
- if (result.error?.message.includes('ENOENT')) {
143
+ if (result.error?.message.includes("ENOENT")) {
142
144
  console.log(`
143
145
  pl-tengo can create tags for tengo autocompletion,
144
146
  but the program should be installed
@@ -151,9 +153,9 @@ https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support`);
151
153
  return;
152
154
  }
153
155
 
154
- checkRunError(result, 'failed to generate ctags');
156
+ checkRunError(result, "failed to generate ctags");
155
157
 
156
- logger.info('Generation of tags is done.');
158
+ logger.info("Generation of tags is done.");
157
159
  }
158
160
 
159
161
  function getTengoFiles(dir: string, depth: number): string[] {
@@ -171,7 +173,7 @@ function getTengoFiles(dir: string, depth: number): string[] {
171
173
  tengoFiles = tengoFiles.concat(getTengoFiles(absPath, depth - 1));
172
174
  }
173
175
 
174
- if (!file.isDirectory() && file.name.endsWith('.tengo')) {
176
+ if (!file.isDirectory() && file.name.endsWith(".tengo")) {
175
177
  tengoFiles.push(absPath);
176
178
  }
177
179
  });
@@ -181,7 +183,7 @@ function getTengoFiles(dir: string, depth: number): string[] {
181
183
 
182
184
  function toRelativePath(dir: string, files: string[]): string[] {
183
185
  // Note that VS Code extension likes only relatives paths to the root of the opened dir.
184
- return files.map((file) => file.replace(dir, '.'));
186
+ return files.map((file) => file.replace(dir, "."));
185
187
  }
186
188
 
187
189
  function checkRunError(result: SpawnSyncReturns<Buffer>, message?: string) {
@@ -189,7 +191,7 @@ function checkRunError(result: SpawnSyncReturns<Buffer>, message?: string) {
189
191
  console.log(result.error);
190
192
  }
191
193
 
192
- const msg = message ?? 'failed to run command';
194
+ const msg = message ?? "failed to run command";
193
195
 
194
196
  if (result.status !== 0) {
195
197
  console.log(`WARN: ${msg} the build will continue as-is`);
@@ -1,12 +1,12 @@
1
- import { Command } from '@oclif/core';
2
- import { createLogger } from '../compiler/util';
3
- import { dumpArtifacts } from '../shared/dump';
4
- import { GlobalFlags } from '../shared/basecmd';
5
- import { spawnEmbed, waitFor } from '../shared/proc';
6
- import { TengoTesterBinaryPath } from '@milaboratories/tengo-tester';
1
+ import { Command } from "@oclif/core";
2
+ import { createLogger } from "../compiler/util";
3
+ import { dumpArtifacts } from "../shared/dump";
4
+ import { GlobalFlags } from "../shared/basecmd";
5
+ import { spawnEmbed, waitFor } from "../shared/proc";
6
+ import { TengoTesterBinaryPath } from "@milaboratories/tengo-tester";
7
7
 
8
8
  export default class Check extends Command {
9
- static override description = 'check tengo sources for language processor an';
9
+ static override description = "check tengo sources for language processor an";
10
10
 
11
11
  // static override args = {
12
12
  // "log-level": Args.string({description: 'logging level'}),
@@ -16,18 +16,21 @@ export default class Check extends Command {
16
16
 
17
17
  static override flags = { ...GlobalFlags };
18
18
 
19
- static override examples = ['<%= config.bin %> <%= command.id %>'];
19
+ static override examples = ["<%= config.bin %> <%= command.id %>"];
20
20
 
21
21
  public async run(): Promise<void> {
22
22
  const { flags, argv } = await this.parse(Check);
23
- const logger = createLogger(flags['log-level']);
23
+ const logger = createLogger(flags["log-level"]);
24
24
 
25
- const testerArgs: string[] = argv.length == 0 ? ['./src'] : (argv as string[]);
25
+ const testerArgs: string[] = argv.length == 0 ? ["./src"] : (argv as string[]);
26
26
 
27
27
  const tester = spawnEmbed(
28
28
  TengoTesterBinaryPath,
29
- 'check', '--log-level', flags['log-level'],
30
- '--artifacts', '-',
29
+ "check",
30
+ "--log-level",
31
+ flags["log-level"],
32
+ "--artifacts",
33
+ "-",
31
34
  ...testerArgs,
32
35
  );
33
36