From d7ec348412ce416203d0212439447aef374e9fc5 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 8 Mar 2024 12:07:12 +0100 Subject: [PATCH] rename `parseAstNode` to `compileAstNodes` --- packages/tailwindcss/src/compile.ts | 4 ++-- packages/tailwindcss/src/design-system.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/tailwindcss/src/compile.ts b/packages/tailwindcss/src/compile.ts index 19629af42..deca45e85 100644 --- a/packages/tailwindcss/src/compile.ts +++ b/packages/tailwindcss/src/compile.ts @@ -37,7 +37,7 @@ export function compileCandidates( // Create the AST next: for (let [candidate, rawCandidate] of candidates) { - let astNode = designSystem.parseAstNode(rawCandidate) + let astNode = designSystem.compileAstNodes(rawCandidate) if (astNode === null) { if (throwOnInvalidCandidate) { throw new Error(`Cannot apply unknown utility class: ${rawCandidate}`) @@ -103,7 +103,7 @@ export function compileCandidates( } } -export function parseAstNodes(rawCandidate: string, designSystem: DesignSystem) { +export function compileAstNodes(rawCandidate: string, designSystem: DesignSystem) { let candidate = designSystem.parseCandidate(rawCandidate) if (candidate === null) return null diff --git a/packages/tailwindcss/src/design-system.ts b/packages/tailwindcss/src/design-system.ts index 55d29e51c..dd844a4f5 100644 --- a/packages/tailwindcss/src/design-system.ts +++ b/packages/tailwindcss/src/design-system.ts @@ -1,6 +1,6 @@ import { toCss } from './ast' import { parseCandidate, parseVariant } from './candidate' -import { compileCandidates, parseAstNodes as parseAstNode } from './compile' +import { compileAstNodes, compileCandidates } from './compile' import { getClassList, getVariants, type ClassEntry, type VariantEntry } from './intellisense' import { getClassOrder } from './sort' import type { Theme } from './theme' @@ -20,7 +20,7 @@ export type DesignSystem = { parseCandidate(candidate: string): ReturnType parseVariant(variant: string): ReturnType - parseAstNode(candidate: string): ReturnType + compileAstNodes(candidate: string): ReturnType getUsedVariants(): ReturnType[] getAstNodeSize(): number @@ -35,7 +35,7 @@ export function buildDesignSystem(theme: Theme): DesignSystem { let parsedVariants = new DefaultMap((variant) => parseVariant(variant, designSystem)) let parsedCandidates = new DefaultMap((candidate) => parseCandidate(candidate, designSystem)) - let parsedAstNodes = new DefaultMap((candidate) => parseAstNode(candidate, designSystem)) + let compiledAstNodes = new DefaultMap((candidate) => compileAstNodes(candidate, designSystem)) let designSystem: DesignSystem = { theme, @@ -74,14 +74,14 @@ export function buildDesignSystem(theme: Theme): DesignSystem { parseVariant(variant: string) { return parsedVariants.get(variant) }, - parseAstNode(candidate: string) { - return parsedAstNodes.get(candidate) + compileAstNodes(candidate: string) { + return compiledAstNodes.get(candidate) }, getUsedVariants() { return Array.from(parsedVariants.values()) }, getAstNodeSize() { - return parsedAstNodes.size + return compiledAstNodes.size }, }