@needle-tools/needle-component-compiler 3.0.0-alpha.6.1370e84 → 3.0.0
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 +54 -4
- package/dist/base-compiler.js +1 -1
- package/package.json +4 -4
package/Changelog.md
CHANGED
|
@@ -4,10 +4,60 @@ 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.0
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
7
|
+
## [3.0.0] - 2026-03-04
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Rewritten compiler architecture with a new `Compiler` (TypeScript walker) + `IWriter` (output backend) design, enabling pluggable output targets
|
|
11
|
+
- CLI interface: `needle-component-compiler <target> <output_dir> <input_files...>` where target is `csharp` or `blender`
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
#### Architecture
|
|
16
|
+
- New `BaseWriter` / `IWriter` interface allows pluggable output backends (C#, Blender, and future targets like React Three Fiber)
|
|
17
|
+
- New `ISink` / `FileSink` abstraction for output, with `NEEDLE_CODEGEN_START` / `NEEDLE_CODEGEN_END` fence support to preserve hand-written code sections
|
|
18
|
+
- Standalone CLI (`npx @needle-tools/needle-component-compiler`) with `--help` and `--version` flags
|
|
19
|
+
|
|
20
|
+
#### C# Compiler
|
|
21
|
+
- Enum declarations with numeric and string initializers
|
|
22
|
+
- Union type fields (e.g. `field: string | number`) emit as `object` with a doc comment listing the union members
|
|
23
|
+
- Inferred types from initializers (e.g. `speed = 5` infers `float`, `name = "hello"` infers `string`, `new Vector3()` infers `Vector3`)
|
|
24
|
+
- `@dont-generate-component` decorator to skip class generation
|
|
25
|
+
- `@nonSerialized` support for fields (skips serialization)
|
|
26
|
+
- `@type` override decorator for fields and classes
|
|
27
|
+
- `@tooltip` decorator emits `[Tooltip("...")]` attribute
|
|
28
|
+
- `@serializable` / `@serializeField` for private field serialization
|
|
29
|
+
- `@ifdef` / `#if UNITY_EDITOR` wrapping for editor-only fields
|
|
30
|
+
- `NEEDLE_CODEGEN` fences in generated output to preserve manual code sections
|
|
31
|
+
- Static and abstract member handling (static fields skipped, static/abstract methods ignored)
|
|
32
|
+
- Method return type emission (void, primitive types, mapped types)
|
|
33
|
+
- Support for `declare class` with `IComponent` interface
|
|
34
|
+
|
|
35
|
+
#### Blender Compiler
|
|
36
|
+
- Full Blender panel schema generation from TypeScript components
|
|
37
|
+
- Property type mapping: `number` → `FloatProperty`, `string` → `StringProperty`, `boolean` → `BoolProperty`, enums → `EnumProperty`, arrays → `CollectionProperty`
|
|
38
|
+
- Inferred types from initializers (numbers, strings, booleans, `new` expressions)
|
|
39
|
+
- Enum support with `EnumProperty` items generation
|
|
40
|
+
- `@tooltip` decorator maps to Blender `description` field
|
|
41
|
+
- `@nonSerialized` decorator to skip properties
|
|
42
|
+
- `@dont-generate-component` decorator to skip class generation
|
|
43
|
+
- `@type` override decorator
|
|
44
|
+
- Missing/unknown type handling with sensible defaults
|
|
45
|
+
- `register_types` generation for Blender add-on registration
|
|
46
|
+
- File watcher for automatic recompilation on source changes
|
|
47
|
+
- Per-component output files with automatic cleanup on deletion
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
- Destructured method parameters (e.g. `{xr}`) now emit as `object @obj` instead of invalid `object @{xr}`
|
|
51
|
+
- `Object3D` type correctly maps to `UnityEngine.GameObject` (not `Transform`)
|
|
52
|
+
- `new` expression type inference for explicit types (e.g. `new RGBAColor()`)
|
|
53
|
+
- `RGBAColor` → `Color` automatic type mapping
|
|
54
|
+
- Method inline anonymous type declarations (e.g. `myMethod(arg: {x: number})`)
|
|
55
|
+
- Codegen no longer deletes manually added code outside of codegen sections
|
|
56
|
+
- Output directory is created automatically if it doesn't exist
|
|
57
|
+
|
|
58
|
+
### Testing
|
|
59
|
+
- Comprehensive test suite with separate C# and Blender test runners (`npm test`, `npm run test:csharp`, `npm run test:blender`)
|
|
60
|
+
- Test coverage for: basic fields, primitives, enums, unions, tooltips, inferred types, advanced features, codegen fences, methods, and extended type mappings
|
|
11
61
|
|
|
12
62
|
## [2.4.1-pre] - 2023-04-03
|
|
13
63
|
# Blender compiler
|
package/dist/base-compiler.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/needle-component-compiler",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Compile Editor components for Needle Engine for C# and Blender",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"url": "git+https://github.com/needle-tools/needle-tiny-component-compiler.git"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
"access": "public",
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|