Skip to content

Commit e2c67cf

Browse files
authored
feat(assets): add yml/yaml/toml extensions and update ignore rules (#184)
1 parent bead8cb commit e2c67cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/core/src/vite-rpc/assets.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function guessType(path: string): AssetType {
4444
return 'audio'
4545
if (/\.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)/i.test(path))
4646
return 'font'
47-
if (/\.(json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown)/i.test(path))
47+
if (/\.(json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown|ya?ml|toml)/i.test(path))
4848
return 'text'
4949
return 'other'
5050
}
@@ -73,11 +73,17 @@ export function setupAssetsRPC(config: SetupAssetsOptions) {
7373
// font
7474
'**/*.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)',
7575
// text
76-
'**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown)',
76+
'**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown|yaml|yml|toml)',
7777
], {
7878
cwd: dir,
7979
onlyFiles: true,
80-
ignore: ['**/node_modules/**', '**/dist/**'],
80+
ignore: [
81+
'**/node_modules/**',
82+
'**/dist/**',
83+
'**/package-lock.*',
84+
'**/pnpm-lock.*',
85+
'**/pnpm-workspace.*',
86+
],
8187
})
8288

8389
cache = await Promise.all(files.map(async (path) => {

0 commit comments

Comments
 (0)