nucleation 0.1.58 → 0.1.67

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
@@ -9,22 +9,19 @@
9
9
  [![Crates.io](https://img.shields.io/crates/v/nucleation.svg)](https://crates.io/crates/nucleation)
10
10
  [![npm](https://img.shields.io/npm/v/nucleation.svg)](https://www.npmjs.com/package/nucleation)
11
11
  [![PyPI](https://img.shields.io/pypi/v/nucleation.svg)](https://pypi.org/project/nucleation)
12
- [![CI/CD](https://github.com/Schem-at/Nucleation/workflows/Nucleation%20CI%2FCD/badge.svg)](https://github.com/Schem-at/Nucleation/actions)
13
12
 
14
13
  ---
15
14
 
16
15
  ## ✨ Features
17
16
 
18
- - ✅ **Multi-format support**: `.schematic`, `.litematic`, `.nbt`, etc.
19
- - 🧠 **Memory-safe Rust core** with zero-copy deserialization
20
- - 🌐 **WASM module** for browser + Node.js with TypeScript support
21
- - 🐍 **Native Python bindings** (`pip install nucleation`)
22
- - ⚙️ **C-compatible FFI** for PHP, C, Go, etc.
23
- - 🎨 **Blockpedia integration** for color analysis and block transformations (native targets)
24
- - 🔄 **Feature parity** across all interfaces via single API definition
25
- - 📦 **Binary builds** for Linux, macOS, Windows (x86_64 + ARM64)
26
- - 🚀 **Automatic binding generation** from centralized API definitions
27
- - 🧪 **Comprehensive test suite** with CI/CD pipeline
17
+ - ✅ Multi-format support: `.schematic`, `.litematic`, `.nbt`, etc.
18
+ - 🧠 Memory-safe Rust core with zero-copy deserialization
19
+ - 🌐 WASM module for browser + Node.js
20
+ - 🐍 Native Python bindings (`pip install nucleation`)
21
+ - ⚙️ C-compatible FFI for PHP, C, Go, etc.
22
+ - 🔄 Feature parity across all interfaces
23
+ - 📦 Binary builds for Linux, macOS, Windows (x86_64 + ARM64)
24
+ - 🧱 Seamless integration with [Cubane](https://github.com/Nano112/cubane)
28
25
 
29
26
  ---
30
27
 
@@ -72,7 +69,7 @@ schematic.load_from_data(&bytes)?;
72
69
  println!("{:?}", schematic.get_info());
73
70
  ```
74
71
 
75
- 📖 → [Documentation](examples/rust.md) | [Complete Code Example](examples/rust_example.rs)
72
+ 📖 → [More in `examples/rust.md`](examples/rust.md)
76
73
 
77
74
  ---
78
75
 
@@ -88,7 +85,7 @@ await parser.fromData(new Uint8Array(bytes));
88
85
  console.log(parser.getDimensions());
89
86
  ```
90
87
 
91
- 📖 → [Documentation](examples/wasm.md) | [Complete Code Example](examples/wasm_example.js)
88
+ 📖 → [More in `examples/wasm.md`](examples/wasm.md)
92
89
 
93
90
  ---
94
91
 
@@ -106,7 +103,7 @@ schem.load_from_bytes(data)
106
103
  print(schem.get_info())
107
104
  ```
108
105
 
109
- 📖 → [Documentation](examples/python.md) | [Complete Code Example](examples/python_example.py)
106
+ 📖 → [More in `examples/python.md`](examples/python.md)
110
107
 
111
108
  ---
112
109
 
@@ -125,20 +122,17 @@ printf("Size: %dx%dx%d\n", info.width, info.height, info.depth);
125
122
  schematic_free(handle);
126
123
  ```
127
124
 
128
- 📖 → [Documentation](examples/ffi.md) | [Complete Code Example](examples/ffi_example.c)
125
+ 📖 → [More in `examples/ffi.md`](examples/ffi.md)
129
126
 
130
127
  ---
131
128
 
132
129
  ## 🔧 Development
133
130
 
134
- ### Building
135
-
136
131
  ```bash
137
132
  # Build the Rust core
138
133
  cargo build --release
139
134
 
140
- # Build WASM module with target support
141
- cargo build --target wasm32-unknown-unknown --features wasm
135
+ # Build WASM module
142
136
  ./build-wasm.sh
143
137
 
144
138
  # Build Python bindings locally
@@ -148,77 +142,21 @@ maturin develop --features python
148
142
  ./build-ffi.sh
149
143
  ```
150
144
 
151
- ### 🤖 Automated Binding Generation
152
-
153
- Nucleation uses a **single source of truth** approach for all bindings. The API is defined once in `src/api_definition.rs` and automatically translated to all supported languages:
154
-
155
- ```bash
156
- # Generate all binding files from API definition
157
- cargo run --bin generate-bindings
158
-
159
- # Check if bindings are up to date
160
- cargo run --bin generate-bindings check
161
-
162
- # Generate API documentation report
163
- cargo run --bin generate-bindings report
164
- ```
165
-
166
- This generates:
167
- - **WASM**: TypeScript definitions and JavaScript bindings
168
- - **Python**: PyO3 bindings and `.pyi` type stubs
169
- - **FFI**: C header files and Rust FFI implementations
170
-
171
- ### 🧪 Testing
172
-
173
- ```bash
174
- # Run all tests
175
- cargo test
176
-
177
- # Test specific targets
178
- cargo test --features wasm --test wasm_tests # WASM tests
179
- cargo test --test python_tests # Python tests
180
- cargo test --test blockpedia_integration_test # Blockpedia tests (non-WASM only)
181
-
182
- # Test WASM build specifically
183
- cargo build --target wasm32-unknown-unknown --features wasm
184
- ```
185
-
186
- **Note**: WASM builds exclude blockpedia features for compatibility. Color analysis and block transformations are available only on native targets.
187
-
188
- ### Version Management
189
-
190
- Versions are centrally managed in `version.toml`. Use the Makefile commands:
191
-
192
- ```bash
193
- # Check version consistency across all files
194
- make version-check
195
-
196
- # Bump versions automatically
197
- make version-bump-patch # 0.1.0 → 0.1.1
198
- make version-bump-minor # 0.1.0 → 0.2.0
199
- make version-bump-major # 0.1.0 → 1.0.0
200
-
201
- # Update all files from version.toml
202
- make version-update
203
- ```
204
-
205
- 📖 → [Full Version Management Guide](docs/VERSION_MANAGEMENT.md)
206
-
207
145
  ---
208
146
 
209
147
  ## 📚 Submodules & Bindings
210
148
 
211
- ### 📄 Documentation & Examples
149
+ ### Rust
150
+ * [`examples/rust.md`](examples/rust.md)
212
151
 
213
- Each binding includes comprehensive documentation and working code examples:
152
+ ### JavaScript/TypeScript
153
+ * [`examples/wasm.md`](examples/wasm.md)
214
154
 
215
- | Language | API Documentation | Working Example | Type Definitions |
216
- |----------|------------------|-----------------|------------------|
217
- | **Rust** | [`examples/rust.md`](examples/rust.md) | [`examples/rust_example.rs`](examples/rust_example.rs) | Native Rust docs |
218
- | **JavaScript/WASM** | [`examples/wasm.md`](examples/wasm.md) | [`examples/wasm_example.js`](examples/wasm_example.js) | [`pkg/nucleation.d.ts`](pkg/nucleation.d.ts) |
219
- | **Python** | [`examples/python.md`](examples/python.md) | [`examples/python_example.py`](examples/python_example.py) | [`python-stubs/nucleation.pyi`](python-stubs/nucleation.pyi) |
220
- | **C/FFI** | [`examples/ffi.md`](examples/ffi.md) | [`examples/ffi_example.c`](examples/ffi_example.c) | [`include/nucleation.h`](include/nucleation.h) |
155
+ ### Python
156
+ * [`examples/python.md`](examples/python.md)
221
157
 
158
+ ### FFI (C/PHP)
159
+ * [`examples/ffi.md`](examples/ffi.md)
222
160
 
223
161
  ---
224
162
 
@@ -476,29 +476,54 @@ export class SchematicWrapper {
476
476
  return v1;
477
477
  }
478
478
  /**
479
- * @param {number} x
480
- * @param {number} y
481
- * @param {number} z
482
- * @param {string} block_name
479
+ * @param {string} version
480
+ * @returns {Uint8Array}
483
481
  */
484
- set_block(x, y, z, block_name) {
485
- const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
482
+ to_schematic_version(version) {
483
+ const ptr0 = passStringToWasm0(version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
486
484
  const len0 = WASM_VECTOR_LEN;
487
- wasm.schematicwrapper_set_block(this.__wbg_ptr, x, y, z, ptr0, len0);
485
+ const ret = wasm.schematicwrapper_to_schematic_version(this.__wbg_ptr, ptr0, len0);
486
+ if (ret[3]) {
487
+ throw takeFromExternrefTable0(ret[2]);
488
+ }
489
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
490
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
491
+ return v2;
492
+ }
493
+ /**
494
+ * @returns {Array<any>}
495
+ */
496
+ get_available_schematic_versions() {
497
+ const ret = wasm.schematicwrapper_get_available_schematic_versions(this.__wbg_ptr);
498
+ return ret;
499
+ }
500
+ /**
501
+ * @returns {any}
502
+ */
503
+ get_palette() {
504
+ const ret = wasm.schematicwrapper_get_palette(this.__wbg_ptr);
505
+ return ret;
506
+ }
507
+ /**
508
+ * @param {string} region_name
509
+ * @returns {any}
510
+ */
511
+ get_palette_from_region(region_name) {
512
+ const ptr0 = passStringToWasm0(region_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
513
+ const len0 = WASM_VECTOR_LEN;
514
+ const ret = wasm.schematicwrapper_get_palette_from_region(this.__wbg_ptr, ptr0, len0);
515
+ return ret;
488
516
  }
489
517
  /**
490
518
  * @param {number} x
491
519
  * @param {number} y
492
520
  * @param {number} z
493
- * @param {string} block_string
521
+ * @param {string} block_name
494
522
  */
495
- set_block_from_string(x, y, z, block_string) {
496
- const ptr0 = passStringToWasm0(block_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
523
+ set_block(x, y, z, block_name) {
524
+ const ptr0 = passStringToWasm0(block_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
497
525
  const len0 = WASM_VECTOR_LEN;
498
- const ret = wasm.schematicwrapper_set_block_from_string(this.__wbg_ptr, x, y, z, ptr0, len0);
499
- if (ret[1]) {
500
- throw takeFromExternrefTable0(ret[0]);
501
- }
526
+ wasm.schematicwrapper_set_block(this.__wbg_ptr, x, y, z, ptr0, len0);
502
527
  }
503
528
  /**
504
529
  * @param {SchematicWrapper} from_schematic
package/nucleation.d.ts CHANGED
@@ -25,8 +25,11 @@ export class SchematicWrapper {
25
25
  to_litematic(): Uint8Array;
26
26
  from_schematic(data: Uint8Array): void;
27
27
  to_schematic(): Uint8Array;
28
+ to_schematic_version(version: string): Uint8Array;
29
+ get_available_schematic_versions(): Array<any>;
30
+ get_palette(): any;
31
+ get_palette_from_region(region_name: string): any;
28
32
  set_block(x: number, y: number, z: number, block_name: string): void;
29
- set_block_from_string(x: number, y: number, z: number, block_string: string): void;
30
33
  copy_region(from_schematic: SchematicWrapper, min_x: number, min_y: number, min_z: number, max_x: number, max_y: number, max_z: number, target_x: number, target_y: number, target_z: number, excluded_blocks: any): void;
31
34
  set_block_with_properties(x: number, y: number, z: number, block_name: string, properties: any): void;
32
35
  get_block(x: number, y: number, z: number): string | undefined;
@@ -65,8 +68,11 @@ export interface InitOutput {
65
68
  readonly schematicwrapper_to_litematic: (a: number) => [number, number, number, number];
66
69
  readonly schematicwrapper_from_schematic: (a: number, b: number, c: number) => [number, number];
67
70
  readonly schematicwrapper_to_schematic: (a: number) => [number, number, number, number];
71
+ readonly schematicwrapper_to_schematic_version: (a: number, b: number, c: number) => [number, number, number, number];
72
+ readonly schematicwrapper_get_available_schematic_versions: (a: number) => any;
73
+ readonly schematicwrapper_get_palette: (a: number) => any;
74
+ readonly schematicwrapper_get_palette_from_region: (a: number, b: number, c: number) => any;
68
75
  readonly schematicwrapper_set_block: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
69
- readonly schematicwrapper_set_block_from_string: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
70
76
  readonly schematicwrapper_copy_region: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: any) => [number, number];
71
77
  readonly schematicwrapper_set_block_with_properties: (a: number, b: number, c: number, d: number, e: number, f: number, g: any) => [number, number];
72
78
  readonly schematicwrapper_get_block: (a: number, b: number, c: number, d: number) => [number, number];
Binary file
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "nucleation",
3
3
  "type": "module",
4
4
  "collaborators": [
5
- "Nano <nano@schem.at>"
5
+ "Nano nano@schem.at"
6
6
  ],
7
7
  "description": "A high-performance Minecraft schematic parser and utility library",
8
- "version": "0.1.58",
8
+ "version": "0.1.67",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",