@bamboocss/types 1.41.1 → 1.42.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/config.d.ts +37 -28
- package/package.json +2 -2
package/dist/config.d.ts
CHANGED
|
@@ -377,6 +377,9 @@ interface CssgenOptions {
|
|
|
377
377
|
polyfill?: boolean
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
/** `'auto'` hashes in production and leaves names readable in development. */
|
|
381
|
+
export type HashSetting = boolean | 'auto'
|
|
382
|
+
|
|
380
383
|
interface CodegenOptions {
|
|
381
384
|
/**
|
|
382
385
|
* Whether to only emit the `tokens` directory
|
|
@@ -385,45 +388,51 @@ interface CodegenOptions {
|
|
|
385
388
|
emitTokensOnly?: boolean
|
|
386
389
|
/**
|
|
387
390
|
* Whether to hash the generated class names / css variables.
|
|
388
|
-
*
|
|
391
|
+
*
|
|
392
|
+
* Readable names cost nothing for most of what a project writes — `fs_14px` and `c_accent`
|
|
393
|
+
* gzip to within a rounding error of a hash, because they repeat. What does cost is an
|
|
394
|
+
* *arbitrary* value, which is escaped into the name whole: one measured project carried a
|
|
395
|
+
* complete `linear-gradient(…)` as a 105-character class, and escaped names were 20% of all
|
|
396
|
+
* class-attribute bytes. Those do not compress away, because the redundancy is inside one long
|
|
397
|
+
* token rather than across repeated short ones.
|
|
398
|
+
*
|
|
399
|
+
* `'auto'` is the answer to both: readable while you are looking at them, hashed when nobody
|
|
400
|
+
* is. The mode comes from the integration — the Vite plugin's dev server is development and
|
|
401
|
+
* everything else is production — and is fixed for the life of a context, so the emitted CSS
|
|
402
|
+
* and the compiled class literals cannot disagree about a name.
|
|
403
|
+
*
|
|
389
404
|
* @default false
|
|
390
405
|
*/
|
|
391
|
-
hash?:
|
|
406
|
+
hash?: HashSetting | { cssVar?: HashSetting; className?: HashSetting }
|
|
392
407
|
/**
|
|
393
|
-
*
|
|
408
|
+
* Whether this context is serving a development build.
|
|
394
409
|
*
|
|
395
|
-
*
|
|
410
|
+
* Set by the integration rather than by a project — the Vite plugin's dev server is the only
|
|
411
|
+
* thing that knows — and read by `hash: 'auto'`. It is deliberately not a mode switch for
|
|
412
|
+
* anything else: a class name that differs between dev and prod is one thing, and CSS that
|
|
413
|
+
* differs is another.
|
|
396
414
|
*
|
|
397
|
-
*
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
*
|
|
402
|
-
* or *shaped* like a CSS value: it starts with a digit or `#` or `-`, or it contains a space,
|
|
403
|
-
* a comma or a function call. `'14px'`, `'100vh'`, `'1px solid red'` and `'rgb(0 0 0)'` all
|
|
404
|
-
* pass; `'mutedd'`, `'accnt'` and `'colors.acent'` do not, because a bare identifier that is
|
|
405
|
-
* neither a token nor a keyword is nothing else.
|
|
406
|
-
* - `true` — only tokens, and every raw value has to be written as `'[14px]'`.
|
|
415
|
+
* @default false
|
|
416
|
+
*/
|
|
417
|
+
dev?: boolean
|
|
418
|
+
/**
|
|
419
|
+
* Require every style value to be a token, so a raw CSS value has to be written `'[14px]'`.
|
|
407
420
|
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* migration and catches that class of mistake.
|
|
421
|
+
* A design-system policy rather than a correctness check: it is how a team says "everything
|
|
422
|
+
* goes through the theme", and the brackets are what make reaching outside it visible in the
|
|
423
|
+
* source. On one otherwise-correct five-page app it reports 468 values, which is what makes
|
|
424
|
+
* it a day-one decision.
|
|
413
425
|
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* ordinary thing to write.
|
|
426
|
+
* A *keyword* is not a raw value. `display: 'flex'` is the only way to say that, so it is
|
|
427
|
+
* left alone — a distinction the type-level version of this could not draw, which is why it
|
|
428
|
+
* did not narrow `display` at all and let `display: 'abc'` through with it.
|
|
418
429
|
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
* rejected, since nothing distinguishes it from a misspelled token; write `` `[${value}]` ``,
|
|
422
|
-
* the same as under `true`, and note the Vite compiler rejects an open runtime value anyway.
|
|
430
|
+
* Reported by the build, graded by `validation`, and it is not what catches a misspelled
|
|
431
|
+
* token — see `unresolvedToken`, which is on by default and needs no setting.
|
|
423
432
|
*
|
|
424
433
|
* @default false
|
|
425
434
|
*/
|
|
426
|
-
|
|
435
|
+
strictValues?: boolean
|
|
427
436
|
/**
|
|
428
437
|
* Change generated typescript definitions to be more strict for built-in CSS properties to only allow valid CSS values.
|
|
429
438
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
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.42.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsx scripts/watch.ts",
|