Skip to content

Commit c58ab68

Browse files
committed
Declare RTLCSSPlugin and rename the property of PluginOptionsNormalized
1 parent da716f8 commit c58ab68

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/@types/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ export interface PluginStringMap {
3939
replace: strings;
4040
}
4141

42+
export type RTLCSSPlugin = {
43+
name: string;
44+
priority: number;
45+
directives: {
46+
control: Object,
47+
value: Array<Object>
48+
};
49+
}
50+
4251
export interface DeclarationPluginProcessor {
4352
expr: RegExp;
4453
action: (prop: string, value: string, context: object) => object;
@@ -72,8 +81,9 @@ export interface PluginOptions {
7281
processDeclarationPlugins?: DeclarationPlugin[];
7382
}
7483

75-
export interface PluginOptionsNormalized extends Omit<Required<PluginOptions>, 'stringMap' | 'prefixSelectorTransformer'> {
84+
export interface PluginOptionsNormalized extends Omit<Required<PluginOptions>, 'stringMap' | 'processDeclarationPlugins' | 'prefixSelectorTransformer'> {
7685
stringMap: StringMap[];
86+
plugins: RTLCSSPlugin[];
7787
prefixSelectorTransformer: PrefixSelectorTransformer | null;
7888
}
7989

src/data/store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const defaultOptions = (): PluginOptionsNormalized => ({
160160
stringMap: getRTLCSSStringMap(defaultStringMap),
161161
greedy: false,
162162
aliases: {},
163-
processDeclarationPlugins: []
163+
plugins: []
164164
});
165165

166166
const store: Store = {
@@ -232,7 +232,7 @@ const normalizeOptions = (options: PluginOptions): PluginOptionsNormalized => {
232232
});
233233
}
234234
if (isAcceptedProcessDeclarationPlugins(options.processDeclarationPlugins)) {
235-
returnOptions.processDeclarationPlugins = options.processDeclarationPlugins.map(plugin => ({
235+
returnOptions.plugins = options.processDeclarationPlugins.map(plugin => ({
236236
...plugin, directives: {control: {}, value: []},
237237
}));
238238
}

src/parsers/declarations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const parseDeclarations = (
6060
stringMap,
6161
greedy,
6262
aliases,
63-
processDeclarationPlugins
63+
plugins
6464
} = store.options;
6565

6666
const deleteDeclarations: Declaration[] = [];
@@ -161,7 +161,7 @@ export const parseDeclarations = (
161161
stringMap,
162162
greedy,
163163
aliases
164-
}, processDeclarationPlugins);
164+
}, plugins);
165165

166166
/* the source could be undefined in certain cases but not during the tests */
167167
/* istanbul ignore next */

0 commit comments

Comments
 (0)