This commit is contained in:
24
types/index.d.ts
vendored
24
types/index.d.ts
vendored
@@ -15,6 +15,11 @@ export interface RollupHtmlTransformContext {
|
||||
// files: Record<string, (OutputChunk | OutputAsset)[]>;
|
||||
}
|
||||
|
||||
export interface RewriteUrlCallbackContext {
|
||||
from: string;
|
||||
rootPath: string;
|
||||
}
|
||||
export type RewriteUrlCallback = (relative: string, context: RewriteUrlCallbackContext) => string|Promise<string>;
|
||||
export type TransformCallback = (source: string, transformContext: RollupHtmlTransformContext) => string|Promise<string>;
|
||||
|
||||
export interface RollupHtmlOptions {
|
||||
@@ -23,6 +28,7 @@ export interface RollupHtmlOptions {
|
||||
* Follows the same logic as rollup's [entryFileNames](https://rollupjs.org/configuration-options/#output-entryfilenames).
|
||||
*/
|
||||
htmlFileNames?: string|((chunkInfo: PreRenderedChunk) => string);
|
||||
|
||||
/**
|
||||
* Transform a source file passed into this plugin to HTML. For example: a handlebars transform
|
||||
* ```
|
||||
@@ -33,6 +39,17 @@ export interface RollupHtmlOptions {
|
||||
*/
|
||||
transform?: TransformCallback;
|
||||
|
||||
/**
|
||||
* Optional callback to rewrite how resources are referenced in the output HTML.
|
||||
* For example to rewrite urls to as paths from the root of your website:
|
||||
* ```
|
||||
* rewriteUrl(relative, {rootPath, from}){
|
||||
* return `/${rootPath}`;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
rewriteUrl?: RewriteUrlCallback;
|
||||
|
||||
/**
|
||||
* Detect which references (<a href="...">, <img src="...">) to resolve from a HTML node.
|
||||
* This rarely needs to be overloaded, but can be used to support non-native attributes used by custom-elements.
|
||||
@@ -49,7 +66,14 @@ export interface RollupHtmlOptions {
|
||||
* Return a falsey value to skip this reference. Return true to resolve as is. (or string to transform the id)
|
||||
*/
|
||||
resolve?: ResolveCallback;
|
||||
|
||||
/**
|
||||
* [Pattern](https://github.com/micromatch/picomatch#globbing-features) to include
|
||||
*/
|
||||
include?: FilterPattern;
|
||||
/**
|
||||
* [Pattern](https://github.com/micromatch/picomatch#globbing-features) to exclude
|
||||
*/
|
||||
exclude?: FilterPattern
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user