@bamboocss/config 1.39.1 → 1.40.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 +14 -0
- package/dist/index.mjs +14 -0
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1106,6 +1106,7 @@ const validateTokens = (options) => {
|
|
|
1106
1106
|
//#region src/validate-config.ts
|
|
1107
1107
|
/**
|
|
1108
1108
|
* Validate the config
|
|
1109
|
+
* - Check that `strictTokens` names a setting that exists
|
|
1109
1110
|
* - Check for duplicate between token & semanticTokens names
|
|
1110
1111
|
* - Check for duplicate between recipes/patterns/slots names
|
|
1111
1112
|
* - Check for token / semanticTokens paths (must end/contain 'value')
|
|
@@ -1136,6 +1137,7 @@ const validateConfig = (config) => {
|
|
|
1136
1137
|
return warnings;
|
|
1137
1138
|
};
|
|
1138
1139
|
if (config.validation === "off") return report();
|
|
1140
|
+
validateStrictTokens(config.strictTokens, addError);
|
|
1139
1141
|
validateBreakpoints(config.theme?.breakpoints, addError);
|
|
1140
1142
|
validateConditions(config.conditions, addError);
|
|
1141
1143
|
const artifacts = {
|
|
@@ -1167,6 +1169,18 @@ const validateConfig = (config) => {
|
|
|
1167
1169
|
validateArtifactNames(artifacts, addError);
|
|
1168
1170
|
return report();
|
|
1169
1171
|
};
|
|
1172
|
+
/**
|
|
1173
|
+
* `strictTokens` has three settings, and a fourth spelling is not one of them.
|
|
1174
|
+
*
|
|
1175
|
+
* It reaches the generated types as a comparison against two known values, so anything else is
|
|
1176
|
+
* neither: `strictTokens: 'unknown'` emitted a *fourth* prop shape — csstype's keywords without
|
|
1177
|
+
* the escape hatch — that no setting asks for, silently. A typo in the middle mode's name is the
|
|
1178
|
+
* likely way to get there, and the symptom is type errors that match no documented behaviour.
|
|
1179
|
+
*/
|
|
1180
|
+
const validateStrictTokens = (value, addError) => {
|
|
1181
|
+
if (value === void 0 || value === true || value === false || value === "unknown-tokens") return;
|
|
1182
|
+
addError("strictTokens", `\`${JSON.stringify(value)}\` is not a setting. Use \`true\` for tokens only, \`'unknown-tokens'\` to reject a value that is neither a token nor a css keyword, or omit it.`);
|
|
1183
|
+
};
|
|
1170
1184
|
//#endregion
|
|
1171
1185
|
//#region src/resolve-config.ts
|
|
1172
1186
|
const hookUtils = {
|
package/dist/index.mjs
CHANGED
|
@@ -1078,6 +1078,7 @@ const validateTokens = (options) => {
|
|
|
1078
1078
|
//#region src/validate-config.ts
|
|
1079
1079
|
/**
|
|
1080
1080
|
* Validate the config
|
|
1081
|
+
* - Check that `strictTokens` names a setting that exists
|
|
1081
1082
|
* - Check for duplicate between token & semanticTokens names
|
|
1082
1083
|
* - Check for duplicate between recipes/patterns/slots names
|
|
1083
1084
|
* - Check for token / semanticTokens paths (must end/contain 'value')
|
|
@@ -1108,6 +1109,7 @@ const validateConfig = (config) => {
|
|
|
1108
1109
|
return warnings;
|
|
1109
1110
|
};
|
|
1110
1111
|
if (config.validation === "off") return report();
|
|
1112
|
+
validateStrictTokens(config.strictTokens, addError);
|
|
1111
1113
|
validateBreakpoints(config.theme?.breakpoints, addError);
|
|
1112
1114
|
validateConditions(config.conditions, addError);
|
|
1113
1115
|
const artifacts = {
|
|
@@ -1139,6 +1141,18 @@ const validateConfig = (config) => {
|
|
|
1139
1141
|
validateArtifactNames(artifacts, addError);
|
|
1140
1142
|
return report();
|
|
1141
1143
|
};
|
|
1144
|
+
/**
|
|
1145
|
+
* `strictTokens` has three settings, and a fourth spelling is not one of them.
|
|
1146
|
+
*
|
|
1147
|
+
* It reaches the generated types as a comparison against two known values, so anything else is
|
|
1148
|
+
* neither: `strictTokens: 'unknown'` emitted a *fourth* prop shape — csstype's keywords without
|
|
1149
|
+
* the escape hatch — that no setting asks for, silently. A typo in the middle mode's name is the
|
|
1150
|
+
* likely way to get there, and the symptom is type errors that match no documented behaviour.
|
|
1151
|
+
*/
|
|
1152
|
+
const validateStrictTokens = (value, addError) => {
|
|
1153
|
+
if (value === void 0 || value === true || value === false || value === "unknown-tokens") return;
|
|
1154
|
+
addError("strictTokens", `\`${JSON.stringify(value)}\` is not a setting. Use \`true\` for tokens only, \`'unknown-tokens'\` to reject a value that is neither a token nor a css keyword, or omit it.`);
|
|
1155
|
+
};
|
|
1142
1156
|
//#endregion
|
|
1143
1157
|
//#region src/resolve-config.ts
|
|
1144
1158
|
const hookUtils = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.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.40.0",
|
|
68
|
+
"@bamboocss/preset-bamboo": "1.40.0",
|
|
69
|
+
"@bamboocss/preset-base": "1.40.0",
|
|
70
|
+
"@bamboocss/shared": "1.40.0",
|
|
71
|
+
"@bamboocss/types": "1.40.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"pkg-types": "2.3.0"
|