Add ignore list for unkown global property

This is for often-seen globals which we _know_ come from client-side libraries,
e.g. litNonce.
This commit is contained in:
Karl Seguin
2025-12-02 11:24:26 +08:00
parent 3dd61aeb71
commit abd3ee9c5d

View File

@@ -54,6 +54,28 @@ pub const Loader = struct {
}
if (comptime builtin.mode == .Debug) {
const ignored = std.StaticStringMap(void).initComptime(.{
.{ "process", {} },
.{ "ShadyDOM", {} },
.{ "ShadyCSS", {} },
.{ "litNonce", {} },
.{ "litHtmlVersions", {} },
.{ "litHtmlPolyfillSupport", {} },
.{ "litElementHydrateSupport", {} },
.{ "recaptcha", {} },
.{ "grecaptcha", {} },
.{ "___grecaptcha_cfg", {} },
.{ "__recaptcha_api", {} },
.{ "__google_recaptcha_client", {} },
.{ "CLOSURE_FLAGS", {} },
});
if (ignored.has(name)) {
return false;
}
log.debug(.unknown_prop, "unkown global property", .{
.info = "but the property can exist in pure JS",
.stack = js_context.stackTrace() catch "???",