Skip to content

Commit

Permalink
chore: cleanup unnecessary cssVarsMapping passing
Browse files Browse the repository at this point in the history
  • Loading branch information
idoros committed Oct 24, 2023
1 parent 3350e0e commit 9ceb2ff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
1 change: 0 additions & 1 deletion packages/core/src/features/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export interface FeatureHooks<T extends NodeTypes = NodeTypes> {
context: FeatureTransformContext;
ast: postcss.Root;
transformer: StylableTransformer;
cssVarsMapping: Record<string, string>;
path: string[];
}) => void;
}
Expand Down
11 changes: 4 additions & 7 deletions packages/core/src/features/st-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export const hooks = createFeature({
}
return isMarker;
},
transformLastPass({ context, ast, transformer, cssVarsMapping, path }) {
ast.walkRules((rule) => appendMixins(context, transformer, rule, cssVarsMapping, path));
transformLastPass({ context, ast, transformer, path }) {
ast.walkRules((rule) => appendMixins(context, transformer, rule, path));
},
});

Expand Down Expand Up @@ -212,7 +212,6 @@ function appendMixins(
context: FeatureTransformContext,
transformer: StylableTransformer,
rule: postcss.Rule,
cssPropertyMapping: Record<string, string>,
path: string[] = []
) {
const [decls, mixins] = collectRuleMixins(context, rule);
Expand All @@ -221,7 +220,7 @@ function appendMixins(
}
for (const mixin of mixins) {
if (mixin.valid) {
appendMixin(context, { transformer, mixDef: mixin, rule, path, cssPropertyMapping });
appendMixin(context, { transformer, mixDef: mixin, rule, path });
}
}
for (const mixinDecl of decls) {
Expand Down Expand Up @@ -359,7 +358,6 @@ interface ApplyMixinContext {
mixDef: AnalyzedMixin & { valid: true };
rule: postcss.Rule;
path: string[];
cssPropertyMapping: Record<string, string>;
}

function appendMixin(context: FeatureTransformContext, config: ApplyMixinContext) {
Expand Down Expand Up @@ -475,8 +473,7 @@ function handleCSSMixin(
context.diagnostics,
mixDef.data.originDecl,
stVarOverride,
config.path,
config.cssPropertyMapping
config.path
);
collectOptionalArgs(
{ meta: resolved.meta, resolver: context.resolver },
Expand Down
11 changes: 1 addition & 10 deletions packages/core/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export interface EvalValueData {
node?: postcss.Node;
meta: StylableMeta;
stVarOverride?: Record<string, string> | null;
cssVarsMapping?: Record<string, string>;
args?: string[];
rootArgument?: string;
initialNode?: postcss.Node;
Expand Down Expand Up @@ -63,7 +62,6 @@ export class StylableEvaluator {
this.valueHook,
context.diagnostics,
context.passedThrough,
data.cssVarsMapping,
data.args,
data.rootArgument,
data.initialNode
Expand Down Expand Up @@ -94,8 +92,7 @@ export function resolveArgumentsValue(
diagnostics: Diagnostics,
node: postcss.Node,
variableOverride?: Record<string, string>,
path?: string[],
cssVarsMapping?: Record<string, string>
path?: string[]
) {
const resolvedArgs = {} as Record<string, string>;
for (const k in options) {
Expand All @@ -108,7 +105,6 @@ export function resolveArgumentsValue(
transformer.replaceValueHook,
diagnostics,
path,
cssVarsMapping,
undefined
);
}
Expand All @@ -125,7 +121,6 @@ export function processDeclarationValue(
valueHook?: replaceValueHook,
diagnostics: Diagnostics = new Diagnostics(),
passedThrough: string[] = [],
cssVarsMapping: Record<string, string> = {},
args: string[] = [],
rootArgument?: string,
initialNode?: postcss.Node
Expand Down Expand Up @@ -155,7 +150,6 @@ export function processDeclarationValue(
node,
meta,
stVarOverride: variableOverride,
cssVarsMapping,
args,
rootArgument,
initialNode,
Expand Down Expand Up @@ -228,7 +222,6 @@ export function processDeclarationValue(
node,
meta,
stVarOverride: variableOverride,
cssVarsMapping,
args,
rootArgument,
initialNode,
Expand Down Expand Up @@ -312,7 +305,6 @@ export function evalDeclarationValue(
valueHook?: replaceValueHook,
diagnostics?: Diagnostics,
passedThrough: string[] = [],
cssVarsMapping?: Record<string, string>,
args: string[] = [],
getResolvedSymbols: (meta: StylableMeta) => MetaResolvedSymbols = createSymbolResolverWithCache(
resolver,
Expand All @@ -329,7 +321,6 @@ export function evalDeclarationValue(
valueHook,
diagnostics,
passedThrough,
cssVarsMapping,
args
).outputValue;
}
2 changes: 0 additions & 2 deletions packages/core/src/stylable-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ export class StylableTransformer {
value: decl.value,
meta,
node: decl,
cssVarsMapping: cssVarsMapping.localToGlobal,
}).outputValue;
};

Expand Down Expand Up @@ -354,7 +353,6 @@ export class StylableTransformer {
context: transformContext,
ast,
transformer: this,
cssVarsMapping: cssVarsMapping.localToGlobal,
path,
};
if (this.experimentalSelectorInference) {
Expand Down

0 comments on commit 9ceb2ff

Please sign in to comment.