@microtronics/studio-cli 0.31.1 → 0.32.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/CHANGELOG.md CHANGED
@@ -1,10 +1,25 @@
1
1
 
2
2
 
3
- ## 0.31.1 (2025-05-12)
3
+ ## 0.32.1 (2025-06-02)
4
4
 
5
5
 
6
6
  ### Bug Fixes
7
7
 
8
+ * **studio-cli:** enable prerelease handling in semver range checks ([77f6720](https://bitbucket.org/microtronics-core/vscode-studio/commits/77f6720f643c0ad491fca1d0ac0ae37bae1fbbd4))
9
+ * **studio-cli:** improve validation for project properties ([1cc8749](https://bitbucket.org/microtronics-core/vscode-studio/commits/1cc8749d2fa8bcea39605477fdc53480791f6c35))
10
+
11
+ ## 0.32.0 (2025-05-23)
12
+
13
+
14
+ ### Features
15
+
16
+ * **studio-cli:** support dde write `flags` support based on dlo-core version ([039ba9b](https://bitbucket.org/microtronics-core/vscode-studio/commits/039ba9b85841bbe7fb6c5606f83438cc080e7016))
17
+
18
+ ## 0.31.1 (2025-05-12)
19
+
20
+
21
+ ### Bug Fixes
22
+
8
23
  * **studio-cli:** correct APM part check for 'blo' files ([a4fdcde](https://bitbucket.org/microtronics-core/vscode-studio/commits/a4fdcde0b3a1a28e073af54934292e9b1734ad66))
9
24
 
10
25
  ## 0.31.0 (2025-05-05)
package/out/dde/dde.js CHANGED
@@ -315,11 +315,11 @@ var DDE;
315
315
  const dependencies = await getDependencies(cwd, fs, manifest);
316
316
  const globalDefines = await globals_1.Globals.read(cwd, fs);
317
317
  const autoInc = (0, dlo_1.generateAutoIncFromMap)(ddeJSON, globalDefines, manifest);
318
- const appAutoDDE = new dlo_1.AutoDDEGenerator(ddeJSON, null);
318
+ const appAutoDDE = new dlo_1.AutoDDEGenerator(manifest, ddeJSON, null);
319
319
  const appDDEInc = appAutoDDE.generate();
320
320
  // generate AutoDDe Files for the libraries:
321
321
  for (const dependency of dependencies) {
322
- const libAutoDDE = new dlo_1.AutoDDEGenerator(ddeJSON, dependency.libraryName);
322
+ const libAutoDDE = new dlo_1.AutoDDEGenerator(manifest, ddeJSON, dependency.libraryName);
323
323
  const { globals, helper } = libAutoDDE.generate();
324
324
  const libraryInc = [...globals, ...helper].join('\r\n');
325
325
  const autoIncName = defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.autoDdeInc.replace('X', dependency.libraryName);
@@ -61,7 +61,7 @@ function getPawnTypeDefinition(field) {
61
61
  return tdef.pwn;
62
62
  }
63
63
  const MICROTRONICS_DLO_CORE = 'Microtronics/dlo-core';
64
- function getRequiredDloCoreVersion(manifest) {
64
+ function getIncludedDloCoreVersion(manifest) {
65
65
  if (manifest_1.Manifest.isLibrary(manifest) && manifest.name === 'dlo-core') {
66
66
  return manifest.version;
67
67
  }
@@ -74,7 +74,7 @@ function getRequiredDloCoreVersion(manifest) {
74
74
  return null;
75
75
  }
76
76
  function getApmVersion(manifest) {
77
- const requiredVersion = getRequiredDloCoreVersion(manifest);
77
+ const requiredVersion = getIncludedDloCoreVersion(manifest);
78
78
  if (requiredVersion === null || semver.gte(requiredVersion, '0.3.0')) {
79
79
  return semver.valid(manifest.version) ? manifest.version : semver.coerce(`${manifest.version}`);
80
80
  }
@@ -82,6 +82,20 @@ function getApmVersion(manifest) {
82
82
  return semver.coerce(manifest.version)?.major;
83
83
  }
84
84
  }
85
+ /**
86
+ * Determines if the dlo-core library version described in the provided manifest supports live data functionality.
87
+ *
88
+ * @param {Manifest.Manifest} manifest - The manifest object containing details about the DLO core.
89
+ * @return {boolean} Returns true if the dlo-core version supports live data, otherwise false.
90
+ */
91
+ function dloCoreSupportsFlags(manifest) {
92
+ const requiredVersion = getIncludedDloCoreVersion(manifest);
93
+ if (requiredVersion === null) {
94
+ return false;
95
+ }
96
+ const releaseVersion = semver.coerce(requiredVersion);
97
+ return semver.gte(releaseVersion, '1.1.0');
98
+ }
85
99
  // eslint-disable-next-line sonarjs/cognitive-complexity
86
100
  function generateAutoIncFromMap(ddeMap, globalDefines, manifest) {
87
101
  const _pwn = []; // sample code output for pawn
@@ -243,6 +257,7 @@ function generateAutoIncFromMap(ddeMap, globalDefines, manifest) {
243
257
  return _pwn.join('\n');
244
258
  }
245
259
  class AutoDDEGenerator {
260
+ manifest;
246
261
  ddeMap;
247
262
  context;
248
263
  globalVariables = [];
@@ -255,7 +270,8 @@ class AutoDDEGenerator {
255
270
  knownDefines = [];
256
271
  pawnIndent = 0;
257
272
  sourceType;
258
- constructor(ddeMap, context) {
273
+ constructor(manifest, ddeMap, context) {
274
+ this.manifest = manifest;
259
275
  this.ddeMap = ddeMap;
260
276
  this.context = context;
261
277
  this.sourceType = 'pawnSource';
@@ -566,7 +582,10 @@ class AutoDDEGenerator {
566
582
  const isTimeseriesContainer = containerDefinition.containerType === ContainerType.hx;
567
583
  const isAlohaContainer = containerDefinition.containerType === ContainerType.aloha;
568
584
  const funcWrite = `_${pre}_write`;
569
- this.pawn('>', `stock ${funcWrite}(${isTimeseriesContainer ? 'const stamp=0' : ''}) {`);
585
+ const timeseriesFlags = dloCoreSupportsFlags(this.manifest) ? ', flags' : '';
586
+ const timeseriesOrAlohaArguments = isTimeseriesContainer ? `stamp${timeseriesFlags}` : '';
587
+ const funcWriteFlags = dloCoreSupportsFlags(this.manifest) ? 'const stamp=0, const flags=0' : 'const stamp=0';
588
+ this.pawn('>', `stock ${funcWrite}(${isTimeseriesContainer ? funcWriteFlags : ''}) {`);
570
589
  // only aloha and time series write directly to the container
571
590
  if (isTimeseriesOrAloha) {
572
591
  this.pawn(`dde_wbegin(DDE_${isAlohaContainer ? ContainerType.aloha : containerDefinition.title}_id);`); // " dde_wbegin( DDE_status_id);"
@@ -574,7 +593,7 @@ class AutoDDEGenerator {
574
593
  this.generateRWFunctionBody(pre, containerDefinition, 'dde_w');
575
594
  // only aloha and time series write directly to the container
576
595
  if (isTimeseriesOrAloha) {
577
- this.pawn(`return dde_wend(${isTimeseriesContainer ? 'stamp' : ''});`); // " dde_wend();"
596
+ this.pawn(`return dde_wend(${timeseriesOrAlohaArguments});`); // " dde_wend();"
578
597
  }
579
598
  this.pawn('<', '}');
580
599
  this.pawn('');
@@ -585,7 +604,7 @@ class AutoDDEGenerator {
585
604
  const funcArgs = this.functionArgumentsForDdeWrite(isTimeseriesContainer, isTimeseriesOrAloha);
586
605
  this.pawn('>', `${this.context ? 'stock ' : ''}${funcFlush}(${funcArgs}) {`);
587
606
  if (isTimeseriesOrAloha) {
588
- this.pawn(`${funcWrite}(${isAlohaContainer ? '' : 'stamp'});`);
607
+ this.pawn(`${funcWrite}(${timeseriesOrAlohaArguments});`);
589
608
  }
590
609
  else {
591
610
  const containerNumber = containerDefinition.name.slice(-1);
@@ -608,7 +627,12 @@ class AutoDDEGenerator {
608
627
  * @private
609
628
  */
610
629
  functionArgumentsForDdeWrite(isTimeseriesContainer, isTimeseriesOrAloha) {
611
- return isTimeseriesContainer ? 'const stamp=0' : isTimeseriesOrAloha ? '' : 'bool:immediate=false';
630
+ const timeseriesFlags = dloCoreSupportsFlags(this.manifest) ? ', const flags=0' : '';
631
+ return isTimeseriesContainer
632
+ ? `const stamp=0${timeseriesFlags}`
633
+ : isTimeseriesOrAloha
634
+ ? ''
635
+ : 'bool:immediate=false';
612
636
  }
613
637
  generateReadMethod(pre, containerDefinition) {
614
638
  this.sourceType = 'readWrite';
@@ -92,7 +92,7 @@ var Dependencies;
92
92
  * @private
93
93
  */
94
94
  function satisfiesSemverRange(libName, v1, range) {
95
- const satisfies = semver.satisfies(v1, range);
95
+ const satisfies = semver.satisfies(v1, range, { includePrerelease: true });
96
96
  if (!satisfies) {
97
97
  throw new Error(`${libName}, version ${v1} does not satisfy required constraint ${range}`);
98
98
  }
package/out/manifest.js CHANGED
@@ -218,11 +218,14 @@ var Manifest;
218
218
  const errorMessage = `Publisher can only contain 'A' through 'Z', 'a' through 'z', '0' through '9' and '-'. The Publisher start with an alphabetic or numeric character.`;
219
219
  const valid = publisher.match(/^[a-zA-Z0-9-]+$/);
220
220
  if (valid) {
221
- const invalidChars = ['-'];
221
+ const invalidChars = ['_'];
222
222
  if (invalidChars.includes(publisher[0]) || invalidChars.includes(publisher[publisher.length - 1])) {
223
223
  return errorMessage;
224
224
  }
225
225
  }
226
+ else {
227
+ return errorMessage;
228
+ }
226
229
  return null;
227
230
  }
228
231
  Manifest.validatePublisherId = validatePublisherId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.31.1",
3
+ "version": "0.32.1",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",
@@ -40,7 +40,7 @@
40
40
  "minimatch": "^10.0.1",
41
41
  "openapi-fetch": "^0.13.0",
42
42
  "pako": "^2.1.0",
43
- "semver": "^7.6.3",
43
+ "semver": "^7.7.2",
44
44
  "@gera2ld/tarjs": "^0.3.1",
45
45
  "tinytar-fix": "^0.1.1",
46
46
  "update-notifier": "^7.3.1",