更新
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
/// <reference types="node" />
|
||||
import { type Plugin } from 'vite';
|
||||
import type { OutputOptions } from 'rollup';
|
||||
export declare function uniCssPlugin(): Plugin;
|
||||
/**
|
||||
* converts the source filepath of the asset to the output filename based on the assetFileNames option. \
|
||||
* this function imitates the behavior of rollup.js. \
|
||||
* https://rollupjs.org/guide/en/#outputassetfilenames
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* const content = Buffer.from('text');
|
||||
* const fileName = assetFileNamesToFileName(
|
||||
* 'assets/[name].[hash][extname]',
|
||||
* '/path/to/file.txt',
|
||||
* getAssetHash(content),
|
||||
* content
|
||||
* )
|
||||
* // 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
|
||||
* @returns output filename
|
||||
*/
|
||||
export declare function assetFileNamesToFileName(assetFileNames: Exclude<OutputOptions['assetFileNames'], undefined>, file: string, contentHash: string, content: string | Buffer): string;
|
||||
Reference in New Issue
Block a user