-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for "react-jsx" and jsxImportSource (#161)
Co-authored-by: benStre <strehle.benedikt@gmail.com>
- Loading branch information
Showing
26 changed files
with
148 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const helloWorld = <div id="helloWorld"></div>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
React.createElement("div", { | ||
id: "helloWorld" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"imports": {} | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_default/transpile/local/jsx/main.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const helloWorld = /*#__PURE__*/ React.createElement("div", { | ||
id: "helloWorld" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"file:///jsx/main.tsx": "local/jsx/main.tsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div id="helloWorld"></div>; |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_preserve/transpile/deno.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"imports": {} | ||
} |
1 change: 1 addition & 0 deletions
1
tests/__snapshots__/jsx/jsx_type_preserve/transpile/local/jsx/main.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const helloWorld = <div id="helloWorld"></div>; |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_preserve/transpile/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"file:///jsx/main.tsx": "local/jsx/main.tsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
React.createElement("div", { | ||
id: "helloWorld" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"imports": {} | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_react/transpile/local/jsx/main.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const helloWorld = /*#__PURE__*/ React.createElement("div", { | ||
id: "helloWorld" | ||
}); |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_react/transpile/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"file:///jsx/main.tsx": "local/jsx/main.tsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"imports": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { jsx as _jsx } from "/jsx-runtime"; | ||
const helloWorld = /*#__PURE__*/ _jsx("div", { | ||
id: "helloWorld" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"file:///jsx/main.tsx": "local/jsx/main.tsx" | ||
} |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_reactjsx_with_custom_import_source/deno.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"imports": {} | ||
} |
4 changes: 4 additions & 0 deletions
4
tests/__snapshots__/jsx/jsx_type_reactjsx_with_custom_import_source/local/jsx/main.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { jsx as _jsx } from "example/jsx-runtime"; | ||
const helloWorld = /*#__PURE__*/ _jsx("div", { | ||
id: "helloWorld" | ||
}); |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_reactjsx_with_custom_import_source/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"file:///jsx/main.tsx": "local/jsx/main.tsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div id="helloWorld"></div>; |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_reactnative/transpile/deno.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"imports": {} | ||
} |
1 change: 1 addition & 0 deletions
1
tests/__snapshots__/jsx/jsx_type_reactnative/transpile/local/jsx/main.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const helloWorld = <div id="helloWorld"></div>; |
3 changes: 3 additions & 0 deletions
3
tests/__snapshots__/jsx/jsx_type_reactnative/transpile/modules.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"file:///jsx/main.tsx": "local/jsx/main.tsx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { | ||
resolveFixture, | ||
testTranspile, | ||
testTranspileAndBundle, | ||
} from "./utils.ts"; | ||
|
||
Deno.test({ | ||
name: "jsx default", | ||
fn: testTranspileAndBundle( | ||
resolveFixture("jsx/main.tsx"), | ||
), | ||
}); | ||
|
||
Deno.test({ | ||
name: "jsx type react", | ||
fn: testTranspileAndBundle( | ||
resolveFixture("jsx/main.tsx"), | ||
{ | ||
compilerOptions: { | ||
jsx: "react", | ||
}, | ||
}, | ||
), | ||
}); | ||
|
||
Deno.test({ | ||
name: "jsx type react-native", | ||
fn: testTranspileAndBundle( | ||
resolveFixture("jsx/main.tsx"), | ||
{ | ||
compilerOptions: { | ||
jsx: "react-native", | ||
}, | ||
}, | ||
), | ||
}); | ||
|
||
Deno.test({ | ||
name: "jsx type preserve", | ||
fn: testTranspileAndBundle( | ||
resolveFixture("jsx/main.tsx"), | ||
{ | ||
compilerOptions: { | ||
jsx: "preserve", | ||
}, | ||
}, | ||
), | ||
}); | ||
|
||
Deno.test({ | ||
name: "jsx type react-jsx", | ||
fn: testTranspile( | ||
resolveFixture("jsx/main.tsx"), | ||
{ | ||
compilerOptions: { | ||
jsx: "react-jsx", | ||
}, | ||
}, | ||
), | ||
}); | ||
|
||
Deno.test({ | ||
name: "jsx type react-jsx with custom import source", | ||
fn: testTranspile( | ||
resolveFixture("jsx/main.tsx"), | ||
{ | ||
compilerOptions: { | ||
jsx: "react-jsx", | ||
jsxImportSource: "example", | ||
}, | ||
}, | ||
), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters