diff options
| author | 2023-05-24 18:33:28 -0700 | |
|---|---|---|
| committer | 2023-05-24 18:33:28 -0700 | |
| commit | 49729341895752f8817f444e9c87eaf4affa68bf (patch) | |
| tree | 9c1fc60a6379e4bff8ab62ac27f5f2df1953a427 /src/resolver/tsconfig_json.zig | |
| parent | d73bce058ab35b39838334f47e56fcea63db8e59 (diff) | |
| download | bun-49729341895752f8817f444e9c87eaf4affa68bf.tar.gz bun-49729341895752f8817f444e9c87eaf4affa68bf.tar.zst bun-49729341895752f8817f444e9c87eaf4affa68bf.zip | |
fix setting `jsxImportSource`, `jsxFactory`, and `jsxFragmentFactory` (#3057)
* default automatic, merge jsx flags from multiple tsconfigs
* use entire package name
* some tests
* more tests
Diffstat (limited to 'src/resolver/tsconfig_json.zig')
| -rw-r--r-- | src/resolver/tsconfig_json.zig | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/resolver/tsconfig_json.zig b/src/resolver/tsconfig_json.zig index 7121e8741..7ec6b3e0b 100644 --- a/src/resolver/tsconfig_json.zig +++ b/src/resolver/tsconfig_json.zig @@ -157,11 +157,14 @@ pub const TSConfigJSON = struct { if (compiler_opts.expr.asProperty("jsx")) |jsx_prop| { if (jsx_prop.expr.asString(allocator)) |str| { + var str_lower = allocator.alloc(u8, str.len) catch unreachable; + defer allocator.free(str_lower); + _ = strings.copyLowercase(str, str_lower); // we don't support "preserve" yet - if (options.JSX.RuntimeMap.get(str)) |runtime| { + if (options.JSX.RuntimeMap.get(str_lower)) |runtime| { result.jsx.runtime = runtime; if (runtime == .automatic) { - result.jsx.setProduction(!strings.contains(str, "jsxDEV")); + result.jsx.setProduction(!strings.contains(str_lower, "jsxdev")); is_jsx_development = result.jsx.development; result.jsx_flags.insert(.development); } @@ -179,7 +182,7 @@ pub const TSConfigJSON = struct { result.jsx_flags.insert(.runtime); } - result.jsx.package_name = options.JSX.Pragma.parsePackageName(str); + result.jsx.package_name = str; result.jsx.setImportSource(allocator); result.jsx_flags.insert(.import_source); } |
