Skip to content

Commit

Permalink
feat(assets): add yml/yaml/toml extensions and update ignore rules
Browse files Browse the repository at this point in the history
  • Loading branch information
LoTwT committed Jan 19, 2024
1 parent bead8cb commit 12ba3e7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/core/src/vite-rpc/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function guessType(path: string): AssetType {
return 'audio'
if (/\.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)/i.test(path))
return 'font'
if (/\.(json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown)/i.test(path))
if (/\.(json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown|ya?ml|toml)/i.test(path))
return 'text'
return 'other'
}
Expand Down Expand Up @@ -73,11 +73,17 @@ export function setupAssetsRPC(config: SetupAssetsOptions) {
// font
'**/*.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)',
// text
'**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown)',
'**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown|yaml|yml|toml)',
], {
cwd: dir,
onlyFiles: true,
ignore: ['**/node_modules/**', '**/dist/**'],
ignore: [
'**/node_modules/**',
'**/dist/**',
'**/package-lock.*',
'**/pnpm-lock.*',
'**/pnpm-workspace.*',
],
})

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

0 comments on commit 12ba3e7

Please sign in to comment.