diff options
author | 2021-06-02 12:48:38 -0700 | |
---|---|---|
committer | 2021-06-02 12:48:38 -0700 | |
commit | ddd5ed1cc2e64f151864bd977cedcefa6929fb74 (patch) | |
tree | 491b8a941a50e10d2770692acfbfdbf01f28ca72 /src/options.zig | |
parent | ee6643ce8b8b3ac32d5ba71d2617b38bb03379af (diff) | |
download | bun-ddd5ed1cc2e64f151864bd977cedcefa6929fb74.tar.gz bun-ddd5ed1cc2e64f151864bd977cedcefa6929fb74.tar.zst bun-ddd5ed1cc2e64f151864bd977cedcefa6929fb74.zip |
JSX & CJS work end-to-end!
Former-commit-id: 44bab947c650bb258d4cdfdf3dfc0b48c559945a
Diffstat (limited to 'src/options.zig')
-rw-r--r-- | src/options.zig | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/options.zig b/src/options.zig index b9e5350f6..066e22670 100644 --- a/src/options.zig +++ b/src/options.zig @@ -365,7 +365,9 @@ pub const JSX = struct { /// Facilitates automatic JSX importing /// Set on a per file basis like this: /// /** @jsxImportSource @emotion/core */ - import_source: string = "react", + import_source: string = "react/jsx-dev-runtime", + classic_import_source: string = "react", + jsx: string = "jsxDEV", development: bool = true, @@ -373,6 +375,10 @@ pub const JSX = struct { pub const Defaults = struct { pub var Factory = [_]string{ "React", "createElement" }; pub var Fragment = [_]string{ "React", "Fragment" }; + pub const ImportSourceDev = "react/jsx-dev-runtime"; + pub const ImportSource = "react/jsx-runtime"; + pub const JSXFunction = "jsx"; + pub const JSXFunctionDev = "jsxDEV"; }; // "React.createElement" => ["React", "createElement"] @@ -424,7 +430,13 @@ pub const JSX = struct { } if (jsx.import_source.len > 0) { - pragma.jsx = jsx.import_source; + pragma.import_source = jsx.import_source; + } else if (jsx.development) { + pragma.import_source = Defaults.ImportSourceDev; + pragma.jsx = Defaults.JSXFunctionDev; + } else { + pragma.import_source = Defaults.ImportSource; + pragma.jsx = Defaults.JSXFunction; } pragma.development = jsx.development; @@ -434,17 +446,6 @@ pub const JSX = struct { } }; - parse: bool = true, - factory: string = "createElement", - fragment: string = "Fragment", - jsx: string = "jsxDEV", - runtime: Runtime = Runtime.automatic, - development: bool = true, - - /// Set on a per file basis like this: - /// /** @jsxImportSource @emotion/core */ - import_source: string = "react", - pub const Runtime = api.Api.JsxRuntime; }; |