@bamboocss/generator 1.39.0 → 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 CHANGED
@@ -4063,6 +4063,8 @@ var Generator = class extends _bamboocss_core.Context {
4063
4063
  * markdown is invisible to a scan of your own source, and the failure is an element quietly
4064
4064
  * losing its reset rather than anything that reports itself.
4065
4065
  */
4066
+ /** Whether this context has already named what the reset lost; see `prunePreflight`. */
4067
+ reportedPreflightPrune = false;
4066
4068
  prunePreflight = (sheet, rendered) => {
4067
4069
  const { preflight } = this.config;
4068
4070
  if (!(0, _bamboocss_core.prunesPreflight)(preflight)) return;
@@ -4072,7 +4074,22 @@ var Generator = class extends _bamboocss_core.Context {
4072
4074
  rendered,
4073
4075
  scope
4074
4076
  });
4075
- _bamboocss_logger.logger.debug("prune:preflight", `Removed ${result.removedRules} reset rule(s) and ${result.removedParts} selector part(s) for unrendered elements`);
4077
+ /**
4078
+ * Said out loud, and by name.
4079
+ *
4080
+ * `info` rather than `debug` because this only runs for a project that asked for it, so
4081
+ * there is nobody to be noisy at — and because the objection to this pass is that being
4082
+ * wrong is silent. An element rendered by a dependency's component, by markdown, or by
4083
+ * `dangerouslySetInnerHTML` is invisible to the scan, loses its reset, and reports
4084
+ * nothing; a list of what went is the only way a reader can check that against what they
4085
+ * know their own app renders.
4086
+ *
4087
+ * Names rather than counts, for the same reason. "Removed 8 rules" is unverifiable.
4088
+ */
4089
+ if (result.removedElements.size && !this.reportedPreflightPrune) {
4090
+ this.reportedPreflightPrune = true;
4091
+ _bamboocss_logger.logger.info("prune:preflight", `Reset rules removed for ${result.removedElements.size} element(s) your source never renders: ${[...result.removedElements].sort().join(", ")}. Anything rendered by a dependency, by markdown, or through \`dangerouslySetInnerHTML\` is invisible to this scan — check the list, or set \`preflight: { prune: false }\`.`);
4092
+ }
4076
4093
  return result;
4077
4094
  };
4078
4095
  /**
package/dist/index.d.cts CHANGED
@@ -50,9 +50,12 @@ declare class Generator extends Context {
50
50
  * markdown is invisible to a scan of your own source, and the failure is an element quietly
51
51
  * losing its reset rather than anything that reports itself.
52
52
  */
53
+ /** Whether this context has already named what the reset lost; see `prunePreflight`. */
54
+ private reportedPreflightPrune;
53
55
  prunePreflight: (sheet: Stylesheet, rendered: Set<string>) => {
54
56
  removedRules: number;
55
57
  removedParts: number;
58
+ removedElements: Set<string>;
56
59
  } | undefined;
57
60
  /**
58
61
  * Drop `@keyframes` nothing can reach. Same completeness requirement as
package/dist/index.d.mts CHANGED
@@ -50,9 +50,12 @@ declare class Generator extends Context {
50
50
  * markdown is invisible to a scan of your own source, and the failure is an element quietly
51
51
  * losing its reset rather than anything that reports itself.
52
52
  */
53
+ /** Whether this context has already named what the reset lost; see `prunePreflight`. */
54
+ private reportedPreflightPrune;
53
55
  prunePreflight: (sheet: Stylesheet, rendered: Set<string>) => {
54
56
  removedRules: number;
55
57
  removedParts: number;
58
+ removedElements: Set<string>;
56
59
  } | undefined;
57
60
  /**
58
61
  * Drop `@keyframes` nothing can reach. Same completeness requirement as
package/dist/index.mjs CHANGED
@@ -4037,6 +4037,8 @@ var Generator = class extends Context {
4037
4037
  * markdown is invisible to a scan of your own source, and the failure is an element quietly
4038
4038
  * losing its reset rather than anything that reports itself.
4039
4039
  */
4040
+ /** Whether this context has already named what the reset lost; see `prunePreflight`. */
4041
+ reportedPreflightPrune = false;
4040
4042
  prunePreflight = (sheet, rendered) => {
4041
4043
  const { preflight } = this.config;
4042
4044
  if (!prunesPreflight(preflight)) return;
@@ -4046,7 +4048,22 @@ var Generator = class extends Context {
4046
4048
  rendered,
4047
4049
  scope
4048
4050
  });
4049
- logger.debug("prune:preflight", `Removed ${result.removedRules} reset rule(s) and ${result.removedParts} selector part(s) for unrendered elements`);
4051
+ /**
4052
+ * Said out loud, and by name.
4053
+ *
4054
+ * `info` rather than `debug` because this only runs for a project that asked for it, so
4055
+ * there is nobody to be noisy at — and because the objection to this pass is that being
4056
+ * wrong is silent. An element rendered by a dependency's component, by markdown, or by
4057
+ * `dangerouslySetInnerHTML` is invisible to the scan, loses its reset, and reports
4058
+ * nothing; a list of what went is the only way a reader can check that against what they
4059
+ * know their own app renders.
4060
+ *
4061
+ * Names rather than counts, for the same reason. "Removed 8 rules" is unverifiable.
4062
+ */
4063
+ if (result.removedElements.size && !this.reportedPreflightPrune) {
4064
+ this.reportedPreflightPrune = true;
4065
+ logger.info("prune:preflight", `Reset rules removed for ${result.removedElements.size} element(s) your source never renders: ${[...result.removedElements].sort().join(", ")}. Anything rendered by a dependency, by markdown, or through \`dangerouslySetInnerHTML\` is invisible to this scan — check the list, or set \`preflight: { prune: false }\`.`);
4066
+ }
4050
4067
  return result;
4051
4068
  };
4052
4069
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/generator",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
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.39.0",
42
- "@bamboocss/is-valid-prop": "^1.39.0",
43
- "@bamboocss/logger": "1.39.0",
44
- "@bamboocss/shared": "1.39.0",
45
- "@bamboocss/token-dictionary": "1.39.0",
46
- "@bamboocss/types": "1.39.0"
41
+ "@bamboocss/core": "1.40.0",
42
+ "@bamboocss/is-valid-prop": "^1.40.0",
43
+ "@bamboocss/logger": "1.40.0",
44
+ "@bamboocss/shared": "1.40.0",
45
+ "@bamboocss/token-dictionary": "1.40.0",
46
+ "@bamboocss/types": "1.40.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/pluralize": "0.0.33"