diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 1983f0b..25bdfe3 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -8,13 +8,13 @@ module.exports = defineConfig({
'eslint:recommended',
'plugin:node/recommended',
'plugin:@typescript-eslint/recommended',
- 'plugin:regexp/recommended'
+ 'plugin:regexp/recommended',
],
plugins: ['import', 'regexp'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
- ecmaVersion: 2021
+ ecmaVersion: 2021,
},
rules: {
eqeqeq: ['warn', 'always', { null: 'never' }],
@@ -25,36 +25,36 @@ module.exports = defineConfig({
'prefer-const': [
'warn',
{
- destructuring: 'all'
- }
+ destructuring: 'all',
+ },
],
'node/no-missing-import': [
'error',
{
allowModules: ['types', 'estree', 'less', 'sass', 'stylus'],
- tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts']
- }
+ tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],
+ },
],
'node/no-missing-require': [
'error',
{
// for try-catching yarn pnp
allowModules: ['pnpapi', 'vite'],
- tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts']
- }
+ tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],
+ },
],
'node/no-extraneous-import': [
'error',
{
- allowModules: ['vite', 'less', 'sass', 'vitest']
- }
+ allowModules: ['vite', 'less', 'sass', 'vitest'],
+ },
],
'node/no-extraneous-require': [
'error',
{
- allowModules: ['vite']
- }
+ allowModules: ['vite'],
+ },
],
'node/no-deprecated-api': 'off',
'node/no-unpublished-import': 'off',
@@ -65,11 +65,11 @@ module.exports = defineConfig({
'@typescript-eslint/ban-types': 'off', // TODO: we should turn this on in a new PR
'@typescript-eslint/explicit-module-boundary-types': [
'error',
- { allowArgumentsExplicitlyTypedAsAny: true }
+ { allowArgumentsExplicitlyTypedAsAny: true },
],
'@typescript-eslint/no-empty-function': [
'error',
- { allow: ['arrowFunctions'] }
+ { allow: ['arrowFunctions'] },
],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR
@@ -80,12 +80,12 @@ module.exports = defineConfig({
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
- { prefer: 'type-imports' }
+ { prefer: 'type-imports' },
],
'import/no-nodejs-modules': [
'error',
- { allow: builtinModules.map((mod) => `node:${mod}`) }
+ { allow: builtinModules.map((mod) => `node:${mod}`) },
],
'import/no-duplicates': 'error',
'import/order': 'error',
@@ -96,27 +96,32 @@ module.exports = defineConfig({
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
- allowSeparatedGroups: false
- }
+ allowSeparatedGroups: false,
+ },
],
- 'regexp/no-contradiction-with-assertion': 'error'
+ 'regexp/no-contradiction-with-assertion': 'error',
},
overrides: [
{
files: ['packages/**'],
excludedFiles: '**/__tests__/**',
rules: {
- 'no-restricted-globals': ['error', 'require', '__dirname', '__filename']
- }
+ 'no-restricted-globals': [
+ 'error',
+ 'require',
+ '__dirname',
+ '__filename',
+ ],
+ },
},
{
files: ['**/build.config.ts'],
rules: {
'no-undef': 'off',
'node/no-missing-import': 'off',
- '@typescript-eslint/explicit-module-boundary-types': 'off'
- }
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
+ },
},
{
files: ['playground/**'],
@@ -129,17 +134,17 @@ module.exports = defineConfig({
'node/no-unsupported-features/es-builtins': [
'error',
{
- version: '^14.18.0 || >=16.0.0'
- }
+ version: '^14.18.0 || >=16.0.0',
+ },
],
'node/no-unsupported-features/node-builtins': [
'error',
{
- version: '^14.18.0 || >=16.0.0'
- }
+ version: '^14.18.0 || >=16.0.0',
+ },
],
- '@typescript-eslint/explicit-module-boundary-types': 'off'
- }
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
+ },
},
{
files: ['playground/**'],
@@ -148,21 +153,21 @@ module.exports = defineConfig({
'no-undef': 'off',
'no-empty': 'off',
'no-constant-condition': 'off',
- '@typescript-eslint/no-empty-function': 'off'
- }
+ '@typescript-eslint/no-empty-function': 'off',
+ },
},
{
files: ['*.js', '*.mjs', '*.cjs'],
rules: {
- '@typescript-eslint/explicit-module-boundary-types': 'off'
- }
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
+ },
},
{
files: ['*.d.ts'],
rules: {
- '@typescript-eslint/triple-slash-reference': 'off'
- }
- }
+ '@typescript-eslint/triple-slash-reference': 'off',
+ },
+ },
],
- reportUnusedDisableDirectives: true
+ reportUnusedDisableDirectives: true,
})
diff --git a/.github/renovate.json5 b/.github/renovate.json5
index 0014c76..ce03a18 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -8,8 +8,8 @@
"packageRules": [
{
"depTypeList": ["peerDependencies"],
- "enabled": false
- }
+ "enabled": false,
+ },
],
"ignoreDeps": [
// manually bumping
@@ -22,6 +22,6 @@
"source-map", // `source-map:v0.7.0+` needs more investigation
"dotenv-expand", // `dotenv-expand:6.0.0+` has breaking changes (#6858)
"kill-port", // `kill-port:^2.0.0 has perf issues (#8392)
- "miniflare" // `miniflare:v2.0.0+` only supports node 16.7
- ]
+ "miniflare", // `miniflare:v2.0.0+` only supports node 16.7
+ ],
}
diff --git a/.prettierrc.json b/.prettierrc.json
index 3a87ddf..568ce1a 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -3,7 +3,7 @@
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
- "trailingComma": "none",
+ "trailingComma": "all",
"overrides": [
{
"files": ["*.json5"],
diff --git a/packages/plugin-react/README.md b/packages/plugin-react/README.md
index 6a8f3cb..e772b2e 100644
--- a/packages/plugin-react/README.md
+++ b/packages/plugin-react/README.md
@@ -14,7 +14,7 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
- plugins: [react()]
+ plugins: [react()],
})
```
@@ -29,7 +29,7 @@ react({
// Exclude storybook stories
exclude: /\.stories\.(t|j)sx?$/,
// Only .tsx files
- include: '**/*.tsx'
+ include: '**/*.tsx',
})
```
@@ -39,7 +39,7 @@ By default, the plugin uses the [automatic JSX runtime](https://github.com/alloc
```js
react({
- jsxRuntime: 'classic'
+ jsxRuntime: 'classic',
})
```
@@ -69,9 +69,9 @@ If you are using ES syntax that are still in proposal status (e.g. class propert
react({
babel: {
parserOpts: {
- plugins: ['decorators-legacy']
- }
- }
+ plugins: ['decorators-legacy'],
+ },
+ },
})
```
diff --git a/packages/plugin-react/build.config.ts b/packages/plugin-react/build.config.ts
index 6116572..9d05aa4 100644
--- a/packages/plugin-react/build.config.ts
+++ b/packages/plugin-react/build.config.ts
@@ -7,6 +7,6 @@ export default defineBuildConfig({
declaration: true,
rollup: {
emitCJS: true,
- inlineDependencies: true
- }
+ inlineDependencies: true,
+ },
})
diff --git a/packages/plugin-react/src/fast-refresh.ts b/packages/plugin-react/src/fast-refresh.ts
index 1461b4d..cea3d24 100644
--- a/packages/plugin-react/src/fast-refresh.ts
+++ b/packages/plugin-react/src/fast-refresh.ts
@@ -7,11 +7,11 @@ export const runtimePublicPath = '/@react-refresh'
const _require = createRequire(import.meta.url)
const reactRefreshDir = path.dirname(
- _require.resolve('react-refresh/package.json')
+ _require.resolve('react-refresh/package.json'),
)
const runtimeFilePath = path.join(
reactRefreshDir,
- 'cjs/react-refresh-runtime.development.js'
+ 'cjs/react-refresh-runtime.development.js',
)
export const runtimeCode = `
@@ -112,7 +112,7 @@ import.meta.hot.accept(mod => {
export function addRefreshWrapper(
code: string,
id: string,
- accept: boolean
+ accept: boolean,
): string {
return (
header.replace('__SOURCE__', JSON.stringify(id)) +
@@ -133,7 +133,7 @@ export function isRefreshBoundary(ast: t.File): boolean {
if (declaration.type === 'ClassDeclaration') return false
if (declaration.type === 'VariableDeclaration') {
return declaration.declarations.every((variable) =>
- isComponentLikeIdentifier(variable.id)
+ isComponentLikeIdentifier(variable.id),
)
}
if (declaration.type === 'FunctionDeclaration') {
diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts
index f8aa109..95db673 100644
--- a/packages/plugin-react/src/index.ts
+++ b/packages/plugin-react/src/index.ts
@@ -10,7 +10,7 @@ import {
isRefreshBoundary,
preambleCode,
runtimeCode,
- runtimePublicPath
+ runtimePublicPath,
} from './fast-refresh'
export interface Options {
@@ -72,7 +72,7 @@ export interface ReactBabelOptions extends BabelOptions {
type ReactBabelHook = (
babelConfig: ReactBabelOptions,
context: ReactBabelHookContext,
- config: ResolvedConfig
+ config: ResolvedConfig,
) => void
type ReactBabelHookContext = { ssr: boolean; id: string }
@@ -101,7 +101,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
let skipReactImport = false
let runPluginOverrides = (
options: ReactBabelOptions,
- context: ReactBabelHookContext
+ context: ReactBabelHookContext,
) => false
let staticBabelOptions: ReactBabelOptions | undefined
@@ -123,7 +123,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
// Copied from https://github.com/vitejs/vite/blob/4e9bdd4fb3654a9d43917e1cb682d3d2bad25115/packages/vite/src/node/config.ts#L477-L494
const resolvedRoot = normalizePath(
- userConfig.root ? path.resolve(userConfig.root) : process.cwd()
+ userConfig.root ? path.resolve(userConfig.root) : process.cwd(),
)
const envDir = userConfig.envDir
? normalizePath(path.resolve(resolvedRoot, userConfig.envDir))
@@ -138,12 +138,12 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
return {
esbuild: {
logOverride: {
- 'this-is-undefined-in-esm': 'silent'
+ 'this-is-undefined-in-esm': 'silent',
},
jsx: 'transform',
jsxImportSource: opts.jsxImportSource,
- jsxSideEffects: opts.jsxPure === false
- }
+ jsxSideEffects: opts.jsxPure === false,
+ },
}
} else {
return {
@@ -151,8 +151,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
jsxDev: !isProduction,
jsx: 'automatic',
jsxImportSource: opts.jsxImportSource,
- jsxSideEffects: opts.jsxPure === false
- }
+ jsxSideEffects: opts.jsxPure === false,
+ },
}
}
},
@@ -160,7 +160,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
devBase = config.base
projectRoot = config.root
filter = createFilter(opts.include, opts.exclude, {
- resolve: projectRoot
+ resolve: projectRoot,
})
needHiresSourcemap =
config.command === 'build' && !!config.build.sourcemap
@@ -172,7 +172,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
skipReactImport = true
config.logger.warn(
'[@vitejs/plugin-react] This plugin imports React for you automatically,' +
- ' so you can stop using `esbuild.jsxInject` for that purpose.'
+ ' so you can stop using `esbuild.jsxInject` for that purpose.',
)
}
@@ -184,7 +184,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
if (hasConflict)
return config.logger.warn(
`[@vitejs/plugin-react] You should stop using "${plugin.name}" ` +
- `since this plugin conflicts with it.`
+ `since this plugin conflicts with it.`,
)
})
@@ -240,7 +240,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
useFastRefresh = true
plugins.push([
await loadPlugin('react-refresh/babel'),
- { skipEnvCheck: true }
+ { skipEnvCheck: true },
])
}
}
@@ -253,7 +253,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
if (!isProduction) {
plugins.push(
await loadPlugin('@babel/plugin-transform-react-jsx-self'),
- await loadPlugin('@babel/plugin-transform-react-jsx-source')
+ await loadPlugin('@babel/plugin-transform-react-jsx-source'),
)
}
@@ -290,7 +290,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
if (shouldSkip) {
return {
code,
- map: inputMap ?? null
+ map: inputMap ?? null,
}
}
@@ -303,7 +303,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
'topLevelAwait',
'classProperties',
'classPrivateProperties',
- 'classPrivateMethods'
+ 'classPrivateMethods',
]
if (!extension.endsWith('.ts')) {
@@ -329,16 +329,16 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
...babelOptions.parserOpts,
sourceType: 'module',
allowAwaitOutsideFunction: true,
- plugins: parserPlugins
+ plugins: parserPlugins,
},
generatorOpts: {
...babelOptions.generatorOpts,
- decoratorsBeforeExport: true
+ decoratorsBeforeExport: true,
},
plugins,
sourceMaps: true,
// Vite handles sourcemap flattening
- inputSourceMap: inputMap ?? (false as any)
+ inputSourceMap: inputMap ?? (false as any),
})
if (result) {
@@ -349,11 +349,11 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
}
return {
code,
- map: result.map
+ map: result.map,
}
}
}
- }
+ },
}
const viteReactRefresh: Plugin = {
@@ -361,8 +361,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
enforce: 'pre',
config: () => ({
resolve: {
- dedupe: ['react', 'react-dom']
- }
+ dedupe: ['react', 'react-dom'],
+ },
}),
resolveId(id) {
if (id === runtimePublicPath) {
@@ -380,10 +380,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
{
tag: 'script',
attrs: { type: 'module' },
- children: preambleCode.replace(`__BASE__`, devBase)
- }
+ children: preambleCode.replace(`__BASE__`, devBase),
+ },
]
- }
+ },
}
const reactJsxRuntimeId = 'react/jsx-runtime'
@@ -400,8 +400,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
// We can't add `react-dom` because the dependency is `react-dom/client`
// for React 18 while it's `react-dom` for React 17. We'd need to detect
// what React version the user has installed.
- include: [reactJsxRuntimeId, reactJsxDevRuntimeId, 'react']
- }
+ include: [reactJsxRuntimeId, reactJsxDevRuntimeId, 'react'],
+ },
}
},
resolveId(id, importer) {
@@ -425,17 +425,17 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
`import * as jsxRuntime from ${JSON.stringify(reactJsxRuntimeId)}`,
`export const Fragment = jsxRuntime.Fragment`,
`export const jsx = jsxRuntime.jsx`,
- `export const jsxs = jsxRuntime.jsxs`
+ `export const jsxs = jsxRuntime.jsxs`,
].join('\n')
}
if (id === virtualReactJsxDevRuntimeId) {
return [
`import * as jsxRuntime from ${JSON.stringify(reactJsxDevRuntimeId)}`,
`export const Fragment = jsxRuntime.Fragment`,
- `export const jsxDEV = jsxRuntime.jsxDEV`
+ `export const jsxDEV = jsxRuntime.jsxDEV`,
].join('\n')
}
- }
+ },
}
return [viteBabel, viteReactRefresh, useAutomaticRuntime && viteReactJsx]
@@ -451,7 +451,7 @@ function createBabelOptions(rawOptions?: BabelOptions) {
const babelOptions = {
babelrc: false,
configFile: false,
- ...rawOptions
+ ...rawOptions,
} as ReactBabelOptions
babelOptions.plugins ||= []
diff --git a/playground/react-classic/__tests__/react.spec.ts b/playground/react-classic/__tests__/react.spec.ts
index 15f6319..e40aa8c 100644
--- a/playground/react-classic/__tests__/react.spec.ts
+++ b/playground/react-classic/__tests__/react.spec.ts
@@ -24,7 +24,7 @@ test.runIf(isServe)(
const meta = await page.evaluate(() => {
const button = document.querySelector('button')
const key = Object.keys(button).find(
- (key) => key.indexOf('__reactFiber') === 0
+ (key) => key.indexOf('__reactFiber') === 0,
)
return button[key]._debugSource
})
@@ -33,7 +33,7 @@ test.runIf(isServe)(
expect(Object.keys(meta).sort()).toEqual([
'columnNumber',
'fileName',
- 'lineNumber'
+ 'lineNumber',
])
- }
+ },
)
diff --git a/playground/react-classic/index.html b/playground/react-classic/index.html
index f0015ce..7417c44 100644
--- a/playground/react-classic/index.html
+++ b/playground/react-classic/index.html
@@ -5,6 +5,6 @@
import App from './App.jsx'
ReactDOM.createRoot(document.getElementById('app')).render(
- React.createElement(App)
+ React.createElement(App),
)
diff --git a/playground/react-classic/vite.config.ts b/playground/react-classic/vite.config.ts
index a2044e9..44f9744 100644
--- a/playground/react-classic/vite.config.ts
+++ b/playground/react-classic/vite.config.ts
@@ -4,13 +4,13 @@ import type { UserConfig } from 'vite'
const config: UserConfig = {
plugins: [
react({
- jsxRuntime: 'classic'
- })
+ jsxRuntime: 'classic',
+ }),
],
build: {
// to make tests faster
- minify: false
- }
+ minify: false,
+ },
}
export default config
diff --git a/playground/react-emotion/__tests__/react.spec.ts b/playground/react-emotion/__tests__/react.spec.ts
index d326a4a..f4625da 100644
--- a/playground/react-emotion/__tests__/react.spec.ts
+++ b/playground/react-emotion/__tests__/react.spec.ts
@@ -3,7 +3,7 @@ import { editFile, page, untilUpdated } from '~utils'
test('should render', async () => {
expect(await page.textContent('h1')).toMatch(
- 'Hello Vite + React + @emotion/react'
+ 'Hello Vite + React + @emotion/react',
)
})
@@ -15,7 +15,7 @@ test('should update', async () => {
test('should hmr', async () => {
editFile('App.jsx', (code) =>
- code.replace('Vite + React + @emotion/react', 'Updated')
+ code.replace('Vite + React + @emotion/react', 'Updated'),
)
await untilUpdated(() => page.textContent('h1'), 'Hello Updated')
// preserve state
@@ -36,7 +36,7 @@ test('should update button style', async () => {
expect(await getButtonBorderStyle()).toMatch('2px solid rgb(0, 0, 0)')
editFile('App.jsx', (code) =>
- code.replace('border: 2px solid #000', 'border: 4px solid red')
+ code.replace('border: 2px solid #000', 'border: 4px solid red'),
)
await untilUpdated(getButtonBorderStyle, '4px solid rgb(255, 0, 0)')
diff --git a/playground/react-emotion/index.html b/playground/react-emotion/index.html
index f0015ce..7417c44 100644
--- a/playground/react-emotion/index.html
+++ b/playground/react-emotion/index.html
@@ -5,6 +5,6 @@
import App from './App.jsx'
ReactDOM.createRoot(document.getElementById('app')).render(
- React.createElement(App)
+ React.createElement(App),
)
diff --git a/playground/react-emotion/vite.config.ts b/playground/react-emotion/vite.config.ts
index 197e04f..3d688fd 100644
--- a/playground/react-emotion/vite.config.ts
+++ b/playground/react-emotion/vite.config.ts
@@ -6,13 +6,13 @@ export default defineConfig({
react({
jsxImportSource: '@emotion/react',
babel: {
- plugins: ['@emotion/babel-plugin']
- }
- })
+ plugins: ['@emotion/babel-plugin'],
+ },
+ }),
],
clearScreen: false,
build: {
// to make tests faster
- minify: false
- }
+ minify: false,
+ },
})
diff --git a/playground/react-env/index.html b/playground/react-env/index.html
index f0015ce..7417c44 100644
--- a/playground/react-env/index.html
+++ b/playground/react-env/index.html
@@ -5,6 +5,6 @@
import App from './App.jsx'
ReactDOM.createRoot(document.getElementById('app')).render(
- React.createElement(App)
+ React.createElement(App),
)
diff --git a/playground/react-env/vite.config.ts b/playground/react-env/vite.config.ts
index 4c1003b..5574698 100644
--- a/playground/react-env/vite.config.ts
+++ b/playground/react-env/vite.config.ts
@@ -9,8 +9,8 @@ const config: UserConfig = {
mode: 'staging',
build: {
// to make tests faster
- minify: false
- }
+ minify: false,
+ },
}
export default config
diff --git a/playground/react-sourcemap/main.jsx b/playground/react-sourcemap/main.jsx
index 705d334..b53aa95 100644
--- a/playground/react-sourcemap/main.jsx
+++ b/playground/react-sourcemap/main.jsx
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client'
import App from './App.jsx'
ReactDOM.createRoot(document.getElementById('app')).render(
- React.createElement(App)
+ React.createElement(App),
)
console.log('main.jsx') // for sourcemap
diff --git a/playground/react-sourcemap/vite.config.ts b/playground/react-sourcemap/vite.config.ts
index d8a2cc4..afe6ecc 100644
--- a/playground/react-sourcemap/vite.config.ts
+++ b/playground/react-sourcemap/vite.config.ts
@@ -4,12 +4,12 @@ import type { UserConfig } from 'vite'
const config: UserConfig = {
plugins: [
react({
- jsxRuntime: process.env.USE_CLASSIC === '1' ? 'classic' : 'automatic'
- })
+ jsxRuntime: process.env.USE_CLASSIC === '1' ? 'classic' : 'automatic',
+ }),
],
build: {
- sourcemap: true
- }
+ sourcemap: true,
+ },
}
export default config
diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts
index 26eb59b..58057b7 100644
--- a/playground/react/__tests__/react.spec.ts
+++ b/playground/react/__tests__/react.spec.ts
@@ -5,7 +5,7 @@ import {
isServe,
page,
untilBrowserLogAfter,
- untilUpdated
+ untilUpdated,
} from '~utils'
test('should render', async () => {
@@ -31,7 +31,7 @@ test.runIf(isServe)(
const meta = await page.evaluate(() => {
const button = document.querySelector('#state-button')
const key = Object.keys(button).find(
- (key) => key.indexOf('__reactFiber') === 0
+ (key) => key.indexOf('__reactFiber') === 0,
)
return button[key]._debugSource
})
@@ -40,9 +40,9 @@ test.runIf(isServe)(
expect(Object.keys(meta).sort()).toEqual([
'columnNumber',
'fileName',
- 'lineNumber'
+ 'lineNumber',
])
- }
+ },
)
if (!isBuild) {
@@ -51,15 +51,15 @@ if (!isBuild) {
await untilBrowserLogAfter(
() =>
editFile('hmr/no-exported-comp.jsx', (code) =>
- code.replace('An Object', 'Updated')
+ code.replace('An Object', 'Updated'),
),
[
'[vite] invalidate /hmr/no-exported-comp.jsx',
'[vite] hot updated: /hmr/no-exported-comp.jsx',
'[vite] hot updated: /hmr/parent.jsx',
- 'Parent rendered'
+ 'Parent rendered',
],
- true
+ true,
)
await untilUpdated(() => page.textContent('#parent'), 'Updated')
})
@@ -67,30 +67,30 @@ if (!isBuild) {
// #3301
test('should hmr react context', async () => {
expect(await page.textContent('#context-button')).toMatch(
- 'context-based count is: 0'
+ 'context-based count is: 0',
)
await page.click('#context-button')
expect(await page.textContent('#context-button')).toMatch(
- 'context-based count is: 1'
+ 'context-based count is: 1',
)
await untilBrowserLogAfter(
() =>
editFile('context/CountProvider.jsx', (code) =>
- code.replace('context provider', 'context provider updated')
+ code.replace('context provider', 'context provider updated'),
),
[
'[vite] invalidate /context/CountProvider.jsx',
'[vite] hot updated: /context/CountProvider.jsx',
'[vite] hot updated: /App.jsx',
'[vite] hot updated: /context/ContextButton.jsx',
- 'Parent rendered'
+ 'Parent rendered',
],
- true
+ true,
)
await untilUpdated(
() => page.textContent('#context-provider'),
- 'context provider updated'
+ 'context provider updated',
)
})
}
diff --git a/playground/react/hmr/no-exported-comp.jsx b/playground/react/hmr/no-exported-comp.jsx
index 7784bcb..6954fc9 100644
--- a/playground/react/hmr/no-exported-comp.jsx
+++ b/playground/react/hmr/no-exported-comp.jsx
@@ -3,5 +3,5 @@
const Unused = () => An unused react component
export const Foo = {
- is: 'An Object'
+ is: 'An Object',
}
diff --git a/playground/react/index.html b/playground/react/index.html
index f0015ce..7417c44 100644
--- a/playground/react/index.html
+++ b/playground/react/index.html
@@ -5,6 +5,6 @@
import App from './App.jsx'
ReactDOM.createRoot(document.getElementById('app')).render(
- React.createElement(App)
+ React.createElement(App),
)
diff --git a/playground/react/vite.config.ts b/playground/react/vite.config.ts
index cd4aaee..2f4a9f1 100644
--- a/playground/react/vite.config.ts
+++ b/playground/react/vite.config.ts
@@ -6,8 +6,8 @@ const config: UserConfig = {
plugins: [react()],
build: {
// to make tests faster
- minify: false
- }
+ minify: false,
+ },
}
export default config
diff --git a/playground/ssr-react/__tests__/serve.ts b/playground/ssr-react/__tests__/serve.ts
index df23d4f..4f117fb 100644
--- a/playground/ssr-react/__tests__/serve.ts
+++ b/playground/ssr-react/__tests__/serve.ts
@@ -19,8 +19,8 @@ export async function serve(): Promise<{ close(): Promise }> {
target: 'esnext',
minify: false,
ssrManifest: true,
- outDir: 'dist/client'
- }
+ outDir: 'dist/client',
+ },
})
// server build
await build({
@@ -32,10 +32,10 @@ export async function serve(): Promise<{ close(): Promise }> {
outDir: 'dist/server',
rollupOptions: {
output: {
- entryFileNames: 'entry-server.js'
- }
- }
- }
+ entryFileNames: 'entry-server.js',
+ },
+ },
+ },
})
}
@@ -45,7 +45,7 @@ export async function serve(): Promise<{ close(): Promise }> {
const { app, vite } = await createServer(
rootDir,
isBuild,
- hmrPorts['ssr-react']
+ hmrPorts['ssr-react'],
)
return new Promise((resolve, reject) => {
@@ -60,7 +60,7 @@ export async function serve(): Promise<{ close(): Promise }> {
if (vite) {
await vite.close()
}
- }
+ },
})
})
} catch (e) {
diff --git a/playground/ssr-react/__tests__/ssr-react.spec.ts b/playground/ssr-react/__tests__/ssr-react.spec.ts
index 111a52a..abea451 100644
--- a/playground/ssr-react/__tests__/ssr-react.spec.ts
+++ b/playground/ssr-react/__tests__/ssr-react.spec.ts
@@ -6,7 +6,7 @@ import {
editFile,
page,
untilBrowserLogAfter,
- untilUpdated
+ untilUpdated,
} from '~utils'
const url = `http://localhost:${port}`
@@ -52,7 +52,7 @@ test('/', async () => {
test('hmr', async () => {
await page.goto(url)
editFile('src/pages/Home.jsx', (code) =>
- code.replace('Home', 'changed')
+ code.replace('Home', 'changed'),
)
await untilUpdated(() => page.textContent('h1'), 'changed')
})
@@ -64,7 +64,7 @@ test('client navigation', async () => {
await page.click('a[href="/about"]')
await untilUpdated(() => page.textContent('h1'), 'About')
editFile('src/pages/About.jsx', (code) =>
- code.replace('About', 'changed')
+ code.replace('About', 'changed'),
)
await untilUpdated(() => page.textContent('h1'), 'changed')
})
@@ -72,6 +72,6 @@ test('client navigation', async () => {
test(`circular dependencies modules doesn't throw`, async () => {
await page.goto(url)
expect(await page.textContent('.circ-dep-init')).toMatch(
- 'circ-dep-init-a circ-dep-init-b'
+ 'circ-dep-init-a circ-dep-init-b',
)
})
diff --git a/playground/ssr-react/server.js b/playground/ssr-react/server.js
index 2f87809..7015917 100644
--- a/playground/ssr-react/server.js
+++ b/playground/ssr-react/server.js
@@ -12,7 +12,7 @@ process.env.MY_CUSTOM_SECRET = 'API_KEY_qwertyuiop'
export async function createServer(
root = process.cwd(),
isProd = process.env.NODE_ENV === 'production',
- hmrPort
+ hmrPort,
) {
const resolve = (p) => path.resolve(__dirname, p)
@@ -38,13 +38,13 @@ export async function createServer(
// During tests we edit the files too fast and sometimes chokidar
// misses change events, so enforce polling for consistency
usePolling: true,
- interval: 100
+ interval: 100,
},
hmr: {
- port: hmrPort
- }
+ port: hmrPort,
+ },
},
- appType: 'custom'
+ appType: 'custom',
})
// use vite's connect instance as middleware
app.use(vite.middlewares)
@@ -52,8 +52,8 @@ export async function createServer(
app.use((await import('compression')).default())
app.use(
(await import('serve-static')).default(resolve('dist/client'), {
- index: false
- })
+ index: false,
+ }),
)
}
@@ -98,6 +98,6 @@ if (!isTest) {
createServer().then(({ app }) =>
app.listen(5173, () => {
console.log('http://localhost:5173')
- })
+ }),
)
}
diff --git a/playground/ssr-react/src/App.jsx b/playground/ssr-react/src/App.jsx
index 6be6af9..2fc9ece 100644
--- a/playground/ssr-react/src/App.jsx
+++ b/playground/ssr-react/src/App.jsx
@@ -9,7 +9,7 @@ const routes = Object.keys(pages).map((path) => {
return {
name,
path: name === 'Home' ? '/' : `/${name.toLowerCase()}`,
- component: pages[path].default
+ component: pages[path].default,
}
})
diff --git a/playground/ssr-react/src/entry-client.jsx b/playground/ssr-react/src/entry-client.jsx
index 7031994..83e04a0 100644
--- a/playground/ssr-react/src/entry-client.jsx
+++ b/playground/ssr-react/src/entry-client.jsx
@@ -6,6 +6,6 @@ ReactDOM.hydrateRoot(
document.getElementById('app'),
-
+ ,
)
console.log('hydrated')
diff --git a/playground/ssr-react/src/entry-server.jsx b/playground/ssr-react/src/entry-server.jsx
index ea1b86a..925fae6 100644
--- a/playground/ssr-react/src/entry-server.jsx
+++ b/playground/ssr-react/src/entry-server.jsx
@@ -6,6 +6,6 @@ export function render(url, context) {
return ReactDOMServer.renderToString(
-
+ ,
)
}
diff --git a/playground/ssr-react/vite.config.js b/playground/ssr-react/vite.config.js
index 676c52a..266400b 100644
--- a/playground/ssr-react/vite.config.js
+++ b/playground/ssr-react/vite.config.js
@@ -4,6 +4,6 @@ import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
build: {
- minify: false
- }
+ minify: false,
+ },
})
diff --git a/playground/test-utils.ts b/playground/test-utils.ts
index a1bb4ad..061ba44 100644
--- a/playground/test-utils.ts
+++ b/playground/test-utils.ts
@@ -31,7 +31,7 @@ export const ports = {
'ssr-webworker': 9606,
'css/postcss-caching': 5005,
'css/postcss-plugins-different-dir': 5006,
- 'css/dynamic-import': 5007
+ 'css/dynamic-import': 5007,
}
export const hmrPorts = {
'optimize-missing-deps': 24680,
@@ -40,7 +40,7 @@ export const hmrPorts = {
'ssr-noexternal': 24683,
'ssr-pug': 24684,
'ssr-react': 24685,
- 'ssr-vue': 24686
+ 'ssr-vue': 24686,
}
const hexToNameMap: Record = {}
@@ -100,7 +100,7 @@ export function readFile(filename: string): string {
export function editFile(
filename: string,
replacer: (str: string) => string,
- runInBuild: boolean = false
+ runInBuild: boolean = false,
): void {
if (isBuild && !runInBuild) return
filename = path.resolve(testDir, filename)
@@ -125,7 +125,7 @@ export function listAssets(base = ''): string[] {
export function findAssetFile(
match: string | RegExp,
base = '',
- assets = 'assets'
+ assets = 'assets',
): string {
const assetsDir = path.join(testDir, 'dist', base, assets)
let files: string[]
@@ -145,7 +145,7 @@ export function findAssetFile(
export function readManifest(base = ''): Manifest {
return JSON.parse(
- fs.readFileSync(path.join(testDir, 'dist', base, 'manifest.json'), 'utf-8')
+ fs.readFileSync(path.join(testDir, 'dist', base, 'manifest.json'), 'utf-8'),
)
}
@@ -155,7 +155,7 @@ export function readManifest(base = ''): Manifest {
export async function untilUpdated(
poll: () => string | Promise,
expected: string,
- runInBuild = false
+ runInBuild = false,
): Promise {
if (isBuild && !runInBuild) return
const maxTries = process.env.CI ? 200 : 50
@@ -175,7 +175,7 @@ export async function untilUpdated(
*/
export async function withRetry(
func: () => Promise,
- runInBuild = false
+ runInBuild = false,
): Promise {
if (isBuild && !runInBuild) return
const maxTries = process.env.CI ? 200 : 50
@@ -195,18 +195,18 @@ export async function untilBrowserLogAfter(
operation: () => any,
target: string | RegExp | Array,
expectOrder?: boolean,
- callback?: UntilBrowserLogAfterCallback
+ callback?: UntilBrowserLogAfterCallback,
): Promise
export async function untilBrowserLogAfter(
operation: () => any,
target: string | RegExp | Array,
- callback?: UntilBrowserLogAfterCallback
+ callback?: UntilBrowserLogAfterCallback,
): Promise
export async function untilBrowserLogAfter(
operation: () => any,
target: string | RegExp | Array,
arg3?: boolean | UntilBrowserLogAfterCallback,
- arg4?: UntilBrowserLogAfterCallback
+ arg4?: UntilBrowserLogAfterCallback,
): Promise {
const expectOrder = typeof arg3 === 'boolean' ? arg3 : false
const callback = typeof arg3 === 'boolean' ? arg4 : arg3
@@ -222,7 +222,7 @@ export async function untilBrowserLogAfter(
async function untilBrowserLog(
target?: string | RegExp | Array,
- expectOrder = true
+ expectOrder = true,
): Promise {
let resolve: () => void
let reject: (reason: any) => void
@@ -253,7 +253,7 @@ async function untilBrowserLog(
const remainingMatchers = target.map(isMatch)
processMsg = (text: string) => {
const nextIndex = remainingMatchers.findIndex((matcher) =>
- matcher(text)
+ matcher(text),
)
if (nextIndex >= 0) {
remainingMatchers.splice(nextIndex, 1)
@@ -304,7 +304,7 @@ export const formatSourcemapForSnapshot = (map: any): any => {
// helper function to kill process, uses taskkill on windows to ensure child process is killed too
export async function killProcess(
- serverProcess: ExecaChildProcess
+ serverProcess: ExecaChildProcess,
): Promise {
if (isWindows) {
try {
diff --git a/playground/vitestGlobalSetup.ts b/playground/vitestGlobalSetup.ts
index 69430aa..7a63d6d 100644
--- a/playground/vitestGlobalSetup.ts
+++ b/playground/vitestGlobalSetup.ts
@@ -17,7 +17,7 @@ export async function setup(): Promise {
headless: !process.env.VITE_DEBUG_SERVE,
args: process.env.CI
? ['--no-sandbox', '--disable-setuid-sandbox']
- : undefined
+ : undefined,
})
await fs.mkdirp(DIR)
@@ -32,12 +32,12 @@ export async function setup(): Promise {
filter(file) {
file = file.replace(/\\/g, '/')
return !file.includes('__tests__') && !file.match(/dist(\/|$)/)
- }
+ },
})
.catch(async (error) => {
if (error.code === 'EPERM' && error.syscall === 'symlink') {
throw new Error(
- 'Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.'
+ 'Could not create symlinks. On Windows, consider activating Developer Mode to allow non-admin users to create symlinks by following the instructions at https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development.',
)
} else {
throw error
diff --git a/playground/vitestSetup.ts b/playground/vitestSetup.ts
index 712bb4b..94a7142 100644
--- a/playground/vitestSetup.ts
+++ b/playground/vitestSetup.ts
@@ -9,14 +9,14 @@ import type {
PluginOption,
ResolvedConfig,
UserConfig,
- ViteDevServer
+ ViteDevServer,
} from 'vite'
import {
build,
createServer,
loadConfigFromFile,
mergeConfig,
- preview
+ preview,
} from 'vite'
import type { Browser, Page } from 'playwright-chromium'
import type { RollupError, RollupWatcher, RollupWatcherEvent } from 'rollup'
@@ -147,7 +147,7 @@ beforeAll(async (s) => {
const testCustomServe = [
resolve(dirname(testPath), 'serve.ts'),
- resolve(dirname(testPath), 'serve.js')
+ resolve(dirname(testPath), 'serve.js'),
].find((i) => fs.existsSync(i))
if (testCustomServe) {
@@ -192,10 +192,10 @@ function loadConfigFromDir(dir: string) {
return loadConfigFromFile(
{
command: isBuild ? 'build' : 'serve',
- mode: isBuild ? 'production' : 'development'
+ mode: isBuild ? 'production' : 'development',
},
undefined,
- dir
+ dir,
)
}
@@ -223,21 +223,21 @@ export async function startDefaultServe(): Promise {
// During tests we edit the files too fast and sometimes chokidar
// misses change events, so enforce polling for consistency
usePolling: true,
- interval: 100
+ interval: 100,
},
host: true,
fs: {
- strict: !isBuild
- }
+ strict: !isBuild,
+ },
},
build: {
// esbuild do not minify ES lib output since that would remove pure annotations and break tree-shaking
// skip transpilation during tests to make it faster
target: 'esnext',
// tests are flaky when `emptyOutDir` is `true`
- emptyOutDir: false
+ emptyOutDir: false,
},
- customLogger: createInMemoryLogger(serverLogs)
+ customLogger: createInMemoryLogger(serverLogs),
}
setupConsoleWarnCollector(serverLogs)
@@ -260,7 +260,7 @@ export async function startDefaultServe(): Promise {
name: 'vite-plugin-watcher',
configResolved(config) {
resolvedConfig = config
- }
+ },
})
options.plugins = [resolvedPlugin()]
const testConfig = mergeConfig(options, config || {})
@@ -290,7 +290,7 @@ export async function startDefaultServe(): Promise {
* Send the rebuild complete message in build watch
*/
export async function notifyRebuildComplete(
- watcher: RollupWatcher
+ watcher: RollupWatcher,
): Promise {
let resolveFn: undefined | (() => void)
const callback = (event: RollupWatcherEvent): void => {
@@ -331,7 +331,7 @@ function createInMemoryLogger(logs: string[]): Logger {
if (opts?.error) {
loggedErrors.add(opts.error)
}
- }
+ },
}
return logger
diff --git a/scripts/publishCI.ts b/scripts/publishCI.ts
index 66dd6e3..b1627cd 100644
--- a/scripts/publishCI.ts
+++ b/scripts/publishCI.ts
@@ -4,7 +4,7 @@ import {
getActiveVersion,
getPackageInfo,
publishPackage,
- step
+ step,
} from './releaseUtils'
async function main() {
@@ -25,7 +25,7 @@ async function main() {
const { currentVersion, pkgDir } = getPackageInfo(pkgName)
if (currentVersion !== version)
throw new Error(
- `Package version from tag "${version}" mismatches with current version "${currentVersion}"`
+ `Package version from tag "${version}" mismatches with current version "${currentVersion}"`,
)
const activeVersion = await getActiveVersion(pkgName)
diff --git a/scripts/release.ts b/scripts/release.ts
index 36d9b22..b17f328 100644
--- a/scripts/release.ts
+++ b/scripts/release.ts
@@ -12,7 +12,7 @@ import {
runIfNotDry,
step,
updateTemplateVersions,
- updateVersion
+ updateVersion,
} from './releaseUtils'
async function main(): Promise {
@@ -22,7 +22,7 @@ async function main(): Promise {
type: 'select',
name: 'pkg',
message: 'Select package',
- choices: packages.map((i) => ({ value: i, title: i }))
+ choices: packages.map((i) => ({ value: i, title: i })),
})
if (!pkg) return
@@ -36,7 +36,7 @@ async function main(): Promise {
type: 'select',
name: 'release',
message: 'Select release type',
- choices: getVersionChoices(currentVersion)
+ choices: getVersionChoices(currentVersion),
})
if (release === 'custom') {
@@ -44,7 +44,7 @@ async function main(): Promise {
type: 'text',
name: 'version',
message: 'Input custom version',
- initial: currentVersion
+ initial: currentVersion,
})
targetVersion = res.version
} else {
@@ -69,7 +69,7 @@ async function main(): Promise {
const { yes }: { yes: boolean } = await prompts({
type: 'confirm',
name: 'yes',
- message: `Releasing ${colors.yellow(tag)} Confirm?`
+ message: `Releasing ${colors.yellow(tag)} Confirm?`,
})
if (!yes) {
@@ -89,7 +89,7 @@ async function main(): Promise {
'CHANGELOG.md',
'-s',
'--commit-path',
- '.'
+ '.',
]
if (pkgName !== 'vite') changelogArgs.push('--lerna-package', pkgName)
await run('npx', changelogArgs, { cwd: pkgDir })
@@ -114,8 +114,8 @@ async function main(): Promise {
} else {
console.log(
colors.green(
- '\nPushed, publishing should starts shortly on CI.\nhttps://github.com/vitejs/vite/actions/workflows/publish.yml'
- )
+ '\nPushed, publishing should starts shortly on CI.\nhttps://github.com/vitejs/vite/actions/workflows/publish.yml',
+ ),
)
}
diff --git a/scripts/releaseUtils.ts b/scripts/releaseUtils.ts
index 5bf32e5..3cc8ec6 100644
--- a/scripts/releaseUtils.ts
+++ b/scripts/releaseUtils.ts
@@ -25,7 +25,7 @@ export const packages = ['plugin-react']
export const versionIncrements: ReleaseType[] = [
'patch',
'minor',
- 'major'
+ 'major',
// 'prepatch',
// 'preminor',
// 'premajor',
@@ -63,14 +63,14 @@ export function getPackageInfo(pkgName: string): {
pkgName,
pkgDir,
pkgPath,
- currentVersion
+ currentVersion,
}
}
export async function run(
bin: string,
args: string[],
- opts: ExecaOptions = {}
+ opts: ExecaOptions = {},
): Promise> {
return execa(bin, args, { stdio: 'inherit', ...opts })
}
@@ -78,11 +78,11 @@ export async function run(
export async function dryRun(
bin: string,
args: string[],
- opts?: ExecaOptions
+ opts?: ExecaOptions,
): Promise {
return console.log(
colors.blue(`[dryrun] ${bin} ${args.join(' ')}`),
- opts || ''
+ opts || '',
)
}
@@ -108,46 +108,46 @@ export function getVersionChoices(currentVersion: string): VersionChoice[] {
let versionChoices: VersionChoice[] = [
{
title: 'next',
- value: inc(isStable ? 'patch' : 'prerelease')
- }
+ value: inc(isStable ? 'patch' : 'prerelease'),
+ },
]
if (isStable) {
versionChoices.push(
{
title: 'beta-minor',
- value: inc('preminor')
+ value: inc('preminor'),
},
{
title: 'beta-major',
- value: inc('premajor')
+ value: inc('premajor'),
},
{
title: 'alpha-minor',
- value: inc('preminor', 'alpha')
+ value: inc('preminor', 'alpha'),
},
{
title: 'alpha-major',
- value: inc('premajor', 'alpha')
+ value: inc('premajor', 'alpha'),
},
{
title: 'minor',
- value: inc('minor')
+ value: inc('minor'),
},
{
title: 'major',
- value: inc('major')
- }
+ value: inc('major'),
+ },
)
} else if (currentAlpha) {
versionChoices.push({
title: 'beta',
- value: inc('patch') + '-beta.0'
+ value: inc('patch') + '-beta.0',
})
} else {
versionChoices.push({
title: 'stable',
- value: inc('patch')
+ value: inc('patch'),
})
}
versionChoices.push({ value: 'custom', title: 'custom' })
@@ -168,14 +168,14 @@ export function updateVersion(pkgPath: string, version: string): void {
export async function publishPackage(
pkdDir: string,
- tag?: string
+ tag?: string,
): Promise {
const publicArgs = ['publish', '--access', 'public']
if (tag) {
publicArgs.push(`--tag`, tag)
}
await runIfNotDry('npm', publicArgs, {
- cwd: pkdDir
+ cwd: pkdDir,
})
}
@@ -203,14 +203,14 @@ export async function logRecentCommits(pkgName: string): Promise {
const tag = await getLatestTag(pkgName)
if (!tag) return
const sha = await run('git', ['rev-list', '-n', '1', tag], {
- stdio: 'pipe'
+ stdio: 'pipe',
}).then((res) => res.stdout.trim())
console.log(
colors.bold(
`\n${colors.blue(`i`)} Commits of ${colors.green(
- pkgName
- )} since ${colors.green(tag)} ${colors.gray(`(${sha.slice(0, 5)})`)}`
- )
+ pkgName,
+ )} since ${colors.green(tag)} ${colors.gray(`(${sha.slice(0, 5)})`)}`,
+ ),
)
await run(
'git',
@@ -220,9 +220,9 @@ export async function logRecentCommits(pkgName: string): Promise {
`${sha}..HEAD`,
'--oneline',
'--',
- `packages/${pkgName}`
+ `packages/${pkgName}`,
],
- { stdio: 'inherit' }
+ { stdio: 'inherit' },
)
console.log()
}
@@ -236,7 +236,7 @@ export async function updateTemplateVersions(): Promise {
const dir = path.resolve(__dirname, '../packages/create-vite')
const templates = readdirSync(dir).filter((dir) =>
- dir.startsWith('template-')
+ dir.startsWith('template-'),
)
for (const template of templates) {
const pkgPath = path.join(dir, template, `package.json`)
@@ -247,7 +247,7 @@ export async function updateTemplateVersions(): Promise {
`^` +
(
await fs.readJSON(
- path.resolve(__dirname, '../packages/plugin-vue/package.json')
+ path.resolve(__dirname, '../packages/plugin-vue/package.json'),
)
).version
}
@@ -256,7 +256,7 @@ export async function updateTemplateVersions(): Promise {
`^` +
(
await fs.readJSON(
- path.resolve(__dirname, '../packages/plugin-react/package.json')
+ path.resolve(__dirname, '../packages/plugin-react/package.json'),
)
).version
}
diff --git a/scripts/rollupLicensePlugin.mjs b/scripts/rollupLicensePlugin.mjs
index fedbd34..3d527af 100644
--- a/scripts/rollupLicensePlugin.mjs
+++ b/scripts/rollupLicensePlugin.mjs
@@ -18,7 +18,7 @@ function licensePlugin(licenseFilePath, licenseTitle, packageName) {
// https://github.com/rollup/rollup/blob/master/build-plugins/generate-license-file.js
// MIT Licensed https://github.com/rollup/rollup/blob/master/LICENSE-CORE.md
const coreLicense = fs.readFileSync(
- new URL('../LICENSE', import.meta.url)
+ new URL('../LICENSE', import.meta.url),
)
function sortLicenses(licenses) {
let withParenthesis = []
@@ -49,7 +49,7 @@ function licensePlugin(licenseFilePath, licenseTitle, packageName) {
author,
maintainers,
contributors,
- repository
+ repository,
}) => {
let text = `## ${name}\n`
if (license) {
@@ -74,11 +74,11 @@ function licensePlugin(licenseFilePath, licenseTitle, packageName) {
try {
const pkgDir = path.dirname(
resolve.sync(path.join(name, 'package.json'), {
- preserveSymlinks: false
- })
+ preserveSymlinks: false,
+ }),
)
const licenseFile = fg.sync(`${pkgDir}/LICENSE*`, {
- caseSensitiveMatch: false
+ caseSensitiveMatch: false,
})[0]
if (licenseFile) {
licenseText = fs.readFileSync(licenseFile, 'utf-8')
@@ -98,7 +98,7 @@ function licensePlugin(licenseFilePath, licenseTitle, packageName) {
}
licenses.add(license)
return text
- }
+ },
)
.join('\n---------------------------------------\n\n')
const licenseText =
@@ -115,11 +115,11 @@ function licensePlugin(licenseFilePath, licenseTitle, packageName) {
fs.writeFileSync(licenseFilePath, licenseText)
console.warn(
colors.yellow(
- '\nLICENSE.md updated. You should commit the updated file.\n'
- )
+ '\nLICENSE.md updated. You should commit the updated file.\n',
+ ),
)
}
- }
+ },
})
}
diff --git a/scripts/verifyCommit.ts b/scripts/verifyCommit.ts
index 92bf5c4..6a47d4c 100644
--- a/scripts/verifyCommit.ts
+++ b/scripts/verifyCommit.ts
@@ -15,14 +15,14 @@ if (!releaseRE.test(msg) && !commitRE.test(msg)) {
console.log()
console.error(
` ${colors.bgRed(colors.white(' ERROR '))} ${colors.red(
- `invalid commit message format.`
+ `invalid commit message format.`,
)}\n\n` +
colors.red(
- ` Proper commit message format is required for automated changelog generation. Examples:\n\n`
+ ` Proper commit message format is required for automated changelog generation. Examples:\n\n`,
) +
` ${colors.green(`feat: add 'comments' option`)}\n` +
` ${colors.green(`fix: handle events on blur (close #28)`)}\n\n` +
- colors.red(` See .github/commit-convention.md for more details.\n`)
+ colors.red(` See .github/commit-convention.md for more details.\n`),
)
process.exit(1)
}
diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts
index da47d97..fe47450 100644
--- a/vitest.config.e2e.ts
+++ b/vitest.config.e2e.ts
@@ -6,8 +6,8 @@ const timeout = process.env.CI ? 50000 : 30000
export default defineConfig({
resolve: {
alias: {
- '~utils': resolve(__dirname, './playground/test-utils')
- }
+ '~utils': resolve(__dirname, './playground/test-utils'),
+ },
},
test: {
include: ['./playground/**/*.spec.[tj]s'],
@@ -19,9 +19,9 @@ export default defineConfig({
onConsoleLog(log) {
if (log.match(/experimental|jit engine|emitted file|tailwind/i))
return false
- }
+ },
},
esbuild: {
- target: 'node14'
- }
+ target: 'node14',
+ },
})
diff --git a/vitest.config.ts b/vitest.config.ts
index 0a8f8c2..f86aad8 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -6,11 +6,11 @@ export default defineConfig({
'**/node_modules/**',
'**/dist/**',
'./playground/**/*.*',
- './playground-temp/**/*.*'
+ './playground-temp/**/*.*',
],
- testTimeout: 20000
+ testTimeout: 20000,
},
esbuild: {
- target: 'node14'
- }
+ target: 'node14',
+ },
})