@needle-tools/needle-component-compiler 3.0.0-alpha.2.b3c6deb → 3.0.0-alpha.3.0d84287

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/Readme.md CHANGED
@@ -2,10 +2,42 @@
2
2
 
3
3
  Compiles TypeScript component definitions into **Unity C#** component stubs and **Blender** Python component schemas for Needle Engine.
4
4
 
5
+ ### CLI Usage
6
+
7
+ ```
8
+ npx @needle-tools/needle-component-compiler <target> <output_dir> <input_files...>
9
+ ```
10
+
11
+ - `target`: `csharp` or `blender`
12
+ - `output_dir`: directory for generated files
13
+ - `input_files`: one or more `.ts` source files
14
+
15
+ ```bash
16
+ # Generate C# component stubs
17
+ npx @needle-tools/needle-component-compiler csharp ./codegen ./src/MyComponent.ts
18
+
19
+ # Generate Blender component schemas
20
+ npx @needle-tools/needle-component-compiler blender ./codegen ./src/MyComponent.ts
21
+
22
+ # Print version
23
+ npx @needle-tools/needle-component-compiler --version
24
+ ```
25
+
26
+ ### Programmatic API
27
+
5
28
  ```
6
29
  npm install @needle-tools/needle-component-compiler
7
30
  ```
8
31
 
32
+ ```ts
33
+ import { Compiler, CSharpWriter, FileSink } from "@needle-tools/needle-component-compiler";
34
+
35
+ const sink = new FileSink("./output");
36
+ const writer = new CSharpWriter(sink);
37
+ const compiler = new Compiler();
38
+ compiler.compile(writer, code, "MyComponent.ts");
39
+ ```
40
+
9
41
  ### Supported TypeScript Features
10
42
 
11
43
  - Classes extending `Behaviour`, `MonoBehaviour`, or implementing `IComponent`
package/dist/Compiler.js CHANGED
@@ -106,6 +106,16 @@ var Compiler = /** @class */ (function () {
106
106
  this.debugLog("[COMPILER] CLASS END", name, "\n");
107
107
  };
108
108
  Compiler.prototype.visitPropertyDeclaration = function (node, writer) {
109
+ // Skip static and abstract properties — they don't map to serialized fields
110
+ if (node.modifiers) {
111
+ for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
112
+ var modifier = _a[_i];
113
+ if (modifier.kind === ts.SyntaxKind.StaticKeyword ||
114
+ modifier.kind === ts.SyntaxKind.AbstractKeyword) {
115
+ return;
116
+ }
117
+ }
118
+ }
109
119
  var name = node.name.getText();
110
120
  var type = this.resolveType(node.type, writer);
111
121
  var visibility = this.getVisibility(node);
@@ -273,7 +273,7 @@ var CSharpWriter = /** @class */ (function (_super) {
273
273
  : "void";
274
274
  if (contextMenu)
275
275
  this.writer.writeLine("[UnityEngine.ContextMenu(\"".concat(contextMenu, "\")]"));
276
- this.writer.writeLine("public void ".concat(methodName, "(").concat(paramList, ") {}"));
276
+ this.writer.writeLine("public ".concat(csReturnType, " ").concat(methodName, "(").concat(paramList, ") {}"));
277
277
  };
278
278
  CSharpWriter.prototype.writeNewTypeExpression = function (typeName, args) {
279
279
  // no-op for C# output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/needle-component-compiler",
3
- "version": "3.0.0-alpha.2.b3c6deb",
3
+ "version": "3.0.0-alpha.3.0d84287",
4
4
  "description": "Compile Editor components for Needle Engine for C# and Blender",
5
5
  "main": "dist/index.js",
6
6
  "bin": {