@needle-tools/needle-component-compiler 1.7.1 → 1.7.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 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.7.1] - 2022-07-27
8
+ - fix UnityEvent codegen
9
+
7
10
  ## [1.7.1] - 2022-07-25
8
11
  - fix array type codegen, for example ``scenes: Array<AssetReference> = [];``, see issue https://github.com/needle-tools/needle-tiny-playground/issues/285
9
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/needle-component-compiler",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Compile mock unity components from typescript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -367,13 +367,15 @@ function run(program, outputDir, sourceFile) {
367
367
  var args = undefined;
368
368
  for (var _i = 0, _a = node.getChildren(); _i < _a.length; _i++) {
369
369
  var ch = _a[_i];
370
- // console.log("child", ts.SyntaxKind[ch.kind]);
370
+ var text = ch.getText();
371
+ // console.log("child", ts.SyntaxKind[ch.kind], text);
371
372
  switch (ch.kind) {
373
+ case ts.SyntaxKind.Identifier:
372
374
  case ts.SyntaxKind.PropertyAccessExpression:
373
- type = tryGetTypeFromText(ch.getText());
375
+ type = tryGetTypeFromText(text);
374
376
  break;
375
377
  case ts.SyntaxKind.SyntaxList:
376
- args = ch.getText();
378
+ args = text;
377
379
  break;
378
380
  }
379
381
  }
@@ -385,6 +387,7 @@ function run(program, outputDir, sourceFile) {
385
387
  break;
386
388
  }
387
389
  var str = node.getText();
390
+ console.log("Unknown assignment:", str, ts.SyntaxKind[node.kind]);
388
391
  return str;
389
392
  }
390
393
  function isPublic(node) {
@@ -382,13 +382,15 @@ export function run(program: ts.Program, outputDir: string, sourceFile: ts.Sourc
382
382
  let type: string | undefined = undefined;
383
383
  let args: string | undefined = undefined;
384
384
  for (const ch of node.getChildren()) {
385
- // console.log("child", ts.SyntaxKind[ch.kind]);
385
+ const text = ch.getText();
386
+ // console.log("child", ts.SyntaxKind[ch.kind], text);
386
387
  switch (ch.kind) {
388
+ case ts.SyntaxKind.Identifier:
387
389
  case ts.SyntaxKind.PropertyAccessExpression:
388
- type = tryGetTypeFromText(ch.getText());
390
+ type = tryGetTypeFromText(text);
389
391
  break;
390
392
  case ts.SyntaxKind.SyntaxList:
391
- args = ch.getText();
393
+ args = text;
392
394
  break;
393
395
  }
394
396
  }
@@ -399,6 +401,7 @@ export function run(program: ts.Program, outputDir: string, sourceFile: ts.Sourc
399
401
  break;
400
402
  }
401
403
  const str = node.getText();
404
+ console.log("Unknown assignment:", str, ts.SyntaxKind[node.kind]);
402
405
  return str;
403
406
  }
404
407
 
package/src/test.ts CHANGED
@@ -1,7 +1,14 @@
1
1
  import { ThisExpression } from "typescript";
2
2
 
3
- export class SocLoader extends Behaviour {
3
+
4
4
 
5
+ export class EventComponent extends Behaviour {
6
+ @serializeable(EventList)
7
+ roomChanged: EventList = new EventList();
8
+ }
9
+
10
+ export class SocLoader extends Behaviour {
11
+
5
12
  @serializeable(AssetReference)
6
13
  scenes: Array<AssetReference> = [];
7
14
  }