Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: format & check with prettier #5869

Merged
merged 1 commit into from Nov 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -91,3 +91,6 @@ jobs:

- name: Lint
run: pnpm run lint

- name: Check formatting
run: pnpm prettier --check .
7 changes: 6 additions & 1 deletion docs/config/index.md
Expand Up @@ -238,7 +238,12 @@ export default defineConfig(async ({ command, mode }) => {
/**
* default: null
*/
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null
localsConvention?:
| 'camelCase'
| 'camelCaseOnly'
| 'dashes'
| 'dashesOnly'
| null
}
```

Expand Down
1 change: 0 additions & 1 deletion docs/guide/api-plugin.md
Expand Up @@ -40,7 +40,6 @@ Vite convention for virtual modules is to prefix the user-facing path with `virt

Note that modules directly derived from a real file, as in the case of a script module in a Single File Component (like a .vue or .svelte SFC) don't need to follow this convention. SFCs generally generate a set of submodules when processed but the code in these can be mapped back to the filesystem. Using `\0` for these submodules would prevent sourcemaps from working correctly.


## Plugins config

Users will add plugins to the project `devDependencies` and configure them using the `plugins` array option.
Expand Down
@@ -1,2 +1 @@
<h1>unicode-path</h1>
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved

2 changes: 1 addition & 1 deletion packages/playground/resolve/config-dep.js
@@ -1,3 +1,3 @@
module.exports = {
a: 1
}
}
2 changes: 1 addition & 1 deletion packages/playground/resolve/vite.config.js
Expand Up @@ -2,7 +2,7 @@ const virtualFile = '@virtual-file'
const virtualId = '\0' + virtualFile

const customVirtualFile = '@custom-virtual-file'
const { a } = require('./config-dep');
const { a } = require('./config-dep')

module.exports = {
resolve: {
Expand Down
5 changes: 4 additions & 1 deletion packages/playground/ssr-vue/src/pages/Home.vue
Expand Up @@ -9,7 +9,10 @@
<p class="inter">this will be styled with a font-face</p>
<p class="import-meta-url">{{ state.url }}</p>
<p class="protocol">{{ state.protocol }}</p>
<div>encrypted message: <p class="encrypted-msg">{{ encryptedMsg }}</p></div>
<div>
encrypted message:
<p class="encrypted-msg">{{ encryptedMsg }}</p>
</div>

<ImportType />
</template>
Expand Down
4 changes: 1 addition & 3 deletions packages/plugin-vue/src/main.ts
Expand Up @@ -269,9 +269,7 @@ async function genScriptCode(
scriptCode = compiler.rewriteDefault(
script.content,
'_sfc_main',
script.lang === 'ts'
? ['typescript']
: undefined
script.lang === 'ts' ? ['typescript'] : undefined
)
map = script.map
} else {
Expand Down
6 changes: 1 addition & 5 deletions packages/vite/src/node/plugins/asset.ts
Expand Up @@ -98,11 +98,7 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
const file = getAssetFilename(hash, config) || this.getFileName(hash)
registerAssetToChunk(chunk, file)
const outputFilepath = config.base + file + postfix
s.overwrite(
match.index,
match.index + full.length,
outputFilepath
)
s.overwrite(match.index, match.index + full.length, outputFilepath)
}

if (s) {
Expand Down
14 changes: 9 additions & 5 deletions packages/vite/src/node/plugins/css.ts
Expand Up @@ -1002,12 +1002,16 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any {
return (loadedPreprocessors[lang] = require(resolved))
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
throw new Error(`Preprocessor dependency "${lang}" not found. Did you install it?`);
throw new Error(
`Preprocessor dependency "${lang}" not found. Did you install it?`
)
} else {
const message = new Error(`Preprocessor dependency "${lang}" failed to load:\n${e.message}`);
message.stack = e.stack + '\n' + message.stack;
throw message;
}
const message = new Error(
`Preprocessor dependency "${lang}" failed to load:\n${e.message}`
)
message.stack = e.stack + '\n' + message.stack
throw message
}
}
}

Expand Down