Skip to content

Commit cceeafb

Browse files
matthewpastrobot-houston
authored andcommitted
[ci] format
1 parent d47baa4 commit cceeafb

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

packages/integrations/react/src/index.ts

+15-16
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ const versionsConfig = {
2121
18: {
2222
server: '@astrojs/react/server.js',
2323
client: '@astrojs/react/client.js',
24-
externals: ['react-dom/server', 'react-dom/client']
24+
externals: ['react-dom/server', 'react-dom/client'],
2525
},
2626
19: {
2727
server: '@astrojs/react/server.js',
2828
client: '@astrojs/react/client.js',
29-
externals: ['react-dom/server', 'react-dom/client']
30-
}
29+
externals: ['react-dom/server', 'react-dom/client'],
30+
},
3131
};
3232

33-
type SupportedReactVersion = keyof (typeof versionsConfig);
33+
type SupportedReactVersion = keyof typeof versionsConfig;
3434
type ReactVersionConfig = (typeof versionsConfig)[SupportedReactVersion];
3535

3636
function getReactMajorVersion(): number {
3737
const matches = /\d+\./.exec(ReactVersion);
38-
if(!matches) {
38+
if (!matches) {
3939
return NaN;
4040
}
4141
return Number(matches[0]);
@@ -75,12 +75,10 @@ function optionsPlugin(experimentalReactChildren: boolean): vite.Plugin {
7575
};
7676
}
7777

78-
function getViteConfiguration({
79-
include,
80-
exclude,
81-
babel,
82-
experimentalReactChildren,
83-
}: ReactIntegrationOptions = {}, reactConfig: ReactVersionConfig) {
78+
function getViteConfiguration(
79+
{ include, exclude, babel, experimentalReactChildren }: ReactIntegrationOptions = {},
80+
reactConfig: ReactVersionConfig
81+
) {
8482
return {
8583
optimizeDeps: {
8684
include: [
@@ -90,9 +88,7 @@ function getViteConfiguration({
9088
'react/jsx-dev-runtime',
9189
'react-dom',
9290
],
93-
exclude: [
94-
reactConfig.server,
95-
],
91+
exclude: [reactConfig.server],
9692
},
9793
plugins: [react({ include, exclude, babel }), optionsPlugin(!!experimentalReactChildren)],
9894
resolve: {
@@ -119,7 +115,7 @@ export default function ({
119115
experimentalReactChildren,
120116
}: ReactIntegrationOptions = {}): AstroIntegration {
121117
const majorVersion = getReactMajorVersion();
122-
if(isUnsupportedVersion(majorVersion)) {
118+
if (isUnsupportedVersion(majorVersion)) {
123119
throw new Error(`Unsupported React version: ${majorVersion}.`);
124120
}
125121
const versionConfig = versionsConfig[majorVersion as SupportedReactVersion];
@@ -130,7 +126,10 @@ export default function ({
130126
'astro:config:setup': ({ command, addRenderer, updateConfig, injectScript }) => {
131127
addRenderer(getRenderer(versionConfig));
132128
updateConfig({
133-
vite: getViteConfiguration({ include, exclude, babel, experimentalReactChildren }, versionConfig),
129+
vite: getViteConfiguration(
130+
{ include, exclude, babel, experimentalReactChildren },
131+
versionConfig
132+
),
134133
});
135134
if (command === 'dev') {
136135
const preamble = FAST_REFRESH_PREAMBLE.replace(`__BASE__`, '/');

0 commit comments

Comments
 (0)