nucleation 0.2.18 → 0.3.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.
Files changed (129) hide show
  1. package/Autostack.d.ts +43 -0
  2. package/Autostack.mjs +134 -0
  3. package/BlockPos.d.ts +28 -0
  4. package/BlockPos.mjs +129 -0
  5. package/BlockState.d.ts +39 -0
  6. package/BlockState.mjs +134 -0
  7. package/Brush.d.ts +68 -0
  8. package/Brush.mjs +220 -0
  9. package/BuildingTool.d.ts +29 -0
  10. package/BuildingTool.mjs +74 -0
  11. package/ChunkMeshResult.d.ts +75 -0
  12. package/ChunkMeshResult.mjs +253 -0
  13. package/CircuitBuilder.d.ts +118 -0
  14. package/CircuitBuilder.mjs +516 -0
  15. package/DefinitionRegion.d.ts +274 -0
  16. package/DefinitionRegion.mjs +973 -0
  17. package/Diff.d.ts +88 -0
  18. package/Diff.mjs +316 -0
  19. package/Dimensions.d.ts +28 -0
  20. package/Dimensions.mjs +129 -0
  21. package/ExecutionMode.d.ts +42 -0
  22. package/ExecutionMode.mjs +127 -0
  23. package/Fingerprint.d.ts +44 -0
  24. package/Fingerprint.mjs +197 -0
  25. package/InterpolationSpace.d.ts +25 -0
  26. package/InterpolationSpace.mjs +73 -0
  27. package/IoLayout.d.ts +26 -0
  28. package/IoLayout.mjs +81 -0
  29. package/IoLayoutBuilder.d.ts +73 -0
  30. package/IoLayoutBuilder.mjs +315 -0
  31. package/IoType.d.ts +41 -0
  32. package/IoType.mjs +125 -0
  33. package/ItemModelConfig.d.ts +65 -0
  34. package/ItemModelConfig.mjs +223 -0
  35. package/ItemModelPackBuilder.d.ts +32 -0
  36. package/ItemModelPackBuilder.mjs +104 -0
  37. package/ItemModelResult.d.ts +72 -0
  38. package/ItemModelResult.mjs +268 -0
  39. package/ItemScale.d.ts +31 -0
  40. package/ItemScale.mjs +132 -0
  41. package/LayoutFunction.d.ts +52 -0
  42. package/LayoutFunction.mjs +159 -0
  43. package/MchprsWorld.d.ts +131 -0
  44. package/MchprsWorld.mjs +423 -0
  45. package/MeshBounds.d.ts +40 -0
  46. package/MeshBounds.mjs +180 -0
  47. package/MeshConfig.d.ts +101 -0
  48. package/MeshConfig.mjs +306 -0
  49. package/MeshJob.d.ts +44 -0
  50. package/MeshJob.mjs +116 -0
  51. package/MeshPhase.d.ts +38 -0
  52. package/MeshPhase.mjs +90 -0
  53. package/MeshProgress.d.ts +32 -0
  54. package/MeshProgress.mjs +133 -0
  55. package/MeshResult.d.ts +60 -0
  56. package/MeshResult.mjs +206 -0
  57. package/MultiMeshResult.d.ts +50 -0
  58. package/MultiMeshResult.mjs +166 -0
  59. package/Nbt.d.ts +50 -0
  60. package/Nbt.mjs +161 -0
  61. package/NucleationError.d.ts +36 -0
  62. package/NucleationError.mjs +104 -0
  63. package/OutputCondition.d.ts +45 -0
  64. package/OutputCondition.mjs +129 -0
  65. package/Palette.d.ts +84 -0
  66. package/Palette.mjs +269 -0
  67. package/PaletteBuilder.d.ts +76 -0
  68. package/PaletteBuilder.mjs +297 -0
  69. package/README.md +28 -197
  70. package/RawMeshExport.d.ts +74 -0
  71. package/RawMeshExport.mjs +243 -0
  72. package/RedstoneGraph.d.ts +58 -0
  73. package/RedstoneGraph.mjs +242 -0
  74. package/RegionBounds.d.ts +41 -0
  75. package/RegionBounds.mjs +181 -0
  76. package/RenderConfig.d.ts +66 -0
  77. package/RenderConfig.mjs +170 -0
  78. package/Renderer.d.ts +35 -0
  79. package/Renderer.mjs +139 -0
  80. package/ResourcePack.d.ts +105 -0
  81. package/ResourcePack.mjs +447 -0
  82. package/ResourcePackList.d.ts +32 -0
  83. package/ResourcePackList.mjs +96 -0
  84. package/Schematic.d.ts +655 -0
  85. package/Schematic.mjs +2647 -0
  86. package/SchematicBuilder.d.ts +103 -0
  87. package/SchematicBuilder.mjs +401 -0
  88. package/SchematicRegions.d.ts +93 -0
  89. package/SchematicRegions.mjs +411 -0
  90. package/Scripting.d.ts +40 -0
  91. package/Scripting.mjs +138 -0
  92. package/Sdf.d.ts +31 -0
  93. package/Sdf.mjs +107 -0
  94. package/Shape.d.ts +108 -0
  95. package/Shape.mjs +336 -0
  96. package/SortStrategy.d.ts +86 -0
  97. package/SortStrategy.mjs +272 -0
  98. package/Store.d.ts +83 -0
  99. package/Store.mjs +369 -0
  100. package/StoreIo.d.ts +71 -0
  101. package/StoreIo.mjs +292 -0
  102. package/TextureAtlas.d.ts +40 -0
  103. package/TextureAtlas.mjs +122 -0
  104. package/TextureInfo.d.ts +34 -0
  105. package/TextureInfo.mjs +148 -0
  106. package/TypedCircuitExecutor.d.ts +101 -0
  107. package/TypedCircuitExecutor.mjs +378 -0
  108. package/Value.d.ts +73 -0
  109. package/Value.mjs +275 -0
  110. package/WorldChunkView.d.ts +63 -0
  111. package/WorldChunkView.mjs +201 -0
  112. package/WorldSink.d.ts +50 -0
  113. package/WorldSink.mjs +177 -0
  114. package/WorldStream.d.ts +45 -0
  115. package/WorldStream.mjs +184 -0
  116. package/diplomat-runtime.d.ts +15 -0
  117. package/diplomat-runtime.mjs +774 -0
  118. package/diplomat-wasm.mjs +52 -0
  119. package/diplomat.config.mjs +6 -0
  120. package/index.d.ts +117 -0
  121. package/index.mjs +120 -0
  122. package/{nucleation_bg.wasm → nucleation.wasm} +0 -0
  123. package/package.json +19 -41
  124. package/LICENSE +0 -21
  125. package/api.js +0 -608
  126. package/nucleation-cdn-loader.js +0 -15
  127. package/nucleation-original.js +0 -8383
  128. package/nucleation.d.ts +0 -2947
  129. package/nucleation.js +0 -36
@@ -0,0 +1,52 @@
1
+ import cfg from './diplomat.config.mjs';
2
+ import {readString8} from './diplomat-runtime.mjs'
3
+
4
+ let wasm;
5
+
6
+ const imports = {
7
+ env: {
8
+ diplomat_console_debug_js(ptr, len) {
9
+ console.debug(readString8(wasm, ptr, len));
10
+ },
11
+ diplomat_console_error_js(ptr, len) {
12
+ console.error(readString8(wasm, ptr, len));
13
+ },
14
+ diplomat_console_info_js(ptr, len) {
15
+ console.info(readString8(wasm, ptr, len));
16
+ },
17
+ diplomat_console_log_js(ptr, len) {
18
+ console.log(readString8(wasm, ptr, len));
19
+ },
20
+ diplomat_console_warn_js(ptr, len) {
21
+ console.warn(readString8(wasm, ptr, len));
22
+ },
23
+ diplomat_throw_error_js(ptr, len) {
24
+ throw new Error(readString8(wasm, ptr, len));
25
+ }
26
+ }
27
+ }
28
+
29
+ if (globalThis.process?.getBuiltinModule) {
30
+ // Node (>=22)
31
+ const fs = globalThis.process.getBuiltinModule('fs');
32
+ const wasmFile = new Uint8Array(fs.readFileSync(cfg['wasm_path']));
33
+ const loadedWasm = await WebAssembly.instantiate(wasmFile, imports);
34
+ wasm = loadedWasm.instance.exports;
35
+ } else if (globalThis.process) {
36
+ // Node (<22)
37
+ const fs = await import('fs');
38
+ const wasmFile = new Uint8Array(fs.readFileSync(cfg['wasm_path']));
39
+ const loadedWasm = await WebAssembly.instantiate(wasmFile, imports);
40
+ wasm = loadedWasm.instance.exports;
41
+ } else {
42
+ // Browser
43
+ const loadedWasm = await WebAssembly.instantiateStreaming(fetch(cfg['wasm_path']), imports);
44
+ wasm = loadedWasm.instance.exports;
45
+ }
46
+
47
+ wasm.diplomat_init();
48
+ if (cfg['init'] !== undefined) {
49
+ cfg['init'](wasm);
50
+ }
51
+
52
+ export default wasm;
@@ -0,0 +1,6 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import path from "node:path";
3
+
4
+ export default {
5
+ wasm_path: path.join(path.dirname(fileURLToPath(import.meta.url)), "nucleation.wasm"),
6
+ };
package/index.d.ts ADDED
@@ -0,0 +1,117 @@
1
+
2
+ export { codepoint } from './diplomat-runtime';
3
+
4
+
5
+ export { RegionBounds, RegionBounds_obj } from "./RegionBounds"
6
+
7
+ export { ItemScale, ItemScale_obj } from "./ItemScale"
8
+
9
+ export { MeshBounds, MeshBounds_obj } from "./MeshBounds"
10
+
11
+ export { MeshProgress, MeshProgress_obj } from "./MeshProgress"
12
+
13
+ export { TextureInfo, TextureInfo_obj } from "./TextureInfo"
14
+
15
+ export { BlockPos, BlockPos_obj } from "./BlockPos"
16
+
17
+ export { Dimensions, Dimensions_obj } from "./Dimensions"
18
+
19
+ export { Autostack } from "./Autostack"
20
+
21
+ export { Brush } from "./Brush"
22
+
23
+ export { BuildingTool } from "./BuildingTool"
24
+
25
+ export { Palette } from "./Palette"
26
+
27
+ export { PaletteBuilder } from "./PaletteBuilder"
28
+
29
+ export { Shape } from "./Shape"
30
+
31
+ export { DefinitionRegion } from "./DefinitionRegion"
32
+
33
+ export { SchematicRegions } from "./SchematicRegions"
34
+
35
+ export { Diff } from "./Diff"
36
+
37
+ export { Fingerprint } from "./Fingerprint"
38
+
39
+ export { ChunkMeshResult } from "./ChunkMeshResult"
40
+
41
+ export { ItemModelConfig } from "./ItemModelConfig"
42
+
43
+ export { ItemModelPackBuilder } from "./ItemModelPackBuilder"
44
+
45
+ export { ItemModelResult } from "./ItemModelResult"
46
+
47
+ export { MeshConfig } from "./MeshConfig"
48
+
49
+ export { MeshJob } from "./MeshJob"
50
+
51
+ export { MeshResult } from "./MeshResult"
52
+
53
+ export { MultiMeshResult } from "./MultiMeshResult"
54
+
55
+ export { RawMeshExport } from "./RawMeshExport"
56
+
57
+ export { ResourcePack } from "./ResourcePack"
58
+
59
+ export { ResourcePackList } from "./ResourcePackList"
60
+
61
+ export { TextureAtlas } from "./TextureAtlas"
62
+
63
+ export { Nbt } from "./Nbt"
64
+
65
+ export { RenderConfig } from "./RenderConfig"
66
+
67
+ export { Renderer } from "./Renderer"
68
+
69
+ export { BlockState } from "./BlockState"
70
+
71
+ export { Schematic } from "./Schematic"
72
+
73
+ export { SchematicBuilder } from "./SchematicBuilder"
74
+
75
+ export { Scripting } from "./Scripting"
76
+
77
+ export { Sdf } from "./Sdf"
78
+
79
+ export { CircuitBuilder } from "./CircuitBuilder"
80
+
81
+ export { ExecutionMode } from "./ExecutionMode"
82
+
83
+ export { IoLayout } from "./IoLayout"
84
+
85
+ export { IoLayoutBuilder } from "./IoLayoutBuilder"
86
+
87
+ export { IoType } from "./IoType"
88
+
89
+ export { LayoutFunction } from "./LayoutFunction"
90
+
91
+ export { MchprsWorld } from "./MchprsWorld"
92
+
93
+ export { OutputCondition } from "./OutputCondition"
94
+
95
+ export { RedstoneGraph } from "./RedstoneGraph"
96
+
97
+ export { SortStrategy } from "./SortStrategy"
98
+
99
+ export { TypedCircuitExecutor } from "./TypedCircuitExecutor"
100
+
101
+ export { Value } from "./Value"
102
+
103
+ export { Store } from "./Store"
104
+
105
+ export { StoreIo } from "./StoreIo"
106
+
107
+ export { WorldChunkView } from "./WorldChunkView"
108
+
109
+ export { WorldSink } from "./WorldSink"
110
+
111
+ export { WorldStream } from "./WorldStream"
112
+
113
+ export { InterpolationSpace } from "./InterpolationSpace"
114
+
115
+ export { MeshPhase } from "./MeshPhase"
116
+
117
+ export { NucleationError } from "./NucleationError"
package/index.mjs ADDED
@@ -0,0 +1,120 @@
1
+
2
+
3
+ export { RegionBounds } from "./RegionBounds.mjs"
4
+
5
+ export { ItemScale } from "./ItemScale.mjs"
6
+
7
+ export { MeshBounds } from "./MeshBounds.mjs"
8
+
9
+ export { MeshProgress } from "./MeshProgress.mjs"
10
+
11
+ export { TextureInfo } from "./TextureInfo.mjs"
12
+
13
+ export { BlockPos } from "./BlockPos.mjs"
14
+
15
+ export { Dimensions } from "./Dimensions.mjs"
16
+
17
+ export { Autostack } from "./Autostack.mjs"
18
+
19
+ export { Brush } from "./Brush.mjs"
20
+
21
+ export { BuildingTool } from "./BuildingTool.mjs"
22
+
23
+ export { Palette } from "./Palette.mjs"
24
+
25
+ export { PaletteBuilder } from "./PaletteBuilder.mjs"
26
+
27
+ export { Shape } from "./Shape.mjs"
28
+
29
+ export { DefinitionRegion } from "./DefinitionRegion.mjs"
30
+
31
+ export { SchematicRegions } from "./SchematicRegions.mjs"
32
+
33
+ export { Diff } from "./Diff.mjs"
34
+
35
+ export { Fingerprint } from "./Fingerprint.mjs"
36
+
37
+ export { ChunkMeshResult } from "./ChunkMeshResult.mjs"
38
+
39
+ export { ItemModelConfig } from "./ItemModelConfig.mjs"
40
+
41
+ export { ItemModelPackBuilder } from "./ItemModelPackBuilder.mjs"
42
+
43
+ export { ItemModelResult } from "./ItemModelResult.mjs"
44
+
45
+ export { MeshConfig } from "./MeshConfig.mjs"
46
+
47
+ export { MeshJob } from "./MeshJob.mjs"
48
+
49
+ export { MeshResult } from "./MeshResult.mjs"
50
+
51
+ export { MultiMeshResult } from "./MultiMeshResult.mjs"
52
+
53
+ export { RawMeshExport } from "./RawMeshExport.mjs"
54
+
55
+ export { ResourcePack } from "./ResourcePack.mjs"
56
+
57
+ export { ResourcePackList } from "./ResourcePackList.mjs"
58
+
59
+ export { TextureAtlas } from "./TextureAtlas.mjs"
60
+
61
+ export { Nbt } from "./Nbt.mjs"
62
+
63
+ export { RenderConfig } from "./RenderConfig.mjs"
64
+
65
+ export { Renderer } from "./Renderer.mjs"
66
+
67
+ export { BlockState } from "./BlockState.mjs"
68
+
69
+ export { Schematic } from "./Schematic.mjs"
70
+
71
+ export { SchematicBuilder } from "./SchematicBuilder.mjs"
72
+
73
+ export { Scripting } from "./Scripting.mjs"
74
+
75
+ export { Sdf } from "./Sdf.mjs"
76
+
77
+ export { CircuitBuilder } from "./CircuitBuilder.mjs"
78
+
79
+ export { ExecutionMode } from "./ExecutionMode.mjs"
80
+
81
+ export { IoLayout } from "./IoLayout.mjs"
82
+
83
+ export { IoLayoutBuilder } from "./IoLayoutBuilder.mjs"
84
+
85
+ export { IoType } from "./IoType.mjs"
86
+
87
+ export { LayoutFunction } from "./LayoutFunction.mjs"
88
+
89
+ export { MchprsWorld } from "./MchprsWorld.mjs"
90
+
91
+ export { OutputCondition } from "./OutputCondition.mjs"
92
+
93
+ export { RedstoneGraph } from "./RedstoneGraph.mjs"
94
+
95
+ export { SortStrategy } from "./SortStrategy.mjs"
96
+
97
+ export { TypedCircuitExecutor } from "./TypedCircuitExecutor.mjs"
98
+
99
+ export { Value } from "./Value.mjs"
100
+
101
+ export { Store } from "./Store.mjs"
102
+
103
+ export { StoreIo } from "./StoreIo.mjs"
104
+
105
+ export { WorldChunkView } from "./WorldChunkView.mjs"
106
+
107
+ export { WorldSink } from "./WorldSink.mjs"
108
+
109
+ export { WorldStream } from "./WorldStream.mjs"
110
+
111
+ export { InterpolationSpace } from "./InterpolationSpace.mjs"
112
+
113
+ export { MeshPhase } from "./MeshPhase.mjs"
114
+
115
+ export { NucleationError } from "./NucleationError.mjs"
116
+
117
+ import wasm from "./diplomat-wasm.mjs";
118
+ import {FUNCTION_PARAM_ALLOC, internalConstructor} from "./diplomat-runtime.mjs";
119
+
120
+ FUNCTION_PARAM_ALLOC.reserve(internalConstructor, wasm, 52);
package/package.json CHANGED
@@ -1,51 +1,29 @@
1
1
  {
2
2
  "name": "nucleation",
3
+ "version": "0.3.1",
4
+ "description": "A high-performance Minecraft schematic parser and utility library",
3
5
  "type": "module",
4
- "collaborators": [
5
- "Nano nano@schem.at"
6
+ "main": "index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "default": "./index.mjs"
11
+ }
12
+ },
13
+ "files": [
14
+ "*.mjs",
15
+ "*.d.ts",
16
+ "nucleation.wasm",
17
+ "diplomat.config.mjs"
6
18
  ],
7
- "description": "A high-performance Minecraft schematic parser and utility library",
8
- "version": "0.2.18",
9
- "license": "MIT",
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
10
22
  "repository": {
11
23
  "type": "git",
12
24
  "url": "git+https://github.com/Schem-at/Nucleation.git"
13
25
  },
14
- "files": [
15
- "nucleation.js",
16
- "nucleation-original.js",
17
- "nucleation.d.ts",
18
- "nucleation_bg.wasm",
19
- "nucleation_bg.d.ts",
20
- "nucleation-cdn-loader.js",
21
- "api.js",
22
- "README.md"
23
- ],
24
- "main": "./nucleation.js",
25
- "types": "./nucleation.d.ts",
26
- "sideEffects": [
27
- "./snippets/*"
28
- ],
29
- "keywords": [
30
- "minecraft",
31
- "schematic",
32
- "parser",
33
- "voxel"
34
- ],
35
- "module": "./nucleation.js",
36
- "exports": {
37
- ".": {
38
- "import": "./nucleation.js",
39
- "types": "./nucleation.d.ts"
40
- },
41
- "./cdn-loader": {
42
- "import": "./nucleation-cdn-loader.js"
43
- },
44
- "./api": {
45
- "import": "./api.js"
46
- },
47
- "./package.json": "./package.json"
48
- },
49
26
  "homepage": "https://github.com/Schem-at/Nucleation",
50
- "author": "Nano <nano@schem.at>"
27
+ "author": "Nano <nano@schem.at>",
28
+ "license": "MIT"
51
29
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Schem-at
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.