@platforma-sdk/tengo-builder 2.2.5 → 2.3.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.
- package/dist/commands/build.cjs.map +1 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/check.cjs +1 -1
- package/dist/commands/check.cjs.map +1 -1
- package/dist/commands/check.js +2 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dump/artifacts.cjs +26 -0
- package/dist/commands/dump/artifacts.cjs.map +1 -0
- package/dist/commands/dump/artifacts.d.ts +11 -0
- package/dist/commands/dump/artifacts.d.ts.map +1 -0
- package/dist/commands/dump/artifacts.js +24 -0
- package/dist/commands/dump/artifacts.js.map +1 -0
- package/dist/commands/dump/software.cjs +7 -2
- package/dist/commands/dump/software.cjs.map +1 -1
- package/dist/commands/dump/software.d.ts +3 -0
- package/dist/commands/dump/software.d.ts.map +1 -1
- package/dist/commands/dump/software.js +7 -2
- package/dist/commands/dump/software.js.map +1 -1
- package/dist/commands/test.cjs +1 -1
- package/dist/commands/test.cjs.map +1 -1
- package/dist/commands/test.js +2 -2
- package/dist/commands/test.js.map +1 -1
- package/dist/index.cjs +2 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -10
- package/dist/index.js.map +1 -1
- package/dist/shared/basecmd.cjs +9 -0
- package/dist/shared/basecmd.cjs.map +1 -1
- package/dist/shared/basecmd.d.ts +3 -0
- package/dist/shared/basecmd.d.ts.map +1 -1
- package/dist/shared/basecmd.js +9 -1
- package/dist/shared/basecmd.js.map +1 -1
- package/dist/shared/dump.cjs +76 -76
- package/dist/shared/dump.cjs.map +1 -1
- package/dist/shared/dump.d.ts +3 -5
- package/dist/shared/dump.d.ts.map +1 -1
- package/dist/shared/dump.js +77 -73
- package/dist/shared/dump.js.map +1 -1
- package/package.json +4 -4
- package/src/commands/build.ts +3 -3
- package/src/commands/check.ts +2 -2
- package/src/commands/dump/artifacts.ts +28 -0
- package/src/commands/dump/software.ts +8 -2
- package/src/commands/test.ts +2 -2
- package/src/index.ts +4 -12
- package/src/shared/basecmd.ts +9 -0
- package/src/shared/dump.ts +100 -89
- package/dist/commands/dump/all.cjs +0 -20
- package/dist/commands/dump/all.cjs.map +0 -1
- package/dist/commands/dump/all.d.ts +0 -7
- package/dist/commands/dump/all.d.ts.map +0 -1
- package/dist/commands/dump/all.js +0 -18
- package/dist/commands/dump/all.js.map +0 -1
- package/dist/commands/dump/assets.cjs +0 -20
- package/dist/commands/dump/assets.cjs.map +0 -1
- package/dist/commands/dump/assets.d.ts +0 -7
- package/dist/commands/dump/assets.d.ts.map +0 -1
- package/dist/commands/dump/assets.js +0 -18
- package/dist/commands/dump/assets.js.map +0 -1
- package/dist/commands/dump/libs.cjs +0 -24
- package/dist/commands/dump/libs.cjs.map +0 -1
- package/dist/commands/dump/libs.d.ts +0 -10
- package/dist/commands/dump/libs.d.ts.map +0 -1
- package/dist/commands/dump/libs.js +0 -22
- package/dist/commands/dump/libs.js.map +0 -1
- package/dist/commands/dump/templates.cjs +0 -20
- package/dist/commands/dump/templates.cjs.map +0 -1
- package/dist/commands/dump/templates.d.ts +0 -7
- package/dist/commands/dump/templates.d.ts.map +0 -1
- package/dist/commands/dump/templates.js +0 -18
- package/dist/commands/dump/templates.js.map +0 -1
- package/dist/commands/dump/tests.cjs +0 -20
- package/dist/commands/dump/tests.cjs.map +0 -1
- package/dist/commands/dump/tests.d.ts +0 -7
- package/dist/commands/dump/tests.d.ts.map +0 -1
- package/dist/commands/dump/tests.js +0 -18
- package/dist/commands/dump/tests.js.map +0 -1
- package/src/commands/dump/all.ts +0 -17
- package/src/commands/dump/assets.ts +0 -17
- package/src/commands/dump/libs.ts +0 -23
- package/src/commands/dump/templates.ts +0 -17
- package/src/commands/dump/tests.ts +0 -17
package/dist/shared/dump.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var main = require('../compiler/main.cjs');
|
|
4
4
|
var _package = require('../compiler/package.cjs');
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function dumpArtifacts(logger, stream, aType) {
|
|
7
7
|
const packageInfo = main.getPackageInfo(process.cwd(), logger);
|
|
8
8
|
const sources = main.parseSources(logger, packageInfo, 'dist', 'src', '');
|
|
9
9
|
const compiler = main.newCompiler(logger, packageInfo, 'dist');
|
|
@@ -14,104 +14,104 @@ function dumpAll(logger, stream) {
|
|
|
14
14
|
// - all assets
|
|
15
15
|
// - all tests
|
|
16
16
|
// Libs
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
if (!aType || aType === 'library') {
|
|
18
|
+
for (const lib of compiler.allLibs()) {
|
|
19
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(lib.fullName)}`);
|
|
20
|
+
stream.write(JSON.stringify(lib) + '\n');
|
|
21
|
+
}
|
|
22
|
+
for (const src of sources) {
|
|
23
|
+
if (src.fullName.type === 'library') {
|
|
24
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)}`);
|
|
25
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
26
|
+
}
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
// Templates
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
if (!aType || aType === 'template') {
|
|
31
|
+
for (const tpl of compiler.allTemplates()) {
|
|
32
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(tpl.fullName)}`);
|
|
33
|
+
stream.write(JSON.stringify(tpl) + '\n');
|
|
34
|
+
}
|
|
35
|
+
for (const src of sources) {
|
|
36
|
+
if (src.fullName.type === 'template') {
|
|
37
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)} ${src.srcName}`);
|
|
38
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
39
|
+
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
// Software
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (const src of sources) {
|
|
44
|
-
if (src.fullName.type === 'software') {
|
|
45
|
-
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)}`);
|
|
46
|
-
stream.write(JSON.stringify(src) + '\n');
|
|
43
|
+
if (!aType || aType === 'software') {
|
|
44
|
+
for (const sw of compiler.allSoftware()) {
|
|
45
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(sw.fullName)}`);
|
|
46
|
+
stream.write(JSON.stringify(sw) + '\n');
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
for (const src of sources) {
|
|
55
|
-
if (src.fullName.type === 'asset') {
|
|
56
|
-
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)}`);
|
|
57
|
-
stream.write(JSON.stringify(src) + '\n');
|
|
48
|
+
for (const src of sources) {
|
|
49
|
+
if (src.fullName.type === 'software') {
|
|
50
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)}`);
|
|
51
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
52
|
+
}
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(
|
|
64
|
-
stream.write(JSON.stringify(
|
|
55
|
+
// Assets
|
|
56
|
+
if (!aType || aType === 'asset') {
|
|
57
|
+
for (const asset of compiler.allAssets()) {
|
|
58
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(asset.fullName)}`);
|
|
59
|
+
stream.write(JSON.stringify(asset) + '\n');
|
|
65
60
|
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function dumpLibs(logger, dumpDeps, stream) {
|
|
69
|
-
const packageInfo = main.getPackageInfo(process.cwd(), logger);
|
|
70
|
-
const sources = main.parseSources(logger, packageInfo, 'dist', 'src', '');
|
|
71
|
-
if (!dumpDeps) {
|
|
72
61
|
for (const src of sources) {
|
|
73
|
-
if (src.fullName.type === '
|
|
62
|
+
if (src.fullName.type === 'asset') {
|
|
63
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)}`);
|
|
74
64
|
stream.write(JSON.stringify(src) + '\n');
|
|
75
65
|
}
|
|
76
66
|
}
|
|
77
|
-
return;
|
|
78
67
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
// Tests
|
|
69
|
+
if (!aType || aType === 'test') {
|
|
70
|
+
for (const src of sources) {
|
|
71
|
+
if (src.fullName.type === 'test') {
|
|
72
|
+
logger.debug(`Dumping to pl-tester: ${_package.typedArtifactNameToString(src.fullName)} ${src.srcName}`);
|
|
73
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
74
|
+
}
|
|
83
75
|
}
|
|
84
76
|
}
|
|
85
|
-
for (const lib of compiler.allLibs()) {
|
|
86
|
-
stream.write(JSON.stringify(lib) + '\n');
|
|
87
|
-
}
|
|
88
77
|
}
|
|
89
|
-
function
|
|
78
|
+
function dumpSoftware(logger, stream) {
|
|
90
79
|
const packageInfo = main.getPackageInfo(process.cwd(), logger);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
const compiled = main.compile(logger, packageInfo, 'dist');
|
|
81
|
+
const hashes = new Set();
|
|
82
|
+
const sourceMap = new Map();
|
|
83
|
+
for (const tpl of compiled.templates) {
|
|
84
|
+
Object.entries(tpl.data.hashToSource).forEach(([hash, src]) => sourceMap.set(hash, src));
|
|
85
|
+
getTemplateSoftware(stream, tpl.data.template).forEach((hash) => hashes.add(hash));
|
|
86
|
+
}
|
|
87
|
+
for (const hash of hashes) {
|
|
88
|
+
const src = sourceMap.get(hash);
|
|
89
|
+
if (src) {
|
|
90
|
+
if (Object.hasOwn(JSON.parse(src), 'asset')) {
|
|
91
|
+
// Skip assets. They are kept in templates software because of backward compatibility with backend.
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
stream.write(src);
|
|
95
|
+
if (!src.endsWith('\n')) {
|
|
96
|
+
stream.write('\n');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
throw new Error(`Source not found for hash: ${hash}`);
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
function dumpTests(logger, stream) {
|
|
108
|
-
dumpArtifacts(logger, stream, 'test');
|
|
104
|
+
function getTemplateSoftware(stream, tpl) {
|
|
105
|
+
const hashes = new Set();
|
|
106
|
+
for (const sw of Object.values(tpl.software)) {
|
|
107
|
+
hashes.add(sw.sourceHash);
|
|
108
|
+
}
|
|
109
|
+
for (const subTpl of Object.values(tpl.templates)) {
|
|
110
|
+
getTemplateSoftware(stream, subTpl).forEach((hash) => hashes.add(hash));
|
|
111
|
+
}
|
|
112
|
+
return new Set(hashes);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
exports.
|
|
112
|
-
exports.dumpAssets = dumpAssets;
|
|
113
|
-
exports.dumpLibs = dumpLibs;
|
|
115
|
+
exports.dumpArtifacts = dumpArtifacts;
|
|
114
116
|
exports.dumpSoftware = dumpSoftware;
|
|
115
|
-
exports.dumpTemplates = dumpTemplates;
|
|
116
|
-
exports.dumpTests = dumpTests;
|
|
117
117
|
//# sourceMappingURL=dump.cjs.map
|
package/dist/shared/dump.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dump.cjs","sources":["../../src/shared/dump.ts"],"sourcesContent":["import type winston from 'winston';\nimport { getPackageInfo, newCompiler, parseSources } from '../compiler/main';\nimport type { ArtifactType } from '../compiler/package';\nimport { typedArtifactNameToString } from '../compiler/package';\n\nexport function dumpAll(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\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 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 // Templates\n\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 // Software\n\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 // Assets\n\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 // Tests\n\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\nexport function dumpLibs(\n logger: winston.Logger,\n dumpDeps: boolean,\n stream: NodeJS.WritableStream,\n): void {\n const packageInfo = getPackageInfo(process.cwd(), logger);\n\n const sources = parseSources(logger, packageInfo, 'dist', 'src', '');\n\n if (!dumpDeps) {\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\nfunction 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 for (const src of sources) {\n if (src.fullName.type === aType) {\n stream.write(JSON.stringify(src) + '\\n');\n }\n }\n}\n\nexport function dumpTemplates(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n): void {\n dumpArtifacts(logger, stream, 'template');\n}\n\nexport function dumpSoftware(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n): void {\n dumpArtifacts(logger, stream, 'software');\n}\n\nexport function dumpAssets(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n): void {\n dumpArtifacts(logger, stream, 'asset');\n}\n\nexport function dumpTests(\n logger: winston.Logger,\n stream: NodeJS.WritableStream,\n): void {\n dumpArtifacts(logger, stream, 'test');\n}\n"],"names":["getPackageInfo","parseSources","newCompiler","typedArtifactNameToString"],"mappings":";;;;;AAKM,SAAU,OAAO,CACrB,MAAsB,EACtB,MAA6B,EAAA;IAE7B,MAAM,WAAW,GAAGA,mBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;AAEzD,IAAA,MAAM,OAAO,GAAGC,iBAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;IAEpE,MAAM,QAAQ,GAAGC,gBAAW,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;;;;;;;;IAWzD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;AACpC,QAAA,MAAM,CAAC,KAAK,CACV,CAAA,sBAAA,EAAyBC,kCAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,CAAE,CACnE;AACD,QAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC1C;AAEA,IAAA,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE;AACnC,YAAA,MAAM,CAAC,KAAK,CACV,CAAA,sBAAA,EAAyBA,kCAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,CAAE,CACnE;AACD,YAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QAC1C;IACF;;IAIA,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,YAAY,EAAE,EAAE;AACzC,QAAA,MAAM,CAAC,KAAK,CACV,CAAA,sBAAA,EAAyBA,kCAAyB,CAAC,GAAG,CAAC,QAAQ,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B,IAAA,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACxC;AAEM,SAAU,SAAS,CACvB,MAAsB,EACtB,MAA6B,EAAA;AAE7B,IAAA,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;AACvC;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"dump.cjs","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));\n }\n\n return new Set(hashes);\n}\n"],"names":["getPackageInfo","parseSources","newCompiler","typedArtifactNameToString","compile"],"mappings":";;;;;SAMgB,aAAa,CAC3B,MAAsB,EACtB,MAA6B,EAC7B,KAAoB,EAAA;IAEpB,MAAM,WAAW,GAAGA,mBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;AAEzD,IAAA,MAAM,OAAO,GAAGC,iBAAY,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;IAEpE,MAAM,QAAQ,GAAGC,gBAAW,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,CACV,CAAA,sBAAA,EAAyBC,kCAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,CAA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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,MAA6B,EAAE,GAAmB,EAAA;AAC7E,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;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;;;;;"}
|
package/dist/shared/dump.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type winston from 'winston';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
2
|
+
import type { ArtifactType } from '../compiler/package';
|
|
3
|
+
export declare function dumpArtifacts(logger: winston.Logger, stream: NodeJS.WritableStream, aType?: ArtifactType): void;
|
|
4
|
+
export declare function dumpLibs(logger: winston.Logger, stream: NodeJS.WritableStream, recursive: boolean): void;
|
|
5
5
|
export declare function dumpSoftware(logger: winston.Logger, stream: NodeJS.WritableStream): void;
|
|
6
|
-
export declare function dumpAssets(logger: winston.Logger, stream: NodeJS.WritableStream): void;
|
|
7
|
-
export declare function dumpTests(logger: winston.Logger, stream: NodeJS.WritableStream): void;
|
|
8
6
|
//# sourceMappingURL=dump.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dump.d.ts","sourceRoot":"","sources":["../../src/shared/dump.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"dump.d.ts","sourceRoot":"","sources":["../../src/shared/dump.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,OAAO,CAAC,MAAM,EACtB,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,KAAK,CAAC,EAAE,YAAY,GACnB,IAAI,CA8GN;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,OAAO,CAAC,MAAM,EACtB,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,SAAS,EAAE,OAAO,GACjB,IAAI,CAyBN;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,EACtB,MAAM,EAAE,MAAM,CAAC,cAAc,GAC5B,IAAI,CA0BN"}
|
package/dist/shared/dump.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getPackageInfo, parseSources, newCompiler } from '../compiler/main.js';
|
|
1
|
+
import { getPackageInfo, compile, parseSources, newCompiler } from '../compiler/main.js';
|
|
2
2
|
import { typedArtifactNameToString } from '../compiler/package.js';
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function dumpArtifacts(logger, stream, aType) {
|
|
5
5
|
const packageInfo = getPackageInfo(process.cwd(), logger);
|
|
6
6
|
const sources = parseSources(logger, packageInfo, 'dist', 'src', '');
|
|
7
7
|
const compiler = newCompiler(logger, packageInfo, 'dist');
|
|
@@ -12,99 +12,103 @@ function dumpAll(logger, stream) {
|
|
|
12
12
|
// - all assets
|
|
13
13
|
// - all tests
|
|
14
14
|
// Libs
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
if (!aType || aType === 'library') {
|
|
16
|
+
for (const lib of compiler.allLibs()) {
|
|
17
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(lib.fullName)}`);
|
|
18
|
+
stream.write(JSON.stringify(lib) + '\n');
|
|
19
|
+
}
|
|
20
|
+
for (const src of sources) {
|
|
21
|
+
if (src.fullName.type === 'library') {
|
|
22
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
|
|
23
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
// Templates
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
if (!aType || aType === 'template') {
|
|
29
|
+
for (const tpl of compiler.allTemplates()) {
|
|
30
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(tpl.fullName)}`);
|
|
31
|
+
stream.write(JSON.stringify(tpl) + '\n');
|
|
32
|
+
}
|
|
33
|
+
for (const src of sources) {
|
|
34
|
+
if (src.fullName.type === 'template') {
|
|
35
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${src.srcName}`);
|
|
36
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
40
|
// Software
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for (const src of sources) {
|
|
42
|
-
if (src.fullName.type === 'software') {
|
|
43
|
-
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
|
|
44
|
-
stream.write(JSON.stringify(src) + '\n');
|
|
41
|
+
if (!aType || aType === 'software') {
|
|
42
|
+
for (const sw of compiler.allSoftware()) {
|
|
43
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(sw.fullName)}`);
|
|
44
|
+
stream.write(JSON.stringify(sw) + '\n');
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
for (const src of sources) {
|
|
53
|
-
if (src.fullName.type === 'asset') {
|
|
54
|
-
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
|
|
55
|
-
stream.write(JSON.stringify(src) + '\n');
|
|
46
|
+
for (const src of sources) {
|
|
47
|
+
if (src.fullName.type === 'software') {
|
|
48
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
|
|
49
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
50
|
+
}
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(
|
|
62
|
-
stream.write(JSON.stringify(
|
|
53
|
+
// Assets
|
|
54
|
+
if (!aType || aType === 'asset') {
|
|
55
|
+
for (const asset of compiler.allAssets()) {
|
|
56
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(asset.fullName)}`);
|
|
57
|
+
stream.write(JSON.stringify(asset) + '\n');
|
|
63
58
|
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function dumpLibs(logger, dumpDeps, stream) {
|
|
67
|
-
const packageInfo = getPackageInfo(process.cwd(), logger);
|
|
68
|
-
const sources = parseSources(logger, packageInfo, 'dist', 'src', '');
|
|
69
|
-
if (!dumpDeps) {
|
|
70
59
|
for (const src of sources) {
|
|
71
|
-
if (src.fullName.type === '
|
|
60
|
+
if (src.fullName.type === 'asset') {
|
|
61
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`);
|
|
72
62
|
stream.write(JSON.stringify(src) + '\n');
|
|
73
63
|
}
|
|
74
64
|
}
|
|
75
|
-
return;
|
|
76
65
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
// Tests
|
|
67
|
+
if (!aType || aType === 'test') {
|
|
68
|
+
for (const src of sources) {
|
|
69
|
+
if (src.fullName.type === 'test') {
|
|
70
|
+
logger.debug(`Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${src.srcName}`);
|
|
71
|
+
stream.write(JSON.stringify(src) + '\n');
|
|
72
|
+
}
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
|
-
for (const lib of compiler.allLibs()) {
|
|
84
|
-
stream.write(JSON.stringify(lib) + '\n');
|
|
85
|
-
}
|
|
86
75
|
}
|
|
87
|
-
function
|
|
76
|
+
function dumpSoftware(logger, stream) {
|
|
88
77
|
const packageInfo = getPackageInfo(process.cwd(), logger);
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
const compiled = compile(logger, packageInfo, 'dist');
|
|
79
|
+
const hashes = new Set();
|
|
80
|
+
const sourceMap = new Map();
|
|
81
|
+
for (const tpl of compiled.templates) {
|
|
82
|
+
Object.entries(tpl.data.hashToSource).forEach(([hash, src]) => sourceMap.set(hash, src));
|
|
83
|
+
getTemplateSoftware(stream, tpl.data.template).forEach((hash) => hashes.add(hash));
|
|
84
|
+
}
|
|
85
|
+
for (const hash of hashes) {
|
|
86
|
+
const src = sourceMap.get(hash);
|
|
87
|
+
if (src) {
|
|
88
|
+
if (Object.hasOwn(JSON.parse(src), 'asset')) {
|
|
89
|
+
// Skip assets. They are kept in templates software because of backward compatibility with backend.
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
stream.write(src);
|
|
93
|
+
if (!src.endsWith('\n')) {
|
|
94
|
+
stream.write('\n');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
throw new Error(`Source not found for hash: ${hash}`);
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
function dumpTests(logger, stream) {
|
|
106
|
-
dumpArtifacts(logger, stream, 'test');
|
|
102
|
+
function getTemplateSoftware(stream, tpl) {
|
|
103
|
+
const hashes = new Set();
|
|
104
|
+
for (const sw of Object.values(tpl.software)) {
|
|
105
|
+
hashes.add(sw.sourceHash);
|
|
106
|
+
}
|
|
107
|
+
for (const subTpl of Object.values(tpl.templates)) {
|
|
108
|
+
getTemplateSoftware(stream, subTpl).forEach((hash) => hashes.add(hash));
|
|
109
|
+
}
|
|
110
|
+
return new Set(hashes);
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
export {
|
|
113
|
+
export { dumpArtifacts, dumpSoftware };
|
|
110
114
|
//# sourceMappingURL=dump.js.map
|
package/dist/shared/dump.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dump.js","sources":["../../src/shared/dump.ts"],"sourcesContent":["import type winston from 'winston';\nimport { getPackageInfo, newCompiler, parseSources } from '../compiler/main';\nimport type { ArtifactType } from '../compiler/package';\nimport { typedArtifactNameToString } from '../compiler/package';\n\nexport function
|
|
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));\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,CACV,CAAA,sBAAA,EAAyB,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,CAAE,CACnE;AACD,YAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QAC1C;AAEA,QAAA,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;YACzB,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE;AACnC,gBAAA,MAAM,CAAC,KAAK,CACV,CAAA,sBAAA,EAAyB,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,CAAE,CACnE;AACD,gBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,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A6B,EAAE,GAAmB,EAAA;AAC7E,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;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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/tengo-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Pl Tengo Template Builder",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"winston": "^3.17.0",
|
|
23
23
|
"@milaboratories/resolve-helper": "1.1.1",
|
|
24
24
|
"@milaboratories/ts-helpers": "1.5.1",
|
|
25
|
-
"@milaboratories/pl-model-backend": "1.1.
|
|
25
|
+
"@milaboratories/pl-model-backend": "1.1.16"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"typescript": "~5.6.3",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@types/node": "~24.5.2",
|
|
31
31
|
"@milaboratories/build-configs": "1.0.8",
|
|
32
32
|
"@milaboratories/oclif-index": "1.1.1",
|
|
33
|
-
"@milaboratories/ts-builder": "1.0.5",
|
|
34
33
|
"@milaboratories/eslint-config": "1.0.4",
|
|
35
|
-
"@milaboratories/ts-configs": "1.0.6"
|
|
34
|
+
"@milaboratories/ts-configs": "1.0.6",
|
|
35
|
+
"@milaboratories/ts-builder": "1.0.5"
|
|
36
36
|
},
|
|
37
37
|
"oclif": {
|
|
38
38
|
"bin": "pl-tengo",
|
package/src/commands/build.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
3
3
|
import { Command } from '@oclif/core';
|
|
4
4
|
import { compile, savePacks, getPackageInfo } from '../compiler/main';
|
|
5
5
|
import { createLogger } from '../compiler/util';
|
|
6
|
-
import
|
|
6
|
+
import * as opts from '../shared/basecmd';
|
|
7
7
|
import * as fs from 'node:fs';
|
|
8
8
|
import * as fsp from 'node:fs/promises';
|
|
9
9
|
import * as path from 'node:path';
|
|
@@ -16,8 +16,8 @@ export default class Build extends Command {
|
|
|
16
16
|
static override examples = ['<%= config.bin %> <%= command.id %>'];
|
|
17
17
|
|
|
18
18
|
static override flags = {
|
|
19
|
-
...GlobalFlags,
|
|
20
|
-
...CtagsFlags,
|
|
19
|
+
...opts.GlobalFlags,
|
|
20
|
+
...opts.CtagsFlags,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
public async run(): Promise<void> {
|
package/src/commands/check.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import { createLogger } from '../compiler/util';
|
|
3
|
-
import {
|
|
3
|
+
import { dumpArtifacts } from '../shared/dump';
|
|
4
4
|
import { GlobalFlags } from '../shared/basecmd';
|
|
5
5
|
import { spawnEmbed, waitFor } from '../shared/proc';
|
|
6
6
|
import { TengoTesterBinaryPath } from '@milaboratories/tengo-tester';
|
|
@@ -33,7 +33,7 @@ export default class Check extends Command {
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
|
-
|
|
36
|
+
dumpArtifacts(logger, tester.stdin);
|
|
37
37
|
} catch (err: unknown) {
|
|
38
38
|
logger.error(err);
|
|
39
39
|
} finally {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { createLogger } from '../../compiler/util';
|
|
3
|
+
import { dumpArtifacts } from '../../shared/dump';
|
|
4
|
+
import { stdout } from 'node:process';
|
|
5
|
+
import type { ArtifactType } from '../../compiler/package';
|
|
6
|
+
import * as opts from '../../shared/basecmd';
|
|
7
|
+
|
|
8
|
+
export default class DumpArtifacts extends Command {
|
|
9
|
+
static override description = 'parse sources in current package and dump all found artifacts to stdout';
|
|
10
|
+
|
|
11
|
+
static override examples = [
|
|
12
|
+
'<%= config.bin %> <%= command.id %>',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
static override flags = {
|
|
16
|
+
...opts.GlobalFlags,
|
|
17
|
+
...opts.ArtifactTypeFlag,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
public async run(): Promise<void> {
|
|
21
|
+
const { flags } = await this.parse(DumpArtifacts);
|
|
22
|
+
const logger = createLogger(flags['log-level']);
|
|
23
|
+
dumpArtifacts(
|
|
24
|
+
logger, stdout,
|
|
25
|
+
flags.type == 'all' ? undefined : flags.type as ArtifactType,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|