@microtronics/studio-cli 0.49.0 → 0.50.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.
@@ -1843,7 +1843,12 @@ declare class DloCompiler {
1843
1843
  diagnostics: Diagnostics.File[];
1844
1844
  }>;
1845
1845
  /**
1846
- * Get a symbol compiler instance
1846
+ * Run the symbol compiler and return its output lines.
1847
+ * Handles WASM-specific path patching (`.` prefix for PROXYFS, `-R` flag).
1848
+ */
1849
+ getDloSymbols(mainFile: string, compileOptions: string[]): Promise<string[] | null>;
1850
+ /**
1851
+ * Get a symbol compiler instance with direct disk access via CUSTOM_WASM_FS.
1847
1852
  */
1848
1853
  getSymbolCompiler(): Promise<{
1849
1854
  compiler: any;
@@ -91,15 +91,36 @@ class DloCompiler {
91
91
  diagnostics: [...CustomWasmFS_1.precompilerDiagnostics, ...parseWarningsAndErrors(cwd, this.stderr, mainFile)]
92
92
  };
93
93
  }
94
+ /**
95
+ * Run the symbol compiler and return its output lines.
96
+ * Handles WASM-specific path patching (`.` prefix for PROXYFS, `-R` flag).
97
+ */
98
+ async getDloSymbols(mainFile, compileOptions) {
99
+ const symbolOptions = compileOptions.map(option => {
100
+ const command = option.substring(0, 2);
101
+ if (['-D', '-e', '-i', '-o', '-p', '-r', '-T'].includes(command)) {
102
+ return `${command}.${option.substring(2)}`;
103
+ }
104
+ return option;
105
+ });
106
+ const { compiler: symbolCompiler, print } = await this.getSymbolCompiler();
107
+ try {
108
+ const res = await symbolCompiler.callMain(['.' + mainFile, ...symbolOptions, '-R']);
109
+ if (res)
110
+ return null;
111
+ }
112
+ catch (e) {
113
+ if (e.stack?.startsWith('RuntimeError'))
114
+ return null;
115
+ throw e;
116
+ }
117
+ return [...print.stdout, ...print.stderr];
118
+ }
94
119
  //Symbol Compiler handling
95
120
  /**
96
- * Get a symbol compiler instance
121
+ * Get a symbol compiler instance with direct disk access via CUSTOM_WASM_FS.
97
122
  */
98
123
  async getSymbolCompiler() {
99
- // generate a none exiting wasm compiler runtime as main filesystem
100
- if (!this.dloCC) {
101
- await this.initDloCC(true);
102
- }
103
124
  const compilerLog = {
104
125
  stdout: [],
105
126
  stderr: []
@@ -113,13 +134,14 @@ class DloCompiler {
113
134
  compilerLog.stderr.push(err);
114
135
  }
115
136
  });
116
- // mount the main filesystem
117
- dloSymbol.FS.mkdir('/baseDir');
118
- dloSymbol.FS.mount(dloSymbol.PROXYFS, {
119
- root: '/',
120
- fs: this.dloCC.FS
121
- }, '/baseDir');
122
- dloSymbol.FS.chdir('baseDir');
137
+ // Mount CUSTOM_WASM_FS for direct disk access (same as initDloCC)
138
+ const currentCWD = (0, CustomWasmFS_1.uriToMemFsPath)(this.cwd);
139
+ const [rootDir] = currentCWD.split('/');
140
+ const FS = dloSymbol.FS;
141
+ const manifest = await manifest_1.Manifest.read(this.cwd, this.fs);
142
+ FS.filesystems.NODEFS_TS = (0, CustomWasmFS_1.CUSTOM_WASM_FS)(FS, this.cwd, manifest, this.logger);
143
+ FS.mkdir(rootDir);
144
+ FS.mount(FS.filesystems.NODEFS_TS, { root: '/' }, rootDir);
123
145
  return {
124
146
  compiler: dloSymbol,
125
147
  print: compilerLog
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microtronics/studio-cli",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Microtronics Studio CLI Tool",
5
5
  "main": "./out/api.js",
6
6
  "typings": "./dist/studio-cli.d.ts",