feat(bake): handle bundle errors, re-assemble full client payloads, initial error modal (#14504)

This commit is contained in:
dave caruso
2024-10-14 16:49:38 -07:00
committed by GitHub
parent 29d287261b
commit d2fe1ce1c8
27 changed files with 2596 additions and 1317 deletions

View File

@@ -548,7 +548,7 @@ const JSXTag = struct {
// The tag is an identifier
var name = p.lexer.identifier;
var tag_range = p.lexer.range();
try p.lexer.expectInsideJSXElement(.t_identifier);
try p.lexer.expectInsideJSXElementWithName(.t_identifier, "JSX element name");
// Certain identifiers are strings
// <div
@@ -6036,6 +6036,19 @@ fn NewParser_(
.name = LocRef{ .ref = ref, .loc = logger.Loc{} },
};
declared_symbols.appendAssumeCapacity(.{ .ref = ref, .is_top_level = true });
// ensure every e_import_identifier holds the namespace
if (p.options.features.hot_module_reloading) {
const symbol = &p.symbols.items[ref.inner_index];
if (symbol.namespace_alias == null) {
symbol.namespace_alias = .{
.namespace_ref = namespace_ref,
.alias = alias_name,
.import_record_index = import_record_i,
};
}
}
try p.is_import_item.put(allocator, ref, {});
try p.named_imports.put(allocator, ref, js_ast.NamedImport{
.alias = alias_name,
@@ -15780,10 +15793,19 @@ fn NewParser_(
const end_tag = try JSXTag.parse(P, p);
if (!strings.eql(end_tag.name, tag.name)) {
try p.log.addRangeErrorFmt(p.source, end_tag.range, p.allocator, "Expected closing tag \\</{s}\\> to match opening tag \\<{s}\\>", .{
end_tag.name,
tag.name,
});
try p.log.addRangeErrorFmtWithNote(
p.source,
end_tag.range,
p.allocator,
"Expected closing tag \\</{s}\\> to match opening tag \\<{s}\\>",
.{
end_tag.name,
tag.name,
},
"Starting tag here",
.{},
tag.range,
);
return error.SyntaxError;
}