@microtronics/studio-cli 0.35.0 → 0.36.0

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,16 @@
1
1
  # Changelog
2
2
 
3
- ## 0.35.0 (2025-09-12)
3
+ ## 0.36.0 (2025-09-25)
4
4
 
5
5
  ### Bug Fixes
6
6
 
7
- * **cli:** expected test fixtures ([0edb940](https://bitbucket.org/microtronics-core/vscode-studio/commits/0edb940c79aacb0cc631786f141e3cb28ff5cb78))
7
+ * **cli:** enhance DDE function mangling logic for libraries ([4d2272d](https://bitbucket.org/microtronics-core/vscode-studio/commits/4d2272d627530dbbfb342899549c7c76a99c6c56))
8
+
9
+ ## 0.35.0 (2025-09-12)
10
+
11
+ ### Bug Fixes
12
+
13
+ * **cli:** expected test fixtures ([0edb940](https://bitbucket.org/microtronics-core/vscode-studio/commits/0edb940c79aacb0cc631786f141e3cb28ff5cb78))
8
14
  * **cli:** replaced shallow clones with structured clones for API method objects ([f8b3a88](https://bitbucket.org/microtronics-core/vscode-studio/commits/f8b3a88b5a81ad3aa5d422a7f36ea1055068b921))
9
15
 
10
16
  ## 0.34.0 (2025-09-12)
@@ -203,7 +203,7 @@ declare interface components {
203
203
  allowedApplications?: ("*" | string[]) | null;
204
204
  };
205
205
  /** @enum {string} */
206
- ApplicationType: "app" | "addon";
206
+ ApplicationType: "app" | "addon" | "analytics";
207
207
  ApplicationInformationBase: {
208
208
  version: components["parameters"]["ApplicationVersion"];
209
209
  publisherId: components["parameters"]["PublisherId"];
@@ -1844,7 +1844,7 @@ declare class DloPreCompiler {
1844
1844
  private dloFileSequencer;
1845
1845
  constructor();
1846
1846
  get pragmaDynamicFlag(): string | null;
1847
- preCompileDloFile(cwd: URI, manifest: Manifest.Manifest, fileUri: URI, fileBlob: string[]): {
1847
+ preCompileDloFile(cwd: URI, logger: Log.Logger, manifest: Manifest.Manifest, fileUri: URI, fileBlob: string[]): {
1848
1848
  diagnostics: Diagnostics.File[];
1849
1849
  data: string;
1850
1850
  };
@@ -41,7 +41,7 @@ const MODE_FILE = S_IFREG | DEFAULT_FILE_MODE;
41
41
  const preCompiler = new preCompiler_1.DloPreCompiler();
42
42
  const modifiedFileCache = {};
43
43
  exports.precompilerDiagnostics = [];
44
- const CUSTOM_WASM_FS = (FS, cwd, manifest) => {
44
+ const CUSTOM_WASM_FS = (FS, cwd, manifest, logger) => {
45
45
  // clear all cached artifacts during FS setup ( this is needed when loaded in vscode context )
46
46
  exports.precompilerDiagnostics.length = 0;
47
47
  Object.keys(modifiedFileCache).forEach(key => delete modifiedFileCache[key]);
@@ -52,7 +52,7 @@ const CUSTOM_WASM_FS = (FS, cwd, manifest) => {
52
52
  if (!nodeFs.existsSync(fsPath)) {
53
53
  throw new FS.ErrnoError(44 /* ENOENT */);
54
54
  }
55
- const modifiedFileContent = getUpdateModifiedFileCache(cwd, manifest, path);
55
+ const modifiedFileContent = getUpdateModifiedFileCache(cwd, logger, manifest, path);
56
56
  const stat = nodeFs.statSync(fsPath);
57
57
  const size = modifiedFileContent?.length || stat.size;
58
58
  return {
@@ -131,7 +131,7 @@ const CUSTOM_WASM_FS = (FS, cwd, manifest) => {
131
131
  const streamOps = {
132
132
  open(stream) {
133
133
  const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(stream.node.mount.opts.root), FS.getPath(stream.node));
134
- stream.modifiedContent = getUpdateModifiedFileCache(cwd, manifest, path);
134
+ stream.modifiedContent = getUpdateModifiedFileCache(cwd, logger, manifest, path);
135
135
  if (!stream.modifiedContent) {
136
136
  stream.nfd = nodeFs.openSync(path.fsPath, flagsToMode(stream.flags));
137
137
  }
@@ -232,18 +232,18 @@ function copyToBuffer(source, target, targetOffset, sourceStart, sourceEnd) {
232
232
  }
233
233
  }
234
234
  }
235
- function getUpdateModifiedFileCache(cwd, manifest, filePath) {
235
+ function getUpdateModifiedFileCache(cwd, logger, manifest, filePath) {
236
236
  const fsPath = filePath.fsPath;
237
237
  if (!modifiedFileCache[fsPath] && (fsPath.endsWith('.dlo') || fsPath.endsWith('.inc'))) {
238
- modifiedFileCache[fsPath] = precompileRequestedDloFile(cwd, manifest, filePath);
238
+ modifiedFileCache[fsPath] = precompileRequestedDloFile(cwd, logger, manifest, filePath);
239
239
  }
240
240
  return modifiedFileCache[fsPath];
241
241
  }
242
- function precompileRequestedDloFile(cwd, manifest, filePath) {
242
+ function precompileRequestedDloFile(cwd, logger, manifest, filePath) {
243
243
  // Simple example: convert buffer content to a string, modify and convert back
244
244
  const originalContent = nodeFs.readFileSync(filePath.fsPath);
245
245
  const fileBlob = convertBlobToStringArray(originalContent);
246
- const preCompiled = preCompiler.preCompileDloFile(cwd, manifest, filePath, fileBlob);
246
+ const preCompiled = preCompiler.preCompileDloFile(cwd, logger, manifest, filePath, fileBlob);
247
247
  exports.precompilerDiagnostics.push(...preCompiled.diagnostics);
248
248
  return iconv.encode(preCompiled.data, 'cp1252');
249
249
  }
@@ -51,7 +51,7 @@ class DloCompiler {
51
51
  const FS = this.dloCC.FS;
52
52
  const manifest = await manifest_1.Manifest.read(this.cwd, this.fs);
53
53
  // Register our new FS type under a name
54
- FS.filesystems.NODEFS_TS = (0, CustomWasmFS_1.CUSTOM_WASM_FS)(FS, this.cwd, manifest);
54
+ FS.filesystems.NODEFS_TS = (0, CustomWasmFS_1.CUSTOM_WASM_FS)(FS, this.cwd, manifest, this.logger);
55
55
  FS.mkdir(rootDir);
56
56
  FS.mount(FS.filesystems.NODEFS_TS, { root: '/' }, rootDir);
57
57
  // Set the current working directory to the root directory
@@ -87,23 +87,22 @@ class DloPreCompiler {
87
87
  }
88
88
  }
89
89
  // eslint-disable-next-line sonarjs/cognitive-complexity
90
- preCompileDloFile(cwd, manifest, fileUri, fileBlob) {
90
+ preCompileDloFile(cwd, logger, manifest, fileUri, fileBlob) {
91
91
  this.dloFileSequencer.workspacePath = cwd;
92
92
  const fileDiagnostics = [];
93
93
  const filePath = fileUri.path;
94
94
  let mangleDDEFunctions = false;
95
95
  const baseName = vscode_uri_1.Utils.basename(fileUri);
96
96
  // look for autogenerated xxx-dde.inc files
97
- if (filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.path) && baseName.endsWith('-dde.inc')) {
97
+ if (filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.path)) {
98
98
  const ddeIncSource = baseName.substring(0, baseName.length - 8);
99
- if (!['app', 'main'].includes(ddeIncSource)) {
99
+ if (!['app', 'main'].includes(ddeIncSource) && baseName.endsWith('-dde.inc')) {
100
100
  // this is a library specific file!
101
101
  mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(ddeIncSource);
102
102
  // console.log('MANGLED LIB DDE', baseName, ddeIncSource, mangleDDEFunctions);
103
103
  }
104
104
  }
105
- // look for library source files:
106
- if (filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.libdeps)) {
105
+ else if (filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.libdeps)) {
107
106
  const libPath = filePath.split('libdeps/')[1];
108
107
  const [libName] = libPath.split('/');
109
108
  if (!['dlo-core'].includes(libName)) {
@@ -111,9 +110,16 @@ class DloPreCompiler {
111
110
  // console.log('MANGLED LIB', baseName, mangleDDEFunctions);
112
111
  }
113
112
  }
114
- else if (manifest_1.Manifest.isLibrary(manifest) && baseName === `${manifest.name}.inc`) {
115
- mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(manifest.name);
116
- // console.log('MANGLED PROJECT LIB', baseName, mangleDDEFunctions);
113
+ else if (manifest_1.Manifest.isLibrary(manifest)) {
114
+ // mangle dde functions within the project files if the current project is a library project
115
+ // exclude main.dlo and /example and /test folder
116
+ if (baseName.endsWith('.dlo') || filePath.includes('/dlo/examples/') || filePath.includes('/dlo/test/')) {
117
+ logger.log('Skipping dde mangling for project file', baseName);
118
+ }
119
+ else {
120
+ mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(manifest.name);
121
+ // console.log('MANGLED PROJECT LIB', baseName, mangleDDEFunctions);
122
+ }
117
123
  }
118
124
  if (filePath.endsWith('.auto/default.inc')) {
119
125
  return {
package/out/main.js CHANGED
@@ -22,11 +22,14 @@ const devPath = () => {
22
22
  return './dev/app';
23
23
  }
24
24
  else if (process.env.NODE_ENV === 'local-dev-lib') {
25
- return './dev/lib';
25
+ return './dev/modbus-master';
26
26
  }
27
27
  else if (process.env.NODE_ENV === 'local-dev-addon') {
28
28
  return './dev/addon';
29
29
  }
30
+ else if (process.env.NODE_ENV === 'local-dev-analytics') {
31
+ return './dev/analytics';
32
+ }
30
33
  return '';
31
34
  };
32
35
  const cwd = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.file(process.cwd()), devPath());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",
package/studio-cli-addon DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- // used for local development only
3
- process.env.NODE_ENV = 'local-dev-addon';
4
- require('./out/main')(process.argv);