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 Apr 19, 2023
2 parents 9821cb9 + 3679bd7 commit 724142a
Show file tree
Hide file tree
Showing 138 changed files with 4,664 additions and 3,870 deletions.
45 changes: 20 additions & 25 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = defineConfig({
root: true,
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:n/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:regexp/recommended',
],
Expand All @@ -29,37 +29,32 @@ module.exports = defineConfig({
},
],

'node/no-missing-import': [
'error',
{
allowModules: ['types', 'estree', 'less', 'sass', 'stylus'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],
},
],
'node/no-missing-require': [
'n/no-process-exit': 'off',
'n/no-missing-import': 'off',
'n/no-missing-require': [
'error',
{
// for try-catching yarn pnp
allowModules: ['pnpapi', 'vite'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],
},
],
'node/no-extraneous-import': [
'n/no-extraneous-import': [
'error',
{
allowModules: ['vite', 'less', 'sass', 'vitest'],
allowModules: ['vite', 'less', 'sass', 'vitest', 'unbuild'],
},
],
'node/no-extraneous-require': [
'n/no-extraneous-require': [
'error',
{
allowModules: ['vite'],
},
],
'node/no-deprecated-api': 'off',
'node/no-unpublished-import': 'off',
'node/no-unpublished-require': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'n/no-deprecated-api': 'off',
'n/no-unpublished-import': 'off',
'n/no-unpublished-require': 'off',
'n/no-unsupported-features/es-syntax': 'off',

'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'off', // TODO: we should turn this on in a new PR
Expand Down Expand Up @@ -118,7 +113,7 @@ module.exports = defineConfig({
{
files: 'packages/vite/**/*.*',
rules: {
'node/no-restricted-require': [
'n/no-restricted-require': [
'error',
Object.keys(
require('./packages/vite/package.json').devDependencies,
Expand All @@ -141,32 +136,32 @@ module.exports = defineConfig({
{
files: ['packages/vite/src/types/**', '*.spec.ts'],
rules: {
'node/no-extraneous-import': 'off',
'n/no-extraneous-import': 'off',
},
},
{
files: ['packages/create-vite/template-*/**', '**/build.config.ts'],
rules: {
'no-undef': 'off',
'node/no-missing-import': 'off',
'n/no-missing-import': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
{
files: ['playground/**'],
rules: {
'node/no-extraneous-import': 'off',
'node/no-extraneous-require': 'off',
'node/no-missing-import': 'off',
'node/no-missing-require': 'off',
'n/no-extraneous-import': 'off',
'n/no-extraneous-require': 'off',
'n/no-missing-import': 'off',
'n/no-missing-require': 'off',
// engine field doesn't exist in playgrounds
'node/no-unsupported-features/es-builtins': [
'n/no-unsupported-features/es-builtins': [
'error',
{
version: '^14.18.0 || >=16.0.0',
},
],
'node/no-unsupported-features/node-builtins': [
'n/no-unsupported-features/node-builtins': [
'error',
{
version: '^14.18.0 || >=16.0.0',
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node_version: [14, 16, 18]
node_version: [14, 16, 18, 20]
include:
# Active LTS + other OS
- os: macos-latest
Expand Down Expand Up @@ -67,8 +67,14 @@ jobs:
packages/create-vite/template**
**.md
- name: Install pnpm (node 14, pnpm 7)
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version == 14
uses: pnpm/action-setup@v2.2.4
with:
version: 7

- name: Install pnpm
if: steps.changed-files.outputs.only_changed != 'true'
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version != 14
uses: pnpm/action-setup@v2.2.4

- name: Set node version to ${{ matrix.node_version }}
Expand Down
12 changes: 12 additions & 0 deletions docs/_data/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ export const core = [
],
sponsor: 'https://github.com/sponsors/dominikg',
},
{
avatar: 'https://github.com/sheremet-va.png',
name: 'Vladimir',
title: 'Core team member of Vitest & Vite',
desc: 'An open source fullstack developer',
links: [
{ icon: 'github', link: 'https://github.com/sheremet-va' },
{ icon: 'mastodon', link: 'https://elk.zone/m.webtoo.ls/@sheremet_va' },
{ icon: 'twitter', link: 'https://twitter.com/sheremet_va' },
],
sponsor: 'https://github.com/sponsors/sheremet-va',
},
]

export const emeriti = [
Expand Down
2 changes: 1 addition & 1 deletion docs/config/server-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export default defineConfig({
- **Type:** `false | (sourcePath: string, sourcemapPath: string) => boolean`
- **Default:** `(sourcePath) => sourcePath.includes('node_modules')`

Whether or not to ignore source files in the server sourcemap, used to populate the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
Whether or not to ignore source files in the server sourcemap, used to populate the [`x_google_ignoreList` source map extension](https://developer.chrome.com/articles/x-google-ignore-list/).

`server.sourcemapIgnoreList` is the equivalent of [`build.rollupOptions.output.sourcemapIgnoreList`](https://rollupjs.org/configuration-options/#output-sourcemapignorelist) for the dev server. A difference between the two config options is that the rollup function is called with a relative path for `sourcePath` while `server.sourcemapIgnoreList` is called with an absolute path. During dev, most modules have the map and the source in the same folder, so the relative path for `sourcePath` is the file name itself. In these cases, absolute paths makes it convenient to be used instead.

Expand Down
4 changes: 2 additions & 2 deletions docs/config/shared-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ When aliasing to file system paths, always use absolute paths. Relative alias va
More advanced custom resolution can be achieved through [plugins](/guide/api-plugin).

::: warning Using with SSR
If you have configured aliases for [SSR externalized dependencies](/guide/ssr.md#ssr-externals), you may want to alias the actual `node_modules` packages. Both [Yarn](https://classic.yarnpkg.com/en/docs/cli/add/#toc-yarn-add-alias) and [pnpm](https://pnpm.js.org/en/aliases) support aliasing via the `npm:` prefix.
If you have configured aliases for [SSR externalized dependencies](/guide/ssr.md#ssr-externals), you may want to alias the actual `node_modules` packages. Both [Yarn](https://classic.yarnpkg.com/en/docs/cli/add/#toc-yarn-add-alias) and [pnpm](https://pnpm.io/aliases/) support aliasing via the `npm:` prefix.
:::

## resolve.dedupe
Expand Down Expand Up @@ -232,7 +232,7 @@ Specify options to pass to CSS pre-processors. The file extensions are used as k
- `less` - [Options](https://lesscss.org/usage/#less-options).
- `styl`/`stylus` - Only [`define`](https://stylus-lang.com/docs/js.html#define-name-node) is supported, which can be passed as an object.

All preprocessor options also support the `additionalData` option, which can be used to inject extra code for each style content.
All preprocessor options also support the `additionalData` option, which can be used to inject extra code for each style content. Note that if you include actual styles and not just variables, those styles will be duplicated in the final bundle.

Example:

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ You can read more about the transition in the [TypeScript 3.7 release notes](htt

If you are using a library that heavily relies on class fields, please be careful about the library's intended usage of it.

Most libraries expect `"useDefineForClassFields": true`, such as [MobX](https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties), [Vue Class Components 8.x](https://github.com/vuejs/vue-class-component/issues/465), etc.
Most libraries expect `"useDefineForClassFields": true`, such as [MobX](https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties).

But a few libraries haven't transitioned to this new default yet, including [`lit-element`](https://github.com/lit/lit-element/issues/1030). Please explicitly set `useDefineForClassFields` to `false` in these cases.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ If a dependency needs to be transformed by Vite's pipeline, for example, because
For linked dependencies, they are not externalized by default to take advantage of Vite's HMR. If this isn't desired, for example, to test dependencies as if they aren't linked, you can add it to [`ssr.external`](../config/ssr-options.md#ssr-external).
:::warning Working with Aliases
If you have configured aliases that redirect one package to another, you may want to alias the actual `node_modules` packages instead to make it work for SSR externalized dependencies. Both [Yarn](https://classic.yarnpkg.com/en/docs/cli/add/#toc-yarn-add-alias) and [pnpm](https://pnpm.js.org/en/aliases) support aliasing via the `npm:` prefix.
If you have configured aliases that redirect one package to another, you may want to alias the actual `node_modules` packages instead to make it work for SSR externalized dependencies. Both [Yarn](https://classic.yarnpkg.com/en/docs/cli/add/#toc-yarn-add-alias) and [pnpm](https://pnpm.io/aliases/) support aliasing via the `npm:` prefix.
:::
## SSR-specific Plugin Logic
Expand Down
10 changes: 10 additions & 0 deletions docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ See [Reason: CORS request not HTTP - HTTP | MDN](https://developer.mozilla.org/e

You will need to access the file with `http` protocol. The easiest way to achieve this is to run `npx vite preview`.

## Optimized Dependencies

### Outdated pre-bundled deps when linking to a local package

The hash key used to invalidate optimized dependencies depend on the package lock contents, the patches applied to dependencies, and the options in the Vite config file that affects the bundling of node modules. This means that Vite will detect when a dependency is overridden using a feature as [npm overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides), and re-bundle your dependencies on the next server start. Vite won't invalidate the dependencies when you use a feature like [npm link](https://docs.npmjs.com/cli/v9/commands/npm-link). In case you link or unlink a dependency, you'll need to force re-optimization on the next server start by using `vite --force`. We recommend using overrides instead, which are supported now by every package manager (see also [pnpm overrides](https://pnpm.io/package_json#pnpmoverrides) and [yarn resolutions](https://yarnpkg.com/configuration/manifest/#resolutions)).

## Others

### Module externalized for browser compatibility
Expand All @@ -144,3 +150,7 @@ For example, you might see these errors.
> TypeError: Cannot create property 'foo' on boolean 'false'
If these code are used inside dependencies, you could use [`patch-package`](https://github.com/ds300/patch-package) (or [`yarn patch`](https://yarnpkg.com/cli/patch) or [`pnpm patch`](https://pnpm.io/cli/patch)) for an escape hatch.
### Browser extensions
Some browser extensions (like ad-blockers) may prevent the Vite client from sending requests to the Vite dev server. You may see a white screen without logged errors in this case. Try disabling extensions if you have this issue.
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@vitejs/vite-monorepo",
"private": true,
"type": "module",
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
Expand Down Expand Up @@ -50,37 +51,32 @@
"@types/json-stable-stringify": "^1.0.34",
"@types/less": "^3.0.3",
"@types/micromatch": "^4.0.2",
"@types/minimist": "^1.2.2",
"@types/node": "^18.15.5",
"@types/picomatch": "^2.3.0",
"@types/prompts": "2.4.2",
"@types/resolve": "^1.20.2",
"@types/sass": "~1.43.1",
"@types/semver": "^7.3.13",
"@types/stylus": "^0.48.38",
"@types/ws": "^8.5.4",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@vitejs/release-scripts": "^1.1.0",
"conventional-changelog-cli": "^2.2.2",
"eslint": "^8.36.0",
"eslint-define-config": "^1.17.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-regexp": "^1.13.0",
"execa": "^7.1.1",
"fast-glob": "^3.2.12",
"fs-extra": "^11.1.1",
"lint-staged": "^13.2.0",
"minimist": "^1.2.8",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"playwright-chromium": "^1.31.2",
"prettier": "2.8.5",
"prompts": "^2.4.2",
"resolve": "^1.22.1",
"rimraf": "^4.4.0",
"rollup": "^3.20.0",
"semver": "^7.3.8",
"rollup": "^3.20.2",
"simple-git-hooks": "^2.8.1",
"tslib": "^2.5.0",
"tsx": "^3.12.6",
Expand Down Expand Up @@ -108,7 +104,7 @@
"eslint --cache --fix"
]
},
"packageManager": "pnpm@7.30.0",
"packageManager": "pnpm@8.2.0",
"pnpm": {
"overrides": {
"vite": "workspace:*"
Expand Down
15 changes: 15 additions & 0 deletions packages/create-vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 4.3.0-beta.0 (2023-04-06)

* chore: use @vitejs/release-scripts (#12682) ([9c37cc1](https://github.com/vitejs/vite/commit/9c37cc1)), closes [#12682](https://github.com/vitejs/vite/issues/12682)
* chore(create-vite): revert to vite 4.2 (#12456) ([535c8c5](https://github.com/vitejs/vite/commit/535c8c5)), closes [#12456](https://github.com/vitejs/vite/issues/12456)
* chore(create-vite): rollback to vite 4.1 due to npm publish outage ([d8cb765](https://github.com/vitejs/vite/commit/d8cb765))
* chore(create-vite): update to vite 4.3 beta ([9b0df5d](https://github.com/vitejs/vite/commit/9b0df5d))
* feat(create-vite): lit templates will create application instead of library (#12459) ([8186b9b](https://github.com/vitejs/vite/commit/8186b9b)), closes [#12459](https://github.com/vitejs/vite/issues/12459)
* feat(create-vite): stricter TS configs in templates (#12604) ([4ffaeee](https://github.com/vitejs/vite/commit/4ffaeee)), closes [#12604](https://github.com/vitejs/vite/issues/12604)
* feat(create-vite): use typescript 5.0 in templates (#12481) ([8582e2d](https://github.com/vitejs/vite/commit/8582e2d)), closes [#12481](https://github.com/vitejs/vite/issues/12481)
* fix(create-vite): skip lib check in tsconfig templates (#12591) ([a59914c](https://github.com/vitejs/vite/commit/a59914c)), closes [#12591](https://github.com/vitejs/vite/issues/12591)
* fix(create-vite): updated js & ts templates with new react docs link (#12479) ([c327006](https://github.com/vitejs/vite/commit/c327006)), closes [#12479](https://github.com/vitejs/vite/issues/12479)
* fix(deps): update all non-major dependencies (#12389) ([3e60b77](https://github.com/vitejs/vite/commit/3e60b77)), closes [#12389](https://github.com/vitejs/vite/issues/12389)



## 4.2.0 (2023-03-16)

* chore(create-vite): update plugin-vue ([e06cda9](https://github.com/vitejs/vite/commit/e06cda9))
Expand Down
5 changes: 3 additions & 2 deletions packages/create-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-vite",
"version": "4.2.0",
"version": "4.3.0-beta.0",
"type": "module",
"license": "MIT",
"author": "Evan You",
Expand All @@ -13,7 +13,6 @@
"template-*",
"dist"
],
"main": "index.js",
"scripts": {
"dev": "unbuild --stub",
"build": "unbuild",
Expand All @@ -33,6 +32,8 @@
},
"homepage": "https://github.com/vitejs/vite/tree/main/packages/create-vite#readme",
"devDependencies": {
"@types/minimist": "^1.2.2",
"@types/prompts": "^2.4.4",
"cross-spawn": "^7.0.3",
"kolorist": "^1.7.0",
"minimist": "^1.2.8",
Expand Down
Loading

0 comments on commit 724142a

Please sign in to comment.