@bamboocss/node 1.64.4 → 1.64.5

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
@@ -4212,7 +4212,6 @@ var BambooContext = class extends _bamboocss_generator.Generator {
4212
4212
  pattern,
4213
4213
  paths: values
4214
4214
  })),
4215
- tokens: this.nativeTokens,
4216
4215
  cssModules: this.imports.value.css,
4217
4216
  tokenModules: this.imports.value.tokens,
4218
4217
  recipeModules: this.imports.value.recipe,
@@ -4221,21 +4220,24 @@ var BambooContext = class extends _bamboocss_generator.Generator {
4221
4220
  patternNames: this.patterns.keys,
4222
4221
  references: options.references,
4223
4222
  classPrefix: this.utility.prefix || void 0
4224
- });
4223
+ }, this.nativeTokens);
4225
4224
  };
4226
4225
  /**
4227
- * The token table as the native evaluator reads it.
4226
+ * The token table as the native evaluator reads it, converted into the native engine once per
4227
+ * context and handed to each call from then on.
4228
4228
  *
4229
- * Built once per context rather than per call: `compileModules` runs once per transformed
4230
- * module, and the table is every token in the project — rebuilding it priced the whole
4231
- * dictionary into every file, most of which never call `token()`.
4229
+ * `compileModules` runs once per transformed module, and the table is every token in the
4230
+ * project. Rebuilding it priced the whole dictionary into every file, most of which never call
4231
+ * `token()`, and so did handing it over built: each call converted it into Rust again, about
4232
+ * 0.44 µs a token — 0.9 ms a module under `preset-atlaskit`'s 1,655 tokens, several times what
4233
+ * analyzing most modules takes.
4232
4234
  */
4233
4235
  get nativeTokens() {
4234
- this.nativeTokenTable ??= this.tokens.allTokens.map((token) => ({
4236
+ this.nativeTokenTable ??= this.loadNativeExtractor().tokenTable(this.tokens.allTokens.map((token) => ({
4235
4237
  path: token.name,
4236
4238
  value: this.tokens.view.get(token.name),
4237
4239
  variable: this.tokens.view.getVar(token.name)
4238
- }));
4240
+ })));
4239
4241
  return this.nativeTokenTable;
4240
4242
  }
4241
4243
  nativeTokenTable;
@@ -4401,13 +4403,12 @@ var BambooContext = class extends _bamboocss_generator.Generator {
4401
4403
  pattern,
4402
4404
  paths: values
4403
4405
  })),
4404
- tokens: this.nativeTokens,
4405
4406
  jsx: this.jsx.isEnabled,
4406
4407
  classPrefix: this.utility.prefix || void 0
4407
4408
  };
4408
4409
  let analyses;
4409
4410
  try {
4410
- analyses = this.loadNativeExtractor().analyzeMany(sources, entrypoints, options);
4411
+ analyses = this.loadNativeExtractor().analyzeMany(sources, entrypoints, options, this.nativeTokens);
4411
4412
  } finally {
4412
4413
  this.nativePreparedSources.clear();
4413
4414
  }
package/dist/index.d.cts CHANGED
@@ -70,6 +70,11 @@ interface FoldCxArgument {
70
70
  /** For an argument of the call itself: it reads a Bamboo binding or a recipe, so it cannot be copied. */
71
71
  readsBamboo: boolean;
72
72
  }
73
+ interface FoldStyleBranch {
74
+ test: FoldSpan;
75
+ consequent: Record<string, unknown>;
76
+ alternate: Record<string, unknown>;
77
+ }
73
78
  interface FoldCall {
74
79
  name: string;
75
80
  kind: 'css' | 'pattern' | 'recipe' | 'token' | 'tokenValue' | 'viewTransition' | 'keyframes' | 'cva-call' | 'cva' | 'sva' | 'cx';
@@ -82,6 +87,8 @@ interface FoldCall {
82
87
  calleeProperty?: string;
83
88
  data: unknown[];
84
89
  exact: boolean;
90
+ /** Two exact `css()` style objects chosen by the test at the call site. */
91
+ styleBranch?: FoldStyleBranch;
85
92
  /** Why the call is not exact, when the evaluator refused code it does not run. */
86
93
  refusal?: FoldRefusal;
87
94
  argumentCount: number;
@@ -102,7 +109,7 @@ interface FoldCall {
102
109
  */
103
110
  guarded: boolean;
104
111
  /**
105
- * A `token.value()` or `cx()` call written first in an expression statement. What replaces it there
112
+ * A `token.value()`, `cx()`, or conditional `css()` call written first in an expression statement. What replaces it there
106
113
  * cannot open with `(` or `-`, which would continue the line before it where that line has no
107
114
  * semicolon.
108
115
  */
@@ -117,10 +124,12 @@ interface FoldCall {
117
124
  * than it follows, `module` when the helper is called again through another module while it runs;
118
125
  * `helper` and the location are the recursive helper: for `loop` the first to run of those its
119
126
  * cycle goes through, for `calls` the same of the cycle the innermost recurring call closes, for
120
- * `depth` the one most of the calls running are of. `line` is 1-based; `column` too, in UTF-16.
127
+ * `depth` the one most of the calls running are of. `compiled`: a call the compiler replaces,
128
+ * `css()` or a recipe, whose value only it knows — `subject` is the name it imports, `excerpt` and
129
+ * the location the call. `line` is 1-based; `column` too, in UTF-16.
121
130
  */
122
131
  interface FoldRefusal {
123
- kind: 'statement' | 'write' | 'recursion';
132
+ kind: 'statement' | 'write' | 'recursion' | 'compiled';
124
133
  subject: string;
125
134
  helper?: string;
126
135
  excerpt: string;
@@ -688,11 +697,14 @@ declare class BambooContext extends Generator {
688
697
  references: boolean;
689
698
  }) => FoldAnalysis[];
690
699
  /**
691
- * The token table as the native evaluator reads it.
700
+ * The token table as the native evaluator reads it, converted into the native engine once per
701
+ * context and handed to each call from then on.
692
702
  *
693
- * Built once per context rather than per call: `compileModules` runs once per transformed
694
- * module, and the table is every token in the project — rebuilding it priced the whole
695
- * dictionary into every file, most of which never call `token()`.
703
+ * `compileModules` runs once per transformed module, and the table is every token in the
704
+ * project. Rebuilding it priced the whole dictionary into every file, most of which never call
705
+ * `token()`, and so did handing it over built: each call converted it into Rust again, about
706
+ * 0.44 µs a token — 0.9 ms a module under `preset-atlaskit`'s 1,655 tokens, several times what
707
+ * analyzing most modules takes.
696
708
  */
697
709
  private get nativeTokens();
698
710
  private nativeTokenTable;
package/dist/index.d.mts CHANGED
@@ -70,6 +70,11 @@ interface FoldCxArgument {
70
70
  /** For an argument of the call itself: it reads a Bamboo binding or a recipe, so it cannot be copied. */
71
71
  readsBamboo: boolean;
72
72
  }
73
+ interface FoldStyleBranch {
74
+ test: FoldSpan;
75
+ consequent: Record<string, unknown>;
76
+ alternate: Record<string, unknown>;
77
+ }
73
78
  interface FoldCall {
74
79
  name: string;
75
80
  kind: 'css' | 'pattern' | 'recipe' | 'token' | 'tokenValue' | 'viewTransition' | 'keyframes' | 'cva-call' | 'cva' | 'sva' | 'cx';
@@ -82,6 +87,8 @@ interface FoldCall {
82
87
  calleeProperty?: string;
83
88
  data: unknown[];
84
89
  exact: boolean;
90
+ /** Two exact `css()` style objects chosen by the test at the call site. */
91
+ styleBranch?: FoldStyleBranch;
85
92
  /** Why the call is not exact, when the evaluator refused code it does not run. */
86
93
  refusal?: FoldRefusal;
87
94
  argumentCount: number;
@@ -102,7 +109,7 @@ interface FoldCall {
102
109
  */
103
110
  guarded: boolean;
104
111
  /**
105
- * A `token.value()` or `cx()` call written first in an expression statement. What replaces it there
112
+ * A `token.value()`, `cx()`, or conditional `css()` call written first in an expression statement. What replaces it there
106
113
  * cannot open with `(` or `-`, which would continue the line before it where that line has no
107
114
  * semicolon.
108
115
  */
@@ -117,10 +124,12 @@ interface FoldCall {
117
124
  * than it follows, `module` when the helper is called again through another module while it runs;
118
125
  * `helper` and the location are the recursive helper: for `loop` the first to run of those its
119
126
  * cycle goes through, for `calls` the same of the cycle the innermost recurring call closes, for
120
- * `depth` the one most of the calls running are of. `line` is 1-based; `column` too, in UTF-16.
127
+ * `depth` the one most of the calls running are of. `compiled`: a call the compiler replaces,
128
+ * `css()` or a recipe, whose value only it knows — `subject` is the name it imports, `excerpt` and
129
+ * the location the call. `line` is 1-based; `column` too, in UTF-16.
121
130
  */
122
131
  interface FoldRefusal {
123
- kind: 'statement' | 'write' | 'recursion';
132
+ kind: 'statement' | 'write' | 'recursion' | 'compiled';
124
133
  subject: string;
125
134
  helper?: string;
126
135
  excerpt: string;
@@ -688,11 +697,14 @@ declare class BambooContext extends Generator {
688
697
  references: boolean;
689
698
  }) => FoldAnalysis[];
690
699
  /**
691
- * The token table as the native evaluator reads it.
700
+ * The token table as the native evaluator reads it, converted into the native engine once per
701
+ * context and handed to each call from then on.
692
702
  *
693
- * Built once per context rather than per call: `compileModules` runs once per transformed
694
- * module, and the table is every token in the project — rebuilding it priced the whole
695
- * dictionary into every file, most of which never call `token()`.
703
+ * `compileModules` runs once per transformed module, and the table is every token in the
704
+ * project. Rebuilding it priced the whole dictionary into every file, most of which never call
705
+ * `token()`, and so did handing it over built: each call converted it into Rust again, about
706
+ * 0.44 µs a token — 0.9 ms a module under `preset-atlaskit`'s 1,655 tokens, several times what
707
+ * analyzing most modules takes.
696
708
  */
697
709
  private get nativeTokens();
698
710
  private nativeTokenTable;
package/dist/index.mjs CHANGED
@@ -4201,7 +4201,6 @@ var BambooContext = class extends Generator {
4201
4201
  pattern,
4202
4202
  paths: values
4203
4203
  })),
4204
- tokens: this.nativeTokens,
4205
4204
  cssModules: this.imports.value.css,
4206
4205
  tokenModules: this.imports.value.tokens,
4207
4206
  recipeModules: this.imports.value.recipe,
@@ -4210,21 +4209,24 @@ var BambooContext = class extends Generator {
4210
4209
  patternNames: this.patterns.keys,
4211
4210
  references: options.references,
4212
4211
  classPrefix: this.utility.prefix || void 0
4213
- });
4212
+ }, this.nativeTokens);
4214
4213
  };
4215
4214
  /**
4216
- * The token table as the native evaluator reads it.
4215
+ * The token table as the native evaluator reads it, converted into the native engine once per
4216
+ * context and handed to each call from then on.
4217
4217
  *
4218
- * Built once per context rather than per call: `compileModules` runs once per transformed
4219
- * module, and the table is every token in the project — rebuilding it priced the whole
4220
- * dictionary into every file, most of which never call `token()`.
4218
+ * `compileModules` runs once per transformed module, and the table is every token in the
4219
+ * project. Rebuilding it priced the whole dictionary into every file, most of which never call
4220
+ * `token()`, and so did handing it over built: each call converted it into Rust again, about
4221
+ * 0.44 µs a token — 0.9 ms a module under `preset-atlaskit`'s 1,655 tokens, several times what
4222
+ * analyzing most modules takes.
4221
4223
  */
4222
4224
  get nativeTokens() {
4223
- this.nativeTokenTable ??= this.tokens.allTokens.map((token) => ({
4225
+ this.nativeTokenTable ??= this.loadNativeExtractor().tokenTable(this.tokens.allTokens.map((token) => ({
4224
4226
  path: token.name,
4225
4227
  value: this.tokens.view.get(token.name),
4226
4228
  variable: this.tokens.view.getVar(token.name)
4227
- }));
4229
+ })));
4228
4230
  return this.nativeTokenTable;
4229
4231
  }
4230
4232
  nativeTokenTable;
@@ -4390,13 +4392,12 @@ var BambooContext = class extends Generator {
4390
4392
  pattern,
4391
4393
  paths: values
4392
4394
  })),
4393
- tokens: this.nativeTokens,
4394
4395
  jsx: this.jsx.isEnabled,
4395
4396
  classPrefix: this.utility.prefix || void 0
4396
4397
  };
4397
4398
  let analyses;
4398
4399
  try {
4399
- analyses = this.loadNativeExtractor().analyzeMany(sources, entrypoints, options);
4400
+ analyses = this.loadNativeExtractor().analyzeMany(sources, entrypoints, options, this.nativeTokens);
4400
4401
  } finally {
4401
4402
  this.nativePreparedSources.clear();
4402
4403
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.64.4",
3
+ "version": "1.64.5",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -59,23 +59,23 @@
59
59
  "pkg-types": "2.3.0",
60
60
  "pluralize": "8.0.0",
61
61
  "ts-pattern": "5.9.0",
62
- "@bamboocss/config": "1.64.4",
63
- "@bamboocss/core": "1.64.4",
64
- "@bamboocss/generator": "1.64.4",
65
- "@bamboocss/logger": "1.64.4",
66
- "@bamboocss/plugin-svelte": "1.64.4",
67
- "@bamboocss/plugin-vue": "1.64.4",
68
- "@bamboocss/reporter": "1.64.4",
69
- "@bamboocss/shared": "1.64.4",
70
- "@bamboocss/token-dictionary": "1.64.4",
71
- "@bamboocss/types": "1.64.4"
62
+ "@bamboocss/config": "1.64.5",
63
+ "@bamboocss/core": "1.64.5",
64
+ "@bamboocss/generator": "1.64.5",
65
+ "@bamboocss/logger": "1.64.5",
66
+ "@bamboocss/plugin-svelte": "1.64.5",
67
+ "@bamboocss/plugin-vue": "1.64.5",
68
+ "@bamboocss/reporter": "1.64.5",
69
+ "@bamboocss/shared": "1.64.5",
70
+ "@bamboocss/token-dictionary": "1.64.5",
71
+ "@bamboocss/types": "1.64.5"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@astrojs/compiler": "3.0.1",
75
75
  "@astrojs/compiler-rs": "0.5.1",
76
76
  "@types/picomatch": "4.0.2",
77
77
  "boxen": "8.0.1",
78
- "@bamboocss/native-extractor": "1.64.4"
78
+ "@bamboocss/native-extractor": "1.64.5"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@astrojs/compiler": ">=2",