@microtronics/studio-cli 0.61.0 → 0.63.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 +15 -3
- package/README.md +17 -0
- package/dist/main.js +54 -57
- package/dist/studio-cli.d.ts +1 -0
- package/out/api.js +137 -149
- package/out/studio-cli.d.ts +5297 -0
- package/package.json +4 -4
- package/out/DeviceProfiles.js +0 -436
- package/out/FS.js +0 -43
- package/out/crc.js +0 -93
- package/out/dde/coreDefinitions.js +0 -541
- package/out/dde/dde.js +0 -618
- package/out/dde/dynamic-dde.schema.json +0 -1061
- package/out/dde/fileGenerators/api.js +0 -688
- package/out/dde/fileGenerators/dlo.js +0 -1014
- package/out/dde/fileGenerators/dloLocalData.js +0 -387
- package/out/dde/fileGenerators/xml.js +0 -180
- package/out/dde/yamlDdePreCompiler.js +0 -889
- package/out/defaultFiles.js +0 -114
- package/out/dependencies.js +0 -578
- package/out/dfiles/dfiles.js +0 -205
- package/out/diagnostics.js +0 -10
- package/out/dlo/CustomWasmFS.js +0 -258
- package/out/dlo/compiler.js +0 -231
- package/out/dlo/dlo.js +0 -33
- package/out/dlo/dlocc.js +0 -3799
- package/out/dlo/fileSequencer.js +0 -40
- package/out/dlo/preCompiler.js +0 -442
- package/out/dotenv.js +0 -28
- package/out/globals.js +0 -402
- package/out/helper.js +0 -145
- package/out/log.js +0 -60
- package/out/manifest.js +0 -492
- package/out/myDatanetClient.js +0 -291
- package/out/package/apm.js +0 -294
- package/out/package/library.js +0 -165
- package/out/package/package.js +0 -518
- package/out/registryAPI.js +0 -326
- package/out/scriptRunner.js +0 -107
- package/out/typings/registry.js +0 -7
package/out/dlo/compiler.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DloCompiler = void 0;
|
|
4
|
-
exports.parseWarningsAndErrors = parseWarningsAndErrors;
|
|
5
|
-
exports.generateConfigFile = generateConfigFile;
|
|
6
|
-
const vscode_uri_1 = require("vscode-uri");
|
|
7
|
-
const manifest_1 = require("../manifest");
|
|
8
|
-
const defaultFiles_1 = require("../defaultFiles");
|
|
9
|
-
const dependencies_1 = require("../dependencies");
|
|
10
|
-
const apm_1 = require("../package/apm");
|
|
11
|
-
const CustomWasmFS_1 = require("./CustomWasmFS");
|
|
12
|
-
const DLO_MODULE = require('./dlocc.js');
|
|
13
|
-
class DloCompiler {
|
|
14
|
-
cwd;
|
|
15
|
-
fs;
|
|
16
|
-
logger;
|
|
17
|
-
dloCC;
|
|
18
|
-
stdout = [];
|
|
19
|
-
stderr = [];
|
|
20
|
-
constructor(cwd, fs, logger) {
|
|
21
|
-
this.cwd = cwd;
|
|
22
|
-
this.fs = fs;
|
|
23
|
-
this.logger = logger;
|
|
24
|
-
this.dloCC = null;
|
|
25
|
-
}
|
|
26
|
-
async initDloCC(noExit = false) {
|
|
27
|
-
this.stdout.length = 0;
|
|
28
|
-
this.stderr.length = 0;
|
|
29
|
-
this.dloCC = await DLO_MODULE({
|
|
30
|
-
noExitRuntime: noExit,
|
|
31
|
-
print: (data) => {
|
|
32
|
-
const patched = parseCompilerMessage(this.cwd, data);
|
|
33
|
-
this.logger.log(patched ? patched.message : data);
|
|
34
|
-
this.stdout.push(data);
|
|
35
|
-
},
|
|
36
|
-
printErr: (err) => {
|
|
37
|
-
const patched = parseCompilerMessage(this.cwd, err);
|
|
38
|
-
// filter for warn messages
|
|
39
|
-
if (err.includes(': warning')) {
|
|
40
|
-
this.logger.warn(patched ? patched.message : err);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.logger.error(patched ? patched.message : err);
|
|
44
|
-
}
|
|
45
|
-
this.stderr.push(err);
|
|
46
|
-
this.stdout.push(err);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const currentCWD = (0, CustomWasmFS_1.uriToMemFsPath)(this.cwd);
|
|
50
|
-
const [rootDir] = currentCWD.split('/');
|
|
51
|
-
const FS = this.dloCC.FS;
|
|
52
|
-
const manifest = await manifest_1.Manifest.read(this.cwd, this.fs);
|
|
53
|
-
// Register our new FS type under a name
|
|
54
|
-
FS.filesystems.NODEFS_TS = (0, CustomWasmFS_1.CUSTOM_WASM_FS)(FS, this.cwd, manifest, this.logger);
|
|
55
|
-
FS.mkdir(rootDir);
|
|
56
|
-
FS.mount(FS.filesystems.NODEFS_TS, { root: '/' }, rootDir);
|
|
57
|
-
// Set the current working directory to the root directory
|
|
58
|
-
FS.chdir((0, CustomWasmFS_1.uriToMemFsPath)(this.cwd));
|
|
59
|
-
}
|
|
60
|
-
async compile(cwd, fs) {
|
|
61
|
-
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
62
|
-
if (!(await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.dlo, manifest))) {
|
|
63
|
-
this.logger.log('DLO not enabled. Skipped.');
|
|
64
|
-
return {
|
|
65
|
-
code: 0,
|
|
66
|
-
stdout: [],
|
|
67
|
-
stderr: [],
|
|
68
|
-
diagnostics: []
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
await this.initDloCC();
|
|
72
|
-
await fs.mkdir(vscode_uri_1.Utils.joinPath(cwd, 'dist/dlo'));
|
|
73
|
-
const mainFile = vscode_uri_1.Utils.joinPath(cwd, manifest.dlo?.mainFile || defaultFiles_1.DefaultFiles.filePaths.dlo.mainDLO);
|
|
74
|
-
const options = [];
|
|
75
|
-
// read config file
|
|
76
|
-
const configFilePath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.cfg);
|
|
77
|
-
const configFile = (0, CustomWasmFS_1.relativeMemFsPath)(cwd, configFilePath);
|
|
78
|
-
options.push(`-T.${configFile}`);
|
|
79
|
-
let exitCode = 0;
|
|
80
|
-
try {
|
|
81
|
-
const mainFilePath = `.${(0, CustomWasmFS_1.relativeMemFsPath)(cwd, mainFile)}`;
|
|
82
|
-
exitCode = await this.dloCC.callMain([mainFilePath, ...options]);
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
this.logger.error(e);
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
code: exitCode,
|
|
89
|
-
stdout: this.stdout,
|
|
90
|
-
stderr: this.stderr,
|
|
91
|
-
diagnostics: [...CustomWasmFS_1.precompilerDiagnostics, ...parseWarningsAndErrors(cwd, this.stderr, mainFile)]
|
|
92
|
-
};
|
|
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
|
-
}
|
|
119
|
-
//Symbol Compiler handling
|
|
120
|
-
/**
|
|
121
|
-
* Get a symbol compiler instance with direct disk access via CUSTOM_WASM_FS.
|
|
122
|
-
*/
|
|
123
|
-
async getSymbolCompiler() {
|
|
124
|
-
const compilerLog = {
|
|
125
|
-
stdout: [],
|
|
126
|
-
stderr: []
|
|
127
|
-
};
|
|
128
|
-
const dloSymbol = await DLO_MODULE({
|
|
129
|
-
noExitRuntime: false,
|
|
130
|
-
print: (data) => {
|
|
131
|
-
compilerLog.stdout.push(data);
|
|
132
|
-
},
|
|
133
|
-
printErr: (err) => {
|
|
134
|
-
compilerLog.stderr.push(err);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
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);
|
|
145
|
-
return {
|
|
146
|
-
compiler: dloSymbol,
|
|
147
|
-
print: compilerLog
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
exports.DloCompiler = DloCompiler;
|
|
152
|
-
function parseWarningsAndErrors(cwd, stderr, relatedFile) {
|
|
153
|
-
const compilerDiagnostics = [];
|
|
154
|
-
const messages = stderr.filter(line => !!line.trim());
|
|
155
|
-
for (const message of messages) {
|
|
156
|
-
if ((message.includes('Assertion failed:') || message.includes('Compilation aborted.')) && relatedFile) {
|
|
157
|
-
compilerDiagnostics.push({
|
|
158
|
-
file: relatedFile,
|
|
159
|
-
level: 'error',
|
|
160
|
-
line: 0,
|
|
161
|
-
message: message
|
|
162
|
-
});
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
const parsedMessage = parseCompilerMessage(cwd, message);
|
|
166
|
-
if (!parsedMessage) {
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
compilerDiagnostics.push({
|
|
170
|
-
file: vscode_uri_1.URI.parse(`file:///${parsedMessage?.posixPath}`),
|
|
171
|
-
level: parsedMessage.level,
|
|
172
|
-
line: Number(parsedMessage.lineNumber) - 1,
|
|
173
|
-
message: parsedMessage.msg
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
return compilerDiagnostics;
|
|
177
|
-
}
|
|
178
|
-
function parseCompilerMessage(cwd, message) {
|
|
179
|
-
// regular error/warning - such as:
|
|
180
|
-
// C:\Users\aai\rmstudio\apmparts\dlo-pawn\stdlib\rm-dde.inc(392) : error 036: empty statement
|
|
181
|
-
// main.p(138) : warning 203: symbol is never used: "log_str"
|
|
182
|
-
// main.p(6) : fatal error 100: cannot read from file: "oTests/module_t"
|
|
183
|
-
const i0 = message.indexOf(' : ');
|
|
184
|
-
const i1 = message.indexOf(': ', i0 + 3);
|
|
185
|
-
const fileNameAndLineNumber = message.substring(0, i0).trim();
|
|
186
|
-
const levelAndCode = message.substring(i0 + 3, i1).trim();
|
|
187
|
-
const msg = message.substring(i1 + 2).trim();
|
|
188
|
-
// ignore lines which do not contain err/warn msg (or are empty)
|
|
189
|
-
if (!fileNameAndLineNumber || !levelAndCode || !msg) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
const [fileName, lineNumber] = fileNameAndLineNumber.split(/[()(-)]/);
|
|
193
|
-
const decodeLevelAndCode = levelAndCode.split(' ');
|
|
194
|
-
const level = decodeLevelAndCode[decodeLevelAndCode.length - 2]; //lvl is always the second last
|
|
195
|
-
const filePath = vscode_uri_1.Utils.joinPath(cwd, fileName);
|
|
196
|
-
let posixPath = filePath.fsPath.replace(/\\/g, '/');
|
|
197
|
-
if (posixPath.startsWith('/')) {
|
|
198
|
-
posixPath = posixPath.substring(1);
|
|
199
|
-
}
|
|
200
|
-
const patchedMessage = message.replace(fileName, posixPath);
|
|
201
|
-
return { level, msg, posixPath, lineNumber, message: patchedMessage };
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Generates the DLO .cfg file for the dlo compiler
|
|
205
|
-
* @param cwd
|
|
206
|
-
* @param fs
|
|
207
|
-
* @param manifest
|
|
208
|
-
*/
|
|
209
|
-
async function generateConfigFile(cwd, fs, manifest) {
|
|
210
|
-
const compileOptions = [
|
|
211
|
-
'-M', //map output for pawndbg to generate link map
|
|
212
|
-
'-v2' // verbosity of stdout -> 0=quiet, 1=normal, 2=code/data/stack usage report
|
|
213
|
-
];
|
|
214
|
-
const defaultIncPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.defaultInc);
|
|
215
|
-
compileOptions.push(`-p.${(0, CustomWasmFS_1.relativeMemFsPath)(cwd, defaultIncPath)}`);
|
|
216
|
-
const dloLibs = await dependencies_1.Dependencies.getApmPartDependencies(cwd, fs, apm_1.APM.Part.dlo);
|
|
217
|
-
for (const dloLib of dloLibs) {
|
|
218
|
-
const dirName = vscode_uri_1.Utils.dirname(dloLib.path);
|
|
219
|
-
compileOptions.push(`-i.${(0, CustomWasmFS_1.relativeMemFsPath)(cwd, dirName)}`);
|
|
220
|
-
}
|
|
221
|
-
const dloConfiguration = manifest.dlo;
|
|
222
|
-
if (dloConfiguration) {
|
|
223
|
-
compileOptions.push(...dloConfiguration.compileOptions);
|
|
224
|
-
}
|
|
225
|
-
compileOptions.push(`-o./dist/dlo/main.amx`);
|
|
226
|
-
return {
|
|
227
|
-
path: vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.cfg),
|
|
228
|
-
data: compileOptions.join('\n')
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
//# sourceMappingURL=compiler.js.map
|
package/out/dlo/dlo.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DLO = void 0;
|
|
4
|
-
const fileSequencer_1 = require("./fileSequencer");
|
|
5
|
-
const preCompiler_1 = require("./preCompiler");
|
|
6
|
-
const manifest_1 = require("../manifest");
|
|
7
|
-
const compiler_1 = require("./compiler");
|
|
8
|
-
const defaultFiles_1 = require("../defaultFiles");
|
|
9
|
-
const CustomWasmFS_1 = require("./CustomWasmFS");
|
|
10
|
-
var DLO;
|
|
11
|
-
(function (DLO) {
|
|
12
|
-
DLO.FileSequencer = fileSequencer_1.DloFileSequencer;
|
|
13
|
-
DLO.PreCompiler = preCompiler_1.DloPreCompiler;
|
|
14
|
-
/**
|
|
15
|
-
* The DLO Compiler
|
|
16
|
-
*/
|
|
17
|
-
DLO.Compiler = compiler_1.DloCompiler;
|
|
18
|
-
DLO.uriToMemFs = CustomWasmFS_1.uriToMemFsPath;
|
|
19
|
-
DLO.parseCompilerWarningsAndErrors = compiler_1.parseWarningsAndErrors;
|
|
20
|
-
/**
|
|
21
|
-
* Generate the dlo.cfg file and write it to the .studio/auto/dlo directory
|
|
22
|
-
* @param cwd
|
|
23
|
-
* @param fs
|
|
24
|
-
*/
|
|
25
|
-
async function exportDloConfig(cwd, fs, logger) {
|
|
26
|
-
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
27
|
-
const cfgData = await (0, compiler_1.generateConfigFile)(cwd, fs, manifest);
|
|
28
|
-
await fs.writeFile(cfgData.path, cfgData.data);
|
|
29
|
-
logger.log('Generated', defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.cfg);
|
|
30
|
-
}
|
|
31
|
-
DLO.exportDloConfig = exportDloConfig;
|
|
32
|
-
})(DLO || (exports.DLO = DLO = {}));
|
|
33
|
-
//# sourceMappingURL=dlo.js.map
|