@bamboocss/vite 1.28.1 → 1.29.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
@@ -1142,27 +1142,27 @@ const tokenValuesFor = (ctx) => {
1142
1142
  for (const token of ctx.tokens.allTokens) {
1143
1143
  const { varRef, isVirtual, condition } = token.extensions;
1144
1144
  values.set(token.name, {
1145
- value: isVirtual || condition !== "base" ? varRef : token.value,
1146
- variable: varRef
1145
+ value: ctx.tokens.view.get(token.name) ?? (isVirtual || condition !== "base" ? varRef : token.value),
1146
+ variable: ctx.tokens.view.getVar(token.name) ?? varRef
1147
1147
  });
1148
1148
  }
1149
1149
  tokenValues.set(ctx, values);
1150
1150
  return values;
1151
1151
  };
1152
- const createRuntimeToken = (ctx) => (path) => {
1152
+ const createRuntimeTokenValue = (ctx) => (path) => {
1153
1153
  const value = tokenValuesFor(ctx).get(path)?.value;
1154
1154
  return typeof value === "string" ? value : void 0;
1155
1155
  };
1156
1156
  /**
1157
- * The generated runtime's `token.var`, rebuilt in-process.
1157
+ * The generated runtime's `token()`, rebuilt in-process.
1158
1158
  *
1159
- * Mirrors `tokenVar` in `generateTokenJs`, which reads the `variable` half of the same
1160
- * entry `token()` reads the `value` half of. That half is `varRef` for every token
1161
- * regardless of condition, so unlike `createRuntimeToken` there is no split to get wrong
1162
- * and no non-string case to decline: a `var()` reference is a string or the token does not
1163
- * exist. Which is what makes this the more foldable of the two.
1159
+ * Reads the `variable` half of the same entry `token.value()` reads the `value` half of.
1160
+ * That half is `varRef` for every token regardless of condition, so unlike
1161
+ * `createRuntimeTokenValue` there is no split to get wrong and no non-string case to
1162
+ * decline: a `var()` reference is a string or the token does not exist. Which is what makes
1163
+ * the default form the trivially foldable one.
1164
1164
  */
1165
- const createRuntimeTokenVar = (ctx) => (path) => tokenValuesFor(ctx).get(path)?.variable || void 0;
1165
+ const createRuntimeToken = (ctx) => (path) => tokenValuesFor(ctx).get(path)?.variable || void 0;
1166
1166
  /**
1167
1167
  * Whether a slot's class is independent of the variant props.
1168
1168
  *
@@ -1628,7 +1628,7 @@ const foldSource = (options) => {
1628
1628
  const runtimeRecipe = createRuntimeRecipe(ctx);
1629
1629
  const isConstantSlot = createConstantSlotCheck(ctx);
1630
1630
  const runtimeToken = createRuntimeToken(ctx);
1631
- const runtimeTokenVar = createRuntimeTokenVar(ctx);
1631
+ const runtimeTokenValue = createRuntimeTokenValue(ctx);
1632
1632
  /**
1633
1633
  * Does this specifier name a module that exports the css API, exactly?
1634
1634
  *
@@ -1817,7 +1817,7 @@ const foldSource = (options) => {
1817
1817
  const name = item.name ?? type;
1818
1818
  if (!item.box) continue;
1819
1819
  const call = findCallExpression(item.box);
1820
- if (type === "token" || type === "tokenVar") {
1820
+ if (type === "token" || type === "tokenValue") {
1821
1821
  if (!call) {
1822
1822
  skipped.push({
1823
1823
  name,
@@ -1853,8 +1853,8 @@ const foldSource = (options) => {
1853
1853
  }
1854
1854
  const callee = ts_morph.Node.isCallExpression(call) ? call.getExpression() : void 0;
1855
1855
  const propertyName = ts_morph.Node.isPropertyAccessExpression(callee) ? callee.getNameNode().getText() : void 0;
1856
- const wantsVar = type === "tokenVar";
1857
- if (wantsVar !== (propertyName === "var")) {
1856
+ const wantsValue = type === "tokenValue";
1857
+ if (wantsValue !== (propertyName === "value")) {
1858
1858
  skipped.push({
1859
1859
  name,
1860
1860
  reason: "unsupported-kind",
@@ -1863,7 +1863,7 @@ const foldSource = (options) => {
1863
1863
  });
1864
1864
  continue;
1865
1865
  }
1866
- if (!wantsVar && propertyName !== void 0 && !ctx.imports.matchers.tokens.match(propertyName)) {
1866
+ if (!wantsValue && propertyName !== void 0 && propertyName !== "var" && !ctx.imports.matchers.tokens.match(propertyName)) {
1867
1867
  skipped.push({
1868
1868
  name,
1869
1869
  reason: "unsupported-kind",
@@ -1900,7 +1900,7 @@ const foldSource = (options) => {
1900
1900
  });
1901
1901
  continue;
1902
1902
  }
1903
- const value = wantsVar ? runtimeTokenVar(path) : runtimeToken(path);
1903
+ const value = wantsValue ? runtimeTokenValue(path) : runtimeToken(path);
1904
1904
  if (!value) {
1905
1905
  skipped.push({
1906
1906
  name,
package/dist/index.mjs CHANGED
@@ -1115,27 +1115,27 @@ const tokenValuesFor = (ctx) => {
1115
1115
  for (const token of ctx.tokens.allTokens) {
1116
1116
  const { varRef, isVirtual, condition } = token.extensions;
1117
1117
  values.set(token.name, {
1118
- value: isVirtual || condition !== "base" ? varRef : token.value,
1119
- variable: varRef
1118
+ value: ctx.tokens.view.get(token.name) ?? (isVirtual || condition !== "base" ? varRef : token.value),
1119
+ variable: ctx.tokens.view.getVar(token.name) ?? varRef
1120
1120
  });
1121
1121
  }
1122
1122
  tokenValues.set(ctx, values);
1123
1123
  return values;
1124
1124
  };
1125
- const createRuntimeToken = (ctx) => (path) => {
1125
+ const createRuntimeTokenValue = (ctx) => (path) => {
1126
1126
  const value = tokenValuesFor(ctx).get(path)?.value;
1127
1127
  return typeof value === "string" ? value : void 0;
1128
1128
  };
1129
1129
  /**
1130
- * The generated runtime's `token.var`, rebuilt in-process.
1130
+ * The generated runtime's `token()`, rebuilt in-process.
1131
1131
  *
1132
- * Mirrors `tokenVar` in `generateTokenJs`, which reads the `variable` half of the same
1133
- * entry `token()` reads the `value` half of. That half is `varRef` for every token
1134
- * regardless of condition, so unlike `createRuntimeToken` there is no split to get wrong
1135
- * and no non-string case to decline: a `var()` reference is a string or the token does not
1136
- * exist. Which is what makes this the more foldable of the two.
1132
+ * Reads the `variable` half of the same entry `token.value()` reads the `value` half of.
1133
+ * That half is `varRef` for every token regardless of condition, so unlike
1134
+ * `createRuntimeTokenValue` there is no split to get wrong and no non-string case to
1135
+ * decline: a `var()` reference is a string or the token does not exist. Which is what makes
1136
+ * the default form the trivially foldable one.
1137
1137
  */
1138
- const createRuntimeTokenVar = (ctx) => (path) => tokenValuesFor(ctx).get(path)?.variable || void 0;
1138
+ const createRuntimeToken = (ctx) => (path) => tokenValuesFor(ctx).get(path)?.variable || void 0;
1139
1139
  /**
1140
1140
  * Whether a slot's class is independent of the variant props.
1141
1141
  *
@@ -1601,7 +1601,7 @@ const foldSource = (options) => {
1601
1601
  const runtimeRecipe = createRuntimeRecipe(ctx);
1602
1602
  const isConstantSlot = createConstantSlotCheck(ctx);
1603
1603
  const runtimeToken = createRuntimeToken(ctx);
1604
- const runtimeTokenVar = createRuntimeTokenVar(ctx);
1604
+ const runtimeTokenValue = createRuntimeTokenValue(ctx);
1605
1605
  /**
1606
1606
  * Does this specifier name a module that exports the css API, exactly?
1607
1607
  *
@@ -1790,7 +1790,7 @@ const foldSource = (options) => {
1790
1790
  const name = item.name ?? type;
1791
1791
  if (!item.box) continue;
1792
1792
  const call = findCallExpression(item.box);
1793
- if (type === "token" || type === "tokenVar") {
1793
+ if (type === "token" || type === "tokenValue") {
1794
1794
  if (!call) {
1795
1795
  skipped.push({
1796
1796
  name,
@@ -1826,8 +1826,8 @@ const foldSource = (options) => {
1826
1826
  }
1827
1827
  const callee = Node.isCallExpression(call) ? call.getExpression() : void 0;
1828
1828
  const propertyName = Node.isPropertyAccessExpression(callee) ? callee.getNameNode().getText() : void 0;
1829
- const wantsVar = type === "tokenVar";
1830
- if (wantsVar !== (propertyName === "var")) {
1829
+ const wantsValue = type === "tokenValue";
1830
+ if (wantsValue !== (propertyName === "value")) {
1831
1831
  skipped.push({
1832
1832
  name,
1833
1833
  reason: "unsupported-kind",
@@ -1836,7 +1836,7 @@ const foldSource = (options) => {
1836
1836
  });
1837
1837
  continue;
1838
1838
  }
1839
- if (!wantsVar && propertyName !== void 0 && !ctx.imports.matchers.tokens.match(propertyName)) {
1839
+ if (!wantsValue && propertyName !== void 0 && propertyName !== "var" && !ctx.imports.matchers.tokens.match(propertyName)) {
1840
1840
  skipped.push({
1841
1841
  name,
1842
1842
  reason: "unsupported-kind",
@@ -1873,7 +1873,7 @@ const foldSource = (options) => {
1873
1873
  });
1874
1874
  continue;
1875
1875
  }
1876
- const value = wantsVar ? runtimeTokenVar(path) : runtimeToken(path);
1876
+ const value = wantsValue ? runtimeTokenValue(path) : runtimeToken(path);
1877
1877
  if (!value) {
1878
1878
  skipped.push({
1879
1879
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.28.1",
3
+ "version": "1.29.0",
4
4
  "description": "Vite integration for Bamboo CSS",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -37,18 +37,18 @@
37
37
  "dependencies": {
38
38
  "magic-string": "0.30.21",
39
39
  "ts-morph": "28.0.0",
40
- "@bamboocss/config": "1.28.1",
41
- "@bamboocss/core": "1.28.1",
42
- "@bamboocss/logger": "1.28.1",
43
- "@bamboocss/node": "1.28.1",
44
- "@bamboocss/extractor": "1.28.1",
45
- "@bamboocss/shared": "1.28.1",
46
- "@bamboocss/types": "1.28.1"
40
+ "@bamboocss/config": "1.29.0",
41
+ "@bamboocss/core": "1.29.0",
42
+ "@bamboocss/extractor": "1.29.0",
43
+ "@bamboocss/logger": "1.29.0",
44
+ "@bamboocss/node": "1.29.0",
45
+ "@bamboocss/types": "1.29.0",
46
+ "@bamboocss/shared": "1.29.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@jridgewell/trace-mapping": "^0.3.31",
50
50
  "vite": "7.2.6",
51
- "@bamboocss/fixture": "1.28.1"
51
+ "@bamboocss/fixture": "1.29.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "vite": ">=5"