Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9b917c2
chore: Changesets for changes introduced after 1.0.0 but prior to cha…
Benjamin-Dobell Sep 13, 2025
5ebf454
feat: ResolveNodePathMap utility type.
Benjamin-Dobell Jun 3, 2025
a359d04
feat: Types Node direct child APIs
Benjamin-Dobell Jun 3, 2025
0f173d3
fix: Ensure resource types are (re)generated when a scene saves
Benjamin-Dobell Jun 3, 2025
0c57517
feat: UserTypeDescriptor resource type safety
Benjamin-Dobell Jun 3, 2025
18a6ff5
feat: Ensure codegen files are type checked.
Benjamin-Dobell Jun 3, 2025
957d5ca
feat: Improved support for statically typed optional nodes
Benjamin-Dobell Jun 4, 2025
f13ba87
chore: Fix indentation
Benjamin-Dobell Jun 4, 2025
7626e73
fix: get_tree() will not return null, it'll error instead
Benjamin-Dobell Jun 6, 2025
fd177b9
fix: Duplicate Generating in codegen titles
Benjamin-Dobell Jun 6, 2025
05647ac
fix: Critical bug fixes (for crashes) that may occur due to the
Benjamin-Dobell Jun 30, 2025
e35d35e
fix: Duplicate PackedByteArray to_array_buffer() registration
Benjamin-Dobell Jun 30, 2025
143980a
fix: Variant constructor failure on first bound Variant class.
Benjamin-Dobell Jul 3, 2025
9c69889
fix: Another missing Isolate::Scope
Benjamin-Dobell Jul 6, 2025
e7a6713
fix: NodePathMap should permit undefined/optional children
Benjamin-Dobell Jul 11, 2025
c01c0d4
fix: TStringNameCache v8::String reference loss
Benjamin-Dobell Jul 30, 2025
8394f98
fix: Added missing PROPERTY_USAGE_SCRIPT_VARIABLE flag
Benjamin-Dobell Jul 30, 2025
8664bf2
fix: @ExportObject(Node). Was only working for sub-classes.
Benjamin-Dobell Jul 31, 2025
abd0137
fix: JSWorker transfer crash
Benjamin-Dobell Aug 2, 2025
a14dfe0
feat: Expose Variant utility typeof() as godot_typeof().
Benjamin-Dobell Aug 2, 2025
3bd9856
fix: GDictionary keys() return type
Benjamin-Dobell Aug 2, 2025
453da8e
feat: Improved GObject types
Benjamin-Dobell Aug 2, 2025
39a01db
fix: Ensure the GAny union type includes null
Benjamin-Dobell Aug 2, 2025
3369ccd
fix: Bind script instance during default prop evaluation
Benjamin-Dobell Aug 5, 2025
2461614
feat: Constructor params and GDScript compatible 'new'
Benjamin-Dobell Aug 5, 2025
4ae63a9
feat: Worker postMessage support for structured clone and transfer.
Benjamin-Dobell Aug 8, 2025
7372ba3
fix: Don't allow codegen failures to output malformed types
Benjamin-Dobell Aug 13, 2025
047f35a
fix: Invalid codegen for certain types (function literals in particular)
Benjamin-Dobell Aug 14, 2025
36c2a9c
feat: Safer TC39 Stage 3 decorators.
Benjamin-Dobell Aug 9, 2025
e03e7c4
fix: Ensure usercode triggered from ::get/::set does not crash the pr…
Benjamin-Dobell Aug 13, 2025
8d21b32
feat: Global/Local equality operators for JSC, QJS, and web
Benjamin-Dobell Aug 15, 2025
88f8145
fix: Non-V8 builds
Benjamin-Dobell Aug 15, 2025
6770b97
fix: Enum codegen (and godot.lib.api iteration)
Benjamin-Dobell Aug 21, 2025
9ea9ea1
fix: Improved codegen formatting
Benjamin-Dobell Aug 21, 2025
5e0104e
fix: Don't leak temporary default properties object
Benjamin-Dobell Aug 21, 2025
4ac8479
fix: Threading / Godot address reuse crash.
Benjamin-Dobell Aug 21, 2025
e427909
fix: Resource duplicate() return type
Benjamin-Dobell Aug 22, 2025
80db70d
fix: Make Variant constants Readonly<> so they can't be accidentally …
Benjamin-Dobell Aug 26, 2025
d933753
feat: Typesafe EditorUndoRedoManager API types
Benjamin-Dobell Aug 26, 2025
ad96db5
feat: GArray tuple support.
Benjamin-Dobell Aug 27, 2025
e0641c8
feat: Godot 4.5 support
Benjamin-Dobell Aug 27, 2025
f04f30e
ci: Build for multiple Godot engine versions
Benjamin-Dobell Sep 12, 2025
762de54
fix: Don't crash on GodotJS native class mismatch.
Benjamin-Dobell Aug 27, 2025
95cf6b6
fix: Don't crash when script binding fails
Benjamin-Dobell Aug 31, 2025
d3b1ca7
feat: Native object now guaranteed bound during JS initializaation.
Benjamin-Dobell Aug 31, 2025
aebbea4
fix: GDictionary absent values are returned as null, not undefined
Benjamin-Dobell Aug 31, 2025
3bb0f5e
feat: Godot String methods now exposed as static methods on String
Benjamin-Dobell Sep 2, 2025
f9f53dd
feat: Dynamic dispatch types e.g., call_deferred is now typesafe.
Benjamin-Dobell Sep 3, 2025
1ed2957
feat: Codegen GArray/GDictionary generic params from hint strings
Benjamin-Dobell Sep 11, 2025
66e85b2
fix: Ensure GDScript singleton class accessors/modifiers are `static`.
Benjamin-Dobell Sep 13, 2025
28929a8
feat: GodotJS 1.1.0
Benjamin-Dobell Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/acher-neurogliosis-distance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** Statically resolved return type for `get_node()`/`getNode()`.
5 changes: 5 additions & 0 deletions .changeset/actinotoxemia-scryer-uncantoned.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** `ResourceLoader.load()` overload type.
5 changes: 5 additions & 0 deletions .changeset/ammelide-dilute-nazarean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** `@ExportObject(Node)` was only working for sub-classes, not `Node` itself.
5 changes: 5 additions & 0 deletions .changeset/ammonifier-lungi-godmaker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** Duplicate "Generating" label appeared in the UI during codegen.
5 changes: 5 additions & 0 deletions .changeset/appropinquate-hydrogeological-diipolia.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** `GDictionary` absent values are now correctly typed as returning as `null`, not `undefined`.
5 changes: 5 additions & 0 deletions .changeset/arethuse-chlamydozoa-revere.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Feature:** Improved type conversion error messages.
5 changes: 5 additions & 0 deletions .changeset/asphyxiator-perceptionism-doorkeeper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** `@export_` support for enums as keys of `GDictionary`.
5 changes: 5 additions & 0 deletions .changeset/ballistae-pickaway-shelfpiece.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types/Fix:** Invalid codegen for certain types (function literals in particular)
5 changes: 5 additions & 0 deletions .changeset/barter-uxorious-unsuspecting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** Background thread script instantiation (for 4.5 editor).
5 changes: 5 additions & 0 deletions .changeset/beamlike-wartless-endamage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** Handle `hint_string` if `@export_var` is a `GArray` with an element type provided via `details.class_`.
5 changes: 5 additions & 0 deletions .changeset/bedder-unvulgar-ungingled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** Added `Resource` `duplicate()` return type.
25 changes: 25 additions & 0 deletions .changeset/besiren-hodden-margarin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"@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 `<reference no-default-lib=true/>` 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.
110 changes: 110 additions & 0 deletions .changeset/brighid-pit-mortcloth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
"@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<T>` and `Callable<T>`
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<T>()` 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<Card extends CardNode = CardNode> extends GameNode<SceneNodes['scenes/card_collection_3d.tscn']>
```

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<UserTypeDescriptor>({
type: DescriptorType.User,
name: 'CardCollection',
resource: 'res://src/card-collection.ts',
arguments: GArray.create<TypeDescriptor>([
GDictionary.create<UserTypeDescriptor>({
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<T>` 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.
16 changes: 16 additions & 0 deletions .changeset/canadine-knowableness-leucitis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@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.
61 changes: 61 additions & 0 deletions .changeset/cantabrize-infrigidation-spousy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
"@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.
5 changes: 5 additions & 0 deletions .changeset/catharticalness-amphicarpous-unshewed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** Improved GObject types
9 changes: 9 additions & 0 deletions .changeset/chondrosteoma-keratoleukoma-tentaculocyst.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@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.
5 changes: 5 additions & 0 deletions .changeset/clancularly-rattlejack-maguey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@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.
5 changes: 5 additions & 0 deletions .changeset/convolvulinolic-mascouten-evanesce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Feature:** Expose Godot Variant utility method typeof() as `godot_typeof()`/`godotTypeof()`.
5 changes: 5 additions & 0 deletions .changeset/crate-heteromera-runnel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** Threading / Godot address reuse crash.
5 changes: 5 additions & 0 deletions .changeset/cresylite-unjudiciously-misshapen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** Codegen + type checking for animations.
5 changes: 5 additions & 0 deletions .changeset/cylindrella-prediluvial-araneology.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Feature:** `CameraFeed` types.
7 changes: 7 additions & 0 deletions .changeset/cymraeg-recappable-porousness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@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.
5 changes: 5 additions & 0 deletions .changeset/decretorily-enveil-misexplain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Feature:** Support async module loader in quickjs.impl.
5 changes: 5 additions & 0 deletions .changeset/embryotome-papilioninae-troostitic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Feature:** Godot 4.5 support
11 changes: 11 additions & 0 deletions .changeset/epimachinae-anemonal-unbearableness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@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.


5 changes: 5 additions & 0 deletions .changeset/epitrichium-dacite-fibrinolytic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** Duplicate PackedByteArray to_array_buffer() registration
5 changes: 5 additions & 0 deletions .changeset/equity-clarionet-subtenancy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Fix:** Added missing `PROPERTY_USAGE_SCRIPT_VARIABLE` flag on exported variables.
5 changes: 5 additions & 0 deletions .changeset/ethnobiological-elfenfolk-semola.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** `NodePathMap` now permits `undefined`/optional children.
5 changes: 5 additions & 0 deletions .changeset/exosmotic-pedatisect-kaffir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Feature/Types:** Types + codegen for project input actions.
5 changes: 5 additions & 0 deletions .changeset/extracapsular-unchangeable-coleochaetaceous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types:** `EditorUndoRedoManager` API types
5 changes: 5 additions & 0 deletions .changeset/fasciolar-cloisonless-hymeniophore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godot-js/editor": patch
---

**Types**: Ensure the GAny union type includes null
Loading
Loading