diff options
author | 2023-06-20 19:29:20 -0700 | |
---|---|---|
committer | 2023-06-20 19:29:20 -0700 | |
commit | 6a1fbef8fdc8d2bb12a0124b5730d5682a4360d5 (patch) | |
tree | 68e7613eb244144800549b8ee7eda0fb2c2e4cb1 /src/js_parser.zig | |
parent | 50064352346f48da74f66caca9d30b81a77c89b9 (diff) | |
download | bun-6a1fbef8fdc8d2bb12a0124b5730d5682a4360d5.tar.gz bun-6a1fbef8fdc8d2bb12a0124b5730d5682a4360d5.tar.zst bun-6a1fbef8fdc8d2bb12a0124b5730d5682a4360d5.zip |
record jsx factory symbols in classic mode (#3360)
* record jsx factory symbols
* merge factory/fragment when more than one part
* update test
* use existing functions, use, `memberListToComponentsIfDifferent`
* missing file
* fix defaults
Diffstat (limited to 'src/js_parser.zig')
-rw-r--r-- | src/js_parser.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig index 51627a134..33a8cef6d 100644 --- a/src/js_parser.zig +++ b/src/js_parser.zig @@ -15096,6 +15096,10 @@ fn NewParser_( if (e_.tag) |_tag| { break :tagger p.visitExpr(_tag); } else { + if (p.options.jsx.runtime == .classic) { + break :tagger p.jsxStringsToMemberExpression(expr.loc, p.options.jsx.fragment) catch unreachable; + } + break :tagger p.jsxImport(.Fragment, expr.loc); } }; @@ -15169,9 +15173,11 @@ fn NewParser_( i += @intCast(usize, @boolToInt(args[i].data != .e_missing)); } + const target = p.jsxStringsToMemberExpression(expr.loc, p.options.jsx.factory) catch unreachable; + // Call createElement() return p.newExpr(E.Call{ - .target = p.jsxImport(.createElement, expr.loc), + .target = target, .args = ExprNodeList.init(args[0..i]), // Enable tree shaking .can_be_unwrapped_if_unused = !p.options.ignore_dce_annotations, |