@platforma-sdk/tengo-builder 2.1.14 → 2.1.16

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 (108) hide show
  1. package/bin/run.js +6 -0
  2. package/dist/commands/build.cjs +172 -0
  3. package/dist/commands/build.cjs.map +1 -0
  4. package/dist/commands/build.d.ts +4 -5
  5. package/dist/commands/build.d.ts.map +1 -1
  6. package/dist/commands/build.js +149 -0
  7. package/dist/commands/build.js.map +1 -0
  8. package/dist/commands/check.cjs +39 -0
  9. package/dist/commands/check.cjs.map +1 -0
  10. package/dist/commands/check.d.ts +1 -2
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +37 -0
  13. package/dist/commands/check.js.map +1 -0
  14. package/dist/commands/dump/all.cjs +20 -0
  15. package/dist/commands/dump/all.cjs.map +1 -0
  16. package/dist/commands/dump/all.js +18 -0
  17. package/dist/commands/dump/all.js.map +1 -0
  18. package/dist/commands/dump/assets.cjs +20 -0
  19. package/dist/commands/dump/assets.cjs.map +1 -0
  20. package/dist/commands/dump/assets.js +18 -0
  21. package/dist/commands/dump/assets.js.map +1 -0
  22. package/dist/commands/dump/libs.cjs +24 -0
  23. package/dist/commands/dump/libs.cjs.map +1 -0
  24. package/dist/commands/dump/libs.d.ts +1 -2
  25. package/dist/commands/dump/libs.d.ts.map +1 -1
  26. package/dist/commands/dump/libs.js +22 -0
  27. package/dist/commands/dump/libs.js.map +1 -0
  28. package/dist/commands/dump/software.cjs +20 -0
  29. package/dist/commands/dump/software.cjs.map +1 -0
  30. package/dist/commands/dump/software.js +18 -0
  31. package/dist/commands/dump/software.js.map +1 -0
  32. package/dist/commands/dump/templates.cjs +20 -0
  33. package/dist/commands/dump/templates.cjs.map +1 -0
  34. package/dist/commands/dump/templates.js +18 -0
  35. package/dist/commands/dump/templates.js.map +1 -0
  36. package/dist/commands/dump/tests.cjs +20 -0
  37. package/dist/commands/dump/tests.cjs.map +1 -0
  38. package/dist/commands/dump/tests.js +18 -0
  39. package/dist/commands/dump/tests.js.map +1 -0
  40. package/dist/commands/test.cjs +36 -0
  41. package/dist/commands/test.cjs.map +1 -0
  42. package/dist/commands/test.d.ts +1 -2
  43. package/dist/commands/test.d.ts.map +1 -1
  44. package/dist/commands/test.js +34 -0
  45. package/dist/commands/test.js.map +1 -0
  46. package/dist/compiler/artifactset.cjs +75 -0
  47. package/dist/compiler/artifactset.cjs.map +1 -0
  48. package/dist/compiler/artifactset.d.ts +1 -1
  49. package/dist/compiler/artifactset.js +71 -0
  50. package/dist/compiler/artifactset.js.map +1 -0
  51. package/dist/compiler/compiler.cjs +314 -0
  52. package/dist/compiler/compiler.cjs.map +1 -0
  53. package/dist/compiler/compiler.d.ts +3 -3
  54. package/dist/compiler/compiler.js +312 -0
  55. package/dist/compiler/compiler.js.map +1 -0
  56. package/dist/compiler/compileroptions.cjs +45 -0
  57. package/dist/compiler/compileroptions.cjs.map +1 -0
  58. package/dist/compiler/compileroptions.d.ts +2 -2
  59. package/dist/compiler/compileroptions.js +41 -0
  60. package/dist/compiler/compileroptions.js.map +1 -0
  61. package/dist/compiler/main.cjs +387 -0
  62. package/dist/compiler/main.cjs.map +1 -0
  63. package/dist/compiler/main.d.ts +5 -3
  64. package/dist/compiler/main.js +359 -0
  65. package/dist/compiler/main.js.map +1 -0
  66. package/dist/compiler/package.cjs +65 -0
  67. package/dist/compiler/package.cjs.map +1 -0
  68. package/dist/compiler/package.js +55 -0
  69. package/dist/compiler/package.js.map +1 -0
  70. package/dist/compiler/source.cjs +292 -0
  71. package/dist/compiler/source.cjs.map +1 -0
  72. package/dist/compiler/source.d.ts +2 -2
  73. package/dist/compiler/source.js +285 -0
  74. package/dist/compiler/source.js.map +1 -0
  75. package/dist/compiler/template.cjs +48 -0
  76. package/dist/compiler/template.cjs.map +1 -0
  77. package/dist/compiler/template.d.ts +2 -2
  78. package/dist/compiler/template.js +44 -0
  79. package/dist/compiler/template.js.map +1 -0
  80. package/dist/compiler/test.artifacts.d.ts +1 -1
  81. package/dist/compiler/util.cjs +75 -0
  82. package/dist/compiler/util.cjs.map +1 -0
  83. package/dist/compiler/util.js +50 -0
  84. package/dist/compiler/util.js.map +1 -0
  85. package/dist/index.cjs +28 -0
  86. package/dist/index.cjs.map +1 -0
  87. package/dist/index.d.ts +9 -9
  88. package/dist/index.js +23 -41
  89. package/dist/index.js.map +1 -1
  90. package/dist/shared/basecmd.cjs +31 -0
  91. package/dist/shared/basecmd.cjs.map +1 -0
  92. package/dist/shared/basecmd.d.ts +4 -5
  93. package/dist/shared/basecmd.d.ts.map +1 -1
  94. package/dist/shared/basecmd.js +28 -0
  95. package/dist/shared/basecmd.js.map +1 -0
  96. package/dist/shared/dump.cjs +117 -0
  97. package/dist/shared/dump.cjs.map +1 -0
  98. package/dist/shared/dump.d.ts +1 -1
  99. package/dist/shared/dump.js +110 -0
  100. package/dist/shared/dump.js.map +1 -0
  101. package/dist/shared/proc.cjs +26 -0
  102. package/dist/shared/proc.cjs.map +1 -0
  103. package/dist/shared/proc.d.ts +2 -2
  104. package/dist/shared/proc.js +23 -0
  105. package/dist/shared/proc.js.map +1 -0
  106. package/package.json +13 -10
  107. package/dist/index.mjs +0 -1198
  108. package/dist/index.mjs.map +0 -1
@@ -0,0 +1,314 @@
1
+ 'use strict';
2
+
3
+ var template = require('./template.cjs');
4
+ var _package = require('./package.cjs');
5
+ var artifactset = require('./artifactset.cjs');
6
+ var util = require('./util.cjs');
7
+ var compileroptions = require('./compileroptions.cjs');
8
+
9
+ class TengoTemplateCompiler {
10
+ compileMode;
11
+ libs = new artifactset.ArtifactStore((src) => src.fullName);
12
+ software = new artifactset.ArtifactStore((src) => src.fullName);
13
+ assets = new artifactset.ArtifactStore((src) => src.fullName);
14
+ templates = new artifactset.ArtifactStore((tpl) => tpl.fullName);
15
+ constructor(compileMode) {
16
+ this.compileMode = compileMode;
17
+ }
18
+ /** Recursively add dependencies to the template. */
19
+ populateTemplateDataFromDependencies(fullName, data, deps, trace) {
20
+ for (const dep of deps) {
21
+ switch (dep.type) {
22
+ case 'library': {
23
+ const lib = this.getLibOrError(dep);
24
+ const recursionStart = trace.indexOf(_package.artifactNameToString(dep));
25
+ if (recursionStart >= 0) {
26
+ const errorMessage = `library import recursion detected: `
27
+ + `${trace.slice(recursionStart).join(' -> ')} -> ${_package.artifactNameToString(dep)}`;
28
+ throw new Error(errorMessage);
29
+ }
30
+ const tplLib = {
31
+ ..._package.formatArtefactNameAndVersion(lib.fullName),
32
+ sourceHash: lib.sourceHash,
33
+ };
34
+ compileroptions.applyLibraryCompilerOptions(lib.compilerOptions);
35
+ data.template.libs[_package.artifactNameToString(dep)] = tplLib;
36
+ data.hashToSource[tplLib.sourceHash] = lib.src;
37
+ // populate with transient library dependencies
38
+ this.populateTemplateDataFromDependencies(fullName, data, lib.dependencies, [...trace, _package.artifactNameToString(dep)]);
39
+ break;
40
+ }
41
+ case 'software': {
42
+ const software = this.getSoftwareOrError(dep);
43
+ data.template.software[_package.artifactNameToString(dep)] = {
44
+ ..._package.formatArtefactNameAndVersion(software.fullName),
45
+ sourceHash: software.sourceHash,
46
+ };
47
+ data.hashToSource[software.sourceHash] = software.src;
48
+ break;
49
+ }
50
+ case 'asset': {
51
+ const asset = this.getAssetOrError(dep);
52
+ // Yes, we temporarily put assets into 'software' section of template, so controller can
53
+ // handle it the right way without updates
54
+ data.template.software[_package.artifactNameToString(dep)] = {
55
+ ..._package.formatArtefactNameAndVersion(asset.fullName),
56
+ sourceHash: asset.sourceHash,
57
+ };
58
+ data.hashToSource[asset.sourceHash] = asset.src;
59
+ break;
60
+ }
61
+ case 'template': {
62
+ if (_package.typedArtifactNamesEquals(fullName, dep))
63
+ // skipping self reference
64
+ continue;
65
+ const tpl = this.getTemplateOrError(dep);
66
+ data.template.templates[_package.artifactNameToString(dep)] = tpl.data.template;
67
+ data.hashToSource[tpl.data.template.sourceHash] = tpl.source;
68
+ // add all the sources of transitivedependencies to the resulted hashToSource
69
+ for (const [hash, src] of Object.entries(tpl.data.hashToSource)) {
70
+ data.hashToSource[hash] = src;
71
+ }
72
+ break;
73
+ }
74
+ case 'test':
75
+ throw new Error(`dependencies tree error: tests should never be part of template: `
76
+ + `${_package.typedArtifactNameToString(dep)} is dependency of ${_package.artifactNameToString(fullName)}`);
77
+ default:
78
+ util.assertNever(dep.type);
79
+ }
80
+ }
81
+ }
82
+ /** This method assumes that all dependencies are already added to the compiler's context */
83
+ compileAndAddTemplate(tplSrc) {
84
+ if (tplSrc.fullName.type !== 'template')
85
+ throw new Error('unexpected source type');
86
+ // creating template with unpopulated dependencies
87
+ const tplData = {
88
+ type: 'pl.tengo-template.v3',
89
+ hashToSource: {
90
+ [tplSrc.sourceHash]: tplSrc.src,
91
+ },
92
+ template: {
93
+ ..._package.formatArtefactNameAndVersion(tplSrc.fullName),
94
+ templates: {},
95
+ libs: {},
96
+ software: {},
97
+ assets: {},
98
+ sourceHash: tplSrc.sourceHash,
99
+ },
100
+ };
101
+ compileroptions.applyTemplateCompilerOptions(tplSrc.compilerOptions, tplData.template);
102
+ // collecting dependencies in output format
103
+ this.populateTemplateDataFromDependencies(tplSrc.fullName, tplData, tplSrc.dependencies, []);
104
+ return tplData;
105
+ }
106
+ addLib(lib) {
107
+ const libFromMap = this.libs.add(lib.compileMode, lib, false);
108
+ if (libFromMap && !_package.fullNameEquals(lib.fullName, libFromMap.fullName))
109
+ throw new Error(`compiler already contain such library: adding = ${_package.fullNameToString(lib.fullName)}, contains = ${_package.fullNameToString(libFromMap.fullName)}`);
110
+ }
111
+ allLibs() {
112
+ return this.libs.array(this.compileMode);
113
+ }
114
+ getLib(name) {
115
+ if (name.type !== 'library')
116
+ throw new Error(`illegal artifact type: got ${name.type} instead of 'library`);
117
+ return this.libs.get(this.compileMode, name);
118
+ }
119
+ getLibOrError(name) {
120
+ const lib = this.getLib(name);
121
+ if (!lib)
122
+ throw new Error(`library not found: ${_package.artifactNameToString(name)}`);
123
+ return lib;
124
+ }
125
+ checkLibs() {
126
+ this.libs.forEach(this.compileMode, (lib) => {
127
+ for (const dep of lib.dependencies) {
128
+ if (dep.type === 'test')
129
+ throw new Error(`test should never be dependency of production code: ${_package.typedArtifactNameToString(dep)} test is dependency of ${_package.fullNameToString(lib.fullName)}`);
130
+ if (!this.getArtefact(dep))
131
+ throw new Error(`unresolved dependency ${_package.typedArtifactNameToString(dep)} for ${_package.fullNameToString(lib.fullName)}`);
132
+ }
133
+ });
134
+ }
135
+ addSoftware(software) {
136
+ const swFromMap = this.software.add(software.compileMode, software, false);
137
+ if (swFromMap && !_package.fullNameEquals(software.fullName, swFromMap.fullName))
138
+ throw new Error(`compiler already contain info for software: adding = ${_package.fullNameToString(software.fullName)}, contains = ${_package.fullNameToString(swFromMap.fullName)}`);
139
+ }
140
+ allSoftware() {
141
+ return this.software.array(this.compileMode);
142
+ }
143
+ getSoftware(name) {
144
+ if (name.type !== 'software')
145
+ throw new Error(`illegal artifact type: got ${name.type} instead of 'software`);
146
+ return this.software.get(this.compileMode, name);
147
+ }
148
+ getSoftwareOrError(name) {
149
+ const software = this.getSoftware(name);
150
+ if (!software)
151
+ throw new Error(`software info not found: ${_package.artifactNameToString(name)}`);
152
+ return software;
153
+ }
154
+ addAsset(asset) {
155
+ const assetFromMap = this.assets.add(asset.compileMode, asset, false);
156
+ if (assetFromMap && !_package.fullNameEquals(asset.fullName, assetFromMap.fullName))
157
+ throw new Error(`compiler already contain info for asset: adding = ${_package.fullNameToString(asset.fullName)}, contains = ${_package.fullNameToString(assetFromMap.fullName)}`);
158
+ }
159
+ allAssets() {
160
+ return this.assets.array(this.compileMode);
161
+ }
162
+ getAsset(name) {
163
+ if (name.type !== 'asset')
164
+ throw new Error(`illegal artifact type: got ${name.type} instead of 'asset`);
165
+ return this.assets.get(this.compileMode, name);
166
+ }
167
+ getAssetOrError(name) {
168
+ const asset = this.getAsset(name);
169
+ if (!asset)
170
+ throw new Error(`asset info not found: ${_package.artifactNameToString(name)}`);
171
+ return asset;
172
+ }
173
+ addTemplate(tpl) {
174
+ const tplFromMap = this.templates.add(tpl.compileMode, tpl, false);
175
+ if (tplFromMap && !_package.fullNameEquals(tpl.fullName, tplFromMap.fullName))
176
+ throw new Error(`compiler already contain such template: adding = ${_package.fullNameToString(tpl.fullName)}, contains = ${_package.fullNameToString(tplFromMap.fullName)}`);
177
+ }
178
+ allTemplates() {
179
+ return this.templates.array(this.compileMode);
180
+ }
181
+ getTemplate(name) {
182
+ if (name.type !== 'template')
183
+ throw new Error(`illegal artifact type: got ${name.type} instead of 'template`);
184
+ return this.templates.get(this.compileMode, name);
185
+ }
186
+ getTemplateOrError(name) {
187
+ const tpl = this.getTemplate(name);
188
+ if (!tpl)
189
+ throw new Error(`template not found: ${_package.artifactNameToString(name)}`);
190
+ return tpl;
191
+ }
192
+ getArtefact(name) {
193
+ switch (name.type) {
194
+ case 'template':
195
+ return this.getTemplate(name);
196
+ case 'library':
197
+ return this.getLib(name);
198
+ case 'software':
199
+ return this.getSoftware(name);
200
+ case 'asset':
201
+ return this.getAsset(name);
202
+ case 'test':
203
+ // Tests are ignored by the complier. They should never be compiled into templates or libs and
204
+ // should never be a dependency.
205
+ return undefined;
206
+ default:
207
+ util.assertNever(name.type);
208
+ }
209
+ }
210
+ compileAndAdd(sources) {
211
+ const result = {
212
+ templates: [],
213
+ libs: [],
214
+ software: [],
215
+ assets: [],
216
+ };
217
+ let current = [];
218
+ for (const src of sources) {
219
+ if (src.fullName.type === 'library') {
220
+ // add libraries 'as-is' to be able to resolve them as dependencies
221
+ this.addLib(src);
222
+ result.libs.push(src);
223
+ }
224
+ else if (src.fullName.type === 'software') {
225
+ // add software 'as-is' to be able to resolve them as dependencies
226
+ this.addSoftware(src);
227
+ result.software.push(src);
228
+ }
229
+ else if (src.fullName.type === 'asset') {
230
+ // add assets 'as-is' to be able to resolve them as dependencies
231
+ this.addAsset(src);
232
+ result.assets.push(src);
233
+ }
234
+ else {
235
+ current.push(src);
236
+ }
237
+ }
238
+ while (current.length > 0) {
239
+ const unprocessed = [];
240
+ for (const src of current) {
241
+ //
242
+ // If one of the dependencies can't be resolved with current compiler context,
243
+ // we put aside the source until next iteration, in hope that the dependency
244
+ // will be satisfied then.
245
+ //
246
+ // This is equivalent to topological sorting of input sources.
247
+ //
248
+ const unsatisfied = src.dependencies.filter((dep) => !this.getArtefact(dep)
249
+ // allow self reference for templates
250
+ && !(src.fullName.type === 'template' && _package.typedArtifactNamesEquals(src.fullName, dep)));
251
+ if (unsatisfied.length > 0) {
252
+ let errorMessage = `Unsatisfied dependencies in ${_package.fullNameToString(src.fullName)}:\n`;
253
+ for (const dep of unsatisfied) {
254
+ errorMessage += ` - ${_package.typedArtifactNameToString(dep)}\n`;
255
+ }
256
+ unprocessed.push({ src, err: new Error(errorMessage) });
257
+ continue;
258
+ }
259
+ // type specific processing
260
+ switch (src.fullName.type) {
261
+ case 'library':
262
+ // libraries are added as is
263
+ this.addLib(src);
264
+ result.libs.push(src);
265
+ break;
266
+ case 'software':
267
+ // software dependencies are added as is
268
+ this.addSoftware(src);
269
+ result.software.push(src);
270
+ break;
271
+ case 'asset':
272
+ // software dependencies are added as is
273
+ this.addAsset(src);
274
+ result.assets.push(src);
275
+ break;
276
+ case 'template':
277
+ // templates are compiled and then added
278
+ try {
279
+ const tpl = this.compileAndAddTemplate(src);
280
+ const tplWithSrc = template.newTemplateWithSource(src.compileMode, src.fullName, tpl, src.src);
281
+ this.addTemplate(tplWithSrc);
282
+ result.templates.push(tplWithSrc);
283
+ }
284
+ catch (error) {
285
+ const err = error;
286
+ let errorMessage = `Unsatisfied dependencies in ${_package.fullNameToString(src.fullName)}:\n`;
287
+ errorMessage += ` - ${err.message}\n`;
288
+ unprocessed.push({ src, err: Error(errorMessage) }); // one or more dependencies are not resolvable yet
289
+ }
290
+ break;
291
+ case 'test':
292
+ // Ignore tests: they never should be part of compiled code or be a dependency.
293
+ break;
294
+ default:
295
+ util.assertNever(src.fullName.type);
296
+ }
297
+ }
298
+ // checking that we successfully added at least one source,
299
+ // if not all the source files in unprocessed array have unmet dependencies
300
+ if (current.length === unprocessed.length) {
301
+ let errorMessage = '';
302
+ for (const u of unprocessed) {
303
+ errorMessage += `\n${u.err.message}`;
304
+ }
305
+ throw new Error(errorMessage);
306
+ }
307
+ current = unprocessed.map(({ src: ArtifactSource }) => ArtifactSource);
308
+ }
309
+ return result;
310
+ }
311
+ }
312
+
313
+ exports.TengoTemplateCompiler = TengoTemplateCompiler;
314
+ //# sourceMappingURL=compiler.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.cjs","sources":["../../src/compiler/compiler.ts"],"sourcesContent":["import type { ArtifactSource } from './source';\nimport type { TemplateWithSource } from './template';\nimport { newTemplateWithSource } from './template';\nimport type {\n TypedArtifactName, FullArtifactName,\n CompileMode,\n} from './package';\nimport {\n fullNameToString,\n typedArtifactNameToString,\n artifactNameToString,\n formatArtefactNameAndVersion, typedArtifactNamesEquals,\n fullNameEquals,\n} from './package';\nimport { ArtifactStore } from './artifactset';\nimport { assertNever } from './util';\nimport { applyLibraryCompilerOptions, applyTemplateCompilerOptions } from './compileroptions';\nimport type { CompiledTemplateV3 } from '@milaboratories/pl-model-backend';\n\n/** A compilation result. */\nexport interface TemplatesAndLibs {\n templates: TemplateWithSource[];\n libs: ArtifactSource[];\n software: ArtifactSource[];\n assets: ArtifactSource[];\n}\n\nexport class TengoTemplateCompiler {\n private readonly libs = new ArtifactStore<ArtifactSource>((src) => src.fullName);\n private readonly software = new ArtifactStore<ArtifactSource>((src) => src.fullName);\n private readonly assets = new ArtifactStore<ArtifactSource>((src) => src.fullName);\n private readonly templates = new ArtifactStore<TemplateWithSource>((tpl) => tpl.fullName);\n\n constructor(\n private readonly compileMode: CompileMode,\n ) { }\n\n /** Recursively add dependencies to the template. */\n private populateTemplateDataFromDependencies(\n fullName: FullArtifactName,\n data: CompiledTemplateV3,\n deps: TypedArtifactName[],\n trace: string[],\n ) {\n for (const dep of deps) {\n switch (dep.type) {\n case 'library': {\n const lib = this.getLibOrError(dep);\n\n const recursionStart = trace.indexOf(artifactNameToString(dep));\n if (recursionStart >= 0) {\n const errorMessage = `library import recursion detected: `\n + `${trace.slice(recursionStart).join(' -> ')} -> ${artifactNameToString(dep)}`;\n throw new Error(errorMessage);\n }\n\n const tplLib = {\n ...formatArtefactNameAndVersion(lib.fullName),\n sourceHash: lib.sourceHash,\n };\n\n applyLibraryCompilerOptions(lib.compilerOptions, tplLib);\n data.template.libs[artifactNameToString(dep)] = tplLib;\n data.hashToSource[tplLib.sourceHash] = lib.src;\n\n // populate with transient library dependencies\n this.populateTemplateDataFromDependencies(fullName, data, lib.dependencies, [...trace, artifactNameToString(dep)]);\n\n break;\n }\n case 'software': {\n const software = this.getSoftwareOrError(dep);\n data.template.software[artifactNameToString(dep)] = {\n ...formatArtefactNameAndVersion(software.fullName),\n sourceHash: software.sourceHash,\n };\n data.hashToSource[software.sourceHash] = software.src;\n\n break;\n }\n case 'asset': {\n const asset = this.getAssetOrError(dep);\n // Yes, we temporarily put assets into 'software' section of template, so controller can\n // handle it the right way without updates\n data.template.software[artifactNameToString(dep)] = {\n ...formatArtefactNameAndVersion(asset.fullName),\n sourceHash: asset.sourceHash,\n };\n data.hashToSource[asset.sourceHash] = asset.src;\n break;\n }\n case 'template': {\n if (typedArtifactNamesEquals(fullName, dep))\n // skipping self reference\n continue;\n\n const tpl = this.getTemplateOrError(dep);\n data.template.templates[artifactNameToString(dep)] = tpl.data.template;\n data.hashToSource[tpl.data.template.sourceHash] = tpl.source;\n\n // add all the sources of transitivedependencies to the resulted hashToSource\n for (const [hash, src] of Object.entries(tpl.data.hashToSource)) {\n data.hashToSource[hash] = src;\n }\n\n break;\n }\n case 'test':\n throw new Error(\n `dependencies tree error: tests should never be part of template: `\n + `${typedArtifactNameToString(dep)} is dependency of ${artifactNameToString(fullName)}`,\n );\n default:\n assertNever(dep.type);\n }\n }\n }\n\n /** This method assumes that all dependencies are already added to the compiler's context */\n private compileAndAddTemplate(tplSrc: ArtifactSource): CompiledTemplateV3 {\n if (tplSrc.fullName.type !== 'template')\n throw new Error('unexpected source type');\n\n // creating template with unpopulated dependencies\n const tplData: CompiledTemplateV3 = {\n type: 'pl.tengo-template.v3',\n hashToSource: {\n [tplSrc.sourceHash]: tplSrc.src,\n },\n template: {\n ...formatArtefactNameAndVersion(tplSrc.fullName),\n templates: {},\n libs: {},\n software: {},\n assets: {},\n sourceHash: tplSrc.sourceHash,\n },\n };\n\n applyTemplateCompilerOptions(tplSrc.compilerOptions, tplData.template);\n\n // collecting dependencies in output format\n this.populateTemplateDataFromDependencies(tplSrc.fullName, tplData, tplSrc.dependencies, []);\n\n return tplData;\n }\n\n addLib(lib: ArtifactSource) {\n const libFromMap = this.libs.add(lib.compileMode, lib, false);\n if (libFromMap && !fullNameEquals(lib.fullName, libFromMap.fullName))\n throw new Error(\n `compiler already contain such library: adding = ${fullNameToString(lib.fullName)}, contains = ${fullNameToString(libFromMap.fullName)}`,\n );\n }\n\n allLibs(): ArtifactSource[] {\n return this.libs.array(this.compileMode);\n }\n\n getLib(name: TypedArtifactName): ArtifactSource | undefined {\n if (name.type !== 'library')\n throw new Error(`illegal artifact type: got ${name.type} instead of 'library`);\n return this.libs.get(this.compileMode, name);\n }\n\n getLibOrError(name: TypedArtifactName): ArtifactSource {\n const lib = this.getLib(name);\n if (!lib)\n throw new Error(`library not found: ${artifactNameToString(name)}`);\n return lib;\n }\n\n checkLibs() {\n this.libs.forEach(this.compileMode, (lib) => {\n for (const dep of lib.dependencies) {\n if (dep.type === 'test')\n throw new Error(`test should never be dependency of production code: ${typedArtifactNameToString(dep)} test is dependency of ${fullNameToString(lib.fullName)}`);\n\n if (!this.getArtefact(dep))\n throw new Error(`unresolved dependency ${typedArtifactNameToString(dep)} for ${fullNameToString(lib.fullName)}`);\n }\n });\n }\n\n addSoftware(software: ArtifactSource) {\n const swFromMap = this.software.add(software.compileMode, software, false);\n if (swFromMap && !fullNameEquals(software.fullName, swFromMap.fullName))\n throw new Error(\n `compiler already contain info for software: adding = ${fullNameToString(software.fullName)}, contains = ${fullNameToString(swFromMap.fullName)}`,\n );\n }\n\n allSoftware(): ArtifactSource[] {\n return this.software.array(this.compileMode);\n }\n\n getSoftware(name: TypedArtifactName): ArtifactSource | undefined {\n if (name.type !== 'software')\n throw new Error(`illegal artifact type: got ${name.type} instead of 'software`);\n\n return this.software.get(this.compileMode, name);\n }\n\n getSoftwareOrError(name: TypedArtifactName): ArtifactSource {\n const software = this.getSoftware(name);\n if (!software)\n throw new Error(`software info not found: ${artifactNameToString(name)}`);\n return software;\n }\n\n addAsset(asset: ArtifactSource) {\n const assetFromMap = this.assets.add(asset.compileMode, asset, false);\n if (assetFromMap && !fullNameEquals(asset.fullName, assetFromMap.fullName))\n throw new Error(\n `compiler already contain info for asset: adding = ${fullNameToString(asset.fullName)}, contains = ${fullNameToString(assetFromMap.fullName)}`,\n );\n }\n\n allAssets(): ArtifactSource[] {\n return this.assets.array(this.compileMode);\n }\n\n getAsset(name: TypedArtifactName): ArtifactSource | undefined {\n if (name.type !== 'asset')\n throw new Error(`illegal artifact type: got ${name.type} instead of 'asset`);\n\n return this.assets.get(this.compileMode, name);\n }\n\n getAssetOrError(name: TypedArtifactName): ArtifactSource {\n const asset = this.getAsset(name);\n if (!asset)\n throw new Error(`asset info not found: ${artifactNameToString(name)}`);\n return asset;\n }\n\n addTemplate(tpl: TemplateWithSource) {\n const tplFromMap = this.templates.add(tpl.compileMode, tpl, false);\n if (tplFromMap && !fullNameEquals(tpl.fullName, tplFromMap.fullName))\n throw new Error(\n `compiler already contain such template: adding = ${fullNameToString(tpl.fullName)}, contains = ${fullNameToString(tplFromMap.fullName)}`,\n );\n }\n\n allTemplates(): TemplateWithSource[] {\n return this.templates.array(this.compileMode);\n }\n\n getTemplate(name: TypedArtifactName): TemplateWithSource | undefined {\n if (name.type !== 'template')\n throw new Error(`illegal artifact type: got ${name.type} instead of 'template`);\n return this.templates.get(this.compileMode, name);\n }\n\n getTemplateOrError(name: TypedArtifactName): TemplateWithSource {\n const tpl = this.getTemplate(name);\n if (!tpl)\n throw new Error(`template not found: ${artifactNameToString(name)}`);\n return tpl;\n }\n\n getArtefact(name: TypedArtifactName): ArtifactSource | TemplateWithSource | undefined {\n switch (name.type) {\n case 'template':\n return this.getTemplate(name);\n case 'library':\n return this.getLib(name);\n case 'software':\n return this.getSoftware(name);\n case 'asset':\n return this.getAsset(name);\n case 'test':\n // Tests are ignored by the complier. They should never be compiled into templates or libs and\n // should never be a dependency.\n return undefined;\n default:\n assertNever(name.type);\n }\n }\n\n compileAndAdd(sources: ArtifactSource[]): TemplatesAndLibs {\n const result: TemplatesAndLibs = {\n templates: [],\n libs: [],\n software: [],\n assets: [],\n };\n\n let current: ArtifactSource[] = [];\n\n for (const src of sources) {\n if (src.fullName.type === 'library') {\n // add libraries 'as-is' to be able to resolve them as dependencies\n this.addLib(src);\n result.libs.push(src);\n } else if (src.fullName.type === 'software') {\n // add software 'as-is' to be able to resolve them as dependencies\n this.addSoftware(src);\n result.software.push(src);\n } else if (src.fullName.type === 'asset') {\n // add assets 'as-is' to be able to resolve them as dependencies\n this.addAsset(src);\n result.assets.push(src);\n } else {\n current.push(src);\n }\n }\n\n while (current.length > 0) {\n const unprocessed: { src: ArtifactSource; err: Error }[] = [];\n\n for (const src of current) {\n //\n // If one of the dependencies can't be resolved with current compiler context,\n // we put aside the source until next iteration, in hope that the dependency\n // will be satisfied then.\n //\n // This is equivalent to topological sorting of input sources.\n //\n const unsatisfied = src.dependencies.filter((dep) =>\n !this.getArtefact(dep)\n // allow self reference for templates\n && !(src.fullName.type === 'template' && typedArtifactNamesEquals(src.fullName, dep)),\n );\n if (unsatisfied.length > 0) {\n let errorMessage = `Unsatisfied dependencies in ${fullNameToString(src.fullName)}:\\n`;\n for (const dep of unsatisfied) {\n errorMessage += ` - ${typedArtifactNameToString(dep)}\\n`;\n }\n unprocessed.push({ src, err: new Error(errorMessage) });\n\n continue;\n }\n\n // type specific processing\n switch (src.fullName.type) {\n case 'library':\n // libraries are added as is\n this.addLib(src);\n result.libs.push(src);\n break;\n case 'software':\n // software dependencies are added as is\n this.addSoftware(src);\n result.software.push(src);\n break;\n case 'asset':\n // software dependencies are added as is\n this.addAsset(src);\n result.assets.push(src);\n break;\n case 'template':\n // templates are compiled and then added\n try {\n const tpl = this.compileAndAddTemplate(src);\n const tplWithSrc = newTemplateWithSource(src.compileMode, src.fullName, tpl, src.src);\n this.addTemplate(tplWithSrc);\n result.templates.push(tplWithSrc);\n } catch (error: unknown) {\n const err = error as Error;\n let errorMessage = `Unsatisfied dependencies in ${fullNameToString(src.fullName)}:\\n`;\n errorMessage += ` - ${err.message}\\n`;\n\n unprocessed.push({ src, err: Error(errorMessage) }); // one or more dependencies are not resolvable yet\n }\n break;\n case 'test':\n // Ignore tests: they never should be part of compiled code or be a dependency.\n break;\n default:\n assertNever(src.fullName.type);\n }\n }\n\n // checking that we successfully added at least one source,\n // if not all the source files in unprocessed array have unmet dependencies\n if (current.length === unprocessed.length) {\n let errorMessage = '';\n\n for (const u of unprocessed) {\n errorMessage += `\\n${u.err.message}`;\n }\n throw new Error(errorMessage);\n }\n\n current = unprocessed.map(({ src: ArtifactSource }) => ArtifactSource);\n }\n\n return result;\n }\n}\n"],"names":["ArtifactStore","artifactNameToString","formatArtefactNameAndVersion","applyLibraryCompilerOptions","typedArtifactNamesEquals","typedArtifactNameToString","assertNever","applyTemplateCompilerOptions","fullNameEquals","fullNameToString","newTemplateWithSource"],"mappings":";;;;;;;;MA2Ba,qBAAqB,CAAA;AAOb,IAAA,WAAA;AANF,IAAA,IAAI,GAAG,IAAIA,yBAAa,CAAiB,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC;AAC/D,IAAA,QAAQ,GAAG,IAAIA,yBAAa,CAAiB,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC;AACnE,IAAA,MAAM,GAAG,IAAIA,yBAAa,CAAiB,CAAC,GAAG,KAAK,GAAG,CAAC,QAAQ,CAAC;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;gBACtC;AACA,gBAAA,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC;YAC/B;AAEA,YAAA,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,cAAc,CAAC;QACxE;AAEA,QAAA,OAAO,MAAM;IACf;AACD;;;;"}
@@ -1,6 +1,6 @@
1
- import { ArtifactSource } from './source';
2
- import { TemplateWithSource } from './template';
3
- import { TypedArtifactName, CompileMode } from './package';
1
+ import type { ArtifactSource } from './source';
2
+ import type { TemplateWithSource } from './template';
3
+ import type { TypedArtifactName, CompileMode } from './package';
4
4
  /** A compilation result. */
5
5
  export interface TemplatesAndLibs {
6
6
  templates: TemplateWithSource[];