-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read jsxImportSource from tsconfig (#4759)
* Read jsxImportSource from tsconfig * Only read from tsconfig if not found earlier
- Loading branch information
Showing
13 changed files
with
118 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Read jsxImportSource from tsconfig |
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
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
7 changes: 7 additions & 0 deletions
7
packages/astro/test/fixtures/react-and-solid/astro.config.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,7 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import react from '@astrojs/react'; | ||
import solid from '@astrojs/solid-js'; | ||
|
||
export default defineConfig({ | ||
integrations: [react(), solid()] | ||
}); |
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 @@ | ||
{ | ||
"name": "@test/react-and-solid", | ||
"dependencies": { | ||
"astro": "workspace:*", | ||
"@astrojs/react": "workspace:*", | ||
"@astrojs/solid-js": "workspace:*" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/react-and-solid/src/components/ExampleReact.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,6 @@ | ||
/** @jsxImportSource react */ | ||
import { FC } from 'react'; | ||
|
||
export const ExampleReact: FC = () => { | ||
return <div id="example-react">example react component</div>; | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/astro/test/fixtures/react-and-solid/src/components/ExampleSolid.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,5 @@ | ||
import { VoidComponent } from 'solid-js'; | ||
|
||
export const ExampleSolid: VoidComponent = () => { | ||
return <div id="example-solid">example solidjs component</div>; | ||
}; |
13 changes: 13 additions & 0 deletions
13
packages/astro/test/fixtures/react-and-solid/src/pages/index.astro
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,13 @@ | ||
--- | ||
import { ExampleReact } from '../components/ExampleReact'; | ||
import { ExampleSolid } from '../components/ExampleSolid'; | ||
--- | ||
<html> | ||
<head> | ||
<title>title</title> | ||
</head> | ||
<body> | ||
<ExampleReact /> | ||
<ExampleSolid /> | ||
</body> | ||
</html> |
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,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"jsxImportSource": "solid-js", | ||
"types": ["astro/client"] | ||
} | ||
} |
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,20 @@ | ||
import { expect } from 'chai'; | ||
import * as cheerio from 'cheerio'; | ||
import { loadFixture } from './test-utils.js'; | ||
|
||
describe('Solid app with some React components', () => { | ||
/** @type {import('./test-utils').Fixture} */ | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ root: './fixtures/react-and-solid/' }); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Reads jsxImportSource from tsconfig', async () => { | ||
let html = await fixture.readFile('/index.html'); | ||
let $ = cheerio.load(html); | ||
expect($('#example-solid').text()).to.equal('example solidjs component'); | ||
expect($('#example-react').text()).to.equal('example react component'); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.