@bamboocss/vite 1.17.2 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -693,9 +693,9 @@ const createCssContext = (ctx) => ({
693
693
  });
694
694
  const createRuntimeCss = (ctx) => {
695
695
  const cssContext = createCssContext(ctx);
696
- const cssFn = (0, _bamboocss_shared.createCss)(cssContext);
697
- const { mergeCss } = (0, _bamboocss_shared.createMergeCss)(cssContext);
698
- return (...styles) => cssFn(mergeCss(...styles));
696
+ const cssFn = (0, _bamboocss_shared.createCssUncached)(cssContext);
697
+ const { mergeCssUncached } = (0, _bamboocss_shared.createMergeCss)(cssContext);
698
+ return (0, _bamboocss_shared.memo)((...styles) => cssFn(mergeCssUncached(...styles)));
699
699
  };
700
700
  /**
701
701
  * The map is every token in the project, so it is built once per context and shared by
@@ -748,7 +748,7 @@ const createRuntimeRecipe = (ctx) => {
748
748
  const className = slot ? ctx.recipes.getSlotKey(node.className, slot) : node.className;
749
749
  const { defaultVariants = {} } = config;
750
750
  const compoundVariants = slot ? (0, _bamboocss_shared.getSlotCompoundVariant)(config.compoundVariants ?? [], slot) : config.compoundVariants ?? [];
751
- const recipeCss = (0, _bamboocss_shared.createCss)({
751
+ const recipeCss = (0, _bamboocss_shared.createCssUncached)({
752
752
  hash: Boolean(ctx.hash.className),
753
753
  conditions: {
754
754
  shift: ctx.conditions.shift,
package/dist/index.d.cts CHANGED
@@ -18,8 +18,10 @@ import { Plugin } from "vite";
18
18
  * construction. What still needs asserting — and is asserted in `__tests__` — is that
19
19
  * these class names correspond to rules the build actually emits.
20
20
  *
21
- * Mirrors `generateCssFn` in `@bamboocss/generator`: `css = (...styles) =>
22
- * cssFn(mergeCss(...styles))`.
21
+ * Mirrors `generateCssFn` in `@bamboocss/generator`: `css = memo((...styles) =>
22
+ * cssFn(mergeCssUncached(...styles)))`, with the memo on the argument list and neither
23
+ * inner cache. Unlike the generated runtime this one is built once per build and shared
24
+ * across every module, so the outer cache is what carries the repeats.
23
25
  */
24
26
  interface RuntimeCss {
25
27
  (...styles: Dict[]): string;
package/dist/index.d.mts CHANGED
@@ -18,8 +18,10 @@ import { Plugin } from "vite";
18
18
  * construction. What still needs asserting — and is asserted in `__tests__` — is that
19
19
  * these class names correspond to rules the build actually emits.
20
20
  *
21
- * Mirrors `generateCssFn` in `@bamboocss/generator`: `css = (...styles) =>
22
- * cssFn(mergeCss(...styles))`.
21
+ * Mirrors `generateCssFn` in `@bamboocss/generator`: `css = memo((...styles) =>
22
+ * cssFn(mergeCssUncached(...styles)))`, with the memo on the argument list and neither
23
+ * inner cache. Unlike the generated runtime this one is built once per build and shared
24
+ * across every module, so the outer cache is what carries the repeats.
23
25
  */
24
26
  interface RuntimeCss {
25
27
  (...styles: Dict[]): string;
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { box, maybeBoxNode, unbox } from "@bamboocss/extractor";
3
3
  import MagicString from "magic-string";
4
4
  import { Node, SyntaxKind, VariableDeclarationKind } from "ts-morph";
5
5
  import { Recipes } from "@bamboocss/core";
6
- import { compact, createCss, createMergeCss, getSlotCompoundVariant, withoutSpace } from "@bamboocss/shared";
6
+ import { compact, createCssUncached, createMergeCss, getSlotCompoundVariant, memo, withoutSpace } from "@bamboocss/shared";
7
7
  import { resolve } from "node:path";
8
8
  import { logger } from "@bamboocss/logger";
9
9
  import { loadConfigAndCreateContext } from "@bamboocss/node";
@@ -666,9 +666,9 @@ const createCssContext = (ctx) => ({
666
666
  });
667
667
  const createRuntimeCss = (ctx) => {
668
668
  const cssContext = createCssContext(ctx);
669
- const cssFn = createCss(cssContext);
670
- const { mergeCss } = createMergeCss(cssContext);
671
- return (...styles) => cssFn(mergeCss(...styles));
669
+ const cssFn = createCssUncached(cssContext);
670
+ const { mergeCssUncached } = createMergeCss(cssContext);
671
+ return memo((...styles) => cssFn(mergeCssUncached(...styles)));
672
672
  };
673
673
  /**
674
674
  * The map is every token in the project, so it is built once per context and shared by
@@ -721,7 +721,7 @@ const createRuntimeRecipe = (ctx) => {
721
721
  const className = slot ? ctx.recipes.getSlotKey(node.className, slot) : node.className;
722
722
  const { defaultVariants = {} } = config;
723
723
  const compoundVariants = slot ? getSlotCompoundVariant(config.compoundVariants ?? [], slot) : config.compoundVariants ?? [];
724
- const recipeCss = createCss({
724
+ const recipeCss = createCssUncached({
725
725
  hash: Boolean(ctx.hash.className),
726
726
  conditions: {
727
727
  shift: ctx.conditions.shift,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "description": "Vite integration for Bamboo CSS",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -35,18 +35,18 @@
35
35
  "dependencies": {
36
36
  "magic-string": "0.30.21",
37
37
  "ts-morph": "28.0.0",
38
- "@bamboocss/config": "1.17.2",
39
- "@bamboocss/core": "1.17.2",
40
- "@bamboocss/extractor": "1.17.2",
41
- "@bamboocss/logger": "1.17.2",
42
- "@bamboocss/node": "1.17.2",
43
- "@bamboocss/shared": "1.17.2",
44
- "@bamboocss/types": "1.17.2"
38
+ "@bamboocss/config": "1.18.0",
39
+ "@bamboocss/extractor": "1.18.0",
40
+ "@bamboocss/core": "1.18.0",
41
+ "@bamboocss/node": "1.18.0",
42
+ "@bamboocss/logger": "1.18.0",
43
+ "@bamboocss/shared": "1.18.0",
44
+ "@bamboocss/types": "1.18.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jridgewell/trace-mapping": "^0.3.31",
48
48
  "vite": "7.2.6",
49
- "@bamboocss/fixture": "1.17.2"
49
+ "@bamboocss/fixture": "1.18.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "vite": ">=5"