Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add tsdoc comments with @public and descriptions - use purgecss UserDefinedOptions to create the plugins's options
- Loading branch information
Showing
14 changed files
with
131 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,14 @@ | ||
import { StringRegExpArray, UserDefinedSafelist } from "purgecss"; | ||
import { | ||
UserDefinedOptions as PurgeCSSUserDefinedOptions, | ||
RawContent | ||
} from "purgecss"; | ||
|
||
export interface RawContent<T = string> { | ||
extension: string; | ||
raw: T; | ||
} | ||
export interface RawCSS { | ||
raw: string; | ||
} | ||
export type ExtractorFunction<T = string> = (content: T) => string[]; | ||
export interface Extractors { | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
} | ||
|
||
export interface UserDefinedOptions { | ||
content?: Array<string | RawContent>; | ||
/** | ||
* {@inheritDoc purgecss#UserDefinedOptions} | ||
* | ||
* @public | ||
*/ | ||
export interface UserDefinedOptions extends Omit<PurgeCSSUserDefinedOptions, "css"> { | ||
contentFunction?: (sourceFile: string) => Array<string | RawContent>; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
output?: string; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
safelist?: UserDefinedSafelist; | ||
blocklist?: StringRegExpArray; | ||
skippedContentGlobs?: Array<string>; | ||
dynamicAttributes?: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,38 @@ | ||
import { ComplexSafelist, StringRegExpArray } from "purgecss"; | ||
import type { | ||
ComplexSafelist, | ||
StringRegExpArray, | ||
UserDefinedOptions as PurgeCSSUserDefinedOptions | ||
} from "purgecss"; | ||
|
||
export interface RawContent<T = string> { | ||
extension: string; | ||
raw: T; | ||
} | ||
export interface RawCSS { | ||
raw: string; | ||
} | ||
export type ExtractorFunction<T = string> = (content: T) => string[]; | ||
export interface Extractors { | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
} | ||
|
||
/** | ||
* @public | ||
*/ | ||
export type PathFunction = () => string[]; | ||
/** | ||
* @public | ||
*/ | ||
export type SafelistFunction = () => ComplexSafelist; | ||
/** | ||
* @public | ||
*/ | ||
export type BlocklistFunction = () => StringRegExpArray; | ||
|
||
export interface UserDefinedOptions { | ||
/** | ||
* @public | ||
*/ | ||
export type PurgedStats = { | ||
[index: string]: string[]; | ||
}; | ||
|
||
/** | ||
* @public | ||
*/ | ||
export type UserDefinedOptions = Omit<PurgeCSSUserDefinedOptions, "css" | "content" | "safelist" | "blocklist"> & { | ||
paths: string[] | PathFunction; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
moduleExtensions?: string[]; | ||
output?: string; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
verbose?: boolean; | ||
safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction; | ||
blocklist?: StringRegExpArray | BlocklistFunction; | ||
skippedContentGlobs?: Array<string>; | ||
dynamicAttributes?: string[]; | ||
safelist: PurgeCSSUserDefinedOptions['safelist'] | SafelistFunction; | ||
blocklist: PurgeCSSUserDefinedOptions['blocklist'] | BlocklistFunction; | ||
only?: string[]; | ||
} | ||
|
||
export type PurgedStats = { | ||
[index: string]: string[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,26 @@ | ||
import { StringRegExpArray, UserDefinedSafelist } from "purgecss"; | ||
|
||
export interface RawContent<T = string> { | ||
extension: string; | ||
raw: T; | ||
} | ||
export interface RawCSS { | ||
raw: string; | ||
} | ||
export type ExtractorFunction<T = string> = (content: T) => string[]; | ||
export interface Extractors { | ||
extensions: string[]; | ||
extractor: ExtractorFunction; | ||
} | ||
import type { | ||
RawContent, | ||
UserDefinedOptions as PurgeCSSUserDefinedOptions, | ||
} from "purgecss"; | ||
|
||
/** | ||
* @public | ||
*/ | ||
export type OutputFunction = (css: string, styles: string[]) => void; | ||
|
||
export interface UserDefinedOptions { | ||
content: Array<string | RawContent>; | ||
/** | ||
* {@inheritDoc purgecss#UserDefinedOptions} | ||
* | ||
* @public | ||
*/ | ||
export type UserDefinedOptions = Omit< | ||
PurgeCSSUserDefinedOptions, | ||
"css" | "output" | "rejectedCss" | ||
> & { | ||
contentFunction?: (sourceFile: string) => Array<string | RawContent>; | ||
defaultExtractor?: ExtractorFunction; | ||
extractors?: Array<Extractors>; | ||
fontFace?: boolean; | ||
keyframes?: boolean; | ||
output?: string | OutputFunction | boolean; | ||
rejected?: boolean; | ||
stdin?: boolean; | ||
stdout?: boolean; | ||
variables?: boolean; | ||
safelist?: UserDefinedSafelist; | ||
blocklist?: StringRegExpArray; | ||
skippedContentGlobs?: Array<string>; | ||
dynamicAttributes?: string[]; | ||
|
||
output: PurgeCSSUserDefinedOptions["output"] | OutputFunction | boolean; | ||
insert?: boolean; | ||
include?: string | RegExp | (string | RegExp)[]; | ||
exclude?: string | RegExp | (string | RegExp)[]; | ||
dest?: string; | ||
} | ||
}; |