@microtronics/studio-cli 0.7.0 → 0.8.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 +8 -0
- package/dist/studio-cli.d.ts +39 -4
- package/out/FS.d.ts.map +1 -1
- package/out/FS.js +0 -31
- package/out/dde/dde.d.ts.map +1 -1
- package/out/dde/dde.js +4 -3
- package/out/dlo/compiler.d.ts.map +1 -1
- package/out/dlo/compiler.js +95 -20
- package/out/dlo/dlo.d.ts.map +1 -1
- package/out/dlo/dlo.js +1 -0
- package/out/dlo/dlocc.d.ts.map +1 -1
- package/out/dlo/dlocc.js +755 -810
- package/out/dlo/preCompiler.js +3 -3
- package/out/globals.d.ts.map +1 -1
- package/out/globals.js +3 -2
- package/out/helper.d.ts.map +1 -1
- package/out/helper.js +31 -0
- package/out/main.js +11 -2
- package/out/manifest.d.ts.map +1 -1
- package/out/manifest.js +3 -2
- package/out/scriptRunner.d.ts.map +1 -0
- package/out/scriptRunner.js +101 -0
- package/package.json +73 -73
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## 0.8.0 (2024-12-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **studio-cli:** allow to trigger pov build from cli ([048dfe4](https://bitbucket.org/microtronics-core/vscode-studio/commits/048dfe4ae92e77ecdacc85c821b465ab3187ff63))
|
|
9
|
+
* **studio-core:** allow to trigger blo build from cli ([1cdfa02](https://bitbucket.org/microtronics-core/vscode-studio/commits/1cdfa026517759392acb0f098a90e9fda8faf5c1))
|
|
10
|
+
|
|
3
11
|
## 0.7.0 (2024-12-16)
|
|
4
12
|
|
|
5
13
|
|
package/dist/studio-cli.d.ts
CHANGED
|
@@ -1534,6 +1534,7 @@ export declare namespace DLO {
|
|
|
1534
1534
|
*/
|
|
1535
1535
|
const Compiler: typeof DloCompiler;
|
|
1536
1536
|
export type Compiler = DloCompiler;
|
|
1537
|
+
const uriToMemFs: typeof uriToMemFsPath;
|
|
1537
1538
|
/**
|
|
1538
1539
|
* Generate the dlo.cfg file and write it to the .studio/auto/dlo directory
|
|
1539
1540
|
* @param cwd
|
|
@@ -1544,11 +1545,11 @@ export declare namespace DLO {
|
|
|
1544
1545
|
|
|
1545
1546
|
declare class DloCompiler {
|
|
1546
1547
|
private preCompiler;
|
|
1547
|
-
private
|
|
1548
|
+
private dloCC;
|
|
1548
1549
|
private stdout;
|
|
1549
1550
|
private stderr;
|
|
1550
1551
|
constructor();
|
|
1551
|
-
private
|
|
1552
|
+
private initDloCC;
|
|
1552
1553
|
private get MEMFS();
|
|
1553
1554
|
compile(cwd: URI, fs: LocalFS): Promise<{
|
|
1554
1555
|
code: number;
|
|
@@ -1559,16 +1560,45 @@ declare class DloCompiler {
|
|
|
1559
1560
|
private persistGeneratedFiles;
|
|
1560
1561
|
private readConfigFile;
|
|
1561
1562
|
/**
|
|
1562
|
-
*
|
|
1563
|
+
* Search for all dlo files and persist it to the MEMFS
|
|
1563
1564
|
* @param cwd
|
|
1564
1565
|
* @param fs
|
|
1565
1566
|
* @param manifest
|
|
1566
1567
|
* @private
|
|
1567
1568
|
*/
|
|
1568
|
-
private
|
|
1569
|
+
private persistDloFiles;
|
|
1570
|
+
/**
|
|
1571
|
+
* Precompile the given file and pass it to the MEMFS
|
|
1572
|
+
* @param cwd
|
|
1573
|
+
* @param manifest
|
|
1574
|
+
* @param file
|
|
1575
|
+
* @param stringBlob
|
|
1576
|
+
*/
|
|
1577
|
+
memFSwriteFile(cwd: URI, manifest: Manifest.Manifest, file: URI, stringBlob: string[]): Promise<Diagnostics.File[]>;
|
|
1578
|
+
/**
|
|
1579
|
+
* Move a file within the MEMFS
|
|
1580
|
+
* @param oldUri
|
|
1581
|
+
* @param newUri
|
|
1582
|
+
*/
|
|
1583
|
+
memFSmove(oldUri: URI, newUri: URI): Promise<void>;
|
|
1584
|
+
/**
|
|
1585
|
+
* Remove a file from the MEMFS
|
|
1586
|
+
* @param uri
|
|
1587
|
+
*/
|
|
1588
|
+
memFSunlink(uri: URI): Promise<void>;
|
|
1569
1589
|
private memFSmkdir;
|
|
1570
1590
|
private memFSstat;
|
|
1571
1591
|
private parseWarningsAndErrors;
|
|
1592
|
+
/**
|
|
1593
|
+
* Get a symbol compiler instance
|
|
1594
|
+
*/
|
|
1595
|
+
getSymbolCompiler(): Promise<{
|
|
1596
|
+
compiler: any;
|
|
1597
|
+
print: {
|
|
1598
|
+
stdout: string[];
|
|
1599
|
+
stderr: string[];
|
|
1600
|
+
};
|
|
1601
|
+
}>;
|
|
1572
1602
|
}
|
|
1573
1603
|
|
|
1574
1604
|
declare class DloFileSequencer {
|
|
@@ -1721,6 +1751,9 @@ export declare namespace Helper {
|
|
|
1721
1751
|
* @param content
|
|
1722
1752
|
*/
|
|
1723
1753
|
export function generateCRC32ForFileContent(content: Uint8Array): string;
|
|
1754
|
+
export function convertBlobToString(blob: Uint8Array | any): string;
|
|
1755
|
+
export function normalizeLF(stringToNormalize?: string): string;
|
|
1756
|
+
export function convertBlobToStringArray(blob: Uint8Array | any): string[];
|
|
1724
1757
|
}
|
|
1725
1758
|
|
|
1726
1759
|
declare interface LocalFS {
|
|
@@ -1844,6 +1877,8 @@ export declare namespace Registry {
|
|
|
1844
1877
|
export function fetchLibraryContent(token: string | null, contentURL: string, json?: boolean): Promise<any>;
|
|
1845
1878
|
}
|
|
1846
1879
|
|
|
1880
|
+
declare function uriToMemFsPath(path: URI): string;
|
|
1881
|
+
|
|
1847
1882
|
declare interface XMLField {
|
|
1848
1883
|
alias: string;
|
|
1849
1884
|
byteofs?: string;
|
package/out/FS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../src/FS.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,MAAM,WAA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.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FilePermission = exports.FileType = void 0;
|
|
4
|
-
exports.convertBlobToString = convertBlobToString;
|
|
5
|
-
exports.normalizeLF = normalizeLF;
|
|
6
|
-
exports.convertBlobToStringArray = convertBlobToStringArray;
|
|
7
4
|
/**
|
|
8
5
|
* Enumeration of file types. The types `File` and `Directory` can also be
|
|
9
6
|
* a symbolic links, in that case use `FileType.File | FileType.SymbolicLink` and
|
|
@@ -43,32 +40,4 @@ var FilePermission;
|
|
|
43
40
|
*/
|
|
44
41
|
FilePermission[FilePermission["Readonly"] = 1] = "Readonly";
|
|
45
42
|
})(FilePermission || (exports.FilePermission = FilePermission = {}));
|
|
46
|
-
function convertBlobToString(blob) {
|
|
47
|
-
try {
|
|
48
|
-
let binaryData = null;
|
|
49
|
-
// if vscode runs in desktop mode, the blob is a serialized buffer
|
|
50
|
-
if (blob?.type === 'Buffer') {
|
|
51
|
-
binaryData = Uint8Array.from(blob.data);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
binaryData = blob;
|
|
55
|
-
}
|
|
56
|
-
return new TextDecoder('utf8').decode(binaryData);
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function normalizeLF(stringToNormalize = '') {
|
|
63
|
-
return stringToNormalize.replace(/\r\n|\n\r|\r/g, '\n');
|
|
64
|
-
}
|
|
65
|
-
function convertBlobToStringArray(blob) {
|
|
66
|
-
try {
|
|
67
|
-
const textData = convertBlobToString(blob).trim();
|
|
68
|
-
return normalizeLF(textData).split('\n');
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
43
|
//# sourceMappingURL=FS.js.map
|
package/out/dde/dde.d.ts.map
CHANGED
|
@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AED;;;;OAIG;IACH,SAAsB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,gBAUzD;IAED;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,MAclG;IAED;;;;;OAKG;IACH,SAAsB,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,iBAO9E;IAED;;;;;OAKG;IACH,SAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,gBAE1D;IACD;;;;;OAKG;IACH,SAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,iBA6C/E;IAED;;;;;OAKG;IACH,SAAsB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,iBAqBzE;IAED;;;;;OAKG;IACH,SAAsB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,iBAK3D;CACD"}
|
package/out/dde/dde.js
CHANGED
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.DDE = exports.DDE_PATH = void 0;
|
|
30
30
|
const vscode_uri_1 = require("vscode-uri");
|
|
31
|
-
const FS_1 = require("../FS");
|
|
32
31
|
const dependencies_1 = require("../dependencies");
|
|
33
32
|
const manifest_1 = require("../manifest");
|
|
34
33
|
const ajv_1 = __importDefault(require("ajv"));
|
|
@@ -42,19 +41,21 @@ const semver = __importStar(require("semver"));
|
|
|
42
41
|
const dlo_1 = require("./fileGenerators/dlo");
|
|
43
42
|
const globals_1 = require("../globals");
|
|
44
43
|
const api_1 = require("./fileGenerators/api");
|
|
44
|
+
const helper_1 = require("../helper");
|
|
45
45
|
exports.DDE_PATH = defaultFiles_1.DefaultFiles.filePaths.dde.path;
|
|
46
46
|
// create file cache.
|
|
47
47
|
// yaml & json
|
|
48
48
|
// ...
|
|
49
49
|
var DDE;
|
|
50
50
|
(function (DDE) {
|
|
51
|
+
var convertBlobToString = helper_1.Helper.convertBlobToString;
|
|
51
52
|
/**
|
|
52
53
|
* The json schema to validate the dde structure
|
|
53
54
|
*/
|
|
54
55
|
DDE.DDE_SCHEMA = dynamic_dde_schema_json_1.default;
|
|
55
56
|
async function readYamlFile(filePath, fs) {
|
|
56
57
|
const yamlBin = await fs.readFile(filePath);
|
|
57
|
-
return
|
|
58
|
+
return convertBlobToString(yamlBin);
|
|
58
59
|
}
|
|
59
60
|
DDE.readYamlFile = readYamlFile;
|
|
60
61
|
/**
|
|
@@ -169,7 +170,7 @@ var DDE;
|
|
|
169
170
|
const historyPath = vscode_uri_1.Utils.joinPath(cwd, exports.DDE_PATH, 'history.json');
|
|
170
171
|
try {
|
|
171
172
|
const binary = await fs.readFile(historyPath);
|
|
172
|
-
const historyString =
|
|
173
|
+
const historyString = convertBlobToString(binary);
|
|
173
174
|
return JSON.parse(historyString);
|
|
174
175
|
}
|
|
175
176
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/dlo/compiler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/dlo/compiler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAS,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAS7C,qBAAa,WAAW;IACvB,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAgB;;YAKhB,SAAS;IAiBvB,OAAO,KAAK,KAAK,GAEhB;IAEY,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO;;;;;;YAkC5B,qBAAqB;YAarB,cAAc;IAS5B;;;;;;OAMG;YACW,eAAe;IAe7B;;;;;;OAMG;IACU,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE;IASlG;;;;OAIG;IACU,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;IAS/C;;;OAGG;IACU,WAAW,CAAC,GAAG,EAAE,GAAG;IAQjC,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,sBAAsB;IAiD9B;;OAEG;IACU,iBAAiB;;;oBAKA,MAAM,EAAE;oBAAU,MAAM,EAAE;;;CA6BxD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,UAEvC;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ;;;GAwB1F"}
|
package/out/dlo/compiler.js
CHANGED
|
@@ -24,28 +24,30 @@ 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;
|
|
27
28
|
exports.generateConfigFile = generateConfigFile;
|
|
28
29
|
const preCompiler_1 = require("./preCompiler");
|
|
29
30
|
const vscode_uri_1 = require("vscode-uri");
|
|
30
|
-
const FS_1 = require("../FS");
|
|
31
31
|
const manifest_1 = require("../manifest");
|
|
32
32
|
const defaultFiles_1 = require("../defaultFiles");
|
|
33
33
|
const dependencies_1 = require("../dependencies");
|
|
34
34
|
const iconv = __importStar(require("iconv-lite"));
|
|
35
|
-
const
|
|
35
|
+
const helper_1 = require("../helper");
|
|
36
|
+
var convertBlobToStringArray = helper_1.Helper.convertBlobToStringArray;
|
|
37
|
+
const DLO_MODULE = require('./dlocc.js');
|
|
36
38
|
class DloCompiler {
|
|
37
39
|
preCompiler = new preCompiler_1.DloPreCompiler();
|
|
38
|
-
|
|
40
|
+
dloCC;
|
|
39
41
|
stdout = [];
|
|
40
42
|
stderr = [];
|
|
41
43
|
constructor() {
|
|
42
|
-
this.
|
|
44
|
+
this.dloCC = null;
|
|
43
45
|
}
|
|
44
|
-
async
|
|
46
|
+
async initDloCC(noExit = false) {
|
|
45
47
|
this.stdout.length = 0;
|
|
46
48
|
this.stderr.length = 0;
|
|
47
|
-
this.
|
|
48
|
-
noExitRuntime:
|
|
49
|
+
this.dloCC = await DLO_MODULE({
|
|
50
|
+
noExitRuntime: noExit,
|
|
49
51
|
print: (data) => {
|
|
50
52
|
console.log(data);
|
|
51
53
|
this.stdout.push(data);
|
|
@@ -58,12 +60,12 @@ class DloCompiler {
|
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
62
|
get MEMFS() {
|
|
61
|
-
return this.
|
|
63
|
+
return this.dloCC.FS;
|
|
62
64
|
}
|
|
63
65
|
async compile(cwd, fs) {
|
|
64
66
|
const manifest = await manifest_1.Manifest.read(cwd, fs);
|
|
65
|
-
await this.
|
|
66
|
-
const precompilerDiagnostics = await this.
|
|
67
|
+
await this.initDloCC();
|
|
68
|
+
const precompilerDiagnostics = await this.persistDloFiles(cwd, fs, manifest);
|
|
67
69
|
const mainFile = vscode_uri_1.Utils.joinPath(cwd, manifest.dlo?.mainFile || defaultFiles_1.DefaultFiles.filePaths.dlo.mainDLO);
|
|
68
70
|
const options = [];
|
|
69
71
|
// todo only add cfg file to options if not already set!
|
|
@@ -74,7 +76,7 @@ class DloCompiler {
|
|
|
74
76
|
}
|
|
75
77
|
let exitCode = 0;
|
|
76
78
|
try {
|
|
77
|
-
exitCode = await this.
|
|
79
|
+
exitCode = await this.dloCC.callMain([uriToMemFsPath(mainFile), ...options]);
|
|
78
80
|
// compiler doesn't have any errors
|
|
79
81
|
if (exitCode === 0) {
|
|
80
82
|
await this.persistGeneratedFiles(cwd, fs, mainFile);
|
|
@@ -104,35 +106,74 @@ class DloCompiler {
|
|
|
104
106
|
async readConfigFile(fs, configPath) {
|
|
105
107
|
if (await fs.stat(configPath)) {
|
|
106
108
|
const content = await fs.readFile(configPath);
|
|
107
|
-
return
|
|
109
|
+
return convertBlobToStringArray(content);
|
|
108
110
|
}
|
|
109
111
|
else {
|
|
110
112
|
return [];
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
/**
|
|
114
|
-
*
|
|
116
|
+
* Search for all dlo files and persist it to the MEMFS
|
|
115
117
|
* @param cwd
|
|
116
118
|
* @param fs
|
|
117
119
|
* @param manifest
|
|
118
120
|
* @private
|
|
119
121
|
*/
|
|
120
|
-
async
|
|
122
|
+
async persistDloFiles(cwd, fs, manifest) {
|
|
121
123
|
const files = await fs.findFiles(cwd, '**/*.{dlo,inc}');
|
|
122
124
|
const precompilerDiagnostics = [];
|
|
123
125
|
// add dlo.cfg file to the file list
|
|
124
126
|
for (const file of files) {
|
|
125
127
|
if (await fs.stat(file)) {
|
|
126
128
|
const content = await fs.readFile(file);
|
|
127
|
-
const stringBlob =
|
|
128
|
-
const
|
|
129
|
-
precompilerDiagnostics.push(...
|
|
130
|
-
this.memFSmkdir(file);
|
|
131
|
-
this.MEMFS.writeFile(uriToMemFsPath(file), iconv.encode(preCompiled.data, 'cp1252'));
|
|
129
|
+
const stringBlob = convertBlobToStringArray(content);
|
|
130
|
+
const diagnostics = await this.memFSwriteFile(cwd, manifest, file, stringBlob);
|
|
131
|
+
precompilerDiagnostics.push(...diagnostics);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
return precompilerDiagnostics;
|
|
135
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Precompile the given file and pass it to the MEMFS
|
|
138
|
+
* @param cwd
|
|
139
|
+
* @param manifest
|
|
140
|
+
* @param file
|
|
141
|
+
* @param stringBlob
|
|
142
|
+
*/
|
|
143
|
+
async memFSwriteFile(cwd, manifest, file, stringBlob) {
|
|
144
|
+
const precompilerDiagnostics = [];
|
|
145
|
+
const preCompiled = await this.preCompiler.preCompileDloFile(cwd, manifest, file, stringBlob);
|
|
146
|
+
precompilerDiagnostics.push(...preCompiled.diagnostics);
|
|
147
|
+
this.memFSmkdir(file);
|
|
148
|
+
this.MEMFS.writeFile(uriToMemFsPath(file), iconv.encode(preCompiled.data, 'cp1252'));
|
|
149
|
+
return precompilerDiagnostics;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Move a file within the MEMFS
|
|
153
|
+
* @param oldUri
|
|
154
|
+
* @param newUri
|
|
155
|
+
*/
|
|
156
|
+
async memFSmove(oldUri, newUri) {
|
|
157
|
+
try {
|
|
158
|
+
this.memFSmkdir(newUri);
|
|
159
|
+
this.MEMFS.rename(uriToMemFsPath(oldUri), uriToMemFsPath(newUri));
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
console.error('memFSmove', e);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Remove a file from the MEMFS
|
|
167
|
+
* @param uri
|
|
168
|
+
*/
|
|
169
|
+
async memFSunlink(uri) {
|
|
170
|
+
try {
|
|
171
|
+
this.MEMFS.unlink(uriToMemFsPath(uri));
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
console.error('memFSunlink', e);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
136
177
|
memFSmkdir(uri) {
|
|
137
178
|
const split = uriToMemFsPath(vscode_uri_1.Utils.dirname(uri)).split('/');
|
|
138
179
|
let dirname = '';
|
|
@@ -147,7 +188,7 @@ class DloCompiler {
|
|
|
147
188
|
}
|
|
148
189
|
}
|
|
149
190
|
catch (e) {
|
|
150
|
-
console.error('
|
|
191
|
+
console.error('memFSmkdir', e);
|
|
151
192
|
}
|
|
152
193
|
});
|
|
153
194
|
}
|
|
@@ -202,6 +243,40 @@ class DloCompiler {
|
|
|
202
243
|
}
|
|
203
244
|
return compilerDiagnostics;
|
|
204
245
|
}
|
|
246
|
+
//Symbol Compiler handling
|
|
247
|
+
/**
|
|
248
|
+
* Get a symbol compiler instance
|
|
249
|
+
*/
|
|
250
|
+
async getSymbolCompiler() {
|
|
251
|
+
// generate a none exiting wasm compiler runtime as main filesystem
|
|
252
|
+
if (!this.dloCC) {
|
|
253
|
+
await this.initDloCC(true);
|
|
254
|
+
}
|
|
255
|
+
const compilerLog = {
|
|
256
|
+
stdout: [],
|
|
257
|
+
stderr: []
|
|
258
|
+
};
|
|
259
|
+
const dloSymbol = await DLO_MODULE({
|
|
260
|
+
noExitRuntime: false,
|
|
261
|
+
print: (data) => {
|
|
262
|
+
compilerLog.stdout.push(data);
|
|
263
|
+
},
|
|
264
|
+
printErr: (err) => {
|
|
265
|
+
compilerLog.stderr.push(err);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
// mount the main filesystem
|
|
269
|
+
dloSymbol.FS.mkdir('/baseDir');
|
|
270
|
+
dloSymbol.FS.mount(dloSymbol.PROXYFS, {
|
|
271
|
+
root: '/',
|
|
272
|
+
fs: this.dloCC.FS
|
|
273
|
+
}, '/baseDir');
|
|
274
|
+
dloSymbol.FS.chdir('baseDir');
|
|
275
|
+
return {
|
|
276
|
+
compiler: dloSymbol,
|
|
277
|
+
print: compilerLog
|
|
278
|
+
};
|
|
279
|
+
}
|
|
205
280
|
}
|
|
206
281
|
exports.DloCompiler = DloCompiler;
|
|
207
282
|
function uriToMemFsPath(path) {
|
package/out/dlo/dlo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlo.d.ts","sourceRoot":"","sources":["../../src/dlo/dlo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAsB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"dlo.d.ts","sourceRoot":"","sources":["../../src/dlo/dlo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAsB,cAAc,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC,yBAAiB,GAAG,CAAC;IACb,MAAM,aAAa,yBAAmB,CAAC;IAC9C,KAAY,aAAa,GAAG,gBAAgB,CAAC;IAEtC,MAAM,WAAW,uBAAiB,CAAC;IAC1C,KAAY,WAAW,GAAG,cAAc,CAAC;IAEzC;;OAEG;IACI,MAAM,QAAQ,oBAAc,CAAC;IACpC,KAAY,QAAQ,GAAG,WAAW,CAAC;IAE5B,MAAM,UAAU,uBAAiB,CAAC;IAEzC;;;;OAIG;IACH,SAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,iBAK1D;CACD"}
|
package/out/dlo/dlo.js
CHANGED
package/out/dlo/dlocc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlocc.d.ts","sourceRoot":"","sources":["../../src/dlo/dlocc.js"],"names":[],"mappings":";AAGQ,
|
|
1
|
+
{"version":3,"file":"dlocc.d.ts","sourceRoot":"","sources":["../../src/dlo/dlocc.js"],"names":[],"mappings":";AAGQ,sDAgiHN"}
|