Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: Ensure codegen files are type checked.
We want users to be able to have skipLibCheck: true in their
tsconfig. However, we do need to ensure that our codegen files are
not skipped in such cases. So we no longer use the .d.ts extension.

"Generate Godot d.ts" is now "Generate types" and in addition to
generating all Godot and project types (which it already did), the
autogen directory will now wiped of all files/directories before
commencing generation. This ensures old generated files no longer
pollute the project.
  • Loading branch information
Benjamin-Dobell committed Sep 16, 2025
commit 18a6ff528d8f5dba78dda30035eef955199eedad
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.


2 changes: 1 addition & 1 deletion bridge/jsb_editor_utility_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ namespace jsb
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = isolate->GetCurrentContext();

List<StringName> exposed_class_list = internal::NamingUtil::get_exposed_class_list();
List<StringName> exposed_class_list = internal::NamingUtil::get_exposed_original_class_list();
v8::Local<v8::Array> array = v8::Array::New(isolate, exposed_class_list.size());
int index = 0;

Expand Down
2 changes: 1 addition & 1 deletion bridge/jsb_environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ namespace jsb
// Populate StringNames replacement list so that classes can be lazily loaded by their exposed class name.
if (internal::Settings::get_camel_case_bindings_enabled())
{
List<StringName> exposed_class_list = internal::NamingUtil::get_exposed_class_list();
List<StringName> exposed_class_list = internal::NamingUtil::get_exposed_original_class_list();

for (auto it = exposed_class_list.begin(); it != exposed_class_list.end(); ++it)
{
Expand Down
66 changes: 64 additions & 2 deletions internal/jsb_naming_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@ namespace jsb::internal
{ "XRAPI", "XRApi" },
});

const HashSet<String> omitted_original_classes_set = {
"IPUnix",
"ScriptEditorDebugger",
"Thread",
"Semaphore",

// GodotJS related clases
"GodotJSEditorPlugin",
"GodotJSExportPlugin",
"GodotJSREPL",
"GodotJSScript",
"GodotJSEditorHelper",
"GodotJSEditorProgress",

// GDScript related classes
"GDScript",
"GDScriptEditorTranslationParserPlugin",
"GDScriptNativeClass",
"GDScriptSyntaxHighlighter"
};

String _get_pascal_case_part_override(String p_part, bool p_input_is_upper = true)
{
if (!p_input_is_upper)
Expand Down Expand Up @@ -337,10 +358,10 @@ namespace jsb::internal
return ret;
}

List<StringName> NamingUtil::get_exposed_class_list()
List<StringName> NamingUtil::get_exposed_original_class_list()
{
#ifdef TOOLS_ENABLED
HashSet<StringName> ignored_classes_set;
HashSet<String> ignored_classes_set;

if (internal::Settings::editor_settings_available())
{
Expand All @@ -364,6 +385,12 @@ namespace jsb::internal
{
StringName class_name = *it;

if (omitted_original_classes_set.has(class_name))
{
JSB_LOG(Verbose, "Omitted class '%s' as it's currently not usable from JavaScript", class_name);
continue;
}

#ifdef TOOLS_ENABLED
if (ignored_classes_set.has(get_class_name(class_name)))
{
Expand All @@ -376,6 +403,7 @@ namespace jsb::internal

if (api_type == ClassDB::API_NONE)
{
JSB_LOG(Verbose, "Ignoring class '%s' because it's marked as API_NONE", class_name);
continue;
}

Expand All @@ -396,4 +424,38 @@ namespace jsb::internal

return exposed_class_names;
}

bool NamingUtil::is_original_class_exposed(const String& p_original_name)
{
if (omitted_original_classes_set.has(p_original_name))
{
return false;
}

ClassDB::APIType api_type = ClassDB::get_api_type(p_original_name);

if (api_type == ClassDB::API_NONE)
{
return false;
}

if (!ClassDB::is_class_exposed(p_original_name))
{
return false;
}

if (!ClassDB::is_class_enabled(p_original_name))
{
return false;
}

#ifdef TOOLS_ENABLED
if (internal::Settings::get_ignored_classes().find(p_original_name) >= 0)
{
return false;
}
#endif

return true;
}
}
4 changes: 3 additions & 1 deletion internal/jsb_naming_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace jsb::internal

static String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false);

static List<StringName> get_exposed_class_list();
static List<StringName> get_exposed_original_class_list();

static bool is_original_class_exposed(const String& p_original_name);

static String get_class_name(const String& p_original_name)
{
Expand Down
34 changes: 2 additions & 32 deletions scripts/jsb.editor/src/jsb.editor.codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,33 +728,6 @@ const PrimitiveTypeNames: { [type: number]: string } = {
const RemapTypes: { [name: string]: string } = {
["bool"]: "boolean",
}
const IgnoredTypes = new Set([
"IPUnix",
"ScriptEditorDebugger",
"Thread",
"Semaphore",

//
// "GodotNavigationServer2D",
// "GodotPhysicsServer2D",
// "GodotPhysicsServer3D",
// "PhysicsServer2DExtension",
// "PhysicsServer3DExtension",

// GodotJS related clases
"GodotJSEditorPlugin",
"GodotJSExportPlugin",
"GodotJSREPL",
"GodotJSScript",
"GodotJSEditorHelper",
"GodotJSEditorProgress",

// GDScript related classes
"GDScript",
"GDScriptEditorTranslationParserPlugin",
"GDScriptNativeClass",
"GDScriptSyntaxHighlighter",
])
const GlobalUtilityFuncs = [
{
description: "shorthand for getting project settings",
Expand Down Expand Up @@ -2530,9 +2503,6 @@ export class TSDCodeGen {
// godot classes
for (let class_name in this._types.classes) {
const cls = this._types.classes[class_name];
if (IgnoredTypes.has(class_name)) {
continue;
}
if (typeof this._types.singletons[class_name] !== "undefined") {
// ignore the class if it's already defined as Singleton
continue;
Expand Down Expand Up @@ -2772,7 +2742,7 @@ export class SceneTSDCodeGen {
private make_scene_path(scene_path: string, include_filename = true) {
const relative_path = (
include_filename
? scene_path.replace(/\.t?scn$/i, ".nodes.gen.d.ts")
? scene_path.replace(/\.t?scn$/i, ".nodes.gen.ts")
: scene_path.replace(/\/[^\/]+$/, "")
).replace(/^res:\/\/?/, "");

Expand Down Expand Up @@ -2877,7 +2847,7 @@ export class ResourceTSDCodeGen {
private make_resource_path(resource_path: string, include_filename = true) {
const relative_path = (
include_filename
? resource_path + ".gen.d.ts"
? resource_path + ".gen.ts"
: resource_path.replace(/\/[^\/]+$/, "")
).replace(/^res:\/\/?/, "");

Expand Down
17 changes: 14 additions & 3 deletions weaver-editor/jsb_editor_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ bool GodotJSEditorHelper::_request_codegen(jsb::JSEnvironment& p_env, GodotJSScr
return true;
}

StringName GodotJSEditorHelper::_get_exposed_node_class_name(const StringName& class_name)
{
StringName exposed_class_name = class_name;

while (!jsb::internal::NamingUtil::is_original_class_exposed(exposed_class_name))
{
exposed_class_name = ClassDB::get_parent_class(exposed_class_name);
}

return jsb::internal::NamingUtil::get_class_name(exposed_class_name);
}

Dictionary GodotJSEditorHelper::_build_node_type_descriptor(jsb::JSEnvironment& p_env, Node* p_node, const String& scene_resource_path)
{
Dictionary descriptor;
Expand Down Expand Up @@ -177,7 +189,7 @@ Dictionary GodotJSEditorHelper::_build_node_type_descriptor(jsb::JSEnvironment&
}

descriptor[jsb_string_name(type)] = (int32_t) DescriptorType::Godot;
descriptor[jsb_string_name(name)] = jsb::internal::NamingUtil::get_class_name(p_node->get_class_name());
descriptor[jsb_string_name(name)] = GodotJSEditorHelper::_get_exposed_node_class_name(p_node->get_class_name());
descriptor[jsb_string_name(arguments)] = generic_arguments;
}
else
Expand Down Expand Up @@ -332,9 +344,8 @@ Dictionary GodotJSEditorHelper::get_resource_type_descriptor(const String& p_pat

if (script == nullptr || GodotJSScriptLanguage::get_singleton()->is_global_class_generic(script->get_path()))
{
const StringName& resource_class = resource->get_class_name();
descriptor[jsb_string_name(type)] = (int32_t) DescriptorType::Godot;
descriptor[jsb_string_name(name)] = resource_class == jsb_string_name(GodotJSScript) ? "Script" : jsb::internal::NamingUtil::get_class_name(resource_class);
descriptor[jsb_string_name(name)] = GodotJSEditorHelper::_get_exposed_node_class_name(resource->get_class_name());
}
else
{
Expand Down
1 change: 1 addition & 0 deletions weaver-editor/jsb_editor_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class GodotJSEditorHelper : public Object
private:

static bool _request_codegen(jsb::JSEnvironment& p_env, GodotJSScript* p_script, const Dictionary& p_request, Dictionary& p_result);
static StringName _get_exposed_node_class_name(const StringName& class_name);
static Dictionary _build_node_type_descriptor(jsb::JSEnvironment& p_env, Node* p_node, const String& scene_resource_path = String());
static void _log_load_error(const String &p_file, const String &p_type, Error p_error);

Expand Down
Loading