@bamboocss/generator 1.58.0 → 1.58.2
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 +18 -11
- package/dist/index.d.cts +6 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +18 -11
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -3630,10 +3630,17 @@ var Generator = class extends _bamboocss_core.Context {
|
|
|
3630
3630
|
artifact: "styles.css",
|
|
3631
3631
|
content: css
|
|
3632
3632
|
}) ?? css;
|
|
3633
|
-
this.
|
|
3633
|
+
this.checkSheet(sheet);
|
|
3634
|
+
return css;
|
|
3635
|
+
};
|
|
3636
|
+
/**
|
|
3637
|
+
* What a finished sheet answers to, however it is written out: one file here, or one per layer
|
|
3638
|
+
* by `getSplitCssArtifacts`, which used to skip all three and ship what this refused.
|
|
3639
|
+
*/
|
|
3640
|
+
checkSheet = (sheet) => {
|
|
3641
|
+
this.assertNoUnresolvedTokens(sheet);
|
|
3634
3642
|
this.reportRawValues();
|
|
3635
3643
|
this.reportInvalidDeclarations(sheet);
|
|
3636
|
-
return css;
|
|
3637
3644
|
};
|
|
3638
3645
|
/**
|
|
3639
3646
|
* Fail on a style value shaped like a token path that names no token.
|
|
@@ -3724,17 +3731,16 @@ var Generator = class extends _bamboocss_core.Context {
|
|
|
3724
3731
|
};
|
|
3725
3732
|
/** The raw values `warn` has already reported, keyed `property:value`, for the life of the context. */
|
|
3726
3733
|
reportedRawValues = /* @__PURE__ */ new Set();
|
|
3727
|
-
assertNoUnresolvedTokens = () => {
|
|
3734
|
+
assertNoUnresolvedTokens = (sheet) => {
|
|
3728
3735
|
const severity = this.utility.unresolvedToken;
|
|
3729
3736
|
if (severity.token !== "error" && severity.grammar !== "error") return;
|
|
3730
|
-
const found = new Map(this.utility.
|
|
3737
|
+
const found = new Map(this.utility.serializedUnresolvedTokens);
|
|
3738
|
+
if (sheet) for (const [id, ref] of sheet.unresolvedTokens) found.set(id, ref);
|
|
3739
|
+
for (const [id, ref] of this.recipes.inlineUnresolvedTokens()) found.set(id, ref);
|
|
3731
3740
|
for (const atom of this.decoder.atomic) {
|
|
3732
3741
|
const { prop, value } = atom.entry;
|
|
3733
3742
|
if (typeof value !== "string" || typeof prop !== "string") continue;
|
|
3734
|
-
|
|
3735
|
-
const key = this.utility.resolveShorthand(prop);
|
|
3736
|
-
const bare = this.utility.bareTokenPath(key, value);
|
|
3737
|
-
found.set(`${key}:${bare}`, this.utility.unresolvedTokenRef(key, bare));
|
|
3743
|
+
for (const [id, ref] of this.utility.findUnresolvedTokens(prop, value)) found.set(id, ref);
|
|
3738
3744
|
}
|
|
3739
3745
|
for (const [id, ref] of found) if (severity[ref.kind] !== "error") found.delete(id);
|
|
3740
3746
|
if (!found.size) return;
|
|
@@ -3743,7 +3749,7 @@ var Generator = class extends _bamboocss_core.Context {
|
|
|
3743
3749
|
unit: "value",
|
|
3744
3750
|
separator: "\n"
|
|
3745
3751
|
});
|
|
3746
|
-
throw new _bamboocss_shared.BambooError("UNRESOLVED_TOKEN", `${found.size} style value(s) name a token that does not exist:\n\n${detail}\n\nEach is emitted as written, which parses — so the stylesheet is valid and nothing downstream objects. The browser drops the declaration at compute time and the style is simply absent from the element, which surfaces as "this never applied" a long way from the typo that caused it. Write \`[value]\` to mark
|
|
3752
|
+
throw new _bamboocss_shared.BambooError("UNRESOLVED_TOKEN", `${found.size} style value(s) name a token that does not exist:\n\n${detail}\n\nEach is emitted as written, which parses — so the stylesheet is valid and nothing downstream objects. The browser drops the declaration at compute time and the style is simply absent from the element, which surfaces as "this never applied" a long way from the typo that caused it. Write \`[value]\` to mark a bare value as a literal, or set \`unresolvedToken: 'warn'\` to report these without failing.`);
|
|
3747
3753
|
};
|
|
3748
3754
|
/**
|
|
3749
3755
|
* The findings `warn` has already printed, keyed `property:value`.
|
|
@@ -3775,8 +3781,7 @@ var Generator = class extends _bamboocss_core.Context {
|
|
|
3775
3781
|
reportInvalidDeclarations = (sheet) => {
|
|
3776
3782
|
const severity = this.utility.invalidDeclaration;
|
|
3777
3783
|
if (severity === "off") return;
|
|
3778
|
-
const owned =
|
|
3779
|
-
for (const ref of this.utility.unresolvedTokens.values()) owned.add(`${this.utility.cssPropertyOf(ref.prop)}:${ref.value}`);
|
|
3784
|
+
const owned = this.utility.ownedDeclarations;
|
|
3780
3785
|
const id = (finding) => `${finding.prop}:${finding.value}`;
|
|
3781
3786
|
const findings = sheet.invalidDeclarations.filter((finding) => !owned.has(id(finding)));
|
|
3782
3787
|
if (!findings.length) return;
|
|
@@ -3813,6 +3818,8 @@ var Generator = class extends _bamboocss_core.Context {
|
|
|
3813
3818
|
* Used when --splitting flag is enabled
|
|
3814
3819
|
*/
|
|
3815
3820
|
getSplitCssArtifacts = (sheet) => {
|
|
3821
|
+
sheet.collectInvalidDeclarations();
|
|
3822
|
+
this.checkSheet(sheet);
|
|
3816
3823
|
const layerNames = this.config.layers;
|
|
3817
3824
|
const layers = [
|
|
3818
3825
|
{
|
package/dist/index.d.cts
CHANGED
|
@@ -139,6 +139,11 @@ declare class Generator extends Context {
|
|
|
139
139
|
*/
|
|
140
140
|
getAtomOrigins: () => Map<string, AtomOrigin>;
|
|
141
141
|
getCss: (stylesheet?: Stylesheet) => string;
|
|
142
|
+
/**
|
|
143
|
+
* What a finished sheet answers to, however it is written out: one file here, or one per layer
|
|
144
|
+
* by `getSplitCssArtifacts`, which used to skip all three and ship what this refused.
|
|
145
|
+
*/
|
|
146
|
+
private checkSheet;
|
|
142
147
|
/**
|
|
143
148
|
* Fail on a style value shaped like a token path that names no token.
|
|
144
149
|
*
|
|
@@ -200,7 +205,7 @@ declare class Generator extends Context {
|
|
|
200
205
|
reportRawValues: () => void;
|
|
201
206
|
/** The raw values `warn` has already reported, keyed `property:value`, for the life of the context. */
|
|
202
207
|
private reportedRawValues;
|
|
203
|
-
assertNoUnresolvedTokens: () => void;
|
|
208
|
+
assertNoUnresolvedTokens: (sheet?: Stylesheet) => void;
|
|
204
209
|
/**
|
|
205
210
|
* The findings `warn` has already printed, keyed `property:value`.
|
|
206
211
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -139,6 +139,11 @@ declare class Generator extends Context {
|
|
|
139
139
|
*/
|
|
140
140
|
getAtomOrigins: () => Map<string, AtomOrigin>;
|
|
141
141
|
getCss: (stylesheet?: Stylesheet) => string;
|
|
142
|
+
/**
|
|
143
|
+
* What a finished sheet answers to, however it is written out: one file here, or one per layer
|
|
144
|
+
* by `getSplitCssArtifacts`, which used to skip all three and ship what this refused.
|
|
145
|
+
*/
|
|
146
|
+
private checkSheet;
|
|
142
147
|
/**
|
|
143
148
|
* Fail on a style value shaped like a token path that names no token.
|
|
144
149
|
*
|
|
@@ -200,7 +205,7 @@ declare class Generator extends Context {
|
|
|
200
205
|
reportRawValues: () => void;
|
|
201
206
|
/** The raw values `warn` has already reported, keyed `property:value`, for the life of the context. */
|
|
202
207
|
private reportedRawValues;
|
|
203
|
-
assertNoUnresolvedTokens: () => void;
|
|
208
|
+
assertNoUnresolvedTokens: (sheet?: Stylesheet) => void;
|
|
204
209
|
/**
|
|
205
210
|
* The findings `warn` has already printed, keyed `property:value`.
|
|
206
211
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -3604,10 +3604,17 @@ var Generator = class extends Context {
|
|
|
3604
3604
|
artifact: "styles.css",
|
|
3605
3605
|
content: css
|
|
3606
3606
|
}) ?? css;
|
|
3607
|
-
this.
|
|
3607
|
+
this.checkSheet(sheet);
|
|
3608
|
+
return css;
|
|
3609
|
+
};
|
|
3610
|
+
/**
|
|
3611
|
+
* What a finished sheet answers to, however it is written out: one file here, or one per layer
|
|
3612
|
+
* by `getSplitCssArtifacts`, which used to skip all three and ship what this refused.
|
|
3613
|
+
*/
|
|
3614
|
+
checkSheet = (sheet) => {
|
|
3615
|
+
this.assertNoUnresolvedTokens(sheet);
|
|
3608
3616
|
this.reportRawValues();
|
|
3609
3617
|
this.reportInvalidDeclarations(sheet);
|
|
3610
|
-
return css;
|
|
3611
3618
|
};
|
|
3612
3619
|
/**
|
|
3613
3620
|
* Fail on a style value shaped like a token path that names no token.
|
|
@@ -3698,17 +3705,16 @@ var Generator = class extends Context {
|
|
|
3698
3705
|
};
|
|
3699
3706
|
/** The raw values `warn` has already reported, keyed `property:value`, for the life of the context. */
|
|
3700
3707
|
reportedRawValues = /* @__PURE__ */ new Set();
|
|
3701
|
-
assertNoUnresolvedTokens = () => {
|
|
3708
|
+
assertNoUnresolvedTokens = (sheet) => {
|
|
3702
3709
|
const severity = this.utility.unresolvedToken;
|
|
3703
3710
|
if (severity.token !== "error" && severity.grammar !== "error") return;
|
|
3704
|
-
const found = new Map(this.utility.
|
|
3711
|
+
const found = new Map(this.utility.serializedUnresolvedTokens);
|
|
3712
|
+
if (sheet) for (const [id, ref] of sheet.unresolvedTokens) found.set(id, ref);
|
|
3713
|
+
for (const [id, ref] of this.recipes.inlineUnresolvedTokens()) found.set(id, ref);
|
|
3705
3714
|
for (const atom of this.decoder.atomic) {
|
|
3706
3715
|
const { prop, value } = atom.entry;
|
|
3707
3716
|
if (typeof value !== "string" || typeof prop !== "string") continue;
|
|
3708
|
-
|
|
3709
|
-
const key = this.utility.resolveShorthand(prop);
|
|
3710
|
-
const bare = this.utility.bareTokenPath(key, value);
|
|
3711
|
-
found.set(`${key}:${bare}`, this.utility.unresolvedTokenRef(key, bare));
|
|
3717
|
+
for (const [id, ref] of this.utility.findUnresolvedTokens(prop, value)) found.set(id, ref);
|
|
3712
3718
|
}
|
|
3713
3719
|
for (const [id, ref] of found) if (severity[ref.kind] !== "error") found.delete(id);
|
|
3714
3720
|
if (!found.size) return;
|
|
@@ -3717,7 +3723,7 @@ var Generator = class extends Context {
|
|
|
3717
3723
|
unit: "value",
|
|
3718
3724
|
separator: "\n"
|
|
3719
3725
|
});
|
|
3720
|
-
throw new BambooError("UNRESOLVED_TOKEN", `${found.size} style value(s) name a token that does not exist:\n\n${detail}\n\nEach is emitted as written, which parses — so the stylesheet is valid and nothing downstream objects. The browser drops the declaration at compute time and the style is simply absent from the element, which surfaces as "this never applied" a long way from the typo that caused it. Write \`[value]\` to mark
|
|
3726
|
+
throw new BambooError("UNRESOLVED_TOKEN", `${found.size} style value(s) name a token that does not exist:\n\n${detail}\n\nEach is emitted as written, which parses — so the stylesheet is valid and nothing downstream objects. The browser drops the declaration at compute time and the style is simply absent from the element, which surfaces as "this never applied" a long way from the typo that caused it. Write \`[value]\` to mark a bare value as a literal, or set \`unresolvedToken: 'warn'\` to report these without failing.`);
|
|
3721
3727
|
};
|
|
3722
3728
|
/**
|
|
3723
3729
|
* The findings `warn` has already printed, keyed `property:value`.
|
|
@@ -3749,8 +3755,7 @@ var Generator = class extends Context {
|
|
|
3749
3755
|
reportInvalidDeclarations = (sheet) => {
|
|
3750
3756
|
const severity = this.utility.invalidDeclaration;
|
|
3751
3757
|
if (severity === "off") return;
|
|
3752
|
-
const owned =
|
|
3753
|
-
for (const ref of this.utility.unresolvedTokens.values()) owned.add(`${this.utility.cssPropertyOf(ref.prop)}:${ref.value}`);
|
|
3758
|
+
const owned = this.utility.ownedDeclarations;
|
|
3754
3759
|
const id = (finding) => `${finding.prop}:${finding.value}`;
|
|
3755
3760
|
const findings = sheet.invalidDeclarations.filter((finding) => !owned.has(id(finding)));
|
|
3756
3761
|
if (!findings.length) return;
|
|
@@ -3787,6 +3792,8 @@ var Generator = class extends Context {
|
|
|
3787
3792
|
* Used when --splitting flag is enabled
|
|
3788
3793
|
*/
|
|
3789
3794
|
getSplitCssArtifacts = (sheet) => {
|
|
3795
|
+
sheet.collectInvalidDeclarations();
|
|
3796
|
+
this.checkSheet(sheet);
|
|
3790
3797
|
const layerNames = this.config.layers;
|
|
3791
3798
|
const layers = [
|
|
3792
3799
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/generator",
|
|
3
|
-
"version": "1.58.
|
|
3
|
+
"version": "1.58.2",
|
|
4
4
|
"description": "The css generator for css bamboo",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"pluralize": "8.0.0",
|
|
39
39
|
"postcss": "8.5.26",
|
|
40
40
|
"ts-pattern": "5.9.0",
|
|
41
|
-
"@bamboocss/core": "1.58.
|
|
42
|
-
"@bamboocss/is-valid-prop": "^1.58.
|
|
43
|
-
"@bamboocss/logger": "1.58.
|
|
44
|
-
"@bamboocss/shared": "1.58.
|
|
45
|
-
"@bamboocss/token-dictionary": "1.58.
|
|
46
|
-
"@bamboocss/types": "1.58.
|
|
41
|
+
"@bamboocss/core": "1.58.2",
|
|
42
|
+
"@bamboocss/is-valid-prop": "^1.58.2",
|
|
43
|
+
"@bamboocss/logger": "1.58.2",
|
|
44
|
+
"@bamboocss/shared": "1.58.2",
|
|
45
|
+
"@bamboocss/token-dictionary": "1.58.2",
|
|
46
|
+
"@bamboocss/types": "1.58.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/pluralize": "0.0.33"
|