Skip to content

Commit

Permalink
feat(processor-utils): pass extensions option to processors (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anber authored Apr 25, 2024
1 parent 90574f0 commit 21f175c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/nasty-eagles-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@wyw-in-js/processor-utils': patch
'@wyw-in-js/transform': patch
'wyw-in-js': patch
---

Pass `extensions` option to processors
1 change: 1 addition & 0 deletions packages/processor-utils/src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ClassNameFn, VariableNameFn } from '@wyw-in-js/shared';
export interface IOptions {
classNameSlug?: string | ClassNameFn;
displayName: boolean;
extensions?: string[];
variableNameConfig?: 'var' | 'dashes' | 'raw';
variableNameSlug?: string | VariableNameFn;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/transform/src/plugins/collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function collector(
file: BabelFile,
options: Pick<
StrictOptions,
'classNameSlug' | 'displayName' | 'evaluate' | 'tagResolver'
'classNameSlug' | 'displayName' | 'extensions' | 'evaluate' | 'tagResolver'
> & { eventEmitter?: EventEmitter },
values: ValueCache
) {
Expand Down
7 changes: 6 additions & 1 deletion packages/transform/src/plugins/preeval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import { invalidateTraversalCache } from '../utils/traversalCache';

export type PreevalOptions = Pick<
StrictOptions,
'classNameSlug' | 'displayName' | 'evaluate' | 'features' | 'tagResolver'
| 'classNameSlug'
| 'displayName'
| 'extensions'
| 'evaluate'
| 'features'
| 'tagResolver'
> & { eventEmitter?: EventEmitter };

export function preeval(
Expand Down
4 changes: 2 additions & 2 deletions packages/transform/src/utils/getTagProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ function createProcessorInstance(
fileContext: IFileContext,
options: Pick<
StrictOptions,
'classNameSlug' | 'displayName' | 'evaluate' | 'tagResolver'
'classNameSlug' | 'displayName' | 'extensions' | 'evaluate' | 'tagResolver'
>
): BaseProcessor | null {
const cache = getTraversalCache<BaseProcessor | null, Identifier>(
Expand Down Expand Up @@ -508,7 +508,7 @@ export function applyProcessors(
fileContext: IFileContext,
options: Pick<
StrictOptions,
'classNameSlug' | 'displayName' | 'evaluate' | 'tagResolver'
'classNameSlug' | 'displayName' | 'extensions' | 'evaluate' | 'tagResolver'
>,
callback: (processor: BaseProcessor) => void
) {
Expand Down

0 comments on commit 21f175c

Please sign in to comment.