@bamboocss/config 1.18.0 → 1.20.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 +13 -4
- package/dist/index.mjs +14 -5
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -703,14 +703,23 @@ const validateArtifactNames = (names, addError) => {
|
|
|
703
703
|
};
|
|
704
704
|
//#endregion
|
|
705
705
|
//#region src/validation/validate-breakpoints.ts
|
|
706
|
+
/**
|
|
707
|
+
* The unit a breakpoint is written in, whatever unit that is.
|
|
708
|
+
*
|
|
709
|
+
* This used to ask `getUnit`, which only reports the three units bamboo converts between and
|
|
710
|
+
* answers `undefined` for everything else — so the check fell back to `px` and read `40EM`,
|
|
711
|
+
* `50vw` and `30ch` as pixels alike. A theme mixing `em` and `vw` passed, and one written
|
|
712
|
+
* entirely in `EM` passed by being classified as something it is not.
|
|
713
|
+
*
|
|
714
|
+
* Read generically instead: the trailing letters, lower-cased. A unitless value keeps the
|
|
715
|
+
* `px` default, since `0` and `640` are pixels by convention here.
|
|
716
|
+
*/
|
|
717
|
+
const unitOf = (value) => String(value).trim().match(/[a-z%]+$/i)?.[0]?.toLowerCase() ?? "px";
|
|
706
718
|
const validateBreakpoints = (breakpoints, addError) => {
|
|
707
719
|
if (!breakpoints) return;
|
|
708
720
|
const units = /* @__PURE__ */ new Set();
|
|
709
721
|
const values = Object.values(breakpoints);
|
|
710
|
-
for (const value of values)
|
|
711
|
-
const unit = (0, _bamboocss_shared.getUnit)(value) ?? "px";
|
|
712
|
-
units.add(unit);
|
|
713
|
-
}
|
|
722
|
+
for (const value of values) units.add(unitOf(value));
|
|
714
723
|
if (units.size > 1) addError("breakpoints", `All breakpoints must use the same unit: \`${values.join(", ")}\``);
|
|
715
724
|
};
|
|
716
725
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "@bamboocss/logger";
|
|
2
|
-
import { BAMBOO_CONFIG_NAME, BambooError, assign, dashCase,
|
|
2
|
+
import { BAMBOO_CONFIG_NAME, BambooError, assign, dashCase, isObject, isString, mergeAndConcat, mergeWith, omit, parseJson, pick, stringifyJson, traverse, walkObject } from "@bamboocss/shared";
|
|
3
3
|
import { bundleNRequire } from "bundle-n-require";
|
|
4
4
|
import findUp from "escalade/sync";
|
|
5
5
|
import path, { posix, resolve, sep } from "path";
|
|
@@ -675,14 +675,23 @@ const validateArtifactNames = (names, addError) => {
|
|
|
675
675
|
};
|
|
676
676
|
//#endregion
|
|
677
677
|
//#region src/validation/validate-breakpoints.ts
|
|
678
|
+
/**
|
|
679
|
+
* The unit a breakpoint is written in, whatever unit that is.
|
|
680
|
+
*
|
|
681
|
+
* This used to ask `getUnit`, which only reports the three units bamboo converts between and
|
|
682
|
+
* answers `undefined` for everything else — so the check fell back to `px` and read `40EM`,
|
|
683
|
+
* `50vw` and `30ch` as pixels alike. A theme mixing `em` and `vw` passed, and one written
|
|
684
|
+
* entirely in `EM` passed by being classified as something it is not.
|
|
685
|
+
*
|
|
686
|
+
* Read generically instead: the trailing letters, lower-cased. A unitless value keeps the
|
|
687
|
+
* `px` default, since `0` and `640` are pixels by convention here.
|
|
688
|
+
*/
|
|
689
|
+
const unitOf = (value) => String(value).trim().match(/[a-z%]+$/i)?.[0]?.toLowerCase() ?? "px";
|
|
678
690
|
const validateBreakpoints = (breakpoints, addError) => {
|
|
679
691
|
if (!breakpoints) return;
|
|
680
692
|
const units = /* @__PURE__ */ new Set();
|
|
681
693
|
const values = Object.values(breakpoints);
|
|
682
|
-
for (const value of values)
|
|
683
|
-
const unit = getUnit(value) ?? "px";
|
|
684
|
-
units.add(unit);
|
|
685
|
-
}
|
|
694
|
+
for (const value of values) units.add(unitOf(value));
|
|
686
695
|
if (units.size > 1) addError("breakpoints", `All breakpoints must use the same unit: \`${values.join(", ")}\``);
|
|
687
696
|
};
|
|
688
697
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Find and load bamboo config",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
"escalade": "3.2.0",
|
|
65
65
|
"microdiff": "1.5.0",
|
|
66
66
|
"typescript": "6.0.2",
|
|
67
|
-
"@bamboocss/logger": "1.
|
|
68
|
-
"@bamboocss/preset-bamboo": "1.
|
|
69
|
-
"@bamboocss/preset-base": "1.
|
|
70
|
-
"@bamboocss/shared": "1.
|
|
71
|
-
"@bamboocss/types": "1.
|
|
67
|
+
"@bamboocss/logger": "1.20.0",
|
|
68
|
+
"@bamboocss/preset-bamboo": "1.20.0",
|
|
69
|
+
"@bamboocss/preset-base": "1.20.0",
|
|
70
|
+
"@bamboocss/shared": "1.20.0",
|
|
71
|
+
"@bamboocss/types": "1.20.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"pkg-types": "2.3.0"
|