@bamboocss/vite 1.55.0 → 1.55.1

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.
@@ -1115,6 +1115,7 @@ const FOLDABLE_TYPES = new Set([
1115
1115
  */
1116
1116
  const SURVIVES_TO_RUNTIME = new Set([
1117
1117
  "dynamic",
1118
+ "opaque-composition",
1118
1119
  "runtime-binding",
1119
1120
  "raw-call",
1120
1121
  "unsupported-kind",
@@ -2056,19 +2057,29 @@ const foldSource = (options) => {
2056
2057
  supported = false;
2057
2058
  break;
2058
2059
  }
2059
- if (dynamic.length > 1) {
2060
- skipped.push({
2061
- name: "cx",
2062
- reason: "dynamic",
2063
- start: call.getStart(),
2064
- end: call.getEnd()
2065
- });
2066
- continue;
2067
- }
2068
- if (!supported) {
2060
+ if (!supported || dynamic.length > 1) {
2061
+ /**
2062
+ * Does this argument carry declarations Bamboo compiled?
2063
+ *
2064
+ * Only the candidate half of `take`, because the other half is already known here:
2065
+ * `take` returned false, which happens precisely when an argument is opaque. What is
2066
+ * missing after that abort is whether a *later* argument was one of ours, which the
2067
+ * partially populated `matched`/`dynamic` lists cannot answer — the walk stops at the
2068
+ * first thing it cannot take, and everything after it is unvisited.
2069
+ *
2070
+ * Declared inside the branch so the common path — every `cx()` that compiles — does
2071
+ * not allocate a closure it never calls. The fold runs on every module of every dev
2072
+ * transform, so per-call-site work here is not free.
2073
+ */
2074
+ const composesStyleSet = (arg) => {
2075
+ const candidate = byRange.get(`${arg.getStart()}:${arg.getEnd()}`);
2076
+ if (candidate?.styleSet || candidate?.styleMap?.outputKind === "class" || candidate?.replacement) return true;
2077
+ return _bamboocss_ts_ast.Node.isArrayLiteralExpression(arg) && arg.elements.some(composesStyleSet);
2078
+ };
2079
+ const mixed = !supported && ((0, _bamboocss_ts_ast.childOf)(call, "arguments") ?? []).some(composesStyleSet);
2069
2080
  skipped.push({
2070
2081
  name: "cx",
2071
- reason: "dynamic",
2082
+ reason: mixed ? "opaque-composition" : "dynamic",
2072
2083
  start: call.getStart(),
2073
2084
  end: call.getEnd()
2074
2085
  });
@@ -1113,6 +1113,7 @@ const FOLDABLE_TYPES = new Set([
1113
1113
  */
1114
1114
  const SURVIVES_TO_RUNTIME = new Set([
1115
1115
  "dynamic",
1116
+ "opaque-composition",
1116
1117
  "runtime-binding",
1117
1118
  "raw-call",
1118
1119
  "unsupported-kind",
@@ -2054,19 +2055,29 @@ const foldSource = (options) => {
2054
2055
  supported = false;
2055
2056
  break;
2056
2057
  }
2057
- if (dynamic.length > 1) {
2058
- skipped.push({
2059
- name: "cx",
2060
- reason: "dynamic",
2061
- start: call.getStart(),
2062
- end: call.getEnd()
2063
- });
2064
- continue;
2065
- }
2066
- if (!supported) {
2058
+ if (!supported || dynamic.length > 1) {
2059
+ /**
2060
+ * Does this argument carry declarations Bamboo compiled?
2061
+ *
2062
+ * Only the candidate half of `take`, because the other half is already known here:
2063
+ * `take` returned false, which happens precisely when an argument is opaque. What is
2064
+ * missing after that abort is whether a *later* argument was one of ours, which the
2065
+ * partially populated `matched`/`dynamic` lists cannot answer — the walk stops at the
2066
+ * first thing it cannot take, and everything after it is unvisited.
2067
+ *
2068
+ * Declared inside the branch so the common path — every `cx()` that compiles — does
2069
+ * not allocate a closure it never calls. The fold runs on every module of every dev
2070
+ * transform, so per-call-site work here is not free.
2071
+ */
2072
+ const composesStyleSet = (arg) => {
2073
+ const candidate = byRange.get(`${arg.getStart()}:${arg.getEnd()}`);
2074
+ if (candidate?.styleSet || candidate?.styleMap?.outputKind === "class" || candidate?.replacement) return true;
2075
+ return Node.isArrayLiteralExpression(arg) && arg.elements.some(composesStyleSet);
2076
+ };
2077
+ const mixed = !supported && (childOf(call, "arguments") ?? []).some(composesStyleSet);
2067
2078
  skipped.push({
2068
2079
  name: "cx",
2069
- reason: "dynamic",
2080
+ reason: mixed ? "opaque-composition" : "dynamic",
2070
2081
  start: call.getStart(),
2071
2082
  end: call.getEnd()
2072
2083
  });
package/dist/index.cjs CHANGED
@@ -1127,7 +1127,8 @@ const bamboocss = (options = {}) => {
1127
1127
  "overlapping",
1128
1128
  "unresolved-token",
1129
1129
  "runtime-binding",
1130
- "compile-failed"
1130
+ "compile-failed",
1131
+ "opaque-composition"
1131
1132
  ]);
1132
1133
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1133
1134
  const isNonNegativeInteger = (value) => Number.isSafeInteger(value) && value >= 0;
@@ -2609,7 +2610,7 @@ const bamboocss = (options = {}) => {
2609
2610
  const survivorsHere = [];
2610
2611
  for (const entry of result.skipped) {
2611
2612
  if (entry.reason === "not-imported" || entry.reason === "overlapping") continue;
2612
- if (entry.name === "cx" && entry.reason === "dynamic") continue;
2613
+ if (entry.name === "cx" && (entry.reason === "dynamic" || entry.reason === "opaque-composition")) continue;
2613
2614
  survivorsHere.push({
2614
2615
  line: lineAt(code, entry.start),
2615
2616
  name: entry.name,
package/dist/index.mjs CHANGED
@@ -1122,7 +1122,8 @@ const bamboocss = (options = {}) => {
1122
1122
  "overlapping",
1123
1123
  "unresolved-token",
1124
1124
  "runtime-binding",
1125
- "compile-failed"
1125
+ "compile-failed",
1126
+ "opaque-composition"
1126
1127
  ]);
1127
1128
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1128
1129
  const isNonNegativeInteger = (value) => Number.isSafeInteger(value) && value >= 0;
@@ -2604,7 +2605,7 @@ const bamboocss = (options = {}) => {
2604
2605
  const survivorsHere = [];
2605
2606
  for (const entry of result.skipped) {
2606
2607
  if (entry.reason === "not-imported" || entry.reason === "overlapping") continue;
2607
- if (entry.name === "cx" && entry.reason === "dynamic") continue;
2608
+ if (entry.name === "cx" && (entry.reason === "dynamic" || entry.reason === "opaque-composition")) continue;
2608
2609
  survivorsHere.push({
2609
2610
  line: lineAt(code, entry.start),
2610
2611
  name: entry.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.55.0",
3
+ "version": "1.55.1",
4
4
  "description": "Vite integration for Bamboo CSS",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -42,20 +42,20 @@
42
42
  "magic-string": "0.30.21",
43
43
  "postcss": "8.5.26",
44
44
  "postcss-selector-parser": "7.1.5",
45
- "@bamboocss/config": "1.55.0",
46
- "@bamboocss/extractor": "1.55.0",
47
- "@bamboocss/core": "1.55.0",
48
- "@bamboocss/node": "1.55.0",
49
- "@bamboocss/logger": "1.55.0",
50
- "@bamboocss/types": "1.55.0",
51
- "@bamboocss/shared": "1.55.0",
52
- "@bamboocss/ts-ast": "1.55.0"
45
+ "@bamboocss/config": "1.55.1",
46
+ "@bamboocss/core": "1.55.1",
47
+ "@bamboocss/extractor": "1.55.1",
48
+ "@bamboocss/logger": "1.55.1",
49
+ "@bamboocss/node": "1.55.1",
50
+ "@bamboocss/ts-ast": "1.55.1",
51
+ "@bamboocss/shared": "1.55.1",
52
+ "@bamboocss/types": "1.55.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@jridgewell/trace-mapping": "^0.3.31",
56
56
  "@typescript/api": "npm:typescript@7.1.0-dev.20260826.1",
57
57
  "vite": "7.2.6",
58
- "@bamboocss/fixture": "1.55.0"
58
+ "@bamboocss/fixture": "1.55.1"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "vite": ">=5"