@needle-tools/needle-component-compiler 3.0.0-alpha → 3.0.0-alpha.1.999f08a
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 +133 -88
- package/Readme.md +93 -19
- package/dist/BaseWriter.d.ts +23 -23
- package/dist/BaseWriter.js +90 -90
- package/dist/Compiler.d.ts +22 -20
- package/dist/Compiler.js +447 -412
- package/dist/base-compiler.d.ts +54 -54
- package/dist/base-compiler.js +168 -168
- package/dist/commands.d.ts +3 -3
- package/dist/commands.js +15 -15
- package/dist/component-compiler.d.ts +3 -3
- package/dist/component-compiler.js +816 -704
- package/dist/impl/blender-compiler.d.ts +14 -14
- package/dist/impl/blender-compiler.js +185 -179
- package/dist/impl/csharp-compiler.d.ts +16 -16
- package/dist/impl/csharp-compiler.js +307 -306
- package/dist/impl/react-three-fiber-compiler.d.ts +20 -20
- package/dist/impl/react-three-fiber-compiler.js +36 -36
- package/dist/register-types.d.ts +8 -8
- package/dist/register-types.js +34 -34
- package/dist/watcher.d.ts +6 -6
- package/dist/watcher.js +79 -79
- package/package.json +60 -55
package/dist/base-compiler.d.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { TypeSourceInformation } from "./register-types";
|
|
2
|
-
import { Compiler } from "./Compiler";
|
|
3
|
-
export declare enum Visibility {
|
|
4
|
-
Public = 0,
|
|
5
|
-
Protected = 1,
|
|
6
|
-
Private = 2
|
|
7
|
-
}
|
|
8
|
-
export declare type Argument = {
|
|
9
|
-
name: string;
|
|
10
|
-
type: string;
|
|
11
|
-
defaultValue?: string;
|
|
12
|
-
};
|
|
13
|
-
export interface ISink {
|
|
14
|
-
flush(id: string, str: string): string;
|
|
15
|
-
}
|
|
16
|
-
export declare class FileSink implements ISink {
|
|
17
|
-
private directory;
|
|
18
|
-
constructor(directory: string);
|
|
19
|
-
flush(id: string, str: string): string;
|
|
20
|
-
}
|
|
21
|
-
export declare class MemorySink implements ISink {
|
|
22
|
-
results: string[];
|
|
23
|
-
clear(): void;
|
|
24
|
-
flush(id: string, str: string): string;
|
|
25
|
-
}
|
|
26
|
-
export declare class CodeTextWriter {
|
|
27
|
-
private indent;
|
|
28
|
-
private lines;
|
|
29
|
-
beginBlock(line: string): void;
|
|
30
|
-
endBlock(line: string): void;
|
|
31
|
-
writeLine(line: string): void;
|
|
32
|
-
write(text: string): void;
|
|
33
|
-
flush(): string;
|
|
34
|
-
clear(): void;
|
|
35
|
-
toString(): string;
|
|
36
|
-
}
|
|
37
|
-
export declare function handleDeletedFile(filePath: string, types: TypeSourceInformation): void;
|
|
38
|
-
export declare type EnumMember = {
|
|
39
|
-
name: string;
|
|
40
|
-
value: number | string;
|
|
41
|
-
};
|
|
42
|
-
export interface IWriter {
|
|
43
|
-
get outputInfo(): TypeSourceInformation;
|
|
44
|
-
begin(filePath: string | null): void;
|
|
45
|
-
resolveCSharpTypeName(typescriptTypeName: string, baseTypes?: string[]): string | void;
|
|
46
|
-
end(filePath: string | null): void;
|
|
47
|
-
startNewType(filePath: string | null, typeName: string, baseType: string[], comments?: string[]): void | boolean;
|
|
48
|
-
endNewType(filePath: string | null, typeName: string): void;
|
|
49
|
-
writeMember(visibility: Visibility, name: string, isArray: boolean, type: string, initialValue?: string, comments?: string[]): void;
|
|
50
|
-
writeMethod(visibility: Visibility, name: string, returnType: string | undefined, args: Argument[], comments: string[]): void;
|
|
51
|
-
writeNewTypeExpression(typeName: string, args?: string[]): void;
|
|
52
|
-
registerEnum(name: string, members: EnumMember[]): void;
|
|
53
|
-
}
|
|
54
|
-
export declare function runFromFile(writer: IWriter, path: string): Compiler;
|
|
1
|
+
import { TypeSourceInformation } from "./register-types";
|
|
2
|
+
import { Compiler } from "./Compiler";
|
|
3
|
+
export declare enum Visibility {
|
|
4
|
+
Public = 0,
|
|
5
|
+
Protected = 1,
|
|
6
|
+
Private = 2
|
|
7
|
+
}
|
|
8
|
+
export declare type Argument = {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface ISink {
|
|
14
|
+
flush(id: string, str: string): string;
|
|
15
|
+
}
|
|
16
|
+
export declare class FileSink implements ISink {
|
|
17
|
+
private directory;
|
|
18
|
+
constructor(directory: string);
|
|
19
|
+
flush(id: string, str: string): string;
|
|
20
|
+
}
|
|
21
|
+
export declare class MemorySink implements ISink {
|
|
22
|
+
results: string[];
|
|
23
|
+
clear(): void;
|
|
24
|
+
flush(id: string, str: string): string;
|
|
25
|
+
}
|
|
26
|
+
export declare class CodeTextWriter {
|
|
27
|
+
private indent;
|
|
28
|
+
private lines;
|
|
29
|
+
beginBlock(line: string): void;
|
|
30
|
+
endBlock(line: string): void;
|
|
31
|
+
writeLine(line: string): void;
|
|
32
|
+
write(text: string): void;
|
|
33
|
+
flush(): string;
|
|
34
|
+
clear(): void;
|
|
35
|
+
toString(): string;
|
|
36
|
+
}
|
|
37
|
+
export declare function handleDeletedFile(filePath: string, types: TypeSourceInformation): void;
|
|
38
|
+
export declare type EnumMember = {
|
|
39
|
+
name: string;
|
|
40
|
+
value: number | string;
|
|
41
|
+
};
|
|
42
|
+
export interface IWriter {
|
|
43
|
+
get outputInfo(): TypeSourceInformation;
|
|
44
|
+
begin(filePath: string | null): void;
|
|
45
|
+
resolveCSharpTypeName(typescriptTypeName: string, baseTypes?: string[]): string | void;
|
|
46
|
+
end(filePath: string | null): void;
|
|
47
|
+
startNewType(filePath: string | null, typeName: string, baseType: string[], comments?: string[]): void | boolean;
|
|
48
|
+
endNewType(filePath: string | null, typeName: string): void;
|
|
49
|
+
writeMember(visibility: Visibility, name: string, isArray: boolean, type: string, initialValue?: string, comments?: string[]): void;
|
|
50
|
+
writeMethod(visibility: Visibility, name: string, returnType: string | undefined, args: Argument[], comments: string[]): void;
|
|
51
|
+
writeNewTypeExpression(typeName: string, args?: string[]): void;
|
|
52
|
+
registerEnum(name: string, members: EnumMember[]): void;
|
|
53
|
+
}
|
|
54
|
+
export declare function runFromFile(writer: IWriter, path: string): Compiler;
|
package/dist/base-compiler.js
CHANGED
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runFromFile = exports.handleDeletedFile = exports.CodeTextWriter = exports.MemorySink = exports.FileSink = exports.Visibility = void 0;
|
|
4
|
-
var fs_1 = require("fs");
|
|
5
|
-
var fs = require("fs");
|
|
6
|
-
var commands_1 = require("./commands");
|
|
7
|
-
var Compiler_1 = require("./Compiler");
|
|
8
|
-
var Visibility;
|
|
9
|
-
(function (Visibility) {
|
|
10
|
-
Visibility[Visibility["Public"] = 0] = "Public";
|
|
11
|
-
Visibility[Visibility["Protected"] = 1] = "Protected";
|
|
12
|
-
Visibility[Visibility["Private"] = 2] = "Private";
|
|
13
|
-
})(Visibility = exports.Visibility || (exports.Visibility = {}));
|
|
14
|
-
var FileSink = /** @class */ (function () {
|
|
15
|
-
function FileSink(directory) {
|
|
16
|
-
this.directory = directory;
|
|
17
|
-
}
|
|
18
|
-
FileSink.prototype.flush = function (id, str) {
|
|
19
|
-
if (!fs.existsSync(this.directory)) {
|
|
20
|
-
fs.mkdirSync(this.directory, { recursive: true });
|
|
21
|
-
}
|
|
22
|
-
console.log("Writing " + id + " to " + this.directory);
|
|
23
|
-
var fullPath = this.directory + "/" + id;
|
|
24
|
-
fs.writeFileSync(fullPath, str);
|
|
25
|
-
return fs.realpathSync(fullPath);
|
|
26
|
-
};
|
|
27
|
-
return FileSink;
|
|
28
|
-
}());
|
|
29
|
-
exports.FileSink = FileSink;
|
|
30
|
-
var MemorySink = /** @class */ (function () {
|
|
31
|
-
function MemorySink() {
|
|
32
|
-
this.results = [];
|
|
33
|
-
}
|
|
34
|
-
MemorySink.prototype.clear = function () {
|
|
35
|
-
this.results.length = 0;
|
|
36
|
-
};
|
|
37
|
-
MemorySink.prototype.flush = function (id, str) {
|
|
38
|
-
this.results.push(str);
|
|
39
|
-
return "";
|
|
40
|
-
};
|
|
41
|
-
return MemorySink;
|
|
42
|
-
}());
|
|
43
|
-
exports.MemorySink = MemorySink;
|
|
44
|
-
var CodeTextWriter = /** @class */ (function () {
|
|
45
|
-
function CodeTextWriter() {
|
|
46
|
-
this.indent = 0;
|
|
47
|
-
this.lines = [];
|
|
48
|
-
}
|
|
49
|
-
CodeTextWriter.prototype.beginBlock = function (line) {
|
|
50
|
-
this.writeLine(line);
|
|
51
|
-
this.indent++;
|
|
52
|
-
};
|
|
53
|
-
CodeTextWriter.prototype.endBlock = function (line) {
|
|
54
|
-
// remove the comma from the last line
|
|
55
|
-
if (this.lines.length > 0) {
|
|
56
|
-
var prevLine = this.lines[this.lines.length - 1];
|
|
57
|
-
if (prevLine.endsWith(",")) {
|
|
58
|
-
this.lines[this.lines.length - 1] = prevLine.substring(0, prevLine.length - 1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
this.indent--;
|
|
62
|
-
this.writeLine(line);
|
|
63
|
-
};
|
|
64
|
-
CodeTextWriter.prototype.writeLine = function (line) {
|
|
65
|
-
var indent = "";
|
|
66
|
-
for (var i = 0; i < this.indent; i++) {
|
|
67
|
-
indent += " ";
|
|
68
|
-
}
|
|
69
|
-
var lines = line.split(/\r?\n/);
|
|
70
|
-
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
|
|
71
|
-
var line_1 = lines_1[_i];
|
|
72
|
-
// remove whitespace so we can ensure we correctly end with a comma
|
|
73
|
-
this.lines.push(indent + (line_1 === null || line_1 === void 0 ? void 0 : line_1.trim()));
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
CodeTextWriter.prototype.write = function (text) {
|
|
77
|
-
var lines = text.split(/\r?\n/);
|
|
78
|
-
if (lines.length > 1) {
|
|
79
|
-
for (var i = 0; i < lines.length; i++) {
|
|
80
|
-
this.writeLine(lines[i]);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
if (this.lines.length == 0) {
|
|
85
|
-
this.writeLine(text);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
var lastLine = this.lines[this.lines.length - 1];
|
|
89
|
-
this.lines[this.lines.length - 1] = lastLine + text;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
// beginArray() {
|
|
94
|
-
// this.writeLine("[");
|
|
95
|
-
// this.indent++;
|
|
96
|
-
// }
|
|
97
|
-
// insertArrayItem(item: string) {
|
|
98
|
-
// this.writeLine(item + ",");
|
|
99
|
-
// }
|
|
100
|
-
// endArray() {
|
|
101
|
-
// }
|
|
102
|
-
CodeTextWriter.prototype.flush = function () {
|
|
103
|
-
var str = this.toString();
|
|
104
|
-
this.lines.length = 0;
|
|
105
|
-
return str;
|
|
106
|
-
// if (this.lines.length === 0) return;
|
|
107
|
-
// if (!fs.existsSync(directory)) {
|
|
108
|
-
// fs.mkdirSync(directory, { recursive: true });
|
|
109
|
-
// }
|
|
110
|
-
// console.log("Writing " + filename + " to " + directory);
|
|
111
|
-
// const content = this.toString();
|
|
112
|
-
// this.lines.length = 0;
|
|
113
|
-
// const fullPath = directory + "/" + filename;
|
|
114
|
-
// fs.writeFileSync(fullPath, content);
|
|
115
|
-
// return fs.realpathSync(fullPath);
|
|
116
|
-
};
|
|
117
|
-
CodeTextWriter.prototype.clear = function () {
|
|
118
|
-
this.lines.length = 0;
|
|
119
|
-
};
|
|
120
|
-
CodeTextWriter.prototype.toString = function () {
|
|
121
|
-
return this.lines.join("\r");
|
|
122
|
-
};
|
|
123
|
-
return CodeTextWriter;
|
|
124
|
-
}());
|
|
125
|
-
exports.CodeTextWriter = CodeTextWriter;
|
|
126
|
-
function handleDeletedFile(filePath, types) {
|
|
127
|
-
if (!fs.existsSync(filePath)) {
|
|
128
|
-
var infos = types[filePath];
|
|
129
|
-
if (!infos)
|
|
130
|
-
return;
|
|
131
|
-
for (var i = 0; i < infos.length; i++) {
|
|
132
|
-
var info = infos[i];
|
|
133
|
-
// check if the source file is in any other file
|
|
134
|
-
var found = false;
|
|
135
|
-
for (var otherSourceFile in types) {
|
|
136
|
-
if (otherSourceFile == filePath)
|
|
137
|
-
continue;
|
|
138
|
-
for (var _i = 0, _a = types[otherSourceFile]; _i < _a.length; _i++) {
|
|
139
|
-
var otherInfo = _a[_i];
|
|
140
|
-
if (otherInfo.filePath == info.filePath) {
|
|
141
|
-
found = true;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (found)
|
|
146
|
-
break;
|
|
147
|
-
if (fs.existsSync(info.filePath)) {
|
|
148
|
-
fs.rmSync(info.filePath);
|
|
149
|
-
(0, commands_1.sendFileDeletedCommand)(info.filePath);
|
|
150
|
-
infos.splice(i, 1);
|
|
151
|
-
i--;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
exports.handleDeletedFile = handleDeletedFile;
|
|
158
|
-
function runFromFile(writer, path) {
|
|
159
|
-
if (!fs.existsSync(path)) {
|
|
160
|
-
console.error("File not found", path);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
var code = (0, fs_1.readFileSync)(path).toString();
|
|
164
|
-
var compiler = new Compiler_1.Compiler();
|
|
165
|
-
compiler.compile(writer, code, path);
|
|
166
|
-
return compiler;
|
|
167
|
-
}
|
|
168
|
-
exports.runFromFile = runFromFile;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runFromFile = exports.handleDeletedFile = exports.CodeTextWriter = exports.MemorySink = exports.FileSink = exports.Visibility = void 0;
|
|
4
|
+
var fs_1 = require("fs");
|
|
5
|
+
var fs = require("fs");
|
|
6
|
+
var commands_1 = require("./commands");
|
|
7
|
+
var Compiler_1 = require("./Compiler");
|
|
8
|
+
var Visibility;
|
|
9
|
+
(function (Visibility) {
|
|
10
|
+
Visibility[Visibility["Public"] = 0] = "Public";
|
|
11
|
+
Visibility[Visibility["Protected"] = 1] = "Protected";
|
|
12
|
+
Visibility[Visibility["Private"] = 2] = "Private";
|
|
13
|
+
})(Visibility = exports.Visibility || (exports.Visibility = {}));
|
|
14
|
+
var FileSink = /** @class */ (function () {
|
|
15
|
+
function FileSink(directory) {
|
|
16
|
+
this.directory = directory;
|
|
17
|
+
}
|
|
18
|
+
FileSink.prototype.flush = function (id, str) {
|
|
19
|
+
if (!fs.existsSync(this.directory)) {
|
|
20
|
+
fs.mkdirSync(this.directory, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
console.log("Writing " + id + " to " + this.directory);
|
|
23
|
+
var fullPath = this.directory + "/" + id;
|
|
24
|
+
fs.writeFileSync(fullPath, str);
|
|
25
|
+
return fs.realpathSync(fullPath);
|
|
26
|
+
};
|
|
27
|
+
return FileSink;
|
|
28
|
+
}());
|
|
29
|
+
exports.FileSink = FileSink;
|
|
30
|
+
var MemorySink = /** @class */ (function () {
|
|
31
|
+
function MemorySink() {
|
|
32
|
+
this.results = [];
|
|
33
|
+
}
|
|
34
|
+
MemorySink.prototype.clear = function () {
|
|
35
|
+
this.results.length = 0;
|
|
36
|
+
};
|
|
37
|
+
MemorySink.prototype.flush = function (id, str) {
|
|
38
|
+
this.results.push(str);
|
|
39
|
+
return "";
|
|
40
|
+
};
|
|
41
|
+
return MemorySink;
|
|
42
|
+
}());
|
|
43
|
+
exports.MemorySink = MemorySink;
|
|
44
|
+
var CodeTextWriter = /** @class */ (function () {
|
|
45
|
+
function CodeTextWriter() {
|
|
46
|
+
this.indent = 0;
|
|
47
|
+
this.lines = [];
|
|
48
|
+
}
|
|
49
|
+
CodeTextWriter.prototype.beginBlock = function (line) {
|
|
50
|
+
this.writeLine(line);
|
|
51
|
+
this.indent++;
|
|
52
|
+
};
|
|
53
|
+
CodeTextWriter.prototype.endBlock = function (line) {
|
|
54
|
+
// remove the comma from the last line
|
|
55
|
+
if (this.lines.length > 0) {
|
|
56
|
+
var prevLine = this.lines[this.lines.length - 1];
|
|
57
|
+
if (prevLine.endsWith(",")) {
|
|
58
|
+
this.lines[this.lines.length - 1] = prevLine.substring(0, prevLine.length - 1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
this.indent--;
|
|
62
|
+
this.writeLine(line);
|
|
63
|
+
};
|
|
64
|
+
CodeTextWriter.prototype.writeLine = function (line) {
|
|
65
|
+
var indent = "";
|
|
66
|
+
for (var i = 0; i < this.indent; i++) {
|
|
67
|
+
indent += " ";
|
|
68
|
+
}
|
|
69
|
+
var lines = line.split(/\r?\n/);
|
|
70
|
+
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
|
|
71
|
+
var line_1 = lines_1[_i];
|
|
72
|
+
// remove whitespace so we can ensure we correctly end with a comma
|
|
73
|
+
this.lines.push(indent + (line_1 === null || line_1 === void 0 ? void 0 : line_1.trim()));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
CodeTextWriter.prototype.write = function (text) {
|
|
77
|
+
var lines = text.split(/\r?\n/);
|
|
78
|
+
if (lines.length > 1) {
|
|
79
|
+
for (var i = 0; i < lines.length; i++) {
|
|
80
|
+
this.writeLine(lines[i]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if (this.lines.length == 0) {
|
|
85
|
+
this.writeLine(text);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
var lastLine = this.lines[this.lines.length - 1];
|
|
89
|
+
this.lines[this.lines.length - 1] = lastLine + text;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
// beginArray() {
|
|
94
|
+
// this.writeLine("[");
|
|
95
|
+
// this.indent++;
|
|
96
|
+
// }
|
|
97
|
+
// insertArrayItem(item: string) {
|
|
98
|
+
// this.writeLine(item + ",");
|
|
99
|
+
// }
|
|
100
|
+
// endArray() {
|
|
101
|
+
// }
|
|
102
|
+
CodeTextWriter.prototype.flush = function () {
|
|
103
|
+
var str = this.toString();
|
|
104
|
+
this.lines.length = 0;
|
|
105
|
+
return str;
|
|
106
|
+
// if (this.lines.length === 0) return;
|
|
107
|
+
// if (!fs.existsSync(directory)) {
|
|
108
|
+
// fs.mkdirSync(directory, { recursive: true });
|
|
109
|
+
// }
|
|
110
|
+
// console.log("Writing " + filename + " to " + directory);
|
|
111
|
+
// const content = this.toString();
|
|
112
|
+
// this.lines.length = 0;
|
|
113
|
+
// const fullPath = directory + "/" + filename;
|
|
114
|
+
// fs.writeFileSync(fullPath, content);
|
|
115
|
+
// return fs.realpathSync(fullPath);
|
|
116
|
+
};
|
|
117
|
+
CodeTextWriter.prototype.clear = function () {
|
|
118
|
+
this.lines.length = 0;
|
|
119
|
+
};
|
|
120
|
+
CodeTextWriter.prototype.toString = function () {
|
|
121
|
+
return this.lines.join("\r");
|
|
122
|
+
};
|
|
123
|
+
return CodeTextWriter;
|
|
124
|
+
}());
|
|
125
|
+
exports.CodeTextWriter = CodeTextWriter;
|
|
126
|
+
function handleDeletedFile(filePath, types) {
|
|
127
|
+
if (!fs.existsSync(filePath)) {
|
|
128
|
+
var infos = types[filePath];
|
|
129
|
+
if (!infos)
|
|
130
|
+
return;
|
|
131
|
+
for (var i = 0; i < infos.length; i++) {
|
|
132
|
+
var info = infos[i];
|
|
133
|
+
// check if the source file is in any other file
|
|
134
|
+
var found = false;
|
|
135
|
+
for (var otherSourceFile in types) {
|
|
136
|
+
if (otherSourceFile == filePath)
|
|
137
|
+
continue;
|
|
138
|
+
for (var _i = 0, _a = types[otherSourceFile]; _i < _a.length; _i++) {
|
|
139
|
+
var otherInfo = _a[_i];
|
|
140
|
+
if (otherInfo.filePath == info.filePath) {
|
|
141
|
+
found = true;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (found)
|
|
146
|
+
break;
|
|
147
|
+
if (fs.existsSync(info.filePath)) {
|
|
148
|
+
fs.rmSync(info.filePath);
|
|
149
|
+
(0, commands_1.sendFileDeletedCommand)(info.filePath);
|
|
150
|
+
infos.splice(i, 1);
|
|
151
|
+
i--;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.handleDeletedFile = handleDeletedFile;
|
|
158
|
+
function runFromFile(writer, path) {
|
|
159
|
+
if (!fs.existsSync(path)) {
|
|
160
|
+
console.error("File not found", path);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
var code = (0, fs_1.readFileSync)(path).toString();
|
|
164
|
+
var compiler = new Compiler_1.Compiler();
|
|
165
|
+
compiler.compile(writer, code, path);
|
|
166
|
+
return compiler;
|
|
167
|
+
}
|
|
168
|
+
exports.runFromFile = runFromFile;
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function sendReloadCommand(): void;
|
|
2
|
-
export declare function sendFileWrittenCommand(path: string): void;
|
|
3
|
-
export declare function sendFileDeletedCommand(path: string): void;
|
|
1
|
+
export declare function sendReloadCommand(): void;
|
|
2
|
+
export declare function sendFileWrittenCommand(path: string): void;
|
|
3
|
+
export declare function sendFileDeletedCommand(path: string): void;
|
package/dist/commands.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendFileDeletedCommand = exports.sendFileWrittenCommand = exports.sendReloadCommand = void 0;
|
|
4
|
-
function sendReloadCommand() {
|
|
5
|
-
process.stdout.write("CMD:reload\r");
|
|
6
|
-
}
|
|
7
|
-
exports.sendReloadCommand = sendReloadCommand;
|
|
8
|
-
function sendFileWrittenCommand(path) {
|
|
9
|
-
process.stdout.write("CMD:writefile " + path + "\r");
|
|
10
|
-
}
|
|
11
|
-
exports.sendFileWrittenCommand = sendFileWrittenCommand;
|
|
12
|
-
function sendFileDeletedCommand(path) {
|
|
13
|
-
process.stdout.write("CMD:deletedfile " + path + "\r");
|
|
14
|
-
}
|
|
15
|
-
exports.sendFileDeletedCommand = sendFileDeletedCommand;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendFileDeletedCommand = exports.sendFileWrittenCommand = exports.sendReloadCommand = void 0;
|
|
4
|
+
function sendReloadCommand() {
|
|
5
|
+
process.stdout.write("CMD:reload\r");
|
|
6
|
+
}
|
|
7
|
+
exports.sendReloadCommand = sendReloadCommand;
|
|
8
|
+
function sendFileWrittenCommand(path) {
|
|
9
|
+
process.stdout.write("CMD:writefile " + path + "\r");
|
|
10
|
+
}
|
|
11
|
+
exports.sendFileWrittenCommand = sendFileWrittenCommand;
|
|
12
|
+
function sendFileDeletedCommand(path) {
|
|
13
|
+
process.stdout.write("CMD:deletedfile " + path + "\r");
|
|
14
|
+
}
|
|
15
|
+
exports.sendFileDeletedCommand = sendFileDeletedCommand;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as ts from "typescript";
|
|
2
|
-
export declare function compile(code: string, fileName: string, outputDir: string | null, debugLogs?: boolean): string[];
|
|
3
|
-
export declare function run(program: ts.Program, outputDir: string | null, sourceFile: ts.SourceFile): string[];
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
export declare function compile(code: string, fileName: string, outputDir: string | null, debugLogs?: boolean): string[];
|
|
3
|
+
export declare function run(program: ts.Program, outputDir: string | null, sourceFile: ts.SourceFile): string[];
|