@needle-tools/needle-component-compiler 1.2.0 → 1.2.1

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,7 +4,7 @@ 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.1.0] - 2022-06-15
7
+ ## [1.2.1] - 2022-06-15
8
8
  - allow adding ``@type(MyNamespace.MyType)`` to class declaration
9
9
 
10
10
  ## [1.1.0] - 2022-06-13
@@ -0,0 +1,13 @@
1
+ // auto generated code - do not edit directly
2
+
3
+ #pragma warning disable
4
+
5
+ namespace Needle.Typescript.GeneratedComponents
6
+ {
7
+ public partial class NavComponent : UnityEngine.MonoBehaviour
8
+ {
9
+ public void next(){}
10
+ public void prev(){}
11
+ public void isAtEnd(){}
12
+ }
13
+ }
@@ -4,7 +4,7 @@
4
4
 
5
5
  namespace Needle.Typescript.GeneratedComponents
6
6
  {
7
- public partial class NavigationManager : RoomEntity
7
+ public partial class NavigationManager : RoomEntity
8
8
  {
9
9
  public float @fl = 1f;
10
10
  public void nav_forward(){}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/needle-component-compiler",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Compile mock unity components from typescript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -119,10 +119,7 @@ function run(program, outputDir, sourceFile) {
119
119
  // for some reason our regex does also match surrounding ( ) even tho: https://regex101.com/r/PoWK6V/1
120
120
  // so we remove them
121
121
  var type = match.groups["type"];
122
- if (type.startsWith("("))
123
- type = type.slice(1);
124
- if (type.endsWith(")"))
125
- type = type.slice(0, -1);
122
+ type = type.replace(/\(/, "").replace(/\)/, "");
126
123
  console.log("found type: ", type);
127
124
  lastTypeFound = type;
128
125
  }
@@ -140,8 +140,7 @@ export function run(program: ts.Program, outputDir: string, sourceFile: ts.Sourc
140
140
  // for some reason our regex does also match surrounding ( ) even tho: https://regex101.com/r/PoWK6V/1
141
141
  // so we remove them
142
142
  let type = match.groups["type"];
143
- if (type.startsWith("(")) type = type.slice(1);
144
- if (type.endsWith(")")) type = type.slice(0, -1);
143
+ type = type.replace(/\(/, "").replace(/\)/, "");
145
144
  console.log("found type: ", type);
146
145
  lastTypeFound = type;
147
146
  }
package/src/test.ts CHANGED
@@ -1,7 +1,8 @@
1
1
 
2
- // @generate-component
2
+ import { Behaviour } from "needle.tiny.engine/engine-components/Component";
3
+ import { RoomEntity } from "./Room";
3
4
 
4
- //@type (RoomEntity)
5
+ //@type (RoomEntity)
5
6
  export class NavigationManager extends RoomEntity {
6
7
 
7
8
  fl:number = 1;
@@ -15,6 +16,13 @@ export class NavigationManager extends RoomEntity {
15
16
  }
16
17
  }
17
18
 
19
+ export abstract class NavComponent extends Behaviour {
20
+
21
+ abstract next();
22
+ abstract prev();
23
+ abstract isAtEnd():boolean;
24
+ }
25
+
18
26
 
19
27
  // export class PointOfInterest extends Behaviour {
20
28