@needle-tools/needle-component-compiler 1.11.1 → 1.11.2
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 +3 -0
- package/package.json +2 -2
- package/src/component-compiler.js +9 -3
- package/src/component-compiler.ts +10 -3
package/Changelog.md
CHANGED
|
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.11.2] - 2023-12-16
|
|
8
|
+
- Fix: property setter emitting invalid C# code
|
|
9
|
+
|
|
7
10
|
## [1.11.1] - 2023-12-02
|
|
8
11
|
- Fix: Use Unity AnimatorController type
|
|
9
12
|
- Fix: method inline anonymous type declaration (e.g. `myMethod(arg: {x:number})`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/needle-component-compiler",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"description": "Compile mock unity components from typescript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"chai": "^4.3.6",
|
|
20
20
|
"mocha": "^10.0.0",
|
|
21
21
|
"ts-node": "^10.9.1",
|
|
22
|
-
"npm-watch": "^0.
|
|
22
|
+
"npm-watch": "^0.13.0"
|
|
23
23
|
},
|
|
24
24
|
"watch": {
|
|
25
25
|
"compile": {
|
|
@@ -302,7 +302,7 @@ function run(program, outputDir, sourceFile) {
|
|
|
302
302
|
if (!context)
|
|
303
303
|
break;
|
|
304
304
|
if (allowDebugLogs)
|
|
305
|
-
console.log("Found variable", node.getText());
|
|
305
|
+
console.log("Found variable", ts.SyntaxKind[node.kind], "\n", node.getText());
|
|
306
306
|
var vardec = node;
|
|
307
307
|
var varName = "@" + vardec.name.getText();
|
|
308
308
|
var pub = shouldEmitMethod(vardec);
|
|
@@ -701,8 +701,14 @@ function run(program, outputDir, sourceFile) {
|
|
|
701
701
|
var isInGenericDeclaration = false;
|
|
702
702
|
for (var _b = 0, _c = node.getChildren(); _b < _c.length; _b++) {
|
|
703
703
|
var child = _c[_b];
|
|
704
|
-
//
|
|
705
|
-
|
|
704
|
+
// Fix https://linear.app/needle/issue/NE-4423
|
|
705
|
+
if (child.kind === ts.SyntaxKind.Block) {
|
|
706
|
+
if (allowDebugLogs)
|
|
707
|
+
console.log("Skip block");
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
if (allowDebugLogs)
|
|
711
|
+
console.log("Child type: " + ts.SyntaxKind[child.kind]);
|
|
706
712
|
var isGenericStart = false;
|
|
707
713
|
var isAssignment = false;
|
|
708
714
|
switch (child.kind) {
|
|
@@ -334,7 +334,7 @@ export function run(program: ts.Program, outputDir: string | null, sourceFile: t
|
|
|
334
334
|
resetExportNextClass();
|
|
335
335
|
if (!context) break;
|
|
336
336
|
if (allowDebugLogs)
|
|
337
|
-
console.log("Found variable", node.getText());
|
|
337
|
+
console.log("Found variable", ts.SyntaxKind[node.kind], "\n", node.getText());
|
|
338
338
|
const vardec = node as ts.VariableDeclaration;
|
|
339
339
|
|
|
340
340
|
const varName = "@" + vardec.name.getText();
|
|
@@ -735,8 +735,15 @@ export function run(program: ts.Program, outputDir: string | null, sourceFile: t
|
|
|
735
735
|
|
|
736
736
|
let isInGenericDeclaration = false;
|
|
737
737
|
for (const child of node.getChildren()) {
|
|
738
|
-
|
|
739
|
-
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
// Fix https://linear.app/needle/issue/NE-4423
|
|
741
|
+
if (child.kind === ts.SyntaxKind.Block) {
|
|
742
|
+
if(allowDebugLogs) console.log("Skip block");
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
if(allowDebugLogs) console.log("Child type: " + ts.SyntaxKind[child.kind]);
|
|
740
747
|
let isGenericStart = false;
|
|
741
748
|
let isAssignment = false;
|
|
742
749
|
switch (child.kind) {
|