@needle-tools/needle-component-compiler 3.0.19-next.e2b9a6e → 3.0.20-next.2ca1149

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,11 @@ 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
+ ## [3.0.20] - 2026-05-05
8
+ ### Changed
9
+ - Fields without `@serializable()` decorator (or `//@serializable` / `//@serializeField` comment directive) are no longer emitted in C# or Blender output. This prevents unresolvable types (e.g. `article: Article | undefined = undefined`) from producing compile errors in generated stubs.
10
+ - Blender: component reference types now emit concrete type names (e.g. `Camera`, `Rigidbody`, `AudioSource`) instead of generic `comp`. Added support for: Animation, Animator, Camera, Light, Rigidbody, Renderer, Canvas, VideoPlayer, AudioSource, SphereCollider, MeshCollider, BoxCollider, PlayableDirector, DragControls, Button, Text.
11
+
7
12
  ## [3.0.19] - 2026-04-28
8
13
  ### Fixed
9
14
  - C#: skip `= undefined` initializers — `undefined` is not valid in C#
package/Readme.md CHANGED
@@ -70,6 +70,7 @@ Use `//` comments above classes, fields, or methods to control code generation:
70
70
  | `@abstract` | Class | Mark the generated class as `abstract` |
71
71
  | `@serializeField` | Field | Emit `[UnityEngine.SerializeField]` attribute |
72
72
  | `@nonSerialized` | Field / Method | Skip generating C# code for this member |
73
+ | `@header "My text"` | Field | Emit `[UnityEngine.Header("My text")]` (C# only) |
73
74
  | `@tooltip "My text"` | Field | Emit `[UnityEngine.Tooltip("My text")]` (C#) or `"description"` (Blender) |
74
75
  | `@contextmenu "Label"` | Method | Emit `[UnityEngine.ContextMenu("Label")]` |
75
76
  | `@ifdef MY_DEFINE` | Field | Wrap field in `#if MY_DEFINE` / `#endif` |
package/dist/Compiler.js CHANGED
@@ -151,7 +151,10 @@ var Compiler = /** @class */ (function () {
151
151
  // If the property has a @serializable() decorator, ensure it's in the comments
152
152
  // so the writer emits private/protected fields with [SerializeField]
153
153
  var hasSerialized = this.hasSerializableDecorator(node);
154
- if (hasSerialized && !comments.some(function (c) { return c.startsWith("@serializable"); })) {
154
+ var hasSerializedComment = comments.some(function (c) { return c.startsWith("@serializable") || c.startsWith("@serializeField"); });
155
+ if (!hasSerialized && !hasSerializedComment)
156
+ return; // only emit fields marked with @serializable() or //@serializable or //@serializeField
157
+ if (!comments.some(function (c) { return c.startsWith("@serializable"); })) {
155
158
  comments.push("@serializable");
156
159
  }
157
160
  var flags = [];
@@ -230,6 +230,9 @@ var CSharpWriter = /** @class */ (function (_super) {
230
230
  }
231
231
  // @serializeField → add attribute + force private becomes serialized
232
232
  var serializeField = comments === null || comments === void 0 ? void 0 : comments.some(function (c) { return c.startsWith("@serializeField") || c.startsWith("@serializable"); });
233
+ // @header
234
+ var headerComment = comments === null || comments === void 0 ? void 0 : comments.find(function (c) { return c.startsWith("@header "); });
235
+ var header = headerComment ? headerComment.substring("@header ".length).trim().replace(/^["']|["']$/g, "") : null;
233
236
  // @tooltip
234
237
  var tooltipComment = comments === null || comments === void 0 ? void 0 : comments.find(function (c) { return c.startsWith("@tooltip "); });
235
238
  var tooltip = tooltipComment ? tooltipComment.substring("@tooltip ".length).trim().replace(/^["']|["']$/g, "") : null;
@@ -302,6 +305,8 @@ var CSharpWriter = /** @class */ (function (_super) {
302
305
  if (needsEditorWrap)
303
306
  this.writer.writeLine("#if UNITY_EDITOR");
304
307
  // Emit attributes
308
+ if (header)
309
+ this.writer.writeLine("[UnityEngine.Header(\"".concat(header, "\")]"));
305
310
  if (tooltip)
306
311
  this.writer.writeLine("[UnityEngine.Tooltip(\"".concat(tooltip, "\")]"));
307
312
  if (contextMenu)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/needle-component-compiler",
3
- "version": "3.0.19-next.e2b9a6e",
3
+ "version": "3.0.20-next.2ca1149",
4
4
  "description": "Compile Editor components for Needle Engine for C# and Blender",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/cli.js",