Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Dec 6, 2022
2 parents 21d91ee + 014e4aa commit 73f4ba4
Show file tree
Hide file tree
Showing 751 changed files with 5,026 additions and 14,051 deletions.
97 changes: 51 additions & 46 deletions .eslintrc.cjs
Expand Up @@ -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' }],
Expand All @@ -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',
Expand All @@ -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
Expand All @@ -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',
Expand All @@ -96,56 +96,61 @@ 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: 'packages/vite/**/*.*',
rules: {
'node/no-restricted-require': [
'error',
Object.keys(
require('./packages/vite/package.json').devDependencies
require('./packages/vite/package.json').devDependencies,
).map((d) => ({
name: d,
message:
`devDependencies can only be imported using ESM syntax so ` +
`that they are included in the rollup bundle. If you are trying to ` +
`lazy load a dependency, use (await import('dependency')).default instead.`
}))
]
}
`lazy load a dependency, use (await import('dependency')).default instead.`,
})),
],
},
},
{
files: ['packages/vite/src/node/**'],
rules: {
'no-console': ['error']
}
'no-console': ['error'],
},
},
{
files: ['packages/vite/src/types/**', '*.spec.ts'],
rules: {
'node/no-extraneous-import': 'off'
}
'node/no-extraneous-import': 'off',
},
},
{
files: ['packages/create-vite/template-*/**', '**/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/**'],
Expand All @@ -158,17 +163,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/**'],
Expand All @@ -177,21 +182,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,
})
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
@@ -1,5 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Vite Plugin React Issues
url: https://github.com/vitejs/vite-plugin-react/issues/new/choose
about: React related issues should be reported on the vite-plugin-react repository.
- name: Vite Plugin Vue Issues
url: https://github.com/vitejs/vite-plugin-vue/issues/new/choose
about: Vue related issues should be reported on the vite-plugin-vue repository.
- name: Discord Chat
url: https://chat.vitejs.dev
about: Ask questions and discuss with other Vite users in real time.
Expand Down
8 changes: 4 additions & 4 deletions .github/renovate.json5
Expand Up @@ -8,8 +8,8 @@
"packageRules": [
{
"depTypeList": ["peerDependencies"],
"enabled": false
}
"enabled": false,
},
],
"ignoreDeps": [
// manually bumping
Expand All @@ -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
],
}
2 changes: 1 addition & 1 deletion .prettierrc.json
Expand Up @@ -3,7 +3,7 @@
"tabWidth": 2,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "none",
"trailingComma": "all",
"overrides": [
{
"files": ["*.json5"],
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Expand Up @@ -147,6 +147,8 @@ test('?raw import', async () => {

In many test cases, we need to mock dependencies using `link:` and `file:` protocols. `pnpm` treats `link:` as symlinks and `file:` as hardlinks. To test dependencies as if they were copied into `node_modules`, use the `file:` protocol. Otherwise, use the `link:` protocol.

For a mock dependency, make sure you add a `@vitejs/test-` prefix to the package name. This will avoid possible issues like false-positive alerts.

## Debug Logging

You can set the `DEBUG` environment variable to turn on debugging logs (e.g. `DEBUG="vite:resolve"`). To see all debug logs, you can set `DEBUG="vite:*"`, but be warned that it will be quite noisy. You can run `grep -r "createDebugger('vite:" packages/vite/src/` to see a list of available debug scopes.
Expand Down Expand Up @@ -220,7 +222,7 @@ Vite aims to be fully usable as a dependency in a TypeScript project (e.g. it sh

To get around this, we inline some of these dependencies' types in `packages/vite/src/types`. This way, we can still expose the typing but bundle the dependency's source code.

Use `pnpm run check-dist-types` to check that the bundled types do not rely on types in `devDependencies`. If you are adding `dependencies`, make sure to configure `tsconfig.check.json`.
Use `pnpm run build-types-check` to check that the bundled types do not rely on types in `devDependencies`.

For types shared between client and node, they should be added into `packages/vite/types`. These types are not bundled and are published as is (though they are still considered internal). Dependency types within this directory (e.g. `packages/vite/types/chokidar.d.ts`) are deprecated and should be added to `packages/vite/src/types` instead.

Expand Down
13 changes: 5 additions & 8 deletions README.md
Expand Up @@ -35,14 +35,11 @@ In addition, Vite is highly extensible via its [Plugin API](https://vitejs.dev/g

## Packages

| Package | Version (click for changelogs) |
| ------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------- |
| [vite](packages/vite) | [![vite version](https://img.shields.io/npm/v/vite.svg?label=%20)](packages/vite/CHANGELOG.md) |
| [@vitejs/plugin-vue](packages/plugin-vue) | [![plugin-vue version](https://img.shields.io/npm/v/@vitejs/plugin-vue.svg?label=%20)](packages/plugin-vue/CHANGELOG.md) |
| [@vitejs/plugin-vue-jsx](packages/plugin-vue-jsx) | [![plugin-vue-jsx version](https://img.shields.io/npm/v/@vitejs/plugin-vue-jsx.svg?label=%20)](packages/plugin-vue-jsx/CHANGELOG.md) |
| [@vitejs/plugin-react](packages/plugin-react) | [![plugin-react version](https://img.shields.io/npm/v/@vitejs/plugin-react.svg?label=%20)](packages/plugin-react/CHANGELOG.md) |
| [@vitejs/plugin-legacy](packages/plugin-legacy) | [![plugin-legacy version](https://img.shields.io/npm/v/@vitejs/plugin-legacy.svg?label=%20)](packages/plugin-legacy/CHANGELOG.md) |
| [create-vite](packages/create-vite) | [![create-vite version](https://img.shields.io/npm/v/create-vite.svg?label=%20)](packages/create-vite/CHANGELOG.md) |
| Package | Version (click for changelogs) |
| ----------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
| [vite](packages/vite) | [![vite version](https://img.shields.io/npm/v/vite.svg?label=%20)](packages/vite/CHANGELOG.md) |
| [@vitejs/plugin-legacy](packages/plugin-legacy) | [![plugin-legacy version](https://img.shields.io/npm/v/@vitejs/plugin-legacy.svg?label=%20)](packages/plugin-legacy/CHANGELOG.md) |
| [create-vite](packages/create-vite) | [![create-vite version](https://img.shields.io/npm/v/create-vite.svg?label=%20)](packages/create-vite/CHANGELOG.md) |

## Contribution

Expand Down

0 comments on commit 73f4ba4

Please sign in to comment.