@needle-tools/needle-component-compiler 1.6.0 → 1.6.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.6.0] - 2022-07-10
7
+ ## [1.6.1] - 2022-07-10
8
8
  - add using ``types.json`` json file that will be generated from Unity
9
9
  - change ``@type`` annotiation to only work without braces to be consistent
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/needle-component-compiler",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Compile mock unity components from typescript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,8 +12,8 @@ var exportNextClassCommand = "@generate-component";
12
12
  var dontExportNextClassCommand = "@dont-generate-component";
13
13
  // add above field to add [SerializeField] attribute
14
14
  var serializeCommand = "@serializeField";
15
- // https://regex101.com/r/ltpcKT/1
16
- var typePattern = new RegExp("@type ?(<type>[\w\.]+)");
15
+ // https://regex101.com/r/ltpcKT/2
16
+ var typePattern = new RegExp("@type ?(?<type>.+)");
17
17
  var ifdefPattern = new RegExp("@ifdef ?(?<ifdef>.+)");
18
18
  var CODEGEN_MARKER_START = "// NEEDLE_CODEGEN_START";
19
19
  var CODEGEN_MARKER_END = "// NEEDLE_CODEGEN_END";
@@ -156,7 +156,7 @@ function run(program, outputDir, sourceFile) {
156
156
  // so we remove them
157
157
  var type = typeMatch.groups["type"];
158
158
  type = type.replace(/\(/, "").replace(/\)/, "");
159
- console.log("found type: ", type);
159
+ console.log("Found type: ", type);
160
160
  lastTypeFound = type;
161
161
  }
162
162
  var ifdefMatch = ifdefPattern.exec(comment);
@@ -321,7 +321,6 @@ function run(program, outputDir, sourceFile) {
321
321
  return true;
322
322
  if (text === "Behaviour")
323
323
  return true;
324
- console.log(text);
325
324
  var known = tryGetKnownType(text);
326
325
  if (known)
327
326
  return known;
@@ -11,8 +11,8 @@ const exportNextClassCommand = "@generate-component";
11
11
  const dontExportNextClassCommand = "@dont-generate-component";
12
12
  // add above field to add [SerializeField] attribute
13
13
  const serializeCommand = "@serializeField";
14
- // https://regex101.com/r/ltpcKT/1
15
- const typePattern = new RegExp("@type ?(<type>[\w\.]+)");
14
+ // https://regex101.com/r/ltpcKT/2
15
+ const typePattern = new RegExp("@type ?(?<type>.+)");
16
16
  const ifdefPattern = new RegExp("@ifdef ?(?<ifdef>.+)")
17
17
 
18
18
  const CODEGEN_MARKER_START = "// NEEDLE_CODEGEN_START";
@@ -181,7 +181,7 @@ export function run(program: ts.Program, outputDir: string, sourceFile: ts.Sourc
181
181
  // so we remove them
182
182
  let type = typeMatch.groups["type"];
183
183
  type = type.replace(/\(/, "").replace(/\)/, "");
184
- console.log("found type: ", type);
184
+ console.log("Found type: ", type);
185
185
  lastTypeFound = type;
186
186
  }
187
187
 
package/src/test.ts CHANGED
@@ -6,6 +6,7 @@ import { Behaviour } from "needle.tiny.engine/engine-components/Component";
6
6
 
7
7
  export class MyNewScript extends DriveClient
8
8
  {
9
+ //@type test
9
10
  texture : RenderTexture;
10
11
  }
11
12
 
package/src/component.cs DELETED
@@ -1 +0,0 @@
1
- public class MyClass : MonoBehaviour {