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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export helpers to allow 3rd parties to emit assets #9693

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion packages/vite/rollup.config.ts
Expand Up @@ -181,7 +181,7 @@ function createCjsConfig(isProduction: boolean) {
...Object.keys(pkg.dependencies),
...(isProduction ? [] : Object.keys(pkg.devDependencies))
],
plugins: [...createNodePlugins(false, false, false), bundleSizeLimit(120)]
plugins: [...createNodePlugins(false, false, false), bundleSizeLimit(930)]
})
}

Expand Down
12 changes: 6 additions & 6 deletions packages/vite/src/node/plugins/asset.ts
Expand Up @@ -260,8 +260,8 @@ export function resolveAssetFileNames(
}

/**
* converts the source filepath of the asset to the output filename based on the assetFileNames option. \
* this function imitates the behavior of rollup.js. \
* converts the source filepath of the asset to the output filename based on the assetFileNames option.
* this function imitates the behavior of rollup.js.
Comment on lines -263 to +264
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter was complaining about the trailing backslash

* https://rollupjs.org/guide/en/#outputassetfilenames
*
* @example
Expand All @@ -276,10 +276,10 @@ export function resolveAssetFileNames(
* // fileName: 'assets/file.982d9e3e.txt'
* ```
*
* @param assetFileNames filename pattern. e.g. `'assets/[name].[hash][extname]'`
* @param file filepath of the asset
* @param contentHash hash of the asset. used for `'[hash]'` placeholder
* @param content content of the asset. passed to `assetFileNames` if `assetFileNames` is a function
* @param assetFileNames - filename pattern. e.g. `'assets/[name].[hash][extname]'`
* @param file - filepath of the asset
* @param contentHash - hash of the asset. used for `'[hash]'` placeholder
* @param content - content of the asset. passed to `assetFileNames` if `assetFileNames` is a function
Comment on lines -279 to +282
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter was complaining about the missing dash

* @returns output filename
*/
export function assetFileNamesToFileName(
Expand Down
12 changes: 11 additions & 1 deletion packages/vite/src/node/publicUtils.ts
Expand Up @@ -10,7 +10,17 @@ export {
splitVendorChunkPlugin,
splitVendorChunk
} from './plugins/splitVendorChunk'
export { normalizePath, mergeConfig, mergeAlias, createFilter } from './utils'
export {
assetFileNamesToFileName,
resolveAssetFileNames
} from './plugins/asset'
export {
normalizePath,
mergeConfig,
mergeAlias,
createFilter,
getHash
} from './utils'
export { send } from './server/send'
export { createLogger } from './logger'
export { searchForWorkspaceRoot } from './server/searchRoot'
Expand Down