Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Jul 19, 2023
2 parents fa750a5 + 6bd5434 commit da207d5
Show file tree
Hide file tree
Showing 66 changed files with 1,026 additions and 824 deletions.
12 changes: 11 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = defineConfig({
'eslint:recommended',
'plugin:n/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:regexp/recommended',
],
ignorePatterns: ['packages/create-vite/template-**'],
Expand Down Expand Up @@ -69,15 +70,24 @@ module.exports = defineConfig({
],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'off', // conflicts with prettier
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
// disable rules set in @typescript-eslint/stylistic v6 that wasn't set in @typescript-eslint/recommended v5 and which conflict with current code
// maybe we should turn them on in a new PR
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/ban-tslint-comment': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-function-type': 'off',

'import/no-nodejs-modules': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@54479c37f5eb47a43e595c6b71e1df2c112ce7f1 # v36.4.1
uses: tj-actions/changed-files@2a968ff601949c81b47d9c1fdb789b0d25ddeea2 # v37.1.2
with:
files: |
docs/**
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ And re-run `pnpm install` to link the package.

Each package under `playground/` contains a `__tests__` directory. The tests are run using [Vitest](https://vitest.dev/) + [Playwright](https://playwright.dev/) with custom integrations to make writing tests simple. The detailed setup is inside `vitest.config.e2e.js` and `playground/vitest*` files.

Some playgrounds define variants to run the same app using different config setups. By convention, when running a test spec file in a nested folder in `__tests__`, the setup will try to use a config file named `vite.config-{folderName}.js` at the playground's root. You can see an example of variants in the [assets playground](https://github.com/vitejs/vite/tree/main/playground/assets).

Before running the tests, make sure that [Vite has been built](#repo-setup). On Windows, you may want to [activate Developer Mode](https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development) to resolve [issues with symlink creation for non-admins](https://github.com/vitejs/vite/issues/7390). Also, you may want to [set git `core.symlinks` to `true` to resolve issues with symlinks in git](https://github.com/vitejs/vite/issues/5242).

Each integration test can be run under either dev server mode or build mode.
Expand Down
4 changes: 2 additions & 2 deletions docs/config/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The polyfill can be disabled using `{ polyfill: false }`.

The list of chunks to preload for each dynamic import is computed by Vite. By default, an absolute path including the `base` will be used when loading these dependencies. If the `base` is relative (`''` or `'./'`), `import.meta.url` is used at runtime to avoid absolute paths that depend on the final deployed base.

There is experimental support for fine grained control over the dependencies list and their paths using the `resolveDependencies` function. It expects a function of type `ResolveModulePreloadDependenciesFn`:
There is experimental support for fine grained control over the dependencies list and their paths using the `resolveDependencies` function. [Give Feedback](https://github.com/vitejs/vite/discussions/13841). It expects a function of type `ResolveModulePreloadDependenciesFn`:

```ts
type ResolveModulePreloadDependenciesFn = (
Expand Down Expand Up @@ -218,7 +218,7 @@ By default, Vite will empty the `outDir` on build if it is inside project root.
## build.copyPublicDir
- **Experimental**
- **Experimental:** [Give feedback](https://github.com/vitejs/vite/discussions/13807)
- **Type:** `boolean`
- **Default:** `true`
Expand Down
2 changes: 1 addition & 1 deletion docs/config/dep-optimization-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Set to `true` to force dependency pre-bundling, ignoring previously cached optim

## optimizeDeps.disabled

- **Experimental**
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/13839)
- **Type:** `boolean | 'build' | 'dev'`
- **Default:** `'build'`

Expand Down
6 changes: 3 additions & 3 deletions docs/config/shared-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,23 +260,23 @@ export default defineConfig({

## css.devSourcemap

- **Experimental**
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/13845)
- **Type:** `boolean`
- **Default:** `false`

Whether to enable sourcemaps during dev.

## css.transformer

- **Experimental**
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/13835)
- **Type:** `'postcss' | 'lightningcss'`
- **Default:** `'postcss'`

Selects the engine used for CSS processing. Check out [Lightning CSS](../guide/features.md#lightning-css) for more information.

## css.lightningcss

- **Experimental**
- **Experimental:** [Give Feedback](https://github.com/vitejs/vite/discussions/13835)
- **Type:**

```js
Expand Down
3 changes: 2 additions & 1 deletion docs/config/ssr-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Build target for the SSR server.

## ssr.format

- **Experimental**
- **Experimental:** [CJS support to be removed in Vite 5](https://github.com/vitejs/vite/discussions/13816)
- **Deprecated** Only ESM output will be supported in Vite 5.
- **Type:** `'esm' | 'cjs'`
- **Default:** `esm`

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ In library mode, all `import.meta.env.*` usage are statically replaced when buil
## Advanced Base Options

::: warning
This feature is experimental, the API may change in a future minor without following semver. Please always pin Vite's version to a minor when using it.
This feature is experimental. [Give Feedback](https://github.com/vitejs/vite/discussions/13834).
:::

For advanced use cases, the deployed assets and public files may be in different paths, for example to use different cache strategies.
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ But a few libraries haven't transitioned to this new default yet, including [`li
- [`jsxFactory`](https://www.typescriptlang.org/tsconfig#jsxFactory)
- [`jsxFragmentFactory`](https://www.typescriptlang.org/tsconfig#jsxFragmentFactory)

If migrating your codebase to `"isolatedModules": true` is an unsurmountable effort, you may be able to get around it with a third-party plugin such as [rollup-plugin-friendly-type-imports](https://www.npmjs.com/package/rollup-plugin-friendly-type-imports). However, this approach is not officially supported by Vite.
If migrating your codebase to `"isolatedModules": true` is an insurmountable effort, you may be able to get around it with a third-party plugin such as [rollup-plugin-friendly-type-imports](https://www.npmjs.com/package/rollup-plugin-friendly-type-imports). However, this approach is not officially supported by Vite.

### Client Types

Expand Down Expand Up @@ -268,7 +268,7 @@ If enabled, CSS files will be processed by Lightning CSS instead of PostCSS. To

To configure CSS Modules, you'll use [`css.lightningcss.cssModules`](https://lightningcss.dev/css-modules.html) instead of [`css.modules`](../config/shared-options.md#css-modules) (which configures the way PostCSS handles CSS modules).

By default, Vite uses esbuild to minify CSS. Lightning CSS can also be used as the CSS minifier with [`build.cssMinify: 'lightningcss'`](../config/build-options.md#css-minify).
By default, Vite uses esbuild to minify CSS. Lightning CSS can also be used as the CSS minifier with [`build.cssMinify: 'lightningcss'`](../config/build-options.md#build-cssminify).

::: tip NOTE
[CSS Pre-processors](#css-pre-processors) aren't supported when using Lightning CSS.
Expand Down
4 changes: 4 additions & 0 deletions docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,7 @@ Use a post hook so that your SSR middleware runs _after_ Vite's middlewares.
## SSR Format
By default, Vite generates the SSR bundle in ESM. There is experimental support for configuring `ssr.format`, but it isn't recommended. Future efforts around SSR development will be based on ESM, and CommonJS remains available for backward compatibility. If using ESM for SSR isn't possible in your project, you can set `legacy.buildSsrCjsExternalHeuristics: true` to generate a CJS bundle using the same [externalization heuristics of Vite v2](https://v2.vitejs.dev/guide/ssr.html#ssr-externals).
:::warning Warning
Experimental `legacy.buildSsrCjsExternalHeuristics` and `ssr.format: 'cjs'` are going to be removed in Vite 5. Find more information and give feedback [in this discussion](https://github.com/vitejs/vite/discussions/13816).
:::
4 changes: 4 additions & 0 deletions docs/guide/static-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,7 @@ You can deploy your Vite app as a Static Site on [Render](https://render.com/).
By default, any new commit pushed to the specified branch will automatically trigger a new deployment. [Auto-Deploy](https://render.com/docs/deploys#toggling-auto-deploy-for-a-service) can be configured in the project settings.

You can also add a [custom domain](https://render.com/docs/custom-domains) to your project.

## Flightcontrol

Deploy your static site using [Flightcontrol](https://www.flightcontrol.dev/?ref=docs-vite), by following these [instructions](https://www.flightcontrol.dev/docs/reference/examples/vite?ref=docs-vite)
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@babel/types": "^7.22.5",
"@microsoft/api-extractor": "^7.36.0",
"@microsoft/api-extractor": "^7.36.2",
"@rollup/plugin-typescript": "^11.1.2",
"@types/babel__core": "^7.20.1",
"@types/babel__preset-env": "^7.9.2",
Expand All @@ -62,11 +62,11 @@
"@types/sass": "~1.43.1",
"@types/stylus": "^0.48.38",
"@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/release-scripts": "^1.2.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/release-scripts": "^1.2.1",
"conventional-changelog-cli": "^2.2.2",
"eslint": "^8.44.0",
"eslint": "^8.45.0",
"eslint-define-config": "^1.21.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
Expand All @@ -77,7 +77,7 @@
"lint-staged": "^13.2.3",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"playwright-chromium": "^1.35.1",
"playwright-chromium": "^1.36.1",
"prettier": "3.0.0",
"resolve": "^1.22.2",
"rimraf": "^5.0.1",
Expand All @@ -89,7 +89,7 @@
"unbuild": "^1.2.1",
"vite": "workspace:*",
"vitepress": "1.0.0-beta.5",
"vitest": "^0.32.4",
"vitest": "^0.33.0",
"vue": "^3.3.4"
},
"simple-git-hooks": {
Expand All @@ -109,7 +109,7 @@
"eslint --cache --fix"
]
},
"packageManager": "pnpm@8.6.6",
"packageManager": "pnpm@8.6.7",
"pnpm": {
"overrides": {
"vite": "workspace:*"
Expand Down
4 changes: 2 additions & 2 deletions packages/create-vite/template-lit-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"preview": "vite preview"
},
"dependencies": {
"lit": "^2.7.5"
"lit": "^2.7.6"
},
"devDependencies": {
"typescript": "^5.0.2",
"vite": "^4.4.0"
"vite": "^4.4.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"preview": "vite preview"
},
"dependencies": {
"lit": "^2.7.5"
"lit": "^2.7.6"
},
"devDependencies": {
"vite": "^4.4.0"
"vite": "^4.4.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"preview": "vite preview"
},
"dependencies": {
"preact": "^10.15.1"
"preact": "^10.16.0"
},
"devDependencies": {
"@preact/preset-vite": "^2.5.0",
"typescript": "^5.0.2",
"vite": "^4.4.0"
"vite": "^4.4.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"preview": "vite preview"
},
"dependencies": {
"preact": "^10.15.1"
"preact": "^10.16.0"
},
"devDependencies": {
"@preact/preset-vite": "^2.5.0",
"vite": "^4.4.0"
"vite": "^4.4.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-qwik-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"devDependencies": {
"typescript": "^5.0.2",
"vite": "^4.4.0"
"vite": "^4.4.4"
},
"dependencies": {
"@builder.io/qwik": "^1.2.5"
"@builder.io/qwik": "^1.2.6"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"devDependencies": {
"typescript": "^5.0.2",
"vite": "^4.4.0"
"vite": "^4.4.4"
},
"dependencies": {
"@builder.io/qwik": "^1.2.5"
"@builder.io/qwik": "^1.2.6"
}
}
11 changes: 1 addition & 10 deletions packages/create-vite/template-react-ts/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: __dirname,
},
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-non-null-assertion': 'off',
},
}
27 changes: 27 additions & 0 deletions packages/create-vite/template-react-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
18 changes: 9 additions & 9 deletions packages/create-vite/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@vitejs/plugin-react": "^4.0.1",
"eslint": "^8.44.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.1",
"eslint-plugin-react-refresh": "^0.4.3",
"typescript": "^5.0.2",
"vite": "^4.4.0"
"vite": "^4.4.4"
}
}
4 changes: 2 additions & 2 deletions packages/create-vite/template-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-env node */

module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
Expand Down
Loading

0 comments on commit da207d5

Please sign in to comment.