From 51b23a62a30c4709d49e99b283024c3d384d1945 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 08:20:48 +0000 Subject: [PATCH] chore: update versions --- .changeset/acher-neurogliosis-distance.md | 5 - .changeset/actinotoxemia-scryer-uncantoned.md | 5 - .changeset/ammelide-dilute-nazarean.md | 5 - .changeset/ammonifier-lungi-godmaker.md | 5 - .../appropinquate-hydrogeological-diipolia.md | 5 - .changeset/arethuse-chlamydozoa-revere.md | 5 - .../asphyxiator-perceptionism-doorkeeper.md | 5 - .changeset/ballistae-pickaway-shelfpiece.md | 5 - .changeset/barter-uxorious-unsuspecting.md | 5 - .changeset/beamlike-wartless-endamage.md | 5 - .changeset/bedder-unvulgar-ungingled.md | 5 - .changeset/besiren-hodden-margarin.md | 25 - .changeset/brighid-pit-mortcloth.md | 110 --- .changeset/bright-doodles-change.md | 9 - .changeset/canadine-knowableness-leucitis.md | 16 - .changeset/cantabrize-infrigidation-spousy.md | 61 -- .../catharticalness-amphicarpous-unshewed.md | 5 - ...ondrosteoma-keratoleukoma-tentaculocyst.md | 9 - .changeset/clancularly-rattlejack-maguey.md | 5 - .../convolvulinolic-mascouten-evanesce.md | 5 - .changeset/crate-heteromera-runnel.md | 5 - .../cresylite-unjudiciously-misshapen.md | 5 - .../cylindrella-prediluvial-araneology.md | 5 - .changeset/cymraeg-recappable-porousness.md | 7 - .changeset/decretorily-enveil-misexplain.md | 5 - .changeset/deep-kids-fail.md | 5 - .changeset/eager-garlics-draw.md | 5 - .../embryotome-papilioninae-troostitic.md | 5 - .../epimachinae-anemonal-unbearableness.md | 11 - .changeset/epitrichium-dacite-fibrinolytic.md | 5 - .changeset/equity-clarionet-subtenancy.md | 5 - .../ethnobiological-elfenfolk-semola.md | 5 - .changeset/exosmotic-pedatisect-kaffir.md | 5 - ...acapsular-unchangeable-coleochaetaceous.md | 5 - .../fasciolar-cloisonless-hymeniophore.md | 5 - .../femorocaudal-phrenological-pinguecula.md | 6 - .changeset/flanque-catastate-whirrey.md | 23 - .changeset/foreshadower-swashwork-appearer.md | 7 - .changeset/galenic-spinescence-immodest.md | 18 - .changeset/giant-ducks-talk.md | 17 - .changeset/gristliness-kipchak-intolerant.md | 5 - .../haussmannization-lassock-synedrous.md | 5 - .changeset/heliosis-recti-obstinateness.md | 5 - ...sensitiveness-splendidness-hydradephaga.md | 5 - .../illusiveness-metopomancy-fibroblast.md | 5 - .changeset/inditement-culver-plumbism.md | 7 - .changeset/inordinary-assessment-pandurate.md | 5 - .changeset/introversible-roupet-retinal.md | 5 - .changeset/laverania-euxine-coccygotomy.md | 5 - .changeset/listel-affrontedly-noncensored.md | 5 - .changeset/lucky-ads-admire.md | 5 - .../meiobar-poisonable-prussification.md | 8 - .../metascutellar-phaethontic-collop.md | 5 - .changeset/modern-peas-drum.md | 5 - .changeset/moody-cars-sell.md | 5 - .changeset/moody-dingos-hide.md | 5 - .changeset/muscovitize-theirselves-livish.md | 18 - .../muslined-behavioristic-thanatist.md | 5 - .changeset/ninety-islands-return.md | 15 - ...nperformer-sulfhydrate-stupefactiveness.md | 5 - .../nonsettlement-sobralite-devilish.md | 5 - .changeset/nonzero-uncriticised-somnolize.md | 76 -- .changeset/norseler-nozzler-swill.md | 5 - .../polyploidic-thanklessness-damson.md | 11 - .changeset/precook-pipemouth-coelector.md | 5 - .../prefigurement-benziminazole-chokestrap.md | 5 - .changeset/premonitory-grazier-correption.md | 5 - .../pyrrolidine-monocercous-nucleolinus.md | 5 - .changeset/quinqueradial-firer-longicone.md | 20 - .changeset/radioscopic-autotype-bipennated.md | 5 - .changeset/resweep-coambulant-squarely.md | 18 - .changeset/resymbolize-unavowedly-ocque.md | 5 - .changeset/roadmaster-grotto-disrespectful.md | 5 - .changeset/sabromin-tsantsa-afterdeck.md | 5 - .../sclerogenous-deliverance-drenchingly.md | 5 - .changeset/scumless-boxbush-phytotoxin.md | 5 - .../semideification-schoolish-oolitic.md | 5 - .changeset/sepiost-yawner-inapprehensible.md | 156 ---- .../sheepstealing-fraticellian-miscoinage.md | 18 - .changeset/shippo-tanh-luceres.md | 5 - .changeset/silent-cars-call.md | 7 - .changeset/small-emus-notice.md | 7 - .../somnifuge-formicicide-karyorrhexis.md | 5 - .changeset/sophia-thalessa-flanch.md | 5 - .changeset/subpoenal-lively-unconvenience.md | 5 - .changeset/tangy-pugs-tell.md | 5 - .changeset/tanquam-colinephritis-kanten.md | 5 - .../tiltboard-kissableness-archhypocrisy.md | 18 - .changeset/tolerant-sdeath-vestige.md | 7 - .changeset/unaproned-periorchitis-pierce.md | 5 - .../undenominated-saberlike-atmidometry.md | 8 - .changeset/undergrub-perclose-telotype.md | 5 - .changeset/unhandseled-pockily-acyloin.md | 5 - .../unromantically-analogon-monochloro.md | 6 - .changeset/wiremonger-overawn-overnicely.md | 5 - CHANGELOG.md | 772 +++++++++++++++++- jsb_version.h | 6 +- package.json | 2 +- 98 files changed, 748 insertions(+), 1081 deletions(-) delete mode 100644 .changeset/acher-neurogliosis-distance.md delete mode 100644 .changeset/actinotoxemia-scryer-uncantoned.md delete mode 100644 .changeset/ammelide-dilute-nazarean.md delete mode 100644 .changeset/ammonifier-lungi-godmaker.md delete mode 100644 .changeset/appropinquate-hydrogeological-diipolia.md delete mode 100644 .changeset/arethuse-chlamydozoa-revere.md delete mode 100644 .changeset/asphyxiator-perceptionism-doorkeeper.md delete mode 100644 .changeset/ballistae-pickaway-shelfpiece.md delete mode 100644 .changeset/barter-uxorious-unsuspecting.md delete mode 100644 .changeset/beamlike-wartless-endamage.md delete mode 100644 .changeset/bedder-unvulgar-ungingled.md delete mode 100644 .changeset/besiren-hodden-margarin.md delete mode 100644 .changeset/brighid-pit-mortcloth.md delete mode 100644 .changeset/bright-doodles-change.md delete mode 100644 .changeset/canadine-knowableness-leucitis.md delete mode 100644 .changeset/cantabrize-infrigidation-spousy.md delete mode 100644 .changeset/catharticalness-amphicarpous-unshewed.md delete mode 100644 .changeset/chondrosteoma-keratoleukoma-tentaculocyst.md delete mode 100644 .changeset/clancularly-rattlejack-maguey.md delete mode 100644 .changeset/convolvulinolic-mascouten-evanesce.md delete mode 100644 .changeset/crate-heteromera-runnel.md delete mode 100644 .changeset/cresylite-unjudiciously-misshapen.md delete mode 100644 .changeset/cylindrella-prediluvial-araneology.md delete mode 100644 .changeset/cymraeg-recappable-porousness.md delete mode 100644 .changeset/decretorily-enveil-misexplain.md delete mode 100644 .changeset/deep-kids-fail.md delete mode 100644 .changeset/eager-garlics-draw.md delete mode 100644 .changeset/embryotome-papilioninae-troostitic.md delete mode 100644 .changeset/epimachinae-anemonal-unbearableness.md delete mode 100644 .changeset/epitrichium-dacite-fibrinolytic.md delete mode 100644 .changeset/equity-clarionet-subtenancy.md delete mode 100644 .changeset/ethnobiological-elfenfolk-semola.md delete mode 100644 .changeset/exosmotic-pedatisect-kaffir.md delete mode 100644 .changeset/extracapsular-unchangeable-coleochaetaceous.md delete mode 100644 .changeset/fasciolar-cloisonless-hymeniophore.md delete mode 100644 .changeset/femorocaudal-phrenological-pinguecula.md delete mode 100644 .changeset/flanque-catastate-whirrey.md delete mode 100644 .changeset/foreshadower-swashwork-appearer.md delete mode 100644 .changeset/galenic-spinescence-immodest.md delete mode 100644 .changeset/giant-ducks-talk.md delete mode 100644 .changeset/gristliness-kipchak-intolerant.md delete mode 100644 .changeset/haussmannization-lassock-synedrous.md delete mode 100644 .changeset/heliosis-recti-obstinateness.md delete mode 100644 .changeset/hypersensitiveness-splendidness-hydradephaga.md delete mode 100644 .changeset/illusiveness-metopomancy-fibroblast.md delete mode 100644 .changeset/inditement-culver-plumbism.md delete mode 100644 .changeset/inordinary-assessment-pandurate.md delete mode 100644 .changeset/introversible-roupet-retinal.md delete mode 100644 .changeset/laverania-euxine-coccygotomy.md delete mode 100644 .changeset/listel-affrontedly-noncensored.md delete mode 100644 .changeset/lucky-ads-admire.md delete mode 100644 .changeset/meiobar-poisonable-prussification.md delete mode 100644 .changeset/metascutellar-phaethontic-collop.md delete mode 100644 .changeset/modern-peas-drum.md delete mode 100644 .changeset/moody-cars-sell.md delete mode 100644 .changeset/moody-dingos-hide.md delete mode 100644 .changeset/muscovitize-theirselves-livish.md delete mode 100644 .changeset/muslined-behavioristic-thanatist.md delete mode 100644 .changeset/ninety-islands-return.md delete mode 100644 .changeset/nonperformer-sulfhydrate-stupefactiveness.md delete mode 100644 .changeset/nonsettlement-sobralite-devilish.md delete mode 100644 .changeset/nonzero-uncriticised-somnolize.md delete mode 100644 .changeset/norseler-nozzler-swill.md delete mode 100644 .changeset/polyploidic-thanklessness-damson.md delete mode 100644 .changeset/precook-pipemouth-coelector.md delete mode 100644 .changeset/prefigurement-benziminazole-chokestrap.md delete mode 100644 .changeset/premonitory-grazier-correption.md delete mode 100644 .changeset/pyrrolidine-monocercous-nucleolinus.md delete mode 100644 .changeset/quinqueradial-firer-longicone.md delete mode 100644 .changeset/radioscopic-autotype-bipennated.md delete mode 100644 .changeset/resweep-coambulant-squarely.md delete mode 100644 .changeset/resymbolize-unavowedly-ocque.md delete mode 100644 .changeset/roadmaster-grotto-disrespectful.md delete mode 100644 .changeset/sabromin-tsantsa-afterdeck.md delete mode 100644 .changeset/sclerogenous-deliverance-drenchingly.md delete mode 100644 .changeset/scumless-boxbush-phytotoxin.md delete mode 100644 .changeset/semideification-schoolish-oolitic.md delete mode 100644 .changeset/sepiost-yawner-inapprehensible.md delete mode 100644 .changeset/sheepstealing-fraticellian-miscoinage.md delete mode 100644 .changeset/shippo-tanh-luceres.md delete mode 100644 .changeset/silent-cars-call.md delete mode 100644 .changeset/small-emus-notice.md delete mode 100644 .changeset/somnifuge-formicicide-karyorrhexis.md delete mode 100644 .changeset/sophia-thalessa-flanch.md delete mode 100644 .changeset/subpoenal-lively-unconvenience.md delete mode 100644 .changeset/tangy-pugs-tell.md delete mode 100644 .changeset/tanquam-colinephritis-kanten.md delete mode 100644 .changeset/tiltboard-kissableness-archhypocrisy.md delete mode 100644 .changeset/tolerant-sdeath-vestige.md delete mode 100644 .changeset/unaproned-periorchitis-pierce.md delete mode 100644 .changeset/undenominated-saberlike-atmidometry.md delete mode 100644 .changeset/undergrub-perclose-telotype.md delete mode 100644 .changeset/unhandseled-pockily-acyloin.md delete mode 100644 .changeset/unromantically-analogon-monochloro.md delete mode 100644 .changeset/wiremonger-overawn-overnicely.md diff --git a/.changeset/acher-neurogliosis-distance.md b/.changeset/acher-neurogliosis-distance.md deleted file mode 100644 index 54d2e883..00000000 --- a/.changeset/acher-neurogliosis-distance.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Statically resolved return type for `get_node()`/`getNode()`. diff --git a/.changeset/actinotoxemia-scryer-uncantoned.md b/.changeset/actinotoxemia-scryer-uncantoned.md deleted file mode 100644 index c5c2e671..00000000 --- a/.changeset/actinotoxemia-scryer-uncantoned.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** `ResourceLoader.load()` overload type. diff --git a/.changeset/ammelide-dilute-nazarean.md b/.changeset/ammelide-dilute-nazarean.md deleted file mode 100644 index 0b5e809b..00000000 --- a/.changeset/ammelide-dilute-nazarean.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** `@ExportObject(Node)` was only working for sub-classes, not `Node` itself. diff --git a/.changeset/ammonifier-lungi-godmaker.md b/.changeset/ammonifier-lungi-godmaker.md deleted file mode 100644 index cf4ede27..00000000 --- a/.changeset/ammonifier-lungi-godmaker.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Duplicate "Generating" label appeared in the UI during codegen. diff --git a/.changeset/appropinquate-hydrogeological-diipolia.md b/.changeset/appropinquate-hydrogeological-diipolia.md deleted file mode 100644 index 94bd0dad..00000000 --- a/.changeset/appropinquate-hydrogeological-diipolia.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** `GDictionary` absent values are now correctly typed as returning as `null`, not `undefined`. diff --git a/.changeset/arethuse-chlamydozoa-revere.md b/.changeset/arethuse-chlamydozoa-revere.md deleted file mode 100644 index c8a76335..00000000 --- a/.changeset/arethuse-chlamydozoa-revere.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Improved type conversion error messages. diff --git a/.changeset/asphyxiator-perceptionism-doorkeeper.md b/.changeset/asphyxiator-perceptionism-doorkeeper.md deleted file mode 100644 index 18250904..00000000 --- a/.changeset/asphyxiator-perceptionism-doorkeeper.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** `@export_` support for enums as keys of `GDictionary`. diff --git a/.changeset/ballistae-pickaway-shelfpiece.md b/.changeset/ballistae-pickaway-shelfpiece.md deleted file mode 100644 index 3ed6a94b..00000000 --- a/.changeset/ballistae-pickaway-shelfpiece.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types/Fix:** Invalid codegen for certain types (function literals in particular) diff --git a/.changeset/barter-uxorious-unsuspecting.md b/.changeset/barter-uxorious-unsuspecting.md deleted file mode 100644 index 6c0792a0..00000000 --- a/.changeset/barter-uxorious-unsuspecting.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Background thread script instantiation (for 4.5 editor). diff --git a/.changeset/beamlike-wartless-endamage.md b/.changeset/beamlike-wartless-endamage.md deleted file mode 100644 index acc8f679..00000000 --- a/.changeset/beamlike-wartless-endamage.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Handle `hint_string` if `@export_var` is a `GArray` with an element type provided via `details.class_`. diff --git a/.changeset/bedder-unvulgar-ungingled.md b/.changeset/bedder-unvulgar-ungingled.md deleted file mode 100644 index c2c0c62c..00000000 --- a/.changeset/bedder-unvulgar-ungingled.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Added `Resource` `duplicate()` return type. diff --git a/.changeset/besiren-hodden-margarin.md b/.changeset/besiren-hodden-margarin.md deleted file mode 100644 index eb433add..00000000 --- a/.changeset/besiren-hodden-margarin.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Improved user project type configurability. - -- Codegen for scenes and resources now default to being stored in - `gen/types` rather than `typings/`. However, a setting has been - introduced to configure this. `typings/` is no longer used - because the directory is configured as a type root, which means - directories contained within are expected to be module - definitions. -- `"types": ["node"]` in the default tsconfig was hiding type errors. - This is no longer set. Essentially, this setting was disabling - all types except node types from our type roots. -- `@types/node` removed from the default `package.json`. It was - misleading and made it easy to accidentally use non-existent - functionality. We no longer need these types because... -- Our JS essentials (console, timeout and intervals APIs) are now - included in our `godot.minimal.d.ts`. -- No longer including `` in our TS - files. This seemed to be interfering with user tsconfig options, - and it was not required. Not that it's been removed you're able to - more freely make changes to your tsconfig. For example, you may set - `libs` (or `target`) to make use of newer JS APIs. diff --git a/.changeset/brighid-pit-mortcloth.md b/.changeset/brighid-pit-mortcloth.md deleted file mode 100644 index ea49ab60..00000000 --- a/.changeset/brighid-pit-mortcloth.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Ergonomics overhaul. Camel-case, TS types, codegen + more. - -- There's now a project setting which can be toggled to swap to a - more idiomatic JS naming scheme for Godot bindings. We use - camel and pascal case to more closely align with typical - JavaScript/TypeScript conventions. For `@Decorators` we've gone - with pascal case, which is used in libraries like Angular. Camel - case is perhaps more popular, but pascal case allows us to avoid - reserved names, and thus we can cleanly write `@Export`, instead of - needing to include the trailing underscore on `@export_`. - -- TypeScript types have been improved. Particularly `Signal<>` and - `Callable<>`. `Signal1`, `Signal2`, etc. are now deprecated, as are - `AnySignal` and `AnyCallable`, since the new `Signal` and `Callable` - types handle an arbitrary number of parameters. Importantly, - `Callable.bind(...)` is now accurately typed, so you'll receive - type errors when connecting to signals. - -- `GArray` and `GDictionary` now have a static `.create()` method - which allows you to create nested data structures from literals - and benefit from full type checking. When a `GArray` or `GDictionary` - is expected as a property, a `.proxy()` can be provided in its - place. - -- Partially worked around https://github.com/microsoft/TypeScript/issues/43826 - whereby our proxied `GArray` and `GDictionary` always return proxied - nested values, but will accept non-proxied values when mutating - a property. Basically, there's now `GArrayReadProxy` and - `GDictionaryReadProxy`. These aren't runtime types, they're just - TS types that make it easier to work with proxies. Under normal - circumstances, you likely won't need to know these types exist. - -- Codegen leveled up. Any TS module can now export a function - named `codegen` with the type `CodeGenHandler`. This function - will be called during codegen to allow you to optionally - augment type generation involving user-defined types. Consider, - for example, the `SceneNodes` codegen which previously only knew - how to handle Godot/native types in the scene hierarchy. When - a user type was encountered, it'd write the native type, which - is still useful, but it'd be nice to be able to include user - types. The reason we don't by default is user types are not - required to follow our generic parameter convention where - each node is passed a `Map` argument. - - Let's see an example: - - ```ts - export default class CardCollection extends GameNode - ``` - - the type above does not take a `Map`. Perhaps more interesting, it - takes a different generic parameter, a `CardNode`. If we encounter - a `CardCollection` script attached to a node in the scene somewhere, - GodotJS' internal codegen can't possibly know what that generic - parameter ought to be. So we can help it out. In the same file - where `CardCollection` is defined, we could provide a `codegen` - handler like so: - - ```ts - export const codegen: CodeGenHandler = rawRequest => { - const request = rawRequest.proxy(); - - switch (request.type) { - case CodeGenType.ScriptNodeTypeDescriptor: { - const cardNodeScript = request.node.get('cardNodeScript'); - return GDictionary.create({ - type: DescriptorType.User, - name: 'CardCollection', - resource: 'res://src/card-collection.ts', - arguments: GArray.create([ - GDictionary.create({ - type: DescriptorType.User, - name: cardNodeScript?.getGlobalName() ?? 'CardNode', - resource: cardNodeScript?.resourcePath ?? 'res://src/card-node.ts', - }), - ]), - }); - } - } - - return undefined; - }; - ``` - - Above we handle the codegen request to determine the node type - of the provided `request.node`. What's *really* neat here is we - don't need to hard-code that generic. We've instead exported a - configurable `Script` reference for use in the editor: - - ```ts - @ExportObject(Script) - cardNodeScript: Script = ResourceLoader.load('res://src/card-node.ts') as Script; - ``` - - So the codegen logic simply grabs the type exported from the - chosen script, and provides it as a generic argument to - `CardCollection<>`. - - One thing worth noting, your class does NOT need to be a `@Tool`. - In the above example, `CardCollection` is not a `@Tool`, and - hence the node script is not instantiated during codegen, which - is why we've used `request.node.get('cardNodeScript')` rather - than trying to access the property directly. That said, if you - want, codegen can be combined with `@Tool`. - -- There's also a bunch of logging/error reporting improvements. diff --git a/.changeset/bright-doodles-change.md b/.changeset/bright-doodles-change.md deleted file mode 100644 index c1361d57..00000000 --- a/.changeset/bright-doodles-change.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Bumped default tsconfig target from es2016 to es2022 - -All supported runtimes ought to support the 2022 standard. You can -still manually change the target if desired. This change is to -provide a better user experience by default. \ No newline at end of file diff --git a/.changeset/canadine-knowableness-leucitis.md b/.changeset/canadine-knowableness-leucitis.md deleted file mode 100644 index df4486ed..00000000 --- a/.changeset/canadine-knowableness-leucitis.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Godot String methods now exposed as static methods on `String`. - -This doesn't change anything about how strings are used within -JavaScript i.e. we're still using JS native string type, not -Godot's String. However, Godot's String class has many utility -functions, some of them static and some of them as instance -methods. These are now all available for consumption in JavaScript. -Godot String instance methods are mapped to static methods that -take a `target: string` as their first parameter. - -In general, if there's an equivalent native JS string method, you -should always use it instead since it will be much more performant. diff --git a/.changeset/cantabrize-infrigidation-spousy.md b/.changeset/cantabrize-infrigidation-spousy.md deleted file mode 100644 index 86c7b06b..00000000 --- a/.changeset/cantabrize-infrigidation-spousy.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Constructor params support and GDScript compatible `new` - -Support for `new` is very important for improving interop with -other scripting languages, allowing them to instantiate objects -from a Script reference. Crucially, this allows native -GDExtension to instantiate Nodes/Objects/Resources implemented -in GodotJS. - -Object construction has been refactored. Previously we had three -cases to handle: - -1. new SomeJSWrapperAroundAGodotObject() – JS construction -2. CDO (Class default object) construction - used to determine - default parameters on a class (for use in the editor). -3. Cross binding. Which is when a Godot Object is constructed and - our script latter needs to attach to it. - -In the past, case 1 was the only situation in which instantiating -a JS class ought to also instantiate the Godot native object. -However, in my previous commit I changed CDOs so also instantiate -the underlying native object. So case 2 was eliminated. - -Case 3 (cross binding) is a common situation, it was previously -implemented in a somewhat intrusive fashion. All JS objects were -being constructed and passed a parameter as their first argument. -This indicated whether the object was cross binding (or a CDO). -This prevented users from (easily) implementing constructors, the -user had to know about the internal parameter and pass this -up through to super(). For the most part I imagine users (myself -included) simply avoided using constructors. However, this -complicated some code that would otherwise be trivial in GDScript -or C# because the latter has constructors and the former _init. - -Consequently, I've implemented a new strategy to determine whether -a constructor is being called from C++ (cross binding) or from JS. -The implementation is quite straight forward, but arriving at this -solution was not necessarily obvious. V8 doesn't expose APIs to -intercept construction, and we can't naively use shared flags -to mark a native constructor in progress because the solution -needs to support reentrancy since during construction an object -may instantiate other objects. Additionally, we can't just use -different constructors (V8 templates) because there's issues with -both sub-classing and `instanceof` detection. - -The solution was to take advantage of JS' `Reflect.construct` API. -This allows us to call a constructor but have `new.target` set to -an arbitrary constructable. `new.target` survives whilst -traversing up through super() constructors (similar to how we -previously passed arguments up). This let's us mark a particular -instantiation as coming from C++. `Reflect.construct` instantiates -`this` to match the prototype chain from the provided `newTarget` -so we simply set it to the prototype of the original constructor -and we're on our way. - -Using `Reflect.construct` is also standard JS, so it's available -on our support JS runtimes without needing to resort to any -runtime-specific code. diff --git a/.changeset/catharticalness-amphicarpous-unshewed.md b/.changeset/catharticalness-amphicarpous-unshewed.md deleted file mode 100644 index f0b6f19b..00000000 --- a/.changeset/catharticalness-amphicarpous-unshewed.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Improved GObject types diff --git a/.changeset/chondrosteoma-keratoleukoma-tentaculocyst.md b/.changeset/chondrosteoma-keratoleukoma-tentaculocyst.md deleted file mode 100644 index e3199805..00000000 --- a/.changeset/chondrosteoma-keratoleukoma-tentaculocyst.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Bind script instance during default prop evaluation. - -If properties are implemented in JavaScript as properties (getters) -they'll often want to call Godot methods on self. Without the -script instance being bound this led to a crash. diff --git a/.changeset/clancularly-rattlejack-maguey.md b/.changeset/clancularly-rattlejack-maguey.md deleted file mode 100644 index 3c3269d2..00000000 --- a/.changeset/clancularly-rattlejack-maguey.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Introduced a setting to control whether `.d.ts` for scenes are auto-generated on when scenes are saved in the Editor. diff --git a/.changeset/convolvulinolic-mascouten-evanesce.md b/.changeset/convolvulinolic-mascouten-evanesce.md deleted file mode 100644 index cef6657b..00000000 --- a/.changeset/convolvulinolic-mascouten-evanesce.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Expose Godot Variant utility method typeof() as `godot_typeof()`/`godotTypeof()`. diff --git a/.changeset/crate-heteromera-runnel.md b/.changeset/crate-heteromera-runnel.md deleted file mode 100644 index 30b9ff12..00000000 --- a/.changeset/crate-heteromera-runnel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Threading / Godot address reuse crash. diff --git a/.changeset/cresylite-unjudiciously-misshapen.md b/.changeset/cresylite-unjudiciously-misshapen.md deleted file mode 100644 index 12287605..00000000 --- a/.changeset/cresylite-unjudiciously-misshapen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Codegen + type checking for animations. diff --git a/.changeset/cylindrella-prediluvial-araneology.md b/.changeset/cylindrella-prediluvial-araneology.md deleted file mode 100644 index 8212fb14..00000000 --- a/.changeset/cylindrella-prediluvial-araneology.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** `CameraFeed` types. diff --git a/.changeset/cymraeg-recappable-porousness.md b/.changeset/cymraeg-recappable-porousness.md deleted file mode 100644 index 64ded713..00000000 --- a/.changeset/cymraeg-recappable-porousness.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types/Fix:** Codegen now types more `GArray`/`GDictionary` generic params based on exported variable hint strings. - -Additionally, fixed some codegen for enums when camel-case bindings are enabled. diff --git a/.changeset/decretorily-enveil-misexplain.md b/.changeset/decretorily-enveil-misexplain.md deleted file mode 100644 index a5de01ed..00000000 --- a/.changeset/decretorily-enveil-misexplain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Support async module loader in quickjs.impl. diff --git a/.changeset/deep-kids-fail.md b/.changeset/deep-kids-fail.md deleted file mode 100644 index accf724d..00000000 --- a/.changeset/deep-kids-fail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: null handling in GArray/GDictionary create() helpers diff --git a/.changeset/eager-garlics-draw.md b/.changeset/eager-garlics-draw.md deleted file mode 100644 index b09a0663..00000000 --- a/.changeset/eager-garlics-draw.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Use TypeScript 5.9.2 (latest) by default diff --git a/.changeset/embryotome-papilioninae-troostitic.md b/.changeset/embryotome-papilioninae-troostitic.md deleted file mode 100644 index d2b54f4c..00000000 --- a/.changeset/embryotome-papilioninae-troostitic.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Godot 4.5 support diff --git a/.changeset/epimachinae-anemonal-unbearableness.md b/.changeset/epimachinae-anemonal-unbearableness.md deleted file mode 100644 index c14a6e81..00000000 --- a/.changeset/epimachinae-anemonal-unbearableness.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** "Generate Godot d.ts" in the UI is now "Generate types" and in addition to -generating all Godot and project types (which it already did), the -autogen directory will now be wiped of all files/directories before -commencing generation. This ensures old generated files no longer -pollute the project. - - diff --git a/.changeset/epitrichium-dacite-fibrinolytic.md b/.changeset/epitrichium-dacite-fibrinolytic.md deleted file mode 100644 index 3eeab376..00000000 --- a/.changeset/epitrichium-dacite-fibrinolytic.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Duplicate PackedByteArray to_array_buffer() registration diff --git a/.changeset/equity-clarionet-subtenancy.md b/.changeset/equity-clarionet-subtenancy.md deleted file mode 100644 index 7b8dd2ce..00000000 --- a/.changeset/equity-clarionet-subtenancy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Added missing `PROPERTY_USAGE_SCRIPT_VARIABLE` flag on exported variables. diff --git a/.changeset/ethnobiological-elfenfolk-semola.md b/.changeset/ethnobiological-elfenfolk-semola.md deleted file mode 100644 index 5394021a..00000000 --- a/.changeset/ethnobiological-elfenfolk-semola.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** `NodePathMap` now permits `undefined`/optional children. diff --git a/.changeset/exosmotic-pedatisect-kaffir.md b/.changeset/exosmotic-pedatisect-kaffir.md deleted file mode 100644 index 70c1bf7c..00000000 --- a/.changeset/exosmotic-pedatisect-kaffir.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature/Types:** Types + codegen for project input actions. diff --git a/.changeset/extracapsular-unchangeable-coleochaetaceous.md b/.changeset/extracapsular-unchangeable-coleochaetaceous.md deleted file mode 100644 index 8808bb51..00000000 --- a/.changeset/extracapsular-unchangeable-coleochaetaceous.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** `EditorUndoRedoManager` API types diff --git a/.changeset/fasciolar-cloisonless-hymeniophore.md b/.changeset/fasciolar-cloisonless-hymeniophore.md deleted file mode 100644 index 355a71ed..00000000 --- a/.changeset/fasciolar-cloisonless-hymeniophore.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types**: Ensure the GAny union type includes null diff --git a/.changeset/femorocaudal-phrenological-pinguecula.md b/.changeset/femorocaudal-phrenological-pinguecula.md deleted file mode 100644 index 683831d2..00000000 --- a/.changeset/femorocaudal-phrenological-pinguecula.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Critical bug fixes (for crashes) that may occur due to the -current isolate not being set. diff --git a/.changeset/flanque-catastate-whirrey.md b/.changeset/flanque-catastate-whirrey.md deleted file mode 100644 index 6d498a57..00000000 --- a/.changeset/flanque-catastate-whirrey.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** `GDictionary`/`GArray` recursive handling and `toJSON()`/`toString()` - -`GArrayProxy` (now a named type) will now JSON encode like a regular -JS array i.e. `[1,2,3]` instead of `{"0": 1, "1": 2, "2": 3}`. - -We previously ensured that values accessed via a proxy were -themselves proxied. Thus allowing access to nested properties -via chained access e.g. dict_proxy.a.b. However, when setting or -inserting a proxy-wrapped value, we previously inserted the proxy -itself, rather than the wrapped target. This has now been rectified, -it's not safe to do something like: - -```ts -const a = new GDictionary().proxy(); -a.b = new Dictionary().proxy(); -``` - -The above will result in a `GDictionary` containing a `b` -property that is an empty `GDictionary`. diff --git a/.changeset/foreshadower-swashwork-appearer.md b/.changeset/foreshadower-swashwork-appearer.md deleted file mode 100644 index 4d32477e..00000000 --- a/.changeset/foreshadower-swashwork-appearer.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** TStringNameCache v8::String reference loss - -https://github.com/godotjs/GodotJS/issues/110 diff --git a/.changeset/galenic-spinescence-immodest.md b/.changeset/galenic-spinescence-immodest.md deleted file mode 100644 index 08e71f95..00000000 --- a/.changeset/galenic-spinescence-immodest.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Native object now guaranteed bound during JS initializaation. - -Previously, when a JS class was being instantiated for an existing -native Godot object (e.g. ResourceLoader.load('...')) the JS -instance wasn't actually being bound to the native Godot object -until _after_ the JS instance was constructed/initialized. This -created a problem in which field/property initializers and the -constructor were unable to call any native functions, but could -call JS functions. - -Now, the Godot object is always bound to our instantiated object -as part of our Godot native class constructor. Thus, we can now -safely call methods during initialization. Importantly, this also -fixes TC39 Stage 3 decorator `@bind.signal()` support for fields. diff --git a/.changeset/giant-ducks-talk.md b/.changeset/giant-ducks-talk.md deleted file mode 100644 index debd5142..00000000 --- a/.changeset/giant-ducks-talk.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: Background/async resource loading where scripts are present. - -Shadow script instance replacement was failing due to calling the -wrong GodotJSScript::instance_create() overload. The overloads -have been replaced with separate functions to mitigate future -occurrences. - -Additionally, shadow script instance replacement was not properly -handling user types, only built-ins. This broke in a subtle hard -to debug fashion, whereby you received back a valid JS class -instance for the expected Godot object, however its prototype -chain was incomplete. The JS object was an instance of the base -Godot native object rather than the script on the object. diff --git a/.changeset/gristliness-kipchak-intolerant.md b/.changeset/gristliness-kipchak-intolerant.md deleted file mode 100644 index 751997f2..00000000 --- a/.changeset/gristliness-kipchak-intolerant.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** `JSWorker` transfer crash. diff --git a/.changeset/haussmannization-lassock-synedrous.md b/.changeset/haussmannization-lassock-synedrous.md deleted file mode 100644 index bf542579..00000000 --- a/.changeset/haussmannization-lassock-synedrous.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Async module loader. diff --git a/.changeset/heliosis-recti-obstinateness.md b/.changeset/heliosis-recti-obstinateness.md deleted file mode 100644 index 7e1716d1..00000000 --- a/.changeset/heliosis-recti-obstinateness.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Improved generated typings formatting. diff --git a/.changeset/hypersensitiveness-splendidness-hydradephaga.md b/.changeset/hypersensitiveness-splendidness-hydradephaga.md deleted file mode 100644 index 606a9fac..00000000 --- a/.changeset/hypersensitiveness-splendidness-hydradephaga.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Ensure usercode triggered from `get('prop')`/`set('prop')` does not crash the process, JS runtime errors are caught and logged. diff --git a/.changeset/illusiveness-metopomancy-fibroblast.md b/.changeset/illusiveness-metopomancy-fibroblast.md deleted file mode 100644 index d4539ddb..00000000 --- a/.changeset/illusiveness-metopomancy-fibroblast.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** `godot.lib.api` `instanceof` checks against proxied classes. diff --git a/.changeset/inditement-culver-plumbism.md b/.changeset/inditement-culver-plumbism.md deleted file mode 100644 index db3b740e..00000000 --- a/.changeset/inditement-culver-plumbism.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Don't crash when a GodotJS class implementation's parent class does not match the attached node. - -Instead, we log an error and prevent the script from being instantiated. diff --git a/.changeset/inordinary-assessment-pandurate.md b/.changeset/inordinary-assessment-pandurate.md deleted file mode 100644 index 3a2e10a2..00000000 --- a/.changeset/inordinary-assessment-pandurate.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Enum codegen (and godot.lib.api iteration). diff --git a/.changeset/introversible-roupet-retinal.md b/.changeset/introversible-roupet-retinal.md deleted file mode 100644 index bb97be1c..00000000 --- a/.changeset/introversible-roupet-retinal.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Performance:** Added LRU support for `StringNameCache`. diff --git a/.changeset/laverania-euxine-coccygotomy.md b/.changeset/laverania-euxine-coccygotomy.md deleted file mode 100644 index f2c4c1a2..00000000 --- a/.changeset/laverania-euxine-coccygotomy.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types**: Refined `SceneTree` `GArray` return types. diff --git a/.changeset/listel-affrontedly-noncensored.md b/.changeset/listel-affrontedly-noncensored.md deleted file mode 100644 index 8e5dcf7b..00000000 --- a/.changeset/listel-affrontedly-noncensored.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Don't leak temporary default properties object diff --git a/.changeset/lucky-ads-admire.md b/.changeset/lucky-ads-admire.md deleted file mode 100644 index d5fa68aa..00000000 --- a/.changeset/lucky-ads-admire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: Array counts props incorrectly typed as any diff --git a/.changeset/meiobar-poisonable-prussification.md b/.changeset/meiobar-poisonable-prussification.md deleted file mode 100644 index 32312d4f..00000000 --- a/.changeset/meiobar-poisonable-prussification.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Introduced settings to ensure dependencies are included in exported builds. - -- "Referenced Node Modules" can be enabled to package an _entire_ node module when any file belonging to that module is referenced. -- "Include directories" is another setting that allows you to explicitly add additional directories you want included in your exported builds. diff --git a/.changeset/metascutellar-phaethontic-collop.md b/.changeset/metascutellar-phaethontic-collop.md deleted file mode 100644 index 3689f357..00000000 --- a/.changeset/metascutellar-phaethontic-collop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Godot 4.4 support. diff --git a/.changeset/modern-peas-drum.md b/.changeset/modern-peas-drum.md deleted file mode 100644 index c44f7793..00000000 --- a/.changeset/modern-peas-drum.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: Ensure setTimeout correctly handles negative delays diff --git a/.changeset/moody-cars-sell.md b/.changeset/moody-cars-sell.md deleted file mode 100644 index c4369b81..00000000 --- a/.changeset/moody-cars-sell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: Improved node_modules handling during game exports. diff --git a/.changeset/moody-dingos-hide.md b/.changeset/moody-dingos-hide.md deleted file mode 100644 index c4968500..00000000 --- a/.changeset/moody-dingos-hide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": minor ---- - -GodotJS 1.1 diff --git a/.changeset/muscovitize-theirselves-livish.md b/.changeset/muscovitize-theirselves-livish.md deleted file mode 100644 index facae3d8..00000000 --- a/.changeset/muscovitize-theirselves-livish.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Improved TypeScript class matching regex. - -It was failing in the presence of generics which contain an `extends` -clause e.g. - -```ts -export default class GameNode = {}> extends Node3D -``` - -The regex will now look for the last `extends` on the line in order -to detect the base class. This is only an improvement, it's not -fool-proof and will fail if the base class has a generic that -contains a conditional type expression. Since we only have access -to PCRE2, this is probably the best we can do with just regex. diff --git a/.changeset/muslined-behavioristic-thanatist.md b/.changeset/muslined-behavioristic-thanatist.md deleted file mode 100644 index a8b96485..00000000 --- a/.changeset/muslined-behavioristic-thanatist.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Another missing `Isolate::Scope` that could lead to a runtime crash. diff --git a/.changeset/ninety-islands-return.md b/.changeset/ninety-islands-return.md deleted file mode 100644 index 081589e1..00000000 --- a/.changeset/ninety-islands-return.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: .ts/.js files not included in game export - -Exporting GodotJS games was fundamentally broken by -a Godot engine change which altered the way .skip() -behaved on exported files. Basically, we were skipping -.ts files because we don't want them in the export, -only .js files which we added as extra files. However, -the change to skip's behavior meant extra files are -also skipped. Instead .ts files are now remapped to -the .js file, not skipped. The result is as -previously intended i.e. only .js files ship. diff --git a/.changeset/nonperformer-sulfhydrate-stupefactiveness.md b/.changeset/nonperformer-sulfhydrate-stupefactiveness.md deleted file mode 100644 index bf1347d6..00000000 --- a/.changeset/nonperformer-sulfhydrate-stupefactiveness.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix/Types:** Ensure that codegen quotes property keys when necessary. diff --git a/.changeset/nonsettlement-sobralite-devilish.md b/.changeset/nonsettlement-sobralite-devilish.md deleted file mode 100644 index 6798ca7e..00000000 --- a/.changeset/nonsettlement-sobralite-devilish.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Support for importing `.json` files. diff --git a/.changeset/nonzero-uncriticised-somnolize.md b/.changeset/nonzero-uncriticised-somnolize.md deleted file mode 100644 index ffc6ad53..00000000 --- a/.changeset/nonzero-uncriticised-somnolize.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** New decorator syntax for exporting properties. - -TC39 (JavaScript standard body) have progressed a new decorator -syntax to Stage 3, and TypeScript 5.0 implemented support. The new -syntax is not quite as flexible but is type-safe and will be -more performant when implemented directly in JS engines. -Consequently, all existing decorators have deprecated (but -remain for backwards compatibility). In their place a new API, -`createClassBinder`, has been introduced. - -Our default `tsconfig.json` has been updated to turn off legacy -decorators, unlocking access to the newer syntax. You cannot use -both at once. Both sets of decorators contain warnings if used -with in incompatible tsconfig. - -The new decorator syntax looks something like: - -``` -const bind = createClassBinder(); - -@bind() -@bind.tool() -export default class Player extends CharacterBody2D { - @bind.export.cache() - @bind.export.object(SceneSynchronizer) - accessor synchronizer!: SceneSynchronizer; - - @bind.export.cache() - @bind.export(Variant.Type.TypeInt) - accessor walkSpeed: number = 350; - - @bind.export.cache() - @bind.export(Variant.Type.TypeInt) - accessor dashSpeed: number = 1000; - - @bind.export(Variant.Type.TypeInt) - accessor dashCooldownMs: number = 500; - - @bind.export.enum(Direction) - accessor facing = Direction.Down; - - @bind.export(Variant.Type.TypeInt) - accessor useCooldownMs: number = 500; -} -``` - -A few key points: - -1. You must create a ClassBinder using createClassBinder(). - This is a function and contains properties/APIs on it. - You can use any variable name, but the convention I'll be - using going forward is to use a variable named `bind`. -2. The decorator APIs are all functions that return a decorator - i.e. It's `@bind()` and `@bind.export.cache()` not `@bind` - or `@bind.export.cache`. -3. We're using JavaScript's new/upcoming auto-accessor syntax. - This is not a requirement for all decorators, but not all - decorators (e.g., the new cache() decorator) are supported - on fields. -4. The new cache decorator enables caching of variants on the - Godot side of the JS <-> Godot bridge. - The decorator generates a `set` accessor that updates the cache - automatically whenever a value is assigned to the JS property. - The purpose of the cache is that is provides a fairly sizeable - performance improvement when using Godot's general purpose - .get("property_name") method. This is particularly useful if - you want to expose data to performance sensitive GDExtensions. -5. The order of decorators matters! - Decorators are evaluated "inside->out" and class decorators are - evaluated after all property decorators. `bind()` MUST be - executed AFTER all other decorators. The `@bind.export.cache()` - decorator MUST be evaluated AFTER the property export. diff --git a/.changeset/norseler-nozzler-swill.md b/.changeset/norseler-nozzler-swill.md deleted file mode 100644 index 4da09ff4..00000000 --- a/.changeset/norseler-nozzler-swill.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Always use thread-safe variant pool allocator. diff --git a/.changeset/polyploidic-thanklessness-damson.md b/.changeset/polyploidic-thanklessness-damson.md deleted file mode 100644 index b9159e5c..00000000 --- a/.changeset/polyploidic-thanklessness-damson.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Added types for `Node` direct child APIs: - -- add_child -- get_child -- get_children -- move_child -- remove_child diff --git a/.changeset/precook-pipemouth-coelector.md b/.changeset/precook-pipemouth-coelector.md deleted file mode 100644 index 9a155897..00000000 --- a/.changeset/precook-pipemouth-coelector.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Module resolution now supports modules that utilize `exports` in their `package.json`. diff --git a/.changeset/prefigurement-benziminazole-chokestrap.md b/.changeset/prefigurement-benziminazole-chokestrap.md deleted file mode 100644 index 97e53392..00000000 --- a/.changeset/prefigurement-benziminazole-chokestrap.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Do not instantiate `GodotJSMonitor` if the JS runtime does not support `Performance`. diff --git a/.changeset/premonitory-grazier-correption.md b/.changeset/premonitory-grazier-correption.md deleted file mode 100644 index cb230cfb..00000000 --- a/.changeset/premonitory-grazier-correption.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix/Types:** Don't allow codegen failures to output malformed types. diff --git a/.changeset/pyrrolidine-monocercous-nucleolinus.md b/.changeset/pyrrolidine-monocercous-nucleolinus.md deleted file mode 100644 index 80f65ec0..00000000 --- a/.changeset/pyrrolidine-monocercous-nucleolinus.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Added settings to optionally generate `.d.ts` files for Godot scene files in the Editor. diff --git a/.changeset/quinqueradial-firer-longicone.md b/.changeset/quinqueradial-firer-longicone.md deleted file mode 100644 index aa2b2411..00000000 --- a/.changeset/quinqueradial-firer-longicone.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: exported properties no longer leak into the base class. -feat: inherited properties now class categorized in the Editor. - -Previously sub-classes were reusing the same [[ClassProperties]] -and [[ClassSignals]] as super classes. Thus sub-classes were -exporting properties against super-classes. This also meant that -classes with a shared parent were receiving each others' -properties. Each class no longer looks up the prototype chain -for these objects. - -Consequently, to ensure properties are exported and appear in the -Editor, we now recurse in a similar fashion to GDScript. -Fortunately, we don't need to worry about the cycle detection -logic that GDScript implements, since TypeScript handles this for -us and cycles won't compile. Added benefit is now that properties -appear in the editor categorized appropriately by class. diff --git a/.changeset/radioscopic-autotype-bipennated.md b/.changeset/radioscopic-autotype-bipennated.md deleted file mode 100644 index cd73281b..00000000 --- a/.changeset/radioscopic-autotype-bipennated.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** GDictionary keys() return type diff --git a/.changeset/resweep-coambulant-squarely.md b/.changeset/resweep-coambulant-squarely.md deleted file mode 100644 index 373f7c5f..00000000 --- a/.changeset/resweep-coambulant-squarely.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** ResolveNodePathMap utility type. - -This type makes it easier to dynamically define your own `NodePathMap` types derived from generated SceneNodes. - -It's also useful for creating Node scripts that don't live at the top level of a scene e.g. - -```ts -export default class Table extends Node3D> { - // ... -} -``` - -The above assumes a `Table` node exists as a child of the root in scenes/example/table.tscn. Now -`this.get_node`/`this.getNode` will auto-complete (and provided types for) children of `Table`. diff --git a/.changeset/resymbolize-unavowedly-ocque.md b/.changeset/resymbolize-unavowedly-ocque.md deleted file mode 100644 index 3fcfd120..00000000 --- a/.changeset/resymbolize-unavowedly-ocque.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Variant constructor failure on first bound Variant class. diff --git a/.changeset/roadmaster-grotto-disrespectful.md b/.changeset/roadmaster-grotto-disrespectful.md deleted file mode 100644 index fbec9047..00000000 --- a/.changeset/roadmaster-grotto-disrespectful.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** `@export_dictionary` decorator. diff --git a/.changeset/sabromin-tsantsa-afterdeck.md b/.changeset/sabromin-tsantsa-afterdeck.md deleted file mode 100644 index 7d400bb9..00000000 --- a/.changeset/sabromin-tsantsa-afterdeck.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Don't crash when script binding fails. diff --git a/.changeset/sclerogenous-deliverance-drenchingly.md b/.changeset/sclerogenous-deliverance-drenchingly.md deleted file mode 100644 index 0c5273d5..00000000 --- a/.changeset/sclerogenous-deliverance-drenchingly.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** NIL is now permitted as convertible to any other variant types. diff --git a/.changeset/scumless-boxbush-phytotoxin.md b/.changeset/scumless-boxbush-phytotoxin.md deleted file mode 100644 index 63a49c21..00000000 --- a/.changeset/scumless-boxbush-phytotoxin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** `UserTypeDescriptor` `resource` property is now type-safe and will auto-complete, accepting `Script` resources. diff --git a/.changeset/semideification-schoolish-oolitic.md b/.changeset/semideification-schoolish-oolitic.md deleted file mode 100644 index cc139183..00000000 --- a/.changeset/semideification-schoolish-oolitic.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Ensure resource types are (re)generated when a scene saves diff --git a/.changeset/sepiost-yawner-inapprehensible.md b/.changeset/sepiost-yawner-inapprehensible.md deleted file mode 100644 index 5061dfdf..00000000 --- a/.changeset/sepiost-yawner-inapprehensible.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Dynamic dispatch methods (e.g.,`call_deferred`) are now typesafe. - -Typing these methods was not nearly as straight-forward as I would -have liked. There's also a small usage gotcha due to method -parameters being bivariant in TypeScript. Even with strict function -types enabled, contravariant parameter enforcement only applies -when comparing the variance of non-method functions. This might be -a bit theoretical, so I'll demonstrate with an example. - -```ts -class Sound { - play() { - console.log('Ba-ding!'); - } -} - -class Moo extends Sound { - moo() { - console.log('Moo!'); - } -} - -class Animal { - vocalize(sound: Sound) { - sound.play(); - } -} - -class Cow extends Animal { - override vocalize(moo: Moo) { - moo.moo(); - } -} - -function vocalize(animal: Animal, sound: Sound) { - animal.vocalize(sound); -} - -vocalize(new Cow(), new Sound()); -``` - -The above is perfectly valid in TypeScript, no type errors, but -will crash at runtime. The issue is TypeScript allows us to -override vocalize() and take a covariant (subtype) parameter. So, -we proceed to call moo() on what the implementation believes is -a Moo, but we end up receiving a Sound instead. This obviously -isn't ideal, and the TypeScript language developers are well aware -of the situation, but at present this behavior is required to -support structural type checking on generics, and to handle some -DOM type weirdness. - -Now if we add: - -```ts -function callLater(delayMs: number, target: T, methodName: S, ...args: T[S] extends (...args: any[]) => any ? Parameters : never) { - setTimeout(() => (target[methodName] as (...args: any[]) => any)(...args), delayMs); -} - -class Animal { - vocalize(sound: Sound) { - sound.play(); - } - - vocalizeLater(sound: Sound) { - callLater(1000, this, 'vocalize', sound); // Error on this line - } -} -``` - -This gives the error: - -> Argument of type '[Sound]' is not assignable to parameter of type 'this["vocalize"] extends (...args: any[]) => any ? Parameters : never'.(2345) - -Basically, `this` is NOT the same as `Animal`, it's a polymorphic -type. Due to the use of `this` the type checker is unable to -validate that `[Sound]` is the correct parameter types tuple. This -occurs BECAUSE the parameter types are bivariant, the parameter -types can be (and in this example are) more restrictive than those -declared in the `Animal` type. - -Now, this poses an interesting problem for Godot's call_deferred -(and similar) APIs. Because it's quite common to want to do: - -```ts -this.callDeferred('remove_child', someChild); -``` - -Which leads to a similar error with `removeChild` parameters not -being known for the `this` type. The solution is to introduce a -cast to the same type (or a parent type): - -```ts -(this as Node).callDeferred('remove_child', someChild); -``` - -This works around the issue. Of course, this *technically* isn't -type-safe if a sub-class was to override `removeChild` similarly -to our `vocalize` example above. The cast is basically telling -the typechecker, "Go away. I know what I'm doing. Probably." - -Now that I've explained the usage gotcha, I'll touch on some -technical details of the implementation. - -Using our example above, if you were to try pull `callLater` into -the `Animal` class, drop the `T` generic parameter and replace its -usages with the type `this`. When you try use the method you'll -run into the dreaded: - -> Type instantiation is excessively deep and possibly infinite. - -This occurs because `callLater` attempts to handle parameters for -all functions on the `Animal` class. But one of those functions -is `callLater`. So the parameters for a call to callLater are -potentially the parameters for another callLater... you see where -this is going. - -The solution is basically to explicitly prevent recursion through -`callLater`. Easy enough for this one example. But Godot has -several dynamic dispatch methods, they all need to be excluded, -not just the function itself, because you could chain calls back -and forth between them. - -So, this is where the new 'godot' module interface comes in: - -```ts - /** - * Godot has many APIs that are a form of dynamic dispatch, i.e., they take the name of a function or property and - * then operate on the value matching the name. TypeScript is powerful enough to allow us to type these APIs. - * However, since these APIs can be used to call each other, the type checker can get hung up trying to infinitely - * recurse on these types. What follows is an interface with the built-in dynamic dispatch names. GodotJS' types - * will not recurse through methods matching these names. If you want to build your own dynamic dispatch APIs, you - * can use interface merging to insert additional method names. - */ - interface GodotDynamicDispatchNames { - call: 'call'; - callv: 'callv'; - call_deferred: 'call_deferred'; - add_do_method: 'add_do_method'; - add_undo_method: 'add_undo_method'; - } -``` - -An interface isn't actually the most obvious way to define the -exclusions, a union would be simpler. However, if you were to add -your own dynamic dispatch type method in a sub-class, GodotJS -types will need to avoid recursing through it too. So you can use -interface merging to add to the set. - -There's actually a bit more complexity than just calls to those -methods. Because TS type checking is structural, without the above -you hit up against infinite recursion simply by virtue of the -methods existing on the type, even if you're not calling them. diff --git a/.changeset/sheepstealing-fraticellian-miscoinage.md b/.changeset/sheepstealing-fraticellian-miscoinage.md deleted file mode 100644 index aa56239a..00000000 --- a/.changeset/sheepstealing-fraticellian-miscoinage.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Godot/GDScript best effort typing for nullability of Object types. - -Although they're technically nullable everywhere (Ref<> in C++), -many APIs won't ever return to `null`. Unfortunately, properties do -not have flags to tell us this, so we are making best effort guesses -as follows: - -- Getters/setters are nullable. -- Function return types are nullable, unless the function name - starts with `"create"`. -- Function arguments are non-nullable. - -This seems to be a reasonable starting point, and we will continue to manually tweak -types from here. diff --git a/.changeset/shippo-tanh-luceres.md b/.changeset/shippo-tanh-luceres.md deleted file mode 100644 index b282b852..00000000 --- a/.changeset/shippo-tanh-luceres.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Support for script instantiation from a ResourceLoader executing on another thread. diff --git a/.changeset/silent-cars-call.md b/.changeset/silent-cars-call.md deleted file mode 100644 index 8399ace4..00000000 --- a/.changeset/silent-cars-call.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: exported property hint_string regression w/ camel-case bindings - -This was causing enums, ranges etc. to display incorrectly in the Godot Editor. \ No newline at end of file diff --git a/.changeset/small-emus-notice.md b/.changeset/small-emus-notice.md deleted file mode 100644 index 831bdd77..00000000 --- a/.changeset/small-emus-notice.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix/Types:** Ensure GDScript singleton class accessors/modifiers are `static`. - -Fixes https://github.com/godotjs/GodotJS/issues/99 diff --git a/.changeset/somnifuge-formicicide-karyorrhexis.md b/.changeset/somnifuge-formicicide-karyorrhexis.md deleted file mode 100644 index c180b485..00000000 --- a/.changeset/somnifuge-formicicide-karyorrhexis.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Adhere to typical JS semantics and use default arg when undefined is passed (not just when the parameter is omitted). diff --git a/.changeset/sophia-thalessa-flanch.md b/.changeset/sophia-thalessa-flanch.md deleted file mode 100644 index 1f4e8f11..00000000 --- a/.changeset/sophia-thalessa-flanch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Added `@export_object` shorthand decorator for exporting objects. diff --git a/.changeset/subpoenal-lively-unconvenience.md b/.changeset/subpoenal-lively-unconvenience.md deleted file mode 100644 index d85bb575..00000000 --- a/.changeset/subpoenal-lively-unconvenience.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Ensure string representation of Godot objects include the script class name. diff --git a/.changeset/tangy-pugs-tell.md b/.changeset/tangy-pugs-tell.md deleted file mode 100644 index f040b69e..00000000 --- a/.changeset/tangy-pugs-tell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -fix: setTimeout/setInterval invocation crash diff --git a/.changeset/tanquam-colinephritis-kanten.md b/.changeset/tanquam-colinephritis-kanten.md deleted file mode 100644 index 395433f0..00000000 --- a/.changeset/tanquam-colinephritis-kanten.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Improved support for statically typed optional nodes. diff --git a/.changeset/tiltboard-kissableness-archhypocrisy.md b/.changeset/tiltboard-kissableness-archhypocrisy.md deleted file mode 100644 index 4a3d86ac..00000000 --- a/.changeset/tiltboard-kissableness-archhypocrisy.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** Worker postMessage support for structured clone and transfer. - -This enables bi-directional transfer of all Godot types between -workers and the host environment. The structured clone algorithm -uses referential equality of Variant rather than structural -equality. This both gives us a performance boost and also ensures -that if the same Variant is referred to in nested structures, -upon deserialization, these relationships will remain intact. - -`JSWorkerParent.transfer()` is now deprecated since `postMessage` can -achieve the same and more. - -As before, this is still a v8 only feature. I would say this makes -workers somewhat LESS experimental, but not yet stable. diff --git a/.changeset/tolerant-sdeath-vestige.md b/.changeset/tolerant-sdeath-vestige.md deleted file mode 100644 index 3c22a4a1..00000000 --- a/.changeset/tolerant-sdeath-vestige.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** `GArray` tuple support. - -For example, with the type `GArray<[number, string]>` `.get(0)` will return a `number` and `.get(1)` will return a `string`. diff --git a/.changeset/unaproned-periorchitis-pierce.md b/.changeset/unaproned-periorchitis-pierce.md deleted file mode 100644 index 3d1570ac..00000000 --- a/.changeset/unaproned-periorchitis-pierce.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** Codegen — treat Signal args as output types, not input types. diff --git a/.changeset/undenominated-saberlike-atmidometry.md b/.changeset/undenominated-saberlike-atmidometry.md deleted file mode 100644 index 82ad0bdd..00000000 --- a/.changeset/undenominated-saberlike-atmidometry.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Types:** `get_tree()`/`getTree()` no longer types as returning `null`. - -Although it _will_ return `null` when not inside a tree. This is a runtime error, with an error message -being logged i.e., you should not ever call this function expecting a `null` result. diff --git a/.changeset/undergrub-perclose-telotype.md b/.changeset/undergrub-perclose-telotype.md deleted file mode 100644 index cb9f1124..00000000 --- a/.changeset/undergrub-perclose-telotype.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** TypeLoader `post_bind` now supports reentrancy. diff --git a/.changeset/unhandseled-pockily-acyloin.md b/.changeset/unhandseled-pockily-acyloin.md deleted file mode 100644 index 2b3decd4..00000000 --- a/.changeset/unhandseled-pockily-acyloin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature/Types:** Codegen/types for resources in your project i.e., `ResourceLoader.load("res://whatever")` is now strongly typed depending on the file path. diff --git a/.changeset/unromantically-analogon-monochloro.md b/.changeset/unromantically-analogon-monochloro.md deleted file mode 100644 index f752f198..00000000 --- a/.changeset/unromantically-analogon-monochloro.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Feature:** API to access `GDictionary`/`GArray` like JS objects/arrays (`.proxy()`) and -improved type definitions for `GDictionary` and `GArray`. diff --git a/.changeset/wiremonger-overawn-overnicely.md b/.changeset/wiremonger-overawn-overnicely.md deleted file mode 100644 index 39e38b4a..00000000 --- a/.changeset/wiremonger-overawn-overnicely.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@godot-js/editor": patch ---- - -**Fix:** Make Variant constants (e.g., `Vector3.ZERO`) Readonly<> so they can't (easily) be accidentally mutated. diff --git a/CHANGELOG.md b/CHANGELOG.md index f251f468..ab4995ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,55 +1,771 @@ # @godot-js/editor +## 1.1.0 + +### Minor Changes + +- 14e8cba: GodotJS 1.1 + +### Patch Changes + +- e28d324: **Types:** Statically resolved return type for `get_node()`/`getNode()`. +- e28d324: **Types:** `ResourceLoader.load()` overload type. +- 2073ac9: **Fix:** `@ExportObject(Node)` was only working for sub-classes, not `Node` itself. +- 5171c3a: **Fix:** Duplicate "Generating" label appeared in the UI during codegen. +- 0514427: **Types:** `GDictionary` absent values are now correctly typed as returning as `null`, not `undefined`. +- e28d324: **Feature:** Improved type conversion error messages. +- e28d324: **Fix:** `@export_` support for enums as keys of `GDictionary`. +- 8979b46: **Types/Fix:** Invalid codegen for certain types (function literals in particular) +- e28d324: **Fix:** Background thread script instantiation (for 4.5 editor). +- e28d324: **Fix:** Handle `hint_string` if `@export_var` is a `GArray` with an element type provided via `details.class_`. +- 16450df: **Types:** Added `Resource` `duplicate()` return type. +- e28d324: **Feature:** Improved user project type configurability. + + - Codegen for scenes and resources now default to being stored in + `gen/types` rather than `typings/`. However, a setting has been + introduced to configure this. `typings/` is no longer used + because the directory is configured as a type root, which means + directories contained within are expected to be module + definitions. + - `"types": ["node"]` in the default tsconfig was hiding type errors. + This is no longer set. Essentially, this setting was disabling + all types except node types from our type roots. + - `@types/node` removed from the default `package.json`. It was + misleading and made it easy to accidentally use non-existent + functionality. We no longer need these types because... + - Our JS essentials (console, timeout and intervals APIs) are now + included in our `godot.minimal.d.ts`. + - No longer including `` in our TS + files. This seemed to be interfering with user tsconfig options, + and it was not required. Not that it's been removed you're able to + more freely make changes to your tsconfig. For example, you may set + `libs` (or `target`) to make use of newer JS APIs. + +- e28d324: **Feature:** Ergonomics overhaul. Camel-case, TS types, codegen + more. + + - There's now a project setting which can be toggled to swap to a + more idiomatic JS naming scheme for Godot bindings. We use + camel and pascal case to more closely align with typical + JavaScript/TypeScript conventions. For `@Decorators` we've gone + with pascal case, which is used in libraries like Angular. Camel + case is perhaps more popular, but pascal case allows us to avoid + reserved names, and thus we can cleanly write `@Export`, instead of + needing to include the trailing underscore on `@export_`. + + - TypeScript types have been improved. Particularly `Signal<>` and + `Callable<>`. `Signal1`, `Signal2`, etc. are now deprecated, as are + `AnySignal` and `AnyCallable`, since the new `Signal` and `Callable` + types handle an arbitrary number of parameters. Importantly, + `Callable.bind(...)` is now accurately typed, so you'll receive + type errors when connecting to signals. + + - `GArray` and `GDictionary` now have a static `.create()` method + which allows you to create nested data structures from literals + and benefit from full type checking. When a `GArray` or `GDictionary` + is expected as a property, a `.proxy()` can be provided in its + place. + + - Partially worked around https://github.com/microsoft/TypeScript/issues/43826 + whereby our proxied `GArray` and `GDictionary` always return proxied + nested values, but will accept non-proxied values when mutating + a property. Basically, there's now `GArrayReadProxy` and + `GDictionaryReadProxy`. These aren't runtime types, they're just + TS types that make it easier to work with proxies. Under normal + circumstances, you likely won't need to know these types exist. + + - Codegen leveled up. Any TS module can now export a function + named `codegen` with the type `CodeGenHandler`. This function + will be called during codegen to allow you to optionally + augment type generation involving user-defined types. Consider, + for example, the `SceneNodes` codegen which previously only knew + how to handle Godot/native types in the scene hierarchy. When + a user type was encountered, it'd write the native type, which + is still useful, but it'd be nice to be able to include user + types. The reason we don't by default is user types are not + required to follow our generic parameter convention where + each node is passed a `Map` argument. + + Let's see an example: + + ```ts + export default class CardCollection extends GameNode + ``` + + the type above does not take a `Map`. Perhaps more interesting, it + takes a different generic parameter, a `CardNode`. If we encounter + a `CardCollection` script attached to a node in the scene somewhere, + GodotJS' internal codegen can't possibly know what that generic + parameter ought to be. So we can help it out. In the same file + where `CardCollection` is defined, we could provide a `codegen` + handler like so: + + ```ts + export const codegen: CodeGenHandler = (rawRequest) => { + const request = rawRequest.proxy(); + + switch (request.type) { + case CodeGenType.ScriptNodeTypeDescriptor: { + const cardNodeScript = request.node.get("cardNodeScript"); + return GDictionary.create({ + type: DescriptorType.User, + name: "CardCollection", + resource: "res://src/card-collection.ts", + arguments: GArray.create([ + GDictionary.create({ + type: DescriptorType.User, + name: cardNodeScript?.getGlobalName() ?? "CardNode", + resource: + cardNodeScript?.resourcePath ?? "res://src/card-node.ts", + }), + ]), + }); + } + } + + return undefined; + }; + ``` + + Above we handle the codegen request to determine the node type + of the provided `request.node`. What's _really_ neat here is we + don't need to hard-code that generic. We've instead exported a + configurable `Script` reference for use in the editor: + + ```ts + @ExportObject(Script) + cardNodeScript: Script = ResourceLoader.load('res://src/card-node.ts') as Script; + ``` + + So the codegen logic simply grabs the type exported from the + chosen script, and provides it as a generic argument to + `CardCollection<>`. + + One thing worth noting, your class does NOT need to be a `@Tool`. + In the above example, `CardCollection` is not a `@Tool`, and + hence the node script is not instantiated during codegen, which + is why we've used `request.node.get('cardNodeScript')` rather + than trying to access the property directly. That said, if you + want, codegen can be combined with `@Tool`. + + - There's also a bunch of logging/error reporting improvements. + +- 5c5943e: **Feature:** Bumped default tsconfig target from es2016 to es2022 + + All supported runtimes ought to support the 2022 standard. You can + still manually change the target if desired. This change is to + provide a better user experience by default. + +- 64f5ee8: **Feature:** Godot String methods now exposed as static methods on `String`. + + This doesn't change anything about how strings are used within + JavaScript i.e. we're still using JS native string type, not + Godot's String. However, Godot's String class has many utility + functions, some of them static and some of them as instance + methods. These are now all available for consumption in JavaScript. + Godot String instance methods are mapped to static methods that + take a `target: string` as their first parameter. + + In general, if there's an equivalent native JS string method, you + should always use it instead since it will be much more performant. + +- d87eea1: **Feature:** Constructor params support and GDScript compatible `new` + + Support for `new` is very important for improving interop with + other scripting languages, allowing them to instantiate objects + from a Script reference. Crucially, this allows native + GDExtension to instantiate Nodes/Objects/Resources implemented + in GodotJS. + + Object construction has been refactored. Previously we had three + cases to handle: + + 1. new SomeJSWrapperAroundAGodotObject() – JS construction + 2. CDO (Class default object) construction - used to determine + default parameters on a class (for use in the editor). + 3. Cross binding. Which is when a Godot Object is constructed and + our script latter needs to attach to it. + + In the past, case 1 was the only situation in which instantiating + a JS class ought to also instantiate the Godot native object. + However, in my previous commit I changed CDOs so also instantiate + the underlying native object. So case 2 was eliminated. + + Case 3 (cross binding) is a common situation, it was previously + implemented in a somewhat intrusive fashion. All JS objects were + being constructed and passed a parameter as their first argument. + This indicated whether the object was cross binding (or a CDO). + This prevented users from (easily) implementing constructors, the + user had to know about the internal parameter and pass this + up through to super(). For the most part I imagine users (myself + included) simply avoided using constructors. However, this + complicated some code that would otherwise be trivial in GDScript + or C# because the latter has constructors and the former \_init. + + Consequently, I've implemented a new strategy to determine whether + a constructor is being called from C++ (cross binding) or from JS. + The implementation is quite straight forward, but arriving at this + solution was not necessarily obvious. V8 doesn't expose APIs to + intercept construction, and we can't naively use shared flags + to mark a native constructor in progress because the solution + needs to support reentrancy since during construction an object + may instantiate other objects. Additionally, we can't just use + different constructors (V8 templates) because there's issues with + both sub-classing and `instanceof` detection. + + The solution was to take advantage of JS' `Reflect.construct` API. + This allows us to call a constructor but have `new.target` set to + an arbitrary constructable. `new.target` survives whilst + traversing up through super() constructors (similar to how we + previously passed arguments up). This let's us mark a particular + instantiation as coming from C++. `Reflect.construct` instantiates + `this` to match the prototype chain from the provided `newTarget` + so we simply set it to the prototype of the original constructor + and we're on our way. + + Using `Reflect.construct` is also standard JS, so it's available + on our support JS runtimes without needing to resort to any + runtime-specific code. + +- 72e0bf6: **Types:** Improved GObject types +- d5c1dfa: **Fix:** Bind script instance during default prop evaluation. + + If properties are implemented in JavaScript as properties (getters) + they'll often want to call Godot methods on self. Without the + script instance being bound this led to a crash. + +- e28d324: **Feature:** Introduced a setting to control whether `.d.ts` for scenes are auto-generated on when scenes are saved in the Editor. +- f554365: **Feature:** Expose Godot Variant utility method typeof() as `godot_typeof()`/`godotTypeof()`. +- 460737c: **Fix:** Threading / Godot address reuse crash. +- e28d324: **Types:** Codegen + type checking for animations. +- e28d324: **Feature:** `CameraFeed` types. +- abce9e2: **Types/Fix:** Codegen now types more `GArray`/`GDictionary` generic params based on exported variable hint strings. + + Additionally, fixed some codegen for enums when camel-case bindings are enabled. + +- e28d324: **Feature:** Support async module loader in quickjs.impl. +- ea214c4: fix: null handling in GArray/GDictionary create() helpers +- cffe0d8: **Feature:** Use TypeScript 5.9.2 (latest) by default +- a883172: **Feature:** Godot 4.5 support +- 5bc325e: **Types:** "Generate Godot d.ts" in the UI is now "Generate types" and in addition to + generating all Godot and project types (which it already did), the + autogen directory will now be wiped of all files/directories before + commencing generation. This ensures old generated files no longer + pollute the project. +- 6e96120: **Fix:** Duplicate PackedByteArray to_array_buffer() registration +- 4bb388b: **Fix:** Added missing `PROPERTY_USAGE_SCRIPT_VARIABLE` flag on exported variables. +- 94ac86d: **Types:** `NodePathMap` now permits `undefined`/optional children. +- e28d324: **Feature/Types:** Types + codegen for project input actions. +- 555acc6: **Types:** `EditorUndoRedoManager` API types +- c82dfac: **Types**: Ensure the GAny union type includes null +- 1341389: **Fix:** Critical bug fixes (for crashes) that may occur due to the + current isolate not being set. +- e28d324: **Feature:** `GDictionary`/`GArray` recursive handling and `toJSON()`/`toString()` + + `GArrayProxy` (now a named type) will now JSON encode like a regular + JS array i.e. `[1,2,3]` instead of `{"0": 1, "1": 2, "2": 3}`. + + We previously ensured that values accessed via a proxy were + themselves proxied. Thus allowing access to nested properties + via chained access e.g. dict_proxy.a.b. However, when setting or + inserting a proxy-wrapped value, we previously inserted the proxy + itself, rather than the wrapped target. This has now been rectified, + it's not safe to do something like: + + ```ts + const a = new GDictionary().proxy(); + a.b = new Dictionary().proxy(); + ``` + + The above will result in a `GDictionary` containing a `b` + property that is an empty `GDictionary`. + +- 9ebe4f6: **Fix:** TStringNameCache v8::String reference loss + + https://github.com/godotjs/GodotJS/issues/110 + +- b207444: **Feature:** Native object now guaranteed bound during JS initializaation. + + Previously, when a JS class was being instantiated for an existing + native Godot object (e.g. ResourceLoader.load('...')) the JS + instance wasn't actually being bound to the native Godot object + until _after_ the JS instance was constructed/initialized. This + created a problem in which field/property initializers and the + constructor were unable to call any native functions, but could + call JS functions. + + Now, the Godot object is always bound to our instantiated object + as part of our Godot native class constructor. Thus, we can now + safely call methods during initialization. Importantly, this also + fixes TC39 Stage 3 decorator `@bind.signal()` support for fields. + +- 64dbebc: fix: Background/async resource loading where scripts are present. + + Shadow script instance replacement was failing due to calling the + wrong GodotJSScript::instance_create() overload. The overloads + have been replaced with separate functions to mitigate future + occurrences. + + Additionally, shadow script instance replacement was not properly + handling user types, only built-ins. This broke in a subtle hard + to debug fashion, whereby you received back a valid JS class + instance for the expected Godot object, however its prototype + chain was incomplete. The JS object was an instance of the base + Godot native object rather than the script on the object. + +- 1d85819: **Fix:** `JSWorker` transfer crash. +- e28d324: **Feature:** Async module loader. +- e0f44db: **Types:** Improved generated typings formatting. +- 70e28af: **Fix:** Ensure usercode triggered from `get('prop')`/`set('prop')` does not crash the process, JS runtime errors are caught and logged. +- e28d324: **Fix:** `godot.lib.api` `instanceof` checks against proxied classes. +- e94bbf0: **Fix:** Don't crash when a GodotJS class implementation's parent class does not match the attached node. + + Instead, we log an error and prevent the script from being instantiated. + +- 5f96ffc: **Fix:** Enum codegen (and godot.lib.api iteration). +- e28d324: **Performance:** Added LRU support for `StringNameCache`. +- e28d324: **Types**: Refined `SceneTree` `GArray` return types. +- 937c6f6: **Fix:** Don't leak temporary default properties object +- 21dffd1: fix: Array counts props incorrectly typed as any +- e28d324: **Feature:** Introduced settings to ensure dependencies are included in exported builds. + + - "Referenced Node Modules" can be enabled to package an _entire_ node module when any file belonging to that module is referenced. + - "Include directories" is another setting that allows you to explicitly add additional directories you want included in your exported builds. + +- e28d324: **Feature:** Godot 4.4 support. +- 102806b: fix: Ensure setTimeout correctly handles negative delays +- 88c3060: fix: Improved node_modules handling during game exports. +- e28d324: **Fix:** Improved TypeScript class matching regex. + + It was failing in the presence of generics which contain an `extends` + clause e.g. + + ```ts + export default class GameNode = {}> extends Node3D + ``` + + The regex will now look for the last `extends` on the line in order + to detect the base class. This is only an improvement, it's not + fool-proof and will fail if the base class has a generic that + contains a conditional type expression. Since we only have access + to PCRE2, this is probably the best we can do with just regex. + +- d70a467: **Fix:** Another missing `Isolate::Scope` that could lead to a runtime crash. +- 17f7731: fix: .ts/.js files not included in game export + + Exporting GodotJS games was fundamentally broken by + a Godot engine change which altered the way .skip() + behaved on exported files. Basically, we were skipping + .ts files because we don't want them in the export, + only .js files which we added as extra files. However, + the change to skip's behavior meant extra files are + also skipped. Instead .ts files are now remapped to + the .js file, not skipped. The result is as + previously intended i.e. only .js files ship. + +- e28d324: **Fix/Types:** Ensure that codegen quotes property keys when necessary. +- e28d324: **Feature:** Support for importing `.json` files. +- a4bafef: **Feature:** New decorator syntax for exporting properties. + + TC39 (JavaScript standard body) have progressed a new decorator + syntax to Stage 3, and TypeScript 5.0 implemented support. The new + syntax is not quite as flexible but is type-safe and will be + more performant when implemented directly in JS engines. + Consequently, all existing decorators have deprecated (but + remain for backwards compatibility). In their place a new API, + `createClassBinder`, has been introduced. + + Our default `tsconfig.json` has been updated to turn off legacy + decorators, unlocking access to the newer syntax. You cannot use + both at once. Both sets of decorators contain warnings if used + with in incompatible tsconfig. + + The new decorator syntax looks something like: + + ``` + const bind = createClassBinder(); + + @bind() + @bind.tool() + export default class Player extends CharacterBody2D { + @bind.export.cache() + @bind.export.object(SceneSynchronizer) + accessor synchronizer!: SceneSynchronizer; + + @bind.export.cache() + @bind.export(Variant.Type.TypeInt) + accessor walkSpeed: number = 350; + + @bind.export.cache() + @bind.export(Variant.Type.TypeInt) + accessor dashSpeed: number = 1000; + + @bind.export(Variant.Type.TypeInt) + accessor dashCooldownMs: number = 500; + + @bind.export.enum(Direction) + accessor facing = Direction.Down; + + @bind.export(Variant.Type.TypeInt) + accessor useCooldownMs: number = 500; + } + ``` + + A few key points: + + 1. You must create a ClassBinder using createClassBinder(). + This is a function and contains properties/APIs on it. + You can use any variable name, but the convention I'll be + using going forward is to use a variable named `bind`. + 2. The decorator APIs are all functions that return a decorator + i.e. It's `@bind()` and `@bind.export.cache()` not `@bind` + or `@bind.export.cache`. + 3. We're using JavaScript's new/upcoming auto-accessor syntax. + This is not a requirement for all decorators, but not all + decorators (e.g., the new cache() decorator) are supported + on fields. + 4. The new cache decorator enables caching of variants on the + Godot side of the JS <-> Godot bridge. + The decorator generates a `set` accessor that updates the cache + automatically whenever a value is assigned to the JS property. + The purpose of the cache is that is provides a fairly sizeable + performance improvement when using Godot's general purpose + .get("property_name") method. This is particularly useful if + you want to expose data to performance sensitive GDExtensions. + 5. The order of decorators matters! + Decorators are evaluated "inside->out" and class decorators are + evaluated after all property decorators. `bind()` MUST be + executed AFTER all other decorators. The `@bind.export.cache()` + decorator MUST be evaluated AFTER the property export. + +- e28d324: **Fix:** Always use thread-safe variant pool allocator. +- 01895d4: **Types:** Added types for `Node` direct child APIs: + + - add_child + - get_child + - get_children + - move_child + - remove_child + +- e28d324: **Feature:** Module resolution now supports modules that utilize `exports` in their `package.json`. +- e28d324: **Fix:** Do not instantiate `GodotJSMonitor` if the JS runtime does not support `Performance`. +- 6399703: **Fix/Types:** Don't allow codegen failures to output malformed types. +- e28d324: **Feature:** Added settings to optionally generate `.d.ts` files for Godot scene files in the Editor. +- e28d324: fix: exported properties no longer leak into the base class. + feat: inherited properties now class categorized in the Editor. + + Previously sub-classes were reusing the same [[ClassProperties]] + and [[ClassSignals]] as super classes. Thus sub-classes were + exporting properties against super-classes. This also meant that + classes with a shared parent were receiving each others' + properties. Each class no longer looks up the prototype chain + for these objects. + + Consequently, to ensure properties are exported and appear in the + Editor, we now recurse in a similar fashion to GDScript. + Fortunately, we don't need to worry about the cycle detection + logic that GDScript implements, since TypeScript handles this for + us and cycles won't compile. Added benefit is now that properties + appear in the editor categorized appropriately by class. + +- 4d24683: **Types:** GDictionary keys() return type +- d24b974: **Types:** ResolveNodePathMap utility type. + + This type makes it easier to dynamically define your own `NodePathMap` types derived from generated SceneNodes. + + It's also useful for creating Node scripts that don't live at the top level of a scene e.g. + + ```ts + export default class Table extends Node3D< + ResolveNodePathMap + > { + // ... + } + ``` + + The above assumes a `Table` node exists as a child of the root in scenes/example/table.tscn. Now + `this.get_node`/`this.getNode` will auto-complete (and provided types for) children of `Table`. + +- 8e3bc27: **Fix:** Variant constructor failure on first bound Variant class. +- e28d324: **Fix:** `@export_dictionary` decorator. +- 1675f15: **Fix:** Don't crash when script binding fails. +- e28d324: **Fix:** NIL is now permitted as convertible to any other variant types. +- be2c73c: **Types:** `UserTypeDescriptor` `resource` property is now type-safe and will auto-complete, accepting `Script` resources. +- b96f13a: **Fix:** Ensure resource types are (re)generated when a scene saves +- 59abb7f: **Types:** Dynamic dispatch methods (e.g.,`call_deferred`) are now typesafe. + + Typing these methods was not nearly as straight-forward as I would + have liked. There's also a small usage gotcha due to method + parameters being bivariant in TypeScript. Even with strict function + types enabled, contravariant parameter enforcement only applies + when comparing the variance of non-method functions. This might be + a bit theoretical, so I'll demonstrate with an example. + + ```ts + class Sound { + play() { + console.log("Ba-ding!"); + } + } + + class Moo extends Sound { + moo() { + console.log("Moo!"); + } + } + + class Animal { + vocalize(sound: Sound) { + sound.play(); + } + } + + class Cow extends Animal { + override vocalize(moo: Moo) { + moo.moo(); + } + } + + function vocalize(animal: Animal, sound: Sound) { + animal.vocalize(sound); + } + + vocalize(new Cow(), new Sound()); + ``` + + The above is perfectly valid in TypeScript, no type errors, but + will crash at runtime. The issue is TypeScript allows us to + override vocalize() and take a covariant (subtype) parameter. So, + we proceed to call moo() on what the implementation believes is + a Moo, but we end up receiving a Sound instead. This obviously + isn't ideal, and the TypeScript language developers are well aware + of the situation, but at present this behavior is required to + support structural type checking on generics, and to handle some + DOM type weirdness. + + Now if we add: + + ```ts + function callLater( + delayMs: number, + target: T, + methodName: S, + ...args: T[S] extends (...args: any[]) => any ? Parameters : never + ) { + setTimeout( + () => (target[methodName] as (...args: any[]) => any)(...args), + delayMs + ); + } + + class Animal { + vocalize(sound: Sound) { + sound.play(); + } + + vocalizeLater(sound: Sound) { + callLater(1000, this, "vocalize", sound); // Error on this line + } + } + ``` + + This gives the error: + + > Argument of type '[Sound]' is not assignable to parameter of type 'this["vocalize"] extends (...args: any[]) => any ? Parameters : never'.(2345) + + Basically, `this` is NOT the same as `Animal`, it's a polymorphic + type. Due to the use of `this` the type checker is unable to + validate that `[Sound]` is the correct parameter types tuple. This + occurs BECAUSE the parameter types are bivariant, the parameter + types can be (and in this example are) more restrictive than those + declared in the `Animal` type. + + Now, this poses an interesting problem for Godot's call_deferred + (and similar) APIs. Because it's quite common to want to do: + + ```ts + this.callDeferred("remove_child", someChild); + ``` + + Which leads to a similar error with `removeChild` parameters not + being known for the `this` type. The solution is to introduce a + cast to the same type (or a parent type): + + ```ts + (this as Node).callDeferred("remove_child", someChild); + ``` + + This works around the issue. Of course, this _technically_ isn't + type-safe if a sub-class was to override `removeChild` similarly + to our `vocalize` example above. The cast is basically telling + the typechecker, "Go away. I know what I'm doing. Probably." + + Now that I've explained the usage gotcha, I'll touch on some + technical details of the implementation. + + Using our example above, if you were to try pull `callLater` into + the `Animal` class, drop the `T` generic parameter and replace its + usages with the type `this`. When you try use the method you'll + run into the dreaded: + + > Type instantiation is excessively deep and possibly infinite. + + This occurs because `callLater` attempts to handle parameters for + all functions on the `Animal` class. But one of those functions + is `callLater`. So the parameters for a call to callLater are + potentially the parameters for another callLater... you see where + this is going. + + The solution is basically to explicitly prevent recursion through + `callLater`. Easy enough for this one example. But Godot has + several dynamic dispatch methods, they all need to be excluded, + not just the function itself, because you could chain calls back + and forth between them. + + So, this is where the new 'godot' module interface comes in: + + ```ts + /** + * Godot has many APIs that are a form of dynamic dispatch, i.e., they take the name of a function or property and + * then operate on the value matching the name. TypeScript is powerful enough to allow us to type these APIs. + * However, since these APIs can be used to call each other, the type checker can get hung up trying to infinitely + * recurse on these types. What follows is an interface with the built-in dynamic dispatch names. GodotJS' types + * will not recurse through methods matching these names. If you want to build your own dynamic dispatch APIs, you + * can use interface merging to insert additional method names. + */ + interface GodotDynamicDispatchNames { + call: "call"; + callv: "callv"; + call_deferred: "call_deferred"; + add_do_method: "add_do_method"; + add_undo_method: "add_undo_method"; + } + ``` + + An interface isn't actually the most obvious way to define the + exclusions, a union would be simpler. However, if you were to add + your own dynamic dispatch type method in a sub-class, GodotJS + types will need to avoid recursing through it too. So you can use + interface merging to add to the set. + + There's actually a bit more complexity than just calls to those + methods. Because TS type checking is structural, without the above + you hit up against infinite recursion simply by virtue of the + methods existing on the type, even if you're not calling them. + +- e28d324: **Types:** Godot/GDScript best effort typing for nullability of Object types. + + Although they're technically nullable everywhere (Ref<> in C++), + many APIs won't ever return to `null`. Unfortunately, properties do + not have flags to tell us this, so we are making best effort guesses + as follows: + + - Getters/setters are nullable. + - Function return types are nullable, unless the function name + starts with `"create"`. + - Function arguments are non-nullable. + + This seems to be a reasonable starting point, and we will continue to manually tweak + types from here. + +- e28d324: **Fix:** Support for script instantiation from a ResourceLoader executing on another thread. +- 26590b4: fix: exported property hint_string regression w/ camel-case bindings + + This was causing enums, ranges etc. to display incorrectly in the Godot Editor. + +- f341cda: **Fix/Types:** Ensure GDScript singleton class accessors/modifiers are `static`. + + Fixes https://github.com/godotjs/GodotJS/issues/99 + +- e28d324: **Fix:** Adhere to typical JS semantics and use default arg when undefined is passed (not just when the parameter is omitted). +- e28d324: **Feature:** Added `@export_object` shorthand decorator for exporting objects. +- e28d324: **Feature:** Ensure string representation of Godot objects include the script class name. +- eedd327: fix: setTimeout/setInterval invocation crash +- 3d66a57: **Types:** Improved support for statically typed optional nodes. +- d7353ab: **Feature:** Worker postMessage support for structured clone and transfer. + + This enables bi-directional transfer of all Godot types between + workers and the host environment. The structured clone algorithm + uses referential equality of Variant rather than structural + equality. This both gives us a performance boost and also ensures + that if the same Variant is referred to in nested structures, + upon deserialization, these relationships will remain intact. + + `JSWorkerParent.transfer()` is now deprecated since `postMessage` can + achieve the same and more. + + As before, this is still a v8 only feature. I would say this makes + workers somewhat LESS experimental, but not yet stable. + +- eabb12a: **Feature:** `GArray` tuple support. + + For example, with the type `GArray<[number, string]>` `.get(0)` will return a `number` and `.get(1)` will return a `string`. + +- e28d324: **Types:** Codegen — treat Signal args as output types, not input types. +- 47904ff: **Types:** `get_tree()`/`getTree()` no longer types as returning `null`. + + Although it _will_ return `null` when not inside a tree. This is a runtime error, with an error message + being logged i.e., you should not ever call this function expecting a `null` result. + +- e28d324: **Fix:** TypeLoader `post_bind` now supports reentrancy. +- e28d324: **Feature/Types:** Codegen/types for resources in your project i.e., `ResourceLoader.load("res://whatever")` is now strongly typed depending on the file path. +- e28d324: **Feature:** API to access `GDictionary`/`GArray` like JS objects/arrays (`.proxy()`) and + improved type definitions for `GDictionary` and `GArray`. +- 63dc143: **Fix:** Make Variant constants (e.g., `Vector3.ZERO`) Readonly<> so they can't (easily) be accidentally mutated. + ## 1.0.0 ### Major Changes -* Implement a [*Monitor*](https://github.com/godotjs/GodotJS/wiki/Statistics) of the runtime statistics of a running project -* Implement *console.time/console.timeEnd* -* Refactor [*Worker*](https://github.com/godotjs/GodotJS/wiki/Worker) to support *Godot Object* transfer + +- Implement a [_Monitor_](https://github.com/godotjs/GodotJS/wiki/Statistics) of the runtime statistics of a running project +- Implement _console.time/console.timeEnd_ +- Refactor [_Worker_](https://github.com/godotjs/GodotJS/wiki/Worker) to support _Godot Object_ transfer ### Minor Changes -* Add *worker.onready* callback -* Add threading support for *InstanceBindingCallback* -* Improve multi-threading support for *IConsoleOutput* -* Refactor *GodotJSScript* to support loading in *Worker* -* Add a setting entry for *Exporter* to manually include source files -* More strict type check for native object bindings -* *TypeConvert* returns *true* and *nullptr* for dead object pointers -* Ignore *Thread* class in d.ts codegen + +- Add _worker.onready_ callback +- Add threading support for _InstanceBindingCallback_ +- Improve multi-threading support for _IConsoleOutput_ +- Refactor _GodotJSScript_ to support loading in _Worker_ +- Add a setting entry for _Exporter_ to manually include source files +- More strict type check for native object bindings +- _TypeConvert_ returns _true_ and _nullptr_ for dead object pointers +- Ignore _Thread_ class in d.ts codegen ### Patch Changes -* Fix a godot profiler crash on *GodotJSScriptLanguage::profiling_get_* -* Fix a possible crash in *Worker::finish()* -* Fix an access violation issue in *Worker* + +- Fix a godot profiler crash on _GodotJSScriptLanguage::profiling*get*_ +- Fix a possible crash in _Worker::finish()_ +- Fix an access violation issue in _Worker_ ## 0.9.9 ### Minor Changes -* Add prebuilt libs of lws/v8 for Windows/Linux on ARM64 -* Add support for hooking godot typeloader -* Add support for JavaScriptCore +- Add prebuilt libs of lws/v8 for Windows/Linux on ARM64 +- Add support for hooking godot typeloader +- Add support for JavaScriptCore ### Patch Changes -* Minor bugfix + +- Minor bugfix ## 0.9.8 ### Patch Changes -* Fix a crash issue in `jsb::Buffer` destructor when using *quickjs-ng* as runtime -* Support for pure JavaScript projects (still with typings) -* Refactor annotations and helper functions in `jsb.core` +- Fix a crash issue in `jsb::Buffer` destructor when using _quickjs-ng_ as runtime +- Support for pure JavaScript projects (still with typings) +- Refactor annotations and helper functions in `jsb.core` ### Breaking Changes -* All annotations are moved into `godot.annotations` module (from `jsb.core`). -* `GLOBAL_GET` and `EDITOR_GET` are moved into `godot` module (from `jsb.core`). -* `callable()` is removed from `jsb.core`, use `Callable.create` in `godot` module instead. -* `to_array_buffer()` is removed from `jsb.core`, use `PackedByteArray.to_array_buffer()` instead. -* `$wait` is removed from `jsb.core`, use `SignalN<...>.as_promise()` instead. + +- All annotations are moved into `godot.annotations` module (from `jsb.core`). +- `GLOBAL_GET` and `EDITOR_GET` are moved into `godot` module (from `jsb.core`). +- `callable()` is removed from `jsb.core`, use `Callable.create` in `godot` module instead. +- `to_array_buffer()` is removed from `jsb.core`, use `PackedByteArray.to_array_buffer()` instead. +- `$wait` is removed from `jsb.core`, use `SignalN<...>.as_promise()` instead. > [!NOTE] > Regenerating `.d.ts` files in your project will help you a lot to fix most errors caused by the breaking changes below. -> *VSCode* (or `tsc`) will report all relevant changes as errors. +> _VSCode_ (or `tsc`) will report all relevant changes as errors. > Old annotations still work temporarily in this version but will be removed in a future version. Please update your codes. - diff --git a/jsb_version.h b/jsb_version.h index d78475a1..fe92a34e 100644 --- a/jsb_version.h +++ b/jsb_version.h @@ -1,10 +1,10 @@ -#ifndef GODOTJS_VERSION_H +#ifndef GODOTJS_VERSION_H #define GODOTJS_VERSION_H #include "jsb.gen.h" #define JSB_MAJOR_VERSION 1 -#define JSB_MINOR_VERSION 0 +#define JSB_MINOR_VERSION 1 #define JSB_PATCH_VERSION 0 -#endif +#endif \ No newline at end of file diff --git a/package.json b/package.json index 1fb8fb32..eecb54ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@godot-js/editor", - "version": "1.0.0", + "version": "1.1.0", "private": true, "type": "module", "packageManager": "pnpm@10.11.0+sha1.4048eeefd564ff1ab248fac3e2854d38245fe2f1",