From 1f636eb0fedf9740cdf369c034307704a9a49415 Mon Sep 17 00:00:00 2001 From: Alexandre Stahmer <47224540+astahmer@users.noreply.github.com> Date: Tue, 21 May 2024 14:27:03 +0200 Subject: [PATCH] chore: rm CacheMap usage - fix HMR in some setups (#2612) * chore: rm CacheMap in Utility * chore: rm CacheMap usage everywhere for now --- .changeset/strong-ravens-hope.md | 7 +++++++ packages/core/src/style-decoder.ts | 7 +++---- packages/core/src/utility.ts | 5 ++--- packages/node/src/builder.ts | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .changeset/strong-ravens-hope.md diff --git a/.changeset/strong-ravens-hope.md b/.changeset/strong-ravens-hope.md new file mode 100644 index 000000000..2c581c2a5 --- /dev/null +++ b/.changeset/strong-ravens-hope.md @@ -0,0 +1,7 @@ +--- +"@pandacss/shared": patch +"@pandacss/core": patch +"@pandacss/node": patch +--- + +Fix a cache issue that leads to HMR growing slower in some cases diff --git a/packages/core/src/style-decoder.ts b/packages/core/src/style-decoder.ts index 4fef75e79..44c74611d 100644 --- a/packages/core/src/style-decoder.ts +++ b/packages/core/src/style-decoder.ts @@ -1,5 +1,4 @@ import { - CacheMap, PandaError, deepSet, esc, @@ -29,9 +28,9 @@ export class StyleDecoder { classNames = new Map() // - atomic_cache = new CacheMap() - group_cache = new CacheMap() - recipe_base_cache = new CacheMap() + atomic_cache = new Map() + group_cache = new Map() + recipe_base_cache = new Map() // atomic = new Set() // diff --git a/packages/core/src/utility.ts b/packages/core/src/utility.ts index 699510dd5..dd06ab18b 100644 --- a/packages/core/src/utility.ts +++ b/packages/core/src/utility.ts @@ -1,5 +1,4 @@ import { - CacheMap, compact, getArbitraryValue, hypenateProperty, @@ -43,12 +42,12 @@ export class Utility { /** * [cache] The map of property names to their resolved class names */ - classNames = new CacheMap() + classNames = new Map() /** * [cache] The map of the property to their resolved styless */ - styles = new CacheMap() + styles = new Map() /** * Map of shorthand properties to their longhand properties diff --git a/packages/node/src/builder.ts b/packages/node/src/builder.ts index ce258d639..de07e7f94 100644 --- a/packages/node/src/builder.ts +++ b/packages/node/src/builder.ts @@ -1,7 +1,7 @@ import { findConfig, getConfigDependencies } from '@pandacss/config' import { optimizeCss } from '@pandacss/core' import { logger } from '@pandacss/logger' -import { CacheMap, PandaError, uniq } from '@pandacss/shared' +import { PandaError, uniq } from '@pandacss/shared' import type { DiffConfigResult } from '@pandacss/types' import { existsSync, statSync } from 'fs' import { normalize, resolve } from 'path' @@ -11,7 +11,7 @@ import { loadConfigAndCreateContext } from './config' import { PandaContext } from './create-context' import { parseDependency } from './parse-dependency' -const fileModifiedMap = new CacheMap() +const fileModifiedMap = new Map() interface FileChanges { changes: Map