From 965d07fb911345cfd4e22ac36175fe34327b4758 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 1 Jan 2021 22:55:58 -0500 Subject: [PATCH] chore: update branch links [ci skip] --- .github/contributing.md | 46 ++++++++++++++++++++++++++++---- .github/maintenance.md | 36 ------------------------- packages/plugin-vue/package.json | 2 +- 3 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 .github/maintenance.md diff --git a/.github/contributing.md b/.github/contributing.md index 0a84d1a1..6caa68f0 100644 --- a/.github/contributing.md +++ b/.github/contributing.md @@ -1,12 +1,9 @@ # Vite Contributing Guide -Hi! I'm really excited that you are interested in contributing to Vite.js. Before submitting your contribution, please make sure to take a moment and read through the following guidelines: - -- [Pull Request Guidelines](#pull-request-guidelines) - +Hi! We are really excited that you are interested in contributing to Vite. Before submitting your contribution, please make sure to take a moment and read through the following guidelines: ## Pull Request Guidelines -- Checkout a topic branch from a base branch, e.g. `master`, and merge back against that branch. +- Checkout a topic branch from a base branch, e.g. `main`, and merge back against that branch. - If adding a new feature: @@ -26,3 +23,42 @@ Hi! I'm really excited that you are interested in contributing to Vite.js. Befor - Commit messages must follow the [commit message convention](./commit-convention.md) so that changelogs can be automatically generated. Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [yorkie](https://github.com/yyx990803/yorkie)). - No need to worry about code style as long as you have installed the dev dependencies - modified files are automatically formatted with Prettier on commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [yorkie](https://github.com/yyx990803/yorkie)). + +## Maintenance Guidelines + +> The following section is mostly for maintainers who have commit access, but it's helpful to go through if you intend to make non-trivial contributions to the codebase. + +Vite aims to be lightweight, and this includes being aware of the number of npm dependencies and their size. + +We use rollup to pre-bundle most dependencies before publishing! Therefore most dependencies, even used in src code, should be added under `devDependencies` by default. This also creates a number of constraints that we need to be aware of in the codebase: + +### Usage of `require()` + +In some cases we intentionally lazy-require some dependencies to improve startup performance. However, note that we cannot use simple `require('somedep')` calls since these are ignored in ESM files so the dependency won't be included in the bundle, and the actual dependency won't even be there when published since they are in `devDependencies`. + +Instead, use `(await import('somedep')).default`. + +### Think before adding a dependency + +Most deps should be added to `devDependencies` even if they are needed at runtime. Some exceptions are: + +- Type packages. Example: `@types/*`. +- Deps that cannot be properly bundled due to binary files. Example: `esbuild`. +- Deps that ships its own types and its type is used in vite's own public types. Example: `rollup`. + +Avoid deps that has large transitive dependencies that results in bloated size compared to the functionality it provides. For example, `http-proxy` itself plus `@types/http-proxy` is a little over 1MB in size, but `http-proxy-middleware` pulls in a ton of dependencies that makes it 7MB(!) when a minimal custom middleware on top of `http-proxy` only requires a couple lines of code. + +### Ensure type support + +Vite aims to be fully usable as a dependency in a TypeScript project (e.g. it should provide proper typings for VitePress), and also in `vite.config.ts`. This means technically a dependency whose types are exposed needs to be part of `dependencies` instead of `devDependencies`. However, these means we won't be able to bundle it. + +To get around this, we inline some of these dependencies' types in `packages/vite/types`. This way we can still expose the typing but bundle the dependency's source code. + +### Think before adding yet another option + +We already have many config options, and we should avoid fixing an issue by adding yet another one. Before adding an option, try to think about: + +- Whether the problem is really worth addressing +- Whether the problem can be fixed with a smarter default +- Whether the problem has workaround using existing options +- Whether the problem can be addressed with a plugin instead diff --git a/.github/maintenance.md b/.github/maintenance.md deleted file mode 100644 index 2d079163..00000000 --- a/.github/maintenance.md +++ /dev/null @@ -1,36 +0,0 @@ -# Vite Maintenance Principles - -Vite aims to be lightweight, and this includes being aware of the number of npm dependencies and their size. - -We use rollup to pre-bundle most dependencies before publishing! Therefore most dependencies, even used in src code, should be added under `devDependencies` by default. This also creates a number of constraints that we need to be aware of in the codebase: - -## Usage of `require()` - -In some cases we intentionally lazy-require some dependencies to improve startup performance. However, note that we cannot use simple `require('somedep')` calls since these are ignored in ESM files so the dependency won't be included in the bundle, and the actual dependency won't even be there when published since they are in `devDependencies`. - -Instead, use `(await import('somedep')).default`. - -## Think before adding a dependency - -Most deps should be added to `devDependencies` even if they are needed at runtime. Some exceptions are: - -- Type packages. Example: `@types/*`. -- Deps that cannot be properly bundled due to binary files. Example: `esbuild`. -- Deps that ships its own types and its type is used in vite's own public types. Example: `rollup`. - -Avoid deps that has large transitive dependencies that results in bloated size compared to the functionality it provides. For example, `http-proxy` itself plus `@types/http-proxy` is a little over 1MB in size, but `http-proxy-middleware` pulls in a ton of dependencies that makes it 7MB(!) when a minimal custom middleware on top of `http-proxy` only requires a couple lines of code. - -## Ensure type support - -Vite aims to be fully usable as a dependency in a TypeScript project (e.g. it should provide proper typings for VitePress), and also in `vite.config.ts`. This means technically a dependency whose types are exposed needs to be part of `dependencies` instead of `devDependencies`. However, these means we won't be able to bundle it. - -To get around this, we inline some of these dependencies' types in `packages/vite/types`. This way we can still expose the typing but bundle the dependency's source code. - -## Think before adding yet another option - -We already have many config options, and we should avoid fixing an issue by adding yet another one. Before adding an option, try to think about: - -- Whether the problem is really worth addressing -- Whether the problem can be fixed with a smarter default -- Whether the problem has workaround using existing options -- Whether the problem can be addressed with a plugin instead diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 5c3c18e5..5dbb1351 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -25,7 +25,7 @@ "bugs": { "url": "https://github.com/vitejs/vite/issues" }, - "homepage": "https://github.com/vitejs/vite/tree/master/packages/plugin-vue#readme", + "homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-vue#readme", "peerDependencies": { "@vue/compiler-sfc": "^3.0.4" },