@bamboocss/types 1.33.0 → 1.34.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.
- package/dist/config.d.ts +73 -5
- package/dist/runtime.d.ts +2 -0
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -407,6 +407,34 @@ interface CodegenOptions {
|
|
|
407
407
|
* @default 'true'
|
|
408
408
|
*/
|
|
409
409
|
shorthands?: boolean
|
|
410
|
+
/**
|
|
411
|
+
* Whether a lowered style leaf falls back to `css()` for a value that is not a scalar.
|
|
412
|
+
*
|
|
413
|
+
* Only the build-time fold calls the helper this governs. `css({ color: tone })` lowers to
|
|
414
|
+
* `cssLeaf('c_', 'color', tone)`, which builds the class by concatenation — and hands the
|
|
415
|
+
* value to `css()` when it turns out to be a condition object or a responsive array, which
|
|
416
|
+
* no concatenation describes.
|
|
417
|
+
*
|
|
418
|
+
* That fallback is the single edge keeping the css engine in a bundle. It is reachable only
|
|
419
|
+
* for a value the fold could not see the shape of, and it costs the whole prize: on
|
|
420
|
+
* `sandbox/runtime-perf`, one dynamic leaf takes a module from **923 B to 7,542 B gzipped**,
|
|
421
|
+
* because the reference pulls in `createCss`, the merge, the utility and shorthand tables
|
|
422
|
+
* and the conditions. Turned off, the same module keeps 10 top-level bindings instead of 39.
|
|
423
|
+
*
|
|
424
|
+
* Turning it off asserts something about your source: **a style value that varies at runtime
|
|
425
|
+
* is a scalar** — a string, a number, a boolean, or nothing. Write conditions and responsive
|
|
426
|
+
* values as literals at the call site, where the fold reads them and resolves each branch,
|
|
427
|
+
* rather than assembling them into a variable. A value that breaks the assertion throws,
|
|
428
|
+
* naming the property, instead of silently producing a class with no rule behind it.
|
|
429
|
+
*
|
|
430
|
+
* Pairs with `failOnUnfolded` in `@bamboocss/vite`: with the fallback off a lowered leaf no
|
|
431
|
+
* longer keeps the engine, so that option stops reporting one as a survivor. Together they
|
|
432
|
+
* are what makes zero runtime reachable for an app that has any dynamic styling at all —
|
|
433
|
+
* before this, it required an app with none.
|
|
434
|
+
*
|
|
435
|
+
* @default true
|
|
436
|
+
*/
|
|
437
|
+
leafFallback?: boolean
|
|
410
438
|
/**
|
|
411
439
|
* File extension for generated javascript files.
|
|
412
440
|
* @default 'mjs'
|
|
@@ -615,11 +643,20 @@ export interface PruneOptions {
|
|
|
615
643
|
* are dead weight in the stylesheet that blocks first paint. Only keyframes the theme
|
|
616
644
|
* declares are ever removed — one emitted by `global.css` is left alone.
|
|
617
645
|
*
|
|
618
|
-
* A name is kept when any declaration in the generated css names it,
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
* used one breaks the
|
|
646
|
+
* A name is kept when any declaration in the generated css names it, when a token
|
|
647
|
+
* declaration that *survives* `tokens` names it, and when it appears anywhere under
|
|
648
|
+
* `include` — which covers an animation assembled at runtime or applied through an inline
|
|
649
|
+
* `style` rather than through bamboo. That textual fallback is deliberately
|
|
650
|
+
* over-inclusive: keeping an unused keyframe costs bytes, dropping a used one breaks the
|
|
651
|
+
* animation.
|
|
652
|
+
*
|
|
653
|
+
* The middle one is why this cannot be read off the stylesheet alone. `--animations-drawer:
|
|
654
|
+
* slide-in-right 400ms` reaches its keyframe only if something reaches the property, and a
|
|
655
|
+
* property can be reached from outside the css entirely — a `token()` call, a `keepTokens`
|
|
656
|
+
* pattern, a theme, a `globalCss` export. Those are exactly the tokens `tokens` keeps, so
|
|
657
|
+
* this defers to that pass rather than asking again: a keyframe is dropped only when the
|
|
658
|
+
* declarations naming it were dropped too. Under `tokens: 'off'` nothing is removable, so
|
|
659
|
+
* every keyframe a declaration names is kept.
|
|
623
660
|
*
|
|
624
661
|
* @default true
|
|
625
662
|
*/
|
|
@@ -650,6 +687,37 @@ export interface Config
|
|
|
650
687
|
* @default 'warn'
|
|
651
688
|
*/
|
|
652
689
|
validation?: 'off' | 'warn' | 'error'
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* What to do about a style value shaped like a token path that resolves to no token.
|
|
693
|
+
*
|
|
694
|
+
* - `off` says nothing.
|
|
695
|
+
* - `warn` logs each one as it is transformed.
|
|
696
|
+
* - `error` fails the build, listing every one it found.
|
|
697
|
+
*
|
|
698
|
+
* Every branch of the resolver ends in `|| value`, so an unknown path is emitted as
|
|
699
|
+
* written: `background: 'accent.default'` ships as `background: accent.default`. That
|
|
700
|
+
* parses, so nothing downstream objects and the stylesheet is valid — the browser drops the
|
|
701
|
+
* declaration at compute time and the style is simply absent. It surfaces as "this colour
|
|
702
|
+
* never applied", a long way from the typo that caused it, and a build carrying one warns
|
|
703
|
+
* identically on every run until somebody happens to read the log.
|
|
704
|
+
*
|
|
705
|
+
* `warn` is the default because the test is a *shape*: a dotted value against the set of
|
|
706
|
+
* values the property enumerates. That is right about a mistyped token and cannot be sure
|
|
707
|
+
* about a literal, so escalating it is a choice a project makes once it knows its own
|
|
708
|
+
* source is clean. `[accent.default]` marks a value as literal and is never reported.
|
|
709
|
+
*
|
|
710
|
+
* Not to be confused with {@link PruneOptions.unresolvedPath}, which is about a `token()`
|
|
711
|
+
* *call* whose path the prune scan cannot follow statically — a question about pruning
|
|
712
|
+
* coverage, asked of a token that usually exists. This one is about a token that does not.
|
|
713
|
+
*
|
|
714
|
+
* A binding that does not exist is not graded here and always throws: that is read off an
|
|
715
|
+
* entrypoint's own export list rather than inferred, so there is no setting under which it
|
|
716
|
+
* is what someone meant.
|
|
717
|
+
*
|
|
718
|
+
* @default 'warn'
|
|
719
|
+
*/
|
|
720
|
+
unresolvedToken?: 'off' | 'warn' | 'error'
|
|
653
721
|
}
|
|
654
722
|
|
|
655
723
|
export interface Preset extends ExtendableOptions, PresetOptions {
|
package/dist/runtime.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface WatchOptions extends InputOptions {
|
|
|
19
19
|
interface FileSystem {
|
|
20
20
|
readDirSync(dir: string): string[]
|
|
21
21
|
existsSync(fileLike: string): boolean
|
|
22
|
+
/** False for a path that does not exist, so a caller never has to test twice. */
|
|
23
|
+
isDirSync(path: string): boolean
|
|
22
24
|
glob(opts: InputOptions): string[]
|
|
23
25
|
readFileSync(filePath: string): string
|
|
24
26
|
rmDirSync(dirPath: string): void
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.1",
|
|
4
4
|
"description": "The types for css bamboo",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ncp": "2.0.0",
|
|
33
33
|
"pkg-types": "2.3.0",
|
|
34
34
|
"ts-morph": "28.0.0",
|
|
35
|
-
"@bamboocss/extractor": "1.
|
|
35
|
+
"@bamboocss/extractor": "1.34.1"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx scripts/watch.ts",
|