@platforma-sdk/tengo-builder 1.17.4 → 1.17.6

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 (52) hide show
  1. package/dist/commands/build.d.ts +4 -4
  2. package/dist/commands/build.d.ts.map +1 -1
  3. package/dist/commands/check.d.ts +1 -1
  4. package/dist/commands/dump/all.d.ts.map +1 -1
  5. package/dist/commands/dump/assets.d.ts.map +1 -1
  6. package/dist/commands/dump/libs.d.ts.map +1 -1
  7. package/dist/commands/dump/software.d.ts.map +1 -1
  8. package/dist/commands/dump/templates.d.ts.map +1 -1
  9. package/dist/commands/dump/tests.d.ts.map +1 -1
  10. package/dist/commands/test.d.ts +1 -1
  11. package/dist/compiler/artifactset.d.ts.map +1 -1
  12. package/dist/compiler/compiler.d.ts.map +1 -1
  13. package/dist/compiler/compileroptions.d.ts +1 -1
  14. package/dist/compiler/compileroptions.d.ts.map +1 -1
  15. package/dist/compiler/main.d.ts.map +1 -1
  16. package/dist/compiler/source.d.ts.map +1 -1
  17. package/dist/compiler/template.d.ts +1 -47
  18. package/dist/compiler/template.d.ts.map +1 -1
  19. package/dist/compiler/test.artifacts.d.ts.map +1 -1
  20. package/dist/compiler/util.d.ts.map +1 -1
  21. package/dist/index.js +11 -11
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +153 -150
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/shared/basecmd.d.ts +4 -4
  26. package/dist/shared/basecmd.d.ts.map +1 -1
  27. package/dist/shared/dump.d.ts.map +1 -1
  28. package/dist/shared/proc.d.ts +2 -2
  29. package/dist/shared/proc.d.ts.map +1 -1
  30. package/package.json +5 -3
  31. package/src/commands/build.ts +12 -11
  32. package/src/commands/check.ts +2 -2
  33. package/src/commands/dump/all.ts +8 -8
  34. package/src/commands/dump/assets.ts +8 -8
  35. package/src/commands/dump/libs.ts +11 -12
  36. package/src/commands/dump/software.ts +8 -8
  37. package/src/commands/dump/templates.ts +8 -9
  38. package/src/commands/dump/tests.ts +8 -8
  39. package/src/commands/test.ts +1 -1
  40. package/src/compiler/artifactset.ts +14 -13
  41. package/src/compiler/compiler.ts +63 -56
  42. package/src/compiler/compileroptions.ts +12 -12
  43. package/src/compiler/main.ts +29 -27
  44. package/src/compiler/package.ts +1 -1
  45. package/src/compiler/source.ts +53 -51
  46. package/src/compiler/template.ts +23 -75
  47. package/src/compiler/test.artifacts.ts +24 -24
  48. package/src/compiler/util.ts +7 -5
  49. package/src/index.ts +1 -1
  50. package/src/shared/basecmd.ts +16 -16
  51. package/src/shared/dump.ts +22 -21
  52. package/src/shared/proc.ts +6 -4
@@ -1,4 +1,4 @@
1
- import { FullArtifactName } from './package';
1
+ import type { FullArtifactName } from './package';
2
2
 
3
3
  export interface TestArtifactSource {
4
4
  fullName: FullArtifactName;
@@ -35,7 +35,7 @@ export const testLocalLib1Name: FullArtifactName = {
35
35
  type: 'library',
36
36
  pkg: 'current-package',
37
37
  id: 'local-library-1',
38
- version: '1.2.3'
38
+ version: '1.2.3',
39
39
  };
40
40
  export const testLocalLib1Src = `
41
41
  otherLib := import("package1:other-lib-2" )
@@ -72,7 +72,7 @@ export const testLocalLib2Name: FullArtifactName = {
72
72
  type: 'library',
73
73
  pkg: 'current-package',
74
74
  id: 'local-library-2',
75
- version: '2.3.4'
75
+ version: '2.3.4',
76
76
  };
77
77
  export const testLocalLib2Src = `
78
78
  otherLib := import("package1:someid")
@@ -97,7 +97,7 @@ export const testLocalLib3Name: FullArtifactName = {
97
97
  type: 'library',
98
98
  pkg: 'current-package',
99
99
  id: 'local-library-3',
100
- version: '6.6.6'
100
+ version: '6.6.6',
101
101
  };
102
102
  export const testLocalLib3Src = `
103
103
  export {
@@ -109,7 +109,7 @@ export const testLocalTpl1Name: FullArtifactName = {
109
109
  type: 'template',
110
110
  pkg: 'current-package',
111
111
  id: 'local-template-1',
112
- version: '1.2.3'
112
+ version: '1.2.3',
113
113
  };
114
114
  export const testLocalTpl1Src = `
115
115
  lib1 := import( ":local-library-1")
@@ -123,7 +123,7 @@ export const testLocalTpl2Name: FullArtifactName = {
123
123
  type: 'template',
124
124
  pkg: 'current-package',
125
125
  id: 'local-template-2',
126
- version: '1.2.3'
126
+ version: '1.2.3',
127
127
  };
128
128
  export const testLocalTpl2Src = `
129
129
  lib := import("package1:other-lib-1")
@@ -136,7 +136,7 @@ export const testLocalTpl3Name: FullArtifactName = {
136
136
  type: 'template',
137
137
  pkg: 'current-package',
138
138
  id: 'local-template-3',
139
- version: '1.2.3'
139
+ version: '1.2.3',
140
140
  };
141
141
 
142
142
  export const testLocalTpl3Src = `
@@ -155,27 +155,27 @@ lib := import(":local-library-3")
155
155
 
156
156
  export const testLocalLib1: TestArtifactSource = {
157
157
  fullName: testLocalLib1Name,
158
- src: testLocalLib1Src
158
+ src: testLocalLib1Src,
159
159
  };
160
160
 
161
161
  export const testLocalLib3: TestArtifactSource = {
162
162
  fullName: testLocalLib3Name,
163
- src: testLocalLib3Src
163
+ src: testLocalLib3Src,
164
164
  };
165
165
 
166
166
  export const testLocalTpl1: TestArtifactSource = {
167
167
  fullName: testLocalTpl1Name,
168
- src: testLocalTpl1Src
168
+ src: testLocalTpl1Src,
169
169
  };
170
170
 
171
171
  export const testLocalTpl2: TestArtifactSource = {
172
172
  fullName: testLocalTpl2Name,
173
- src: testLocalTpl2Src
173
+ src: testLocalTpl2Src,
174
174
  };
175
175
 
176
176
  export const testLocalTpl3: TestArtifactSource = {
177
177
  fullName: testLocalTpl3Name,
178
- src: testLocalTpl3Src
178
+ src: testLocalTpl3Src,
179
179
  };
180
180
 
181
181
  export const testLocalPackage = [testLocalTpl1, testLocalLib1, testLocalTpl2];
@@ -184,7 +184,7 @@ export const testPackage1Lib1Name: FullArtifactName = {
184
184
  type: 'library',
185
185
  pkg: 'package1',
186
186
  id: 'other-lib-1',
187
- version: '1.2.3'
187
+ version: '1.2.3',
188
188
  };
189
189
  export const testPackage1Lib1Src = `
190
190
  export {
@@ -196,7 +196,7 @@ export const testPackage1Soft1Name: FullArtifactName = {
196
196
  type: 'software',
197
197
  pkg: 'current-package',
198
198
  id: 'software-1',
199
- version: '1.2.3'
199
+ version: '1.2.3',
200
200
  };
201
201
  export const testPackage1Soft1Src = `
202
202
  some software contents. Template builder should pass it 'as-is'
@@ -206,7 +206,7 @@ export const testPackage1Lib2Name: FullArtifactName = {
206
206
  type: 'library',
207
207
  pkg: 'package1',
208
208
  id: 'other-lib-2',
209
- version: '1.2.3'
209
+ version: '1.2.3',
210
210
  };
211
211
  export const testPackage1Lib2Src = `
212
212
  lib := import("package1:other-lib-1")
@@ -220,34 +220,34 @@ export const testPackage1Tpl3Name: FullArtifactName = {
220
220
  type: 'template',
221
221
  pkg: 'package1',
222
222
  id: 'template-3',
223
- version: '1.2.3'
223
+ version: '1.2.3',
224
224
  };
225
225
  export const testPackage1Tpl3Src = `
226
226
  lib := import("package1:other-lib-1")
227
227
  `;
228
228
 
229
- export const testPackage1Tpl3CompiledBase64 =
230
- 'H4sIAAAAAAAAE22PQQqDMBREr/KZVQsxELsL9CZ/E+VjQ2MiJpUWyd2LglCo2xlm3syK4LsMu2Jy/dMNYmwqD5mb4LvGbHp0o8Ce2wp57mHBUd5TmgutHImIGDmNwrDEWFx4iWFwrByhsMicfYqwMLrVN9Sq/hhFxim4Is3tBxF8R3fy4wa68OkgxnVnHPntWFUon2mvD7pIHFJz2HppzwZ9AanB7OAUAQAA';
229
+ export const testPackage1Tpl3CompiledBase64
230
+ = 'H4sIAAAAAAAAE22PQQqDMBREr/KZVQsxELsL9CZ/E+VjQ2MiJpUWyd2LglCo2xlm3syK4LsMu2Jy/dMNYmwqD5mb4LvGbHp0o8Ce2wp57mHBUd5TmgutHImIGDmNwrDEWFx4iWFwrByhsMicfYqwMLrVN9Sq/hhFxim4Is3tBxF8R3fy4wa68OkgxnVnHPntWFUon2mvD7pIHFJz2HppzwZ9AanB7OAUAQAA';
231
231
 
232
232
  export const testPackage1Lib1: TestArtifactSource = {
233
233
  fullName: testPackage1Lib1Name,
234
- src: testPackage1Lib1Src
234
+ src: testPackage1Lib1Src,
235
235
  };
236
236
 
237
237
  export const testPackage1Lib2: TestArtifactSource = {
238
238
  fullName: testPackage1Lib2Name,
239
- src: testPackage1Lib2Src
239
+ src: testPackage1Lib2Src,
240
240
  };
241
241
 
242
242
  export const testPackage1Tpl3: TestArtifactSource = {
243
243
  fullName: testPackage1Tpl3Name,
244
- src: testPackage1Tpl3Src
244
+ src: testPackage1Tpl3Src,
245
245
  };
246
246
 
247
247
  export const testPackage1: TestArtifactSource[] = [
248
248
  testPackage1Lib1,
249
249
  testPackage1Lib2,
250
- testPackage1Tpl3
250
+ testPackage1Tpl3,
251
251
  ];
252
252
 
253
253
  export const testPackage2: TestArtifactSource[] = [testLocalLib3, testLocalTpl3];
@@ -256,6 +256,6 @@ export const testPackage2BrokenHash: TestArtifactSource[] = [
256
256
  testLocalLib3,
257
257
  {
258
258
  fullName: testLocalTpl3Name,
259
- src: testLocalTpl3SrcWrongOverride
260
- }
259
+ src: testLocalTpl3SrcWrongOverride,
260
+ },
261
261
  ];
@@ -3,6 +3,7 @@ import * as path from 'node:path';
3
3
  import * as winston from 'winston';
4
4
 
5
5
  export function assertNever(x: never): never {
6
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
6
7
  throw new Error('Unexpected object: ' + x);
7
8
  }
8
9
 
@@ -10,14 +11,14 @@ export function createLogger(level: string = 'debug'): winston.Logger {
10
11
  return winston.createLogger({
11
12
  level: level,
12
13
  format: winston.format.printf(({ level, message }) => {
13
- return `${level.padStart(6, ' ')}: ${message}`;
14
+ return `${level.padStart(6, ' ')}: ${message as string}`;
14
15
  }),
15
16
  transports: [
16
17
  new winston.transports.Console({
17
18
  stderrLevels: ['error', 'warn', 'info', 'debug'],
18
- handleExceptions: true
19
- })
20
- ]
19
+ handleExceptions: true,
20
+ }),
21
+ ],
21
22
  });
22
23
  }
23
24
 
@@ -47,7 +48,8 @@ export function pathType(path: string): PathType {
47
48
  if (s.isFile()) return 'file';
48
49
  if (s.isSymbolicLink()) return 'link';
49
50
  return 'unknown';
50
- } catch (err: any) {
51
+ } catch (error: unknown) {
52
+ const err = error as NodeJS.ErrnoException;
51
53
  if (err.code == 'ENOENT') return 'absent';
52
54
  else throw err;
53
55
  }
package/src/index.ts CHANGED
@@ -20,5 +20,5 @@ export const COMMANDS = {
20
20
  'dump:libs': Cmd5,
21
21
  'dump:software': Cmd6,
22
22
  'dump:templates': Cmd7,
23
- 'dump:tests': Cmd8
23
+ 'dump:tests': Cmd8,
24
24
  };
@@ -1,28 +1,28 @@
1
- import { Flags } from '@oclif/core'
1
+ import { Flags } from '@oclif/core';
2
2
 
3
3
  export const GlobalFlags = {
4
- "log-level": Flags.string({
5
- description: "logging level",
6
- default: "info",
7
- options: ["error", "warn", "info", "debug"],
8
- })
9
- }
4
+ 'log-level': Flags.string({
5
+ description: 'logging level',
6
+ default: 'info',
7
+ options: ['error', 'warn', 'info', 'debug'],
8
+ }),
9
+ };
10
10
 
11
11
  export const CtagsFlags = {
12
- "generate-tags": Flags.boolean({
13
- description: "generate tags, default false",
12
+ 'generate-tags': Flags.boolean({
13
+ description: 'generate tags, default false',
14
14
  default: false,
15
15
  }),
16
16
 
17
- "tags-file": Flags.file({
18
- description: "where to put \".tags\" file, it should be a root of VS Code project",
19
- default: "../../.tags" // usually a user opens a directory with all blocks
17
+ 'tags-file': Flags.file({
18
+ description: 'where to put ".tags" file, it should be a root of VS Code project',
19
+ default: '../../.tags', // usually a user opens a directory with all blocks
20
20
  }),
21
21
 
22
- "tags-additional-args": Flags.string({
23
- description: "additional flags for universal-ctags command: e.g. -e for emacs",
22
+ 'tags-additional-args': Flags.string({
23
+ description: 'additional flags for universal-ctags command: e.g. -e for emacs',
24
24
  default: [],
25
25
  multiple: true,
26
26
  delimiter: ',',
27
- })
28
- }
27
+ }),
28
+ };
@@ -1,10 +1,11 @@
1
- import winston from 'winston';
1
+ import type winston from 'winston';
2
2
  import { getPackageInfo, newCompiler, parseSources } from '../compiler/main';
3
- import { ArtifactType, typedArtifactNameToString } from '../compiler/package';
3
+ import type { ArtifactType } from '../compiler/package';
4
+ import { typedArtifactNameToString } from '../compiler/package';
4
5
 
5
6
  export function dumpAll(
6
7
  logger: winston.Logger,
7
- stream: NodeJS.WritableStream
8
+ stream: NodeJS.WritableStream,
8
9
  ): void {
9
10
  const packageInfo = getPackageInfo();
10
11
 
@@ -23,7 +24,7 @@ export function dumpAll(
23
24
 
24
25
  for (const lib of compiler.allLibs()) {
25
26
  logger.debug(
26
- `Dumping to pl-tester: ${typedArtifactNameToString(lib.fullName)}`
27
+ `Dumping to pl-tester: ${typedArtifactNameToString(lib.fullName)}`,
27
28
  );
28
29
  stream.write(JSON.stringify(lib) + '\n');
29
30
  }
@@ -31,7 +32,7 @@ export function dumpAll(
31
32
  for (const src of sources) {
32
33
  if (src.fullName.type === 'library') {
33
34
  logger.debug(
34
- `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`
35
+ `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`,
35
36
  );
36
37
  stream.write(JSON.stringify(src) + '\n');
37
38
  }
@@ -41,7 +42,7 @@ export function dumpAll(
41
42
 
42
43
  for (const tpl of compiler.allTemplates()) {
43
44
  logger.debug(
44
- `Dumping to pl-tester: ${typedArtifactNameToString(tpl.fullName)}`
45
+ `Dumping to pl-tester: ${typedArtifactNameToString(tpl.fullName)}`,
45
46
  );
46
47
  stream.write(JSON.stringify(tpl) + '\n');
47
48
  }
@@ -51,7 +52,7 @@ export function dumpAll(
51
52
  logger.debug(
52
53
  `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${
53
54
  src.srcName
54
- }`
55
+ }`,
55
56
  );
56
57
  stream.write(JSON.stringify(src) + '\n');
57
58
  }
@@ -61,7 +62,7 @@ export function dumpAll(
61
62
 
62
63
  for (const sw of compiler.allSoftware()) {
63
64
  logger.debug(
64
- `Dumping to pl-tester: ${typedArtifactNameToString(sw.fullName)}`
65
+ `Dumping to pl-tester: ${typedArtifactNameToString(sw.fullName)}`,
65
66
  );
66
67
  stream.write(JSON.stringify(sw) + '\n');
67
68
  }
@@ -69,7 +70,7 @@ export function dumpAll(
69
70
  for (const src of sources) {
70
71
  if (src.fullName.type === 'software') {
71
72
  logger.debug(
72
- `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`
73
+ `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`,
73
74
  );
74
75
  stream.write(JSON.stringify(src) + '\n');
75
76
  }
@@ -79,7 +80,7 @@ export function dumpAll(
79
80
 
80
81
  for (const asset of compiler.allAssets()) {
81
82
  logger.debug(
82
- `Dumping to pl-tester: ${typedArtifactNameToString(asset.fullName)}`
83
+ `Dumping to pl-tester: ${typedArtifactNameToString(asset.fullName)}`,
83
84
  );
84
85
  stream.write(JSON.stringify(asset) + '\n');
85
86
  }
@@ -87,7 +88,7 @@ export function dumpAll(
87
88
  for (const src of sources) {
88
89
  if (src.fullName.type === 'asset') {
89
90
  logger.debug(
90
- `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`
91
+ `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)}`,
91
92
  );
92
93
  stream.write(JSON.stringify(src) + '\n');
93
94
  }
@@ -100,7 +101,7 @@ export function dumpAll(
100
101
  logger.debug(
101
102
  `Dumping to pl-tester: ${typedArtifactNameToString(src.fullName)} ${
102
103
  src.srcName
103
- }`
104
+ }`,
104
105
  );
105
106
  stream.write(JSON.stringify(src) + '\n');
106
107
  }
@@ -110,7 +111,7 @@ export function dumpAll(
110
111
  export function dumpLibs(
111
112
  logger: winston.Logger,
112
113
  dumpDeps: boolean,
113
- stream: NodeJS.WritableStream
114
+ stream: NodeJS.WritableStream,
114
115
  ): void {
115
116
  const packageInfo = getPackageInfo();
116
117
 
@@ -156,28 +157,28 @@ function dumpArtifacts(
156
157
 
157
158
  export function dumpTemplates(
158
159
  logger: winston.Logger,
159
- stream: NodeJS.WritableStream
160
+ stream: NodeJS.WritableStream,
160
161
  ): void {
161
- dumpArtifacts(logger, stream, 'template')
162
+ dumpArtifacts(logger, stream, 'template');
162
163
  }
163
164
 
164
165
  export function dumpSoftware(
165
166
  logger: winston.Logger,
166
- stream: NodeJS.WritableStream
167
+ stream: NodeJS.WritableStream,
167
168
  ): void {
168
- dumpArtifacts(logger, stream, 'software')
169
+ dumpArtifacts(logger, stream, 'software');
169
170
  }
170
171
 
171
172
  export function dumpAssets(
172
173
  logger: winston.Logger,
173
- stream: NodeJS.WritableStream
174
+ stream: NodeJS.WritableStream,
174
175
  ): void {
175
- dumpArtifacts(logger, stream, 'asset')
176
+ dumpArtifacts(logger, stream, 'asset');
176
177
  }
177
178
 
178
179
  export function dumpTests(
179
180
  logger: winston.Logger,
180
- stream: NodeJS.WritableStream
181
+ stream: NodeJS.WritableStream,
181
182
  ): void {
182
- dumpArtifacts(logger, stream, 'test')
183
+ dumpArtifacts(logger, stream, 'test');
183
184
  }
@@ -1,5 +1,6 @@
1
- import { spawn, ChildProcess, ChildProcessByStdio } from 'child_process';
2
- import { Writable } from 'stream';
1
+ import type { ChildProcess, ChildProcessByStdio } from 'node:child_process';
2
+ import { spawn } from 'node:child_process';
3
+ import type { Writable } from 'node:stream';
3
4
 
4
5
  export function spawnEmbed(
5
6
  cmd: string,
@@ -7,8 +8,9 @@ export function spawnEmbed(
7
8
  ): ChildProcessByStdio<Writable, null, null> {
8
9
  const p = spawn(cmd, args, { stdio: ['pipe', 'inherit', 'inherit'] });
9
10
 
10
- p.stdin.on('error', (err: any) => {
11
- if (err.code === 'EPIPE') {
11
+ p.stdin.on('error', (err: Error) => {
12
+ const systemError = err as NodeJS.ErrnoException;
13
+ if (systemError.code === 'EPIPE') {
12
14
  // ignore EPIPE error as it stands for broken command run.
13
15
  // The command will write normal problem description by itself.
14
16
  }