Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add jsxPragmaFrag support to typescript transform
- Loading branch information
Showing
15 changed files
with
84 additions
and
16 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
4 changes: 4 additions & 0 deletions
4
...gin-transform-typescript/test/fixtures/imports/elide-jsx-pragmaFrag-namespace-no/input.ts
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 @@ | ||
/* @jsxFrag jsx.htm */ | ||
// Don't elide htm if a JSX fragment appears somewhere. | ||
import * as jsx from "fake-jsx-package"; | ||
<></>; |
3 changes: 3 additions & 0 deletions
3
...transform-typescript/test/fixtures/imports/elide-jsx-pragmaFrag-namespace-no/options.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 @@ | ||
{ | ||
"plugins": [["transform-typescript", { "isTSX": true }]] | ||
} |
4 changes: 4 additions & 0 deletions
4
...n-transform-typescript/test/fixtures/imports/elide-jsx-pragmaFrag-namespace-no/output.mjs
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 @@ | ||
/* @jsxFrag jsx.htm */ | ||
// Don't elide htm if a JSX fragment appears somewhere. | ||
import * as jsx from "fake-jsx-package"; | ||
<></>; |
4 changes: 4 additions & 0 deletions
4
.../babel-plugin-transform-typescript/test/fixtures/imports/elide-jsx-pragmaFrag-no/input.ts
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 @@ | ||
/* @jsxFrag htm */ | ||
// Don't elide htm if a JSX fragment appears somewhere. | ||
import { htm } from "fake-jsx-package"; | ||
<></>; |
3 changes: 3 additions & 0 deletions
3
...el-plugin-transform-typescript/test/fixtures/imports/elide-jsx-pragmaFrag-no/options.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 @@ | ||
{ | ||
"plugins": [["transform-typescript", { "isTSX": true }]] | ||
} |
4 changes: 4 additions & 0 deletions
4
...abel-plugin-transform-typescript/test/fixtures/imports/elide-jsx-pragmaFrag-no/output.mjs
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 @@ | ||
/* @jsxFrag htm */ | ||
// Don't elide htm if a JSX fragment appears somewhere. | ||
import { htm } from "fake-jsx-package"; | ||
<></>; |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact-no-2/input.ts
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 @@ | ||
// Don't elide Preact if a JSX fragment appears somewhere. | ||
import { Fragment, render } from "preact"; | ||
<></>; |
8 changes: 8 additions & 0 deletions
8
...es/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact-no-2/options.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,8 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"transform-typescript", | ||
{ "jsxPragma": "h", "jsxPragmaFrag": "Fragment", "isTSX": true } | ||
] | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact-no-2/output.mjs
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 @@ | ||
// Don't elide Preact if a JSX fragment appears somewhere. | ||
import { Fragment } from "preact"; | ||
<></>; |
3 changes: 2 additions & 1 deletion
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact-no/input.ts
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Don't elide Preact if a JSX element appears somewhere. | ||
import { h, render } from "preact"; | ||
import { h, Fragment, render } from "preact"; | ||
<div></div>; | ||
<></>; |
7 changes: 6 additions & 1 deletion
7
...ages/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact-no/options.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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{ | ||
"plugins": [["transform-typescript", { "jsxPragma": "h", "isTSX": true }]] | ||
"plugins": [ | ||
[ | ||
"transform-typescript", | ||
{ "jsxPragma": "h", "jsxPragmaFrag": "Fragment", "isTSX": true } | ||
] | ||
] | ||
} |
3 changes: 2 additions & 1 deletion
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact-no/output.mjs
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Don't elide Preact if a JSX element appears somewhere. | ||
import { h } from "preact"; | ||
import { h, Fragment } from "preact"; | ||
<div></div>; | ||
<></>; |
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-preact/input.ts
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import { FooBar, h } from "preact"; | ||
import { FooBar, h, Fragment } from "preact"; | ||
const x: FooBar = 0; |
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