Skip to content

Commit

Permalink
chore: change prettier version to exact (#3386)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 12, 2021
1 parent aee0928 commit d36e10e
Show file tree
Hide file tree
Showing 45 changed files with 156 additions and 138 deletions.
3 changes: 1 addition & 2 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ module.exports = {
},
{
text: 'Changelog',
link:
'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md'
link: 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md'
}
]
},
Expand Down
17 changes: 9 additions & 8 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ If the config needs to call async function, it can export a async function inste

```js
export default async ({ command, mode }) => {
const data = await asyncFunction();
const data = await asyncFunction()
return {
// build specific config
}
}
}
```

Expand Down Expand Up @@ -331,7 +331,7 @@ export default async ({ command, mode }) => {

Specify which IP addresses the server should listen on.
Set this to `0.0.0.0` to listen on all addresses, including LAN and public addresses.

This can be set via the CLI using `--host 0.0.0.0` or `--host`.

### server.port
Expand Down Expand Up @@ -444,8 +444,9 @@ export default async ({ command, mode }) => {
- **Type:** `string`

Restrict files that could be served via `/@fs/`. When `server.fsServe.strict` is set to `true`, accessing files outside this directory will result in a 403.

Vite will search for the root of the potential workspace and use it as default. A valid workspace met the following conditions, otherwise will fallback to the [project root](/guide/#index-html-and-project-root).

- contains `workspaces` field in `package.json`
- contains one of the following file
- `pnpm-workspace.yaml`
Expand All @@ -456,8 +457,8 @@ export default async ({ command, mode }) => {
export default {
server: {
fsServe: {
// Allow serving files from one level up to the project root
root: '..'
// Allow serving files from one level up to the project root
root: '..'
}
}
}
Expand Down Expand Up @@ -499,7 +500,7 @@ export default async ({ command, mode }) => {
- **Default:** `4096` (4kb)

Imported or referenced assets that are smaller than this threshold will be inlined as base64 URLs to avoid extra http requests. Set to `0` to disable inlining altogether.

::: tip Note
Assets will **always** be inlined, regardless of file size, and `build.assetsInlineLimit` will be ignored if you specify `build.lib`
:::
Expand Down Expand Up @@ -593,7 +594,7 @@ export default async ({ command, mode }) => {
- **Default:** `500`

Limit for chunk size warnings (in kbs).

### build.watch

- **Type:** [`WatcherOptions`](https://rollupjs.org/guide/en/#watch-options)`| null`
Expand Down
13 changes: 4 additions & 9 deletions docs/guide/api-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ import vitePlugin from 'vite-plugin-feature'
import rollupPlugin from 'rollup-plugin-feature'

export default {
plugins: [ vitePlugin(), rollupPlugin() ]
plugins: [vitePlugin(), rollupPlugin()]
}
```

Falsy plugins will be ignored, which can be used to easily activate or deactivate plugins.
Falsy plugins will be ignored, which can be used to easily activate or deactivate plugins.

`plugins` also accept presets including several plugins as a single element. This is useful for complex features (like framework integration) that are implemented using several plugins. The array will be flattened internally.

Expand All @@ -49,10 +49,7 @@ import frameworkRefresh from 'vite-plugin-framework-refresh'
import frameworkDevtools from 'vite-plugin-framework-devtools'

export default function framework(config) {
return [
frameworkRefresh(config),
frameworkDevTools(config)
]
return [frameworkRefresh(config), frameworkDevTools(config)]
}
```

Expand All @@ -61,9 +58,7 @@ export default function framework(config) {
import framework from 'vite-plugin-framework'

export default {
plugins: [
framework()
]
plugins: [framework()]
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = {
}
```

If you specify a different root, remember that `__dirname` will still be the folder of your vite.config.js file when resolving the input paths. Therfore, you will need to add your `root` entry to the arguments for `resolve`.
If you specify a different root, remember that `__dirname` will still be the folder of your vite.config.js file when resolving the input paths. Therfore, you will need to add your `root` entry to the arguments for `resolve`.

## Library Mode

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ export function mySSRPlugin() {
## SSR Target
The default target for the SSR build is a node environment, but you can also run the server in a Web Worker. Packages entry resolution is different for each platform. You can configure the target to be Web Worker using the `ssr.target` set to `'webworker'`.
The default target for the SSR build is a node environment, but you can also run the server in a Web Worker. Packages entry resolution is different for each platform. You can configure the target to be Web Worker using the `ssr.target` set to `'webworker'`.
8 changes: 4 additions & 4 deletions docs/guide/using-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export default {
plugins: [
{
...image(),
enforce: 'pre',
},
enforce: 'pre'
}
]
}
```
Expand All @@ -73,8 +73,8 @@ export default {
plugins: [
{
...typescript2(),
apply: 'build',
},
apply: 'build'
}
]
}
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"node-fetch": "^2.6.1",
"npm-run-all": "^4.1.5",
"playwright-chromium": "^1.7.0",
"prettier": "^2.2.1",
"prettier": "2.3.0",
"rimraf": "^3.0.2",
"semver": "^7.3.4",
"sirv": "^1.0.10",
Expand Down
3 changes: 2 additions & 1 deletion packages/create-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ function copy(src, dest) {
}

async function getValidPackageName(projectName) {
const packageNameRegExp = /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/
const packageNameRegExp =
/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/
if (packageNameRegExp.test(projectName)) {
return projectName
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/template-lit-element-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"vite": "^2.3.0",
"typescript": "^4.1.3"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-lit-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"devDependencies": {
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"typescript": "^4.1.3",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"@preact/preset-vite": "^2.0.0",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"typescript": "^4.1.2",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"@vitejs/plugin-react-refresh": "^1.3.1",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"typescript": "^4.2.4",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"svelte": "^3.37.0",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"typescript": "^4.2.3",
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"devDependencies": {
"vite": "^2.3.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"vite": "^2.3.0",
"vue-tsc": "^0.0.24"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"@vue/compiler-sfc": "^3.0.5",
"vite": "^2.3.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@import '~/styles/background.css';
@import '../../references.css';

html, body {
html,
body {
font-family: sans-serif;
line-height: 2.4rem;
}
Expand All @@ -13,7 +14,7 @@ body {
}

ul {
padding: 0 .4em;
padding: 0 0.4em;
margin: 0;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/playground/backend-integration/references.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.asset-reference {
display: grid;
grid-template-areas:
"summary preview ."
"url url url";
'summary preview .'
'url url url';
}

.asset-url {
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/css-codesplit-cjs/main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
h1 {
h1 {
color: red;
}
}
2 changes: 1 addition & 1 deletion packages/playground/dynamic-import/mxd.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
28 changes: 27 additions & 1 deletion packages/playground/multiple-entrypoints/deps.json
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
{"a0":"./a0.js","a1":"./a1.js","a2":"./a2.js","a3":"./a3.js","a4":"./a4.js","a5":"./a5.js","a6":"./a6.js","a7":"./a7.js","a8":"./a8.js","a9":"./a9.js","a10":"./a10.js","a11":"./a11.js","a12":"./a12.js","a13":"./a13.js","a14":"./a14.js","a15":"./a15.js","a16":"./a16.js","a17":"./a17.js","a18":"./a18.js","a19":"./a19.js","a20":"./a20.js","a21":"./a21.js","a22":"./a22.js","a23":"./a23.js","a24":"./a24.js"}
{
"a0": "./a0.js",
"a1": "./a1.js",
"a2": "./a2.js",
"a3": "./a3.js",
"a4": "./a4.js",
"a5": "./a5.js",
"a6": "./a6.js",
"a7": "./a7.js",
"a8": "./a8.js",
"a9": "./a9.js",
"a10": "./a10.js",
"a11": "./a11.js",
"a12": "./a12.js",
"a13": "./a13.js",
"a14": "./a14.js",
"a15": "./a15.js",
"a16": "./a16.js",
"a17": "./a17.js",
"a18": "./a18.js",
"a19": "./a19.js",
"a20": "./a20.js",
"a21": "./a21.js",
"a22": "./a22.js",
"a23": "./a23.js",
"a24": "./a24.js"
}
4 changes: 3 additions & 1 deletion packages/playground/multiple-entrypoints/reference.scss
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.content { color: red; }
.content {
color: red;
}
2 changes: 1 addition & 1 deletion packages/playground/ssr-vue/src/pages/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Foo />
<p class="virtual">msg from virtual module: {{ foo.msg }}</p>

<ImportType/>
<ImportType />
</template>

<script setup>
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/vue/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Slotted>
<div class="slotted">this should be red</div>
</Slotted>
<ScanDep/>
<ScanDep />
</template>

<script setup lang="ts">
Expand Down
11 changes: 5 additions & 6 deletions packages/plugin-react-refresh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ If you are using ES syntax that are still in proposal status (e.g. class propert

```js
export default {
plugins: [reactRefresh({
parserPlugins: [
'classProperties',
'classPrivateProperties'
]
})]
plugins: [
reactRefresh({
parserPlugins: ['classProperties', 'classPrivateProperties']
})
]
}
```

Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-vue/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ async function genTemplateCode(
}
}

const exportDefaultClassRE = /(?:(?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/
const exportDefaultClassRE =
/(?:(?:^|\n|;)\s*)export\s+default\s+class\s+([\w$]+)/

async function genScriptCode(
descriptor: SFCDescriptor,
Expand Down
7 changes: 4 additions & 3 deletions packages/plugin-vue/src/utils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export interface VueQuery {
raw?: boolean
}

export function parseVueRequest(
id: string
): { filename: string; query: VueQuery } {
export function parseVueRequest(id: string): {
filename: string
query: VueQuery
} {
const [filename, rawQuery] = id.split(`?`, 2)
const query = qs.parse(rawQuery) as VueQuery
if (query.vue != null) {
Expand Down
Loading

0 comments on commit d36e10e

Please sign in to comment.