@microtronics/studio-cli 0.27.3 → 0.29.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 +22 -0
- package/dist/studio-cli.d.ts +41 -13
- package/out/api.js +4 -2
- package/out/dde/dde.js +103 -26
- package/out/dde/yamlDdePreCompiler.js +3 -51
- package/out/defaultFiles.js +6 -1
- package/out/dlo/CustomWasmFS.js +227 -0
- package/out/dlo/compiler.js +40 -40
- package/out/dlo/dlo.js +2 -1
- package/out/dlo/dlocc.js +188 -238
- package/out/main.js +5 -1
- package/out/package/apm.js +4 -1
- package/out/package/package.js +21 -4
- package/package.json +1 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.CUSTOM_WASM_FS = exports.precompilerDiagnostics = void 0;
|
|
27
|
+
exports.uriToMemFsPath = uriToMemFsPath;
|
|
28
|
+
const nodeFs = __importStar(require("fs"));
|
|
29
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
30
|
+
const preCompiler_1 = require("./preCompiler");
|
|
31
|
+
const helper_1 = require("../helper");
|
|
32
|
+
var convertBlobToStringArray = helper_1.Helper.convertBlobToStringArray;
|
|
33
|
+
const iconv = __importStar(require("iconv-lite"));
|
|
34
|
+
const S_IFDIR = 0o040000; // Directory flag
|
|
35
|
+
const DEFAULT_DIR_MODE = 0o777; // rwxrwxrwx
|
|
36
|
+
const MODE_DIR = S_IFDIR | DEFAULT_DIR_MODE;
|
|
37
|
+
const S_IFREG = 0o100000; // Regular file flag
|
|
38
|
+
const DEFAULT_FILE_MODE = 0o666; // rw-rw-rw-
|
|
39
|
+
const MODE_FILE = S_IFREG | DEFAULT_FILE_MODE;
|
|
40
|
+
const preCompiler = new preCompiler_1.DloPreCompiler();
|
|
41
|
+
const modifiedFileCache = {};
|
|
42
|
+
exports.precompilerDiagnostics = [];
|
|
43
|
+
const CUSTOM_WASM_FS = (FS, cwd, manifest) => {
|
|
44
|
+
// clear all cached artifacts during FS setup ( this is needed when loaded in vscode context )
|
|
45
|
+
exports.precompilerDiagnostics.length = 0;
|
|
46
|
+
Object.keys(modifiedFileCache).forEach(key => delete modifiedFileCache[key]);
|
|
47
|
+
const nodeOps = {
|
|
48
|
+
getattr(node) {
|
|
49
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(node.mount.opts.root), FS.getPath(node));
|
|
50
|
+
const fsPath = path.fsPath;
|
|
51
|
+
if (!nodeFs.existsSync(fsPath)) {
|
|
52
|
+
throw new FS.ErrnoError(44 /* ENOENT */);
|
|
53
|
+
}
|
|
54
|
+
const modifiedFileContent = getUpdateModifiedFileCache(cwd, manifest, path);
|
|
55
|
+
const stat = nodeFs.statSync(fsPath);
|
|
56
|
+
const size = modifiedFileContent?.length || stat.size;
|
|
57
|
+
return {
|
|
58
|
+
mode: stat.isDirectory() ? MODE_DIR : MODE_FILE,
|
|
59
|
+
size: size,
|
|
60
|
+
atime: stat.atime,
|
|
61
|
+
mtime: stat.mtime,
|
|
62
|
+
ctime: stat.ctime
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
lookup(parent, name) {
|
|
66
|
+
const currPath = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(parent.mount.opts.root), FS.getPath(parent), name);
|
|
67
|
+
const path = currPath.fsPath;
|
|
68
|
+
if (!nodeFs.existsSync(path)) {
|
|
69
|
+
throw new FS.ErrnoError(44 /* ENOENT */);
|
|
70
|
+
}
|
|
71
|
+
const stat = nodeFs.statSync(path);
|
|
72
|
+
const node = FS.createNode(parent, name, stat.isDirectory() ? MODE_DIR : MODE_FILE, 0);
|
|
73
|
+
node.node_ops = parent.node_ops;
|
|
74
|
+
node.stream_ops = parent.stream_ops;
|
|
75
|
+
return node;
|
|
76
|
+
},
|
|
77
|
+
readdir(node) {
|
|
78
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(node.mount.opts.root), FS.getPath(node)).fsPath;
|
|
79
|
+
return ['.', '..', ...nodeFs.readdirSync(path)];
|
|
80
|
+
},
|
|
81
|
+
mknod(parent, name, mode, dev) {
|
|
82
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(parent.mount.opts.root), FS.getPath(parent), name).fsPath;
|
|
83
|
+
nodeFs.writeFileSync(path, '');
|
|
84
|
+
return FS.createNode(parent, name, mode, dev);
|
|
85
|
+
},
|
|
86
|
+
unlink(parent, name) {
|
|
87
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(parent.mount.opts.root), FS.getPath(parent), name).fsPath;
|
|
88
|
+
nodeFs.unlinkSync(path);
|
|
89
|
+
},
|
|
90
|
+
mkdir(parent, name, mode) {
|
|
91
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(parent.mount.opts.root), FS.getPath(parent), name).fsPath;
|
|
92
|
+
nodeFs.mkdirSync(path, { mode });
|
|
93
|
+
return FS.createNode(parent, name, mode | MODE_DIR, 0);
|
|
94
|
+
},
|
|
95
|
+
rmdir(parent, name) {
|
|
96
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(parent.mount.opts.root), FS.getPath(parent), name).fsPath;
|
|
97
|
+
nodeFs.rmdirSync(path);
|
|
98
|
+
},
|
|
99
|
+
rename(oldParent, oldName, newParent, newName) {
|
|
100
|
+
const oldPath = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(oldParent.mount.opts.root), FS.getPath(oldParent), oldName).fsPath;
|
|
101
|
+
const newPath = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(newParent.mount.opts.root), FS.getPath(newParent), newName).fsPath;
|
|
102
|
+
nodeFs.renameSync(oldPath, newPath);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const streamOps = {
|
|
106
|
+
open(stream) {
|
|
107
|
+
const path = vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(stream.node.mount.opts.root), FS.getPath(stream.node));
|
|
108
|
+
stream.modifiedContent = getUpdateModifiedFileCache(cwd, manifest, path);
|
|
109
|
+
if (!stream.modifiedContent) {
|
|
110
|
+
stream.nfd = nodeFs.openSync(path.fsPath, flagsToMode(stream.flags));
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
close(stream) {
|
|
114
|
+
if (stream.nfd) {
|
|
115
|
+
nodeFs.closeSync(stream.nfd);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
read(stream, buffer, offset, length, position) {
|
|
119
|
+
// allow reading none precompiled files
|
|
120
|
+
if (!stream.modifiedContent) {
|
|
121
|
+
return nodeFs.readSync(stream.nfd, buffer, offset, length, position);
|
|
122
|
+
}
|
|
123
|
+
const fileContent = stream.modifiedContent;
|
|
124
|
+
if (position >= fileContent.length) {
|
|
125
|
+
return 0;
|
|
126
|
+
} // EOF handling properly
|
|
127
|
+
const bytesAvailable = fileContent.length - position;
|
|
128
|
+
const bytesToRead = Math.min(length, bytesAvailable);
|
|
129
|
+
copyToBuffer(fileContent, buffer, offset, position, position + bytesToRead);
|
|
130
|
+
// fileContent.copy(buffer, offset, position, position + bytesToRead);
|
|
131
|
+
return bytesToRead;
|
|
132
|
+
},
|
|
133
|
+
write(stream, buffer, offset, length, position) {
|
|
134
|
+
return nodeFs.writeSync(stream.nfd, buffer, offset, length, position);
|
|
135
|
+
},
|
|
136
|
+
flagsToMode: flagsToMode,
|
|
137
|
+
llseek(stream, offset, whence) {
|
|
138
|
+
let position = offset;
|
|
139
|
+
if (whence === 1) {
|
|
140
|
+
position += stream.position;
|
|
141
|
+
}
|
|
142
|
+
else if (whence === 2) {
|
|
143
|
+
const stat = nodeFs.fstatSync(stream.nfd);
|
|
144
|
+
position += stat.size;
|
|
145
|
+
}
|
|
146
|
+
if (position < 0) {
|
|
147
|
+
throw new FS.ErrnoError(28);
|
|
148
|
+
} // EINVAL
|
|
149
|
+
stream.position = position;
|
|
150
|
+
return position;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
mount( /*mount: any*/) {
|
|
155
|
+
const memfsRoot = uriToMemFsPath(cwd);
|
|
156
|
+
const root = FS.createNode(null, memfsRoot, S_IFDIR | DEFAULT_DIR_MODE, 0);
|
|
157
|
+
root.node_ops = nodeOps;
|
|
158
|
+
root.stream_ops = streamOps;
|
|
159
|
+
return root;
|
|
160
|
+
},
|
|
161
|
+
node_ops: nodeOps,
|
|
162
|
+
stream_ops: streamOps
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
exports.CUSTOM_WASM_FS = CUSTOM_WASM_FS;
|
|
166
|
+
function flagsToMode(flags) {
|
|
167
|
+
const accmode = flags & 2097155;
|
|
168
|
+
if (accmode === 0)
|
|
169
|
+
return 'r';
|
|
170
|
+
if (accmode === 1)
|
|
171
|
+
return 'r+';
|
|
172
|
+
if (accmode === 65)
|
|
173
|
+
return 'w';
|
|
174
|
+
if (accmode === 577)
|
|
175
|
+
return 'w+';
|
|
176
|
+
if (accmode === 1089)
|
|
177
|
+
return 'a';
|
|
178
|
+
if (accmode === 1217)
|
|
179
|
+
return 'a+';
|
|
180
|
+
throw new Error(`Unknown file open flags: ${flags}`);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Copies a segment of data from the source buffer to the target buffer, starting at specified offsets.
|
|
184
|
+
* Somehow within the vscode context the target buffer is an Int8Array.
|
|
185
|
+
*
|
|
186
|
+
* @param {Buffer | Uint8Array} source The buffer or Uint8Array to copy data from.
|
|
187
|
+
* @param {Buffer | Uint8Array | Int8Array} target The buffer, Uint8Array, or Int8Array to copy data into.
|
|
188
|
+
* @param {number} targetOffset The offset in the target buffer where data should begin being placed.
|
|
189
|
+
* @param {number} sourceStart The starting index in the source buffer to begin copying from.
|
|
190
|
+
* @param {number} sourceEnd The ending index (exclusive) in the source buffer to stop copying.
|
|
191
|
+
* @return {void} Does not return a value. The target buffer is modified in place.
|
|
192
|
+
*/
|
|
193
|
+
function copyToBuffer(source, target, targetOffset, sourceStart, sourceEnd) {
|
|
194
|
+
if (Buffer.isBuffer(source) && Buffer.isBuffer(target)) {
|
|
195
|
+
source.copy(target, targetOffset, sourceStart, sourceEnd);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const slicedSource = source.subarray(sourceStart, sourceEnd);
|
|
199
|
+
if (Buffer.isBuffer(target)) {
|
|
200
|
+
// Source is Uint8Array, target is Buffer
|
|
201
|
+
Uint8Array.prototype.set.call(target, slicedSource, targetOffset);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// Handles Uint8Array and Int8Array or other TypedArrays safely
|
|
205
|
+
target.set(slicedSource, targetOffset);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function getUpdateModifiedFileCache(cwd, manifest, filePath) {
|
|
210
|
+
const fsPath = filePath.fsPath;
|
|
211
|
+
if (!modifiedFileCache[fsPath] && (fsPath.endsWith('.dlo') || fsPath.endsWith('.inc'))) {
|
|
212
|
+
modifiedFileCache[fsPath] = precompileRequestedDloFile(cwd, manifest, filePath);
|
|
213
|
+
}
|
|
214
|
+
return modifiedFileCache[fsPath];
|
|
215
|
+
}
|
|
216
|
+
function precompileRequestedDloFile(cwd, manifest, filePath) {
|
|
217
|
+
// Simple example: convert buffer content to a string, modify and convert back
|
|
218
|
+
const originalContent = nodeFs.readFileSync(filePath.fsPath);
|
|
219
|
+
const fileBlob = convertBlobToStringArray(originalContent);
|
|
220
|
+
const preCompiled = preCompiler.preCompileDloFile(cwd, manifest, filePath, fileBlob);
|
|
221
|
+
exports.precompilerDiagnostics.push(...preCompiled.diagnostics);
|
|
222
|
+
return iconv.encode(preCompiled.data, 'cp1252');
|
|
223
|
+
}
|
|
224
|
+
function uriToMemFsPath(path) {
|
|
225
|
+
return path.fsPath.replace(/\\/g, '/');
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=CustomWasmFS.js.map
|
package/out/dlo/compiler.js
CHANGED
|
@@ -24,7 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.DloCompiler = void 0;
|
|
27
|
-
exports.uriToMemFsPath = uriToMemFsPath;
|
|
28
27
|
exports.parseWarningsAndErrors = parseWarningsAndErrors;
|
|
29
28
|
exports.generateConfigFile = generateConfigFile;
|
|
30
29
|
const preCompiler_1 = require("./preCompiler");
|
|
@@ -33,17 +32,20 @@ const manifest_1 = require("../manifest");
|
|
|
33
32
|
const defaultFiles_1 = require("../defaultFiles");
|
|
34
33
|
const dependencies_1 = require("../dependencies");
|
|
35
34
|
const iconv = __importStar(require("iconv-lite"));
|
|
36
|
-
const helper_1 = require("../helper");
|
|
37
|
-
var convertBlobToStringArray = helper_1.Helper.convertBlobToStringArray;
|
|
38
35
|
const apm_1 = require("../package/apm");
|
|
36
|
+
const CustomWasmFS_1 = require("./CustomWasmFS");
|
|
39
37
|
const DLO_MODULE = require('./dlocc.js');
|
|
40
38
|
class DloCompiler {
|
|
39
|
+
cwd;
|
|
40
|
+
fs;
|
|
41
41
|
logger;
|
|
42
42
|
preCompiler = new preCompiler_1.DloPreCompiler();
|
|
43
43
|
dloCC;
|
|
44
44
|
stdout = [];
|
|
45
45
|
stderr = [];
|
|
46
|
-
constructor(logger) {
|
|
46
|
+
constructor(cwd, fs, logger) {
|
|
47
|
+
this.cwd = cwd;
|
|
48
|
+
this.fs = fs;
|
|
47
49
|
this.logger = logger;
|
|
48
50
|
this.dloCC = null;
|
|
49
51
|
}
|
|
@@ -57,11 +59,25 @@ class DloCompiler {
|
|
|
57
59
|
this.stdout.push(data);
|
|
58
60
|
},
|
|
59
61
|
printErr: (err) => {
|
|
60
|
-
|
|
62
|
+
// filter for warn messages
|
|
63
|
+
if (err.includes(': warning')) {
|
|
64
|
+
this.logger.warn(err);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.logger.error(err);
|
|
68
|
+
}
|
|
61
69
|
this.stderr.push(err);
|
|
62
70
|
this.stdout.push(err);
|
|
63
71
|
}
|
|
64
72
|
});
|
|
73
|
+
const currentCWD = (0, CustomWasmFS_1.uriToMemFsPath)(this.cwd);
|
|
74
|
+
const [rootDir] = currentCWD.split('/');
|
|
75
|
+
const FS = this.dloCC.FS;
|
|
76
|
+
const manifest = await manifest_1.Manifest.read(this.cwd, this.fs);
|
|
77
|
+
// Register our new FS type under a name
|
|
78
|
+
FS.filesystems.NODEFS_TS = (0, CustomWasmFS_1.CUSTOM_WASM_FS)(FS, this.cwd, manifest);
|
|
79
|
+
FS.mkdir(rootDir);
|
|
80
|
+
FS.mount(FS.filesystems.NODEFS_TS, { root: '/' }, rootDir);
|
|
65
81
|
}
|
|
66
82
|
get MEMFS() {
|
|
67
83
|
return this.dloCC.FS;
|
|
@@ -69,7 +85,7 @@ class DloCompiler {
|
|
|
69
85
|
async compile(cwd, fs) {
|
|
70
86
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
71
87
|
if (!(await manifest_1.Manifest.isApmPartEnabled(cwd, fs, apm_1.APM.Part.dlo, manifest))) {
|
|
72
|
-
|
|
88
|
+
this.logger.log('DLO not enabled. Skipped.');
|
|
73
89
|
return {
|
|
74
90
|
code: 0,
|
|
75
91
|
stdout: [],
|
|
@@ -78,31 +94,27 @@ class DloCompiler {
|
|
|
78
94
|
};
|
|
79
95
|
}
|
|
80
96
|
await this.initDloCC();
|
|
81
|
-
const precompilerDiagnostics = await this.persistDloFiles(cwd, fs, manifest);
|
|
82
97
|
const mainFile = vscode_uri_1.Utils.joinPath(cwd, manifest.dlo?.mainFile || defaultFiles_1.DefaultFiles.filePaths.dlo.mainDLO);
|
|
83
98
|
const options = [];
|
|
84
|
-
//
|
|
99
|
+
// read config file
|
|
85
100
|
const configFilePath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.cfg);
|
|
86
|
-
options.push(
|
|
87
|
-
if (this.preCompiler.pragmaDynamicFlag) {
|
|
88
|
-
options.push(this.preCompiler.pragmaDynamicFlag);
|
|
89
|
-
}
|
|
101
|
+
options.push(`-T${(0, CustomWasmFS_1.uriToMemFsPath)(configFilePath)}`);
|
|
90
102
|
let exitCode = 0;
|
|
91
103
|
try {
|
|
92
|
-
exitCode = await this.dloCC.callMain([uriToMemFsPath(mainFile), ...options]);
|
|
104
|
+
exitCode = await this.dloCC.callMain([(0, CustomWasmFS_1.uriToMemFsPath)(mainFile), ...options]);
|
|
93
105
|
// compiler doesn't have any errors
|
|
94
106
|
if (exitCode === 0) {
|
|
95
107
|
await this.persistGeneratedFiles(cwd, fs, mainFile);
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
catch (e) {
|
|
99
|
-
|
|
111
|
+
this.logger.error(e);
|
|
100
112
|
}
|
|
101
113
|
return {
|
|
102
114
|
code: exitCode,
|
|
103
115
|
stdout: this.stdout,
|
|
104
116
|
stderr: this.stderr,
|
|
105
|
-
diagnostics: [...precompilerDiagnostics, ...parseWarningsAndErrors(this.stderr, mainFile)]
|
|
117
|
+
diagnostics: [...CustomWasmFS_1.precompilerDiagnostics, ...parseWarningsAndErrors(this.stderr, mainFile)]
|
|
106
118
|
};
|
|
107
119
|
}
|
|
108
120
|
async persistGeneratedFiles(cwd, fs, mainFile) {
|
|
@@ -116,15 +128,6 @@ class DloCompiler {
|
|
|
116
128
|
}
|
|
117
129
|
}
|
|
118
130
|
}
|
|
119
|
-
async readConfigFile(fs, configPath) {
|
|
120
|
-
if (await fs.stat(configPath)) {
|
|
121
|
-
const content = await fs.readFile(configPath);
|
|
122
|
-
return convertBlobToStringArray(content);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
131
|
/**
|
|
129
132
|
* Search for all dlo files and persist it to the MEMFS
|
|
130
133
|
* @param cwd
|
|
@@ -132,9 +135,9 @@ class DloCompiler {
|
|
|
132
135
|
* @param manifest
|
|
133
136
|
* @private
|
|
134
137
|
*/
|
|
135
|
-
async persistDloFiles(cwd, fs, manifest) {
|
|
136
|
-
const files = await fs.findFiles(cwd, '
|
|
137
|
-
const precompilerDiagnostics = [];
|
|
138
|
+
/* private async persistDloFiles(cwd: URI, fs: LocalFS, manifest: Manifest.Manifest) {
|
|
139
|
+
const files = await fs.findFiles(cwd, '**!/!*.{dlo,inc}');
|
|
140
|
+
const precompilerDiagnostics: Diagnostics.File[] = [];
|
|
138
141
|
// add dlo.cfg file to the file list
|
|
139
142
|
for (const file of files) {
|
|
140
143
|
if (await fs.stat(file)) {
|
|
@@ -145,7 +148,7 @@ class DloCompiler {
|
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
150
|
return precompilerDiagnostics;
|
|
148
|
-
}
|
|
151
|
+
}*/
|
|
149
152
|
/**
|
|
150
153
|
* Precompile the given file and pass it to the MEMFS
|
|
151
154
|
* @param cwd
|
|
@@ -158,7 +161,7 @@ class DloCompiler {
|
|
|
158
161
|
const preCompiled = this.preCompiler.preCompileDloFile(cwd, manifest, file, stringBlob);
|
|
159
162
|
precompilerDiagnostics.push(...preCompiled.diagnostics);
|
|
160
163
|
this.memFSmkdir(file);
|
|
161
|
-
this.MEMFS.writeFile(uriToMemFsPath(file), iconv.encode(preCompiled.data, 'cp1252'));
|
|
164
|
+
this.MEMFS.writeFile((0, CustomWasmFS_1.uriToMemFsPath)(file), iconv.encode(preCompiled.data, 'cp1252'));
|
|
162
165
|
return precompilerDiagnostics;
|
|
163
166
|
}
|
|
164
167
|
/**
|
|
@@ -169,10 +172,10 @@ class DloCompiler {
|
|
|
169
172
|
async memFSmove(oldUri, newUri) {
|
|
170
173
|
try {
|
|
171
174
|
this.memFSmkdir(newUri);
|
|
172
|
-
this.MEMFS.rename(uriToMemFsPath(oldUri), uriToMemFsPath(newUri));
|
|
175
|
+
this.MEMFS.rename((0, CustomWasmFS_1.uriToMemFsPath)(oldUri), (0, CustomWasmFS_1.uriToMemFsPath)(newUri));
|
|
173
176
|
}
|
|
174
177
|
catch (e) {
|
|
175
|
-
|
|
178
|
+
this.logger.error('memFSmove', e);
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
/**
|
|
@@ -181,14 +184,14 @@ class DloCompiler {
|
|
|
181
184
|
*/
|
|
182
185
|
async memFSunlink(uri) {
|
|
183
186
|
try {
|
|
184
|
-
this.MEMFS.unlink(uriToMemFsPath(uri));
|
|
187
|
+
this.MEMFS.unlink((0, CustomWasmFS_1.uriToMemFsPath)(uri));
|
|
185
188
|
}
|
|
186
189
|
catch (e) {
|
|
187
|
-
|
|
190
|
+
this.logger.error('memFSunlink', e);
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
memFSmkdir(uri) {
|
|
191
|
-
const split = uriToMemFsPath(vscode_uri_1.Utils.dirname(uri)).split('/');
|
|
194
|
+
const split = (0, CustomWasmFS_1.uriToMemFsPath)(vscode_uri_1.Utils.dirname(uri)).split('/');
|
|
192
195
|
let dirname = '';
|
|
193
196
|
split.forEach(folder => {
|
|
194
197
|
if (!folder) {
|
|
@@ -201,7 +204,7 @@ class DloCompiler {
|
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
catch (e) {
|
|
204
|
-
|
|
207
|
+
this.logger.error('memFSmkdir', e);
|
|
205
208
|
}
|
|
206
209
|
});
|
|
207
210
|
}
|
|
@@ -250,9 +253,6 @@ class DloCompiler {
|
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
exports.DloCompiler = DloCompiler;
|
|
253
|
-
function uriToMemFsPath(path) {
|
|
254
|
-
return path.fsPath.replace(/\\/g, '/');
|
|
255
|
-
}
|
|
256
256
|
function parseWarningsAndErrors(stderr, relatedFile) {
|
|
257
257
|
const compilerDiagnostics = [];
|
|
258
258
|
const messages = stderr.filter(line => !!line.trim());
|
|
@@ -307,11 +307,11 @@ async function generateConfigFile(cwd, fs, manifest) {
|
|
|
307
307
|
'-v2' // verbosity of stdout -> 0=quiet, 1=normal, 2=code/data/stack usage report
|
|
308
308
|
];
|
|
309
309
|
const defaultIncPath = vscode_uri_1.Utils.joinPath(cwd, defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.defaultInc);
|
|
310
|
-
compileOptions.push(`-p${uriToMemFsPath(defaultIncPath)}`);
|
|
310
|
+
compileOptions.push(`-p${(0, CustomWasmFS_1.uriToMemFsPath)(defaultIncPath)}`);
|
|
311
311
|
const dloLibs = await dependencies_1.Dependencies.getApmPartDependencies(cwd, fs, apm_1.APM.Part.dlo);
|
|
312
312
|
for (const dloLib of dloLibs) {
|
|
313
313
|
const dirName = vscode_uri_1.Utils.dirname(dloLib.path);
|
|
314
|
-
compileOptions.push(`-i${uriToMemFsPath(dirName)}`);
|
|
314
|
+
compileOptions.push(`-i${(0, CustomWasmFS_1.uriToMemFsPath)(dirName)}`);
|
|
315
315
|
}
|
|
316
316
|
const dloConfiguration = manifest.dlo;
|
|
317
317
|
if (dloConfiguration) {
|
package/out/dlo/dlo.js
CHANGED
|
@@ -6,6 +6,7 @@ const preCompiler_1 = require("./preCompiler");
|
|
|
6
6
|
const manifest_1 = require("../manifest");
|
|
7
7
|
const compiler_1 = require("./compiler");
|
|
8
8
|
const defaultFiles_1 = require("../defaultFiles");
|
|
9
|
+
const CustomWasmFS_1 = require("./CustomWasmFS");
|
|
9
10
|
var DLO;
|
|
10
11
|
(function (DLO) {
|
|
11
12
|
DLO.FileSequencer = fileSequencer_1.DloFileSequencer;
|
|
@@ -14,7 +15,7 @@ var DLO;
|
|
|
14
15
|
* The DLO Compiler
|
|
15
16
|
*/
|
|
16
17
|
DLO.Compiler = compiler_1.DloCompiler;
|
|
17
|
-
DLO.uriToMemFs =
|
|
18
|
+
DLO.uriToMemFs = CustomWasmFS_1.uriToMemFsPath;
|
|
18
19
|
DLO.parseCompilerWarningsAndErrors = compiler_1.parseWarningsAndErrors;
|
|
19
20
|
/**
|
|
20
21
|
* Generate the dlo.cfg file and write it to the .studio/auto/dlo directory
|