@ringozz/godot 4.7.1-9 → 4.7.2-579

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 (111) hide show
  1. package/README.md +12 -7
  2. package/gen/classes/AnimationNode.ts +1 -1
  3. package/gen/classes/AnimationNodeBlendSpace2D.ts +1 -1
  4. package/gen/classes/ArrayOccluder3D.ts +3 -2
  5. package/gen/classes/AudioStreamMP3.ts +1 -1
  6. package/gen/classes/AudioStreamOggVorbis.ts +1 -1
  7. package/gen/classes/AudioStreamWAV.ts +2 -2
  8. package/gen/classes/BitMap.ts +1 -1
  9. package/gen/classes/CPUParticles2D.ts +3 -3
  10. package/gen/classes/CPUParticles3D.ts +3 -3
  11. package/gen/classes/CSGPolygon3D.ts +2 -1
  12. package/gen/classes/CharFXTransform.ts +1 -1
  13. package/gen/classes/CodeEdit.ts +6 -6
  14. package/gen/classes/CodeHighlighter.ts +3 -3
  15. package/gen/classes/CollisionPolygon2D.ts +1 -1
  16. package/gen/classes/CollisionPolygon3D.ts +2 -2
  17. package/gen/classes/ColorPalette.ts +2 -1
  18. package/gen/classes/Compositor.ts +1 -1
  19. package/gen/classes/ConcavePolygonShape2D.ts +2 -1
  20. package/gen/classes/ConcavePolygonShape3D.ts +2 -1
  21. package/gen/classes/Control.ts +4 -4
  22. package/gen/classes/ConvexPolygonShape2D.ts +2 -1
  23. package/gen/classes/ConvexPolygonShape3D.ts +2 -1
  24. package/gen/classes/DPITexture.ts +1 -1
  25. package/gen/classes/DisplayServer.ts +3 -4
  26. package/gen/classes/FileDialog.ts +1 -1
  27. package/gen/classes/Font.ts +1 -1
  28. package/gen/classes/FontFile.ts +2 -2
  29. package/gen/classes/FontVariation.ts +4 -4
  30. package/gen/classes/GLTFAccessor.ts +2 -2
  31. package/gen/classes/GLTFMesh.ts +2 -2
  32. package/gen/classes/GLTFNode.ts +1 -1
  33. package/gen/classes/GLTFObjectModelProperty.ts +2 -2
  34. package/gen/classes/GLTFSkeleton.ts +4 -4
  35. package/gen/classes/GLTFSkin.ts +7 -7
  36. package/gen/classes/GLTFState.ts +19 -19
  37. package/gen/classes/Gradient.ts +2 -2
  38. package/gen/classes/GraphEdit.ts +2 -2
  39. package/gen/classes/HeightMapShape3D.ts +1 -1
  40. package/gen/classes/Image.ts +1 -1
  41. package/gen/classes/Label.ts +2 -2
  42. package/gen/classes/Label3D.ts +1 -1
  43. package/gen/classes/Light3D.ts +4 -2
  44. package/gen/classes/LightmapGIData.ts +5 -5
  45. package/gen/classes/Line2D.ts +1 -1
  46. package/gen/classes/LineEdit.ts +1 -1
  47. package/gen/classes/LinkButton.ts +1 -1
  48. package/gen/classes/MultiMesh.ts +6 -6
  49. package/gen/classes/NavigationMesh.ts +2 -2
  50. package/gen/classes/NavigationMeshSourceGeometryData2D.ts +3 -3
  51. package/gen/classes/NavigationMeshSourceGeometryData3D.ts +3 -3
  52. package/gen/classes/NavigationObstacle2D.ts +1 -1
  53. package/gen/classes/NavigationObstacle3D.ts +1 -1
  54. package/gen/classes/NavigationPathQueryParameters2D.ts +2 -2
  55. package/gen/classes/NavigationPathQueryParameters3D.ts +2 -2
  56. package/gen/classes/NavigationPathQueryResult2D.ts +5 -4
  57. package/gen/classes/NavigationPathQueryResult3D.ts +5 -4
  58. package/gen/classes/NavigationPolygon.ts +3 -3
  59. package/gen/classes/OccluderPolygon2D.ts +2 -1
  60. package/gen/classes/OggPacketSequence.ts +2 -2
  61. package/gen/classes/OpenXRAction.ts +1 -1
  62. package/gen/classes/OpenXRActionMap.ts +2 -2
  63. package/gen/classes/OpenXRActionSet.ts +1 -1
  64. package/gen/classes/OpenXRIPBinding.ts +2 -2
  65. package/gen/classes/OpenXRInteractionProfile.ts +2 -2
  66. package/gen/classes/PhysicsPointQueryParameters2D.ts +1 -1
  67. package/gen/classes/PhysicsPointQueryParameters3D.ts +1 -1
  68. package/gen/classes/PhysicsRayQueryParameters2D.ts +1 -1
  69. package/gen/classes/PhysicsRayQueryParameters3D.ts +1 -1
  70. package/gen/classes/PhysicsShapeQueryParameters2D.ts +1 -1
  71. package/gen/classes/PhysicsShapeQueryParameters3D.ts +1 -1
  72. package/gen/classes/PhysicsTestMotionParameters2D.ts +2 -2
  73. package/gen/classes/PhysicsTestMotionParameters3D.ts +2 -2
  74. package/gen/classes/Polygon2D.ts +5 -5
  75. package/gen/classes/PolygonOccluder3D.ts +2 -1
  76. package/gen/classes/PolygonPathFinder.ts +1 -1
  77. package/gen/classes/RDFramebufferPass.ts +4 -4
  78. package/gen/classes/RDPipelineColorBlendState.ts +1 -1
  79. package/gen/classes/RDPipelineMultisampleState.ts +1 -1
  80. package/gen/classes/RDPipelineShader.ts +1 -1
  81. package/gen/classes/RDShaderSPIRV.ts +10 -10
  82. package/gen/classes/RandomNumberGenerator.ts +2 -2
  83. package/gen/classes/ResourcePreloader.ts +1 -1
  84. package/gen/classes/RichTextLabel.ts +3 -3
  85. package/gen/classes/Shortcut.ts +1 -1
  86. package/gen/classes/SplitContainer.ts +1 -1
  87. package/gen/classes/SpriteFrames.ts +1 -1
  88. package/gen/classes/StreamPeerBuffer.ts +1 -1
  89. package/gen/classes/SystemFont.ts +1 -1
  90. package/gen/classes/TextEdit.ts +1 -1
  91. package/gen/classes/TextMesh.ts +1 -1
  92. package/gen/classes/TileMapLayer.ts +1 -1
  93. package/gen/classes/Translation.ts +1 -1
  94. package/gen/classes/VisualShaderNode.ts +2 -2
  95. package/gen/classes/VisualShaderNodeFrame.ts +1 -1
  96. package/gen/classes/VisualShaderNodeIntParameter.ts +1 -1
  97. package/gen/classes/WebSocketMultiplayerPeer.ts +2 -2
  98. package/gen/classes/WebSocketPeer.ts +2 -2
  99. package/gen/classes/Window.ts +1 -1
  100. package/gen/classes/XRFaceTracker.ts +1 -1
  101. package/gen/heap-types/GodotArray.ts +4 -1
  102. package/gen/heap-types/GodotDictionary.ts +6 -1
  103. package/package.json +16 -10
  104. package/src/assets.d.ts +14 -0
  105. package/src/boot.browser.ts +5 -3
  106. package/src/boot.ts +3 -2
  107. package/src/debug.ts +236 -118
  108. package/src/index.ts +15 -3
  109. package/src/load.ts +23 -2
  110. package/src/preload.ts +19 -1
  111. package/src/runtime.ts +17 -4
package/src/preload.ts CHANGED
@@ -36,7 +36,7 @@ const FORMATS: Record<string, { cls?: string; scan?: boolean; native?: boolean }
36
36
  jpeg: { cls: 'CompressedTexture2D' },
37
37
  png: { cls: 'CompressedTexture2D' },
38
38
  webp: { cls: 'CompressedTexture2D' },
39
- svg: { cls: 'Texture2D' },
39
+ svg: { cls: 'CompressedTexture2D' },
40
40
  exr: { cls: 'TextureLayered' },
41
41
  hdr: { cls: 'TextureLayered' },
42
42
  wav: { cls: 'AudioStreamWAV' },
@@ -44,6 +44,8 @@ const FORMATS: Record<string, { cls?: string; scan?: boolean; native?: boolean }
44
44
  mp3: { cls: 'AudioStreamMP3' },
45
45
  tres: { cls: 'Resource', scan: true, native: true },
46
46
  po: { cls: 'Translation', native: true },
47
+ ttf: { cls: 'FontFile' },
48
+ otf: { cls: 'FontFile' },
47
49
  mtl: { scan: true },
48
50
  };
49
51
 
@@ -175,6 +177,22 @@ const assetPlugin: BunPlugin = {
175
177
  name: 'godot-assets',
176
178
  setup(build) {
177
179
  build.onResolve({ filter: ASSET_RE }, (args) => {
180
+ // Only JS module imports of Godot source assets become `godot`
181
+ // modules. `Bun.build` reports JS imports as `import-statement`
182
+ // (and `dynamic-import`/`require-*`) but HTML asset references
183
+ // (<link>/<img>) and CSS url() refs as `internal`/`url-token` —
184
+ // those fall through so Bun copies/hashes the file normally. The
185
+ // runtime preload (bun run / bun test) reports JS imports with no
186
+ // kind (`undefined`), so treat that as a JS import too.
187
+ if (
188
+ args.kind !== undefined &&
189
+ args.kind !== 'import-statement' &&
190
+ args.kind !== 'dynamic-import' &&
191
+ args.kind !== 'require-call' &&
192
+ args.kind !== 'require-resolve'
193
+ ) {
194
+ return;
195
+ }
178
196
  const importerAbs = args.importer?.startsWith(`${NS}:`)
179
197
  ? args.importer.slice(NS.length + 1)
180
198
  : args.importer;
package/src/runtime.ts CHANGED
@@ -3,11 +3,21 @@
3
3
  ***********************************************************************/
4
4
 
5
5
  /** Shared runtime: platform-specific native-module selection lives in
6
- * `boot.ts` (desktop) / `boot.browser.ts` (web, via the package's
7
- * `browser` field). `_mod` is the native module — the desktop addon's
8
- * `module.exports` or the wasm module's `.default`.
6
+ * `boot.ts` (desktop) / `boot.browser.ts` (web, via the `exports` `./boot`
7
+ * entry's `browser` condition). `_mod` is the native module — the desktop
8
+ * addon's `module.exports` or the wasm module's `.default`.
9
+ *
10
+ * The boot leaf is imported by **package self-reference** (`@ringozz/godot/boot`),
11
+ * not by relative path: a bare specifier resolves through this package's own
12
+ * `exports` map (whose `./boot` entry's `browser` condition selects
13
+ * `boot.browser.ts` on web) exactly like the entrypoint's
14
+ * `import { preloadGodot } from '@ringozz/godot/boot'`, so both sides land on the
15
+ * same absolute path and share ONE `boot.browser.ts` module instance. (A relative
16
+ * `./boot.ts` import would let a consumer's bundler realpath it into
17
+ * `node_modules/.bun/...` while the entrypoint keeps the `node_modules/@ringozz/godot`
18
+ * path — two instances, and the preload handoff below would read `null`.)
9
19
  */
10
- import { getNativeModule } from './boot.ts';
20
+ import { getNativeModule } from '@ringozz/godot/boot';
11
21
  const { default: _mod } = getNativeModule() as any;
12
22
 
13
23
  /** Godot instance */
@@ -69,3 +79,6 @@ export function _P(signal: any, onfulfilled?: any, onrejected?: any) {
69
79
  if (res !== 0) reject(new Error('Failed to connect signal: error code ' + res));
70
80
  }).then(onfulfilled, onrejected);
71
81
  }
82
+
83
+ /** Cleanup callbacks run once by `runGodot` just before the engine is freed; may be async. */
84
+ export const cleanupHooks: Set<() => void | Promise<void>> = new Set();