@bamboocss/node 1.20.0 → 1.20.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 CHANGED
@@ -2238,6 +2238,24 @@ const keyframeNames = (ctx) => Object.keys(ctx.config.theme?.keyframes ?? {});
2238
2238
  //#endregion
2239
2239
  //#region src/builder.ts
2240
2240
  const fileModifiedMap = /* @__PURE__ */ new Map();
2241
+ /**
2242
+ * The declaration that says generated css is already present in a root.
2243
+ *
2244
+ * `generateGlobalCss` emits it unconditionally and `appendBaselineCss` always reaches that
2245
+ * artifact, so anything carrying it holds a copy of the sheet however it got there — written
2246
+ * by `write` on an earlier pass, or inlined from `styles.css` by `postcss-import`.
2247
+ *
2248
+ * A declaration rather than a comment because it has to survive the css being minified
2249
+ * between the copy landing and this check running, which a comment does not.
2250
+ */
2251
+ const GENERATED_SENTINEL = "--made-with-bamboo";
2252
+ function hasGeneratedCss(root) {
2253
+ let found = false;
2254
+ root.walkDecls(GENERATED_SENTINEL, () => {
2255
+ found = true;
2256
+ });
2257
+ return found;
2258
+ }
2241
2259
  var Builder = class {
2242
2260
  /**
2243
2261
  * The current bamboo context
@@ -2374,6 +2392,10 @@ var Builder = class {
2374
2392
  return valid;
2375
2393
  };
2376
2394
  write = (root) => {
2395
+ if (hasGeneratedCss(root)) {
2396
+ _bamboocss_logger.logger.warn("postcss", "Generated css is already present in this file, so nothing was injected. It is imported and generated here at once — keep the `@import` of `styles.css` or the `@layer` statement that the postcss plugin injects at, not both.");
2397
+ return;
2398
+ }
2377
2399
  const ctx = this.getContextOrThrow();
2378
2400
  const sheet = ctx.createSheet();
2379
2401
  ctx.appendBaselineCss(sheet);
package/dist/index.mjs CHANGED
@@ -2223,6 +2223,24 @@ const keyframeNames = (ctx) => Object.keys(ctx.config.theme?.keyframes ?? {});
2223
2223
  //#endregion
2224
2224
  //#region src/builder.ts
2225
2225
  const fileModifiedMap = /* @__PURE__ */ new Map();
2226
+ /**
2227
+ * The declaration that says generated css is already present in a root.
2228
+ *
2229
+ * `generateGlobalCss` emits it unconditionally and `appendBaselineCss` always reaches that
2230
+ * artifact, so anything carrying it holds a copy of the sheet however it got there — written
2231
+ * by `write` on an earlier pass, or inlined from `styles.css` by `postcss-import`.
2232
+ *
2233
+ * A declaration rather than a comment because it has to survive the css being minified
2234
+ * between the copy landing and this check running, which a comment does not.
2235
+ */
2236
+ const GENERATED_SENTINEL = "--made-with-bamboo";
2237
+ function hasGeneratedCss(root) {
2238
+ let found = false;
2239
+ root.walkDecls(GENERATED_SENTINEL, () => {
2240
+ found = true;
2241
+ });
2242
+ return found;
2243
+ }
2226
2244
  var Builder = class {
2227
2245
  /**
2228
2246
  * The current bamboo context
@@ -2359,6 +2377,10 @@ var Builder = class {
2359
2377
  return valid;
2360
2378
  };
2361
2379
  write = (root) => {
2380
+ if (hasGeneratedCss(root)) {
2381
+ logger.warn("postcss", "Generated css is already present in this file, so nothing was injected. It is imported and generated here at once — keep the `@import` of `styles.css` or the `@layer` statement that the postcss plugin injects at, not both.");
2382
+ return;
2383
+ }
2362
2384
  const ctx = this.getContextOrThrow();
2363
2385
  const sheet = ctx.createSheet();
2364
2386
  ctx.appendBaselineCss(sheet);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.20.0",
3
+ "version": "1.20.2",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -52,18 +52,18 @@
52
52
  "postcss": "8.5.26",
53
53
  "ts-morph": "28.0.0",
54
54
  "ts-pattern": "5.9.0",
55
- "@bamboocss/config": "1.20.0",
56
- "@bamboocss/core": "1.20.0",
57
- "@bamboocss/generator": "1.20.0",
58
- "@bamboocss/logger": "1.20.0",
59
- "@bamboocss/parser": "1.20.0",
60
- "@bamboocss/plugin-lightningcss": "1.20.0",
61
- "@bamboocss/plugin-svelte": "1.20.0",
62
- "@bamboocss/plugin-vue": "1.20.0",
63
- "@bamboocss/reporter": "1.20.0",
64
- "@bamboocss/shared": "1.20.0",
65
- "@bamboocss/token-dictionary": "1.20.0",
66
- "@bamboocss/types": "1.20.0"
55
+ "@bamboocss/config": "1.20.2",
56
+ "@bamboocss/core": "1.20.2",
57
+ "@bamboocss/generator": "1.20.2",
58
+ "@bamboocss/logger": "1.20.2",
59
+ "@bamboocss/parser": "1.20.2",
60
+ "@bamboocss/plugin-lightningcss": "1.20.2",
61
+ "@bamboocss/plugin-svelte": "1.20.2",
62
+ "@bamboocss/plugin-vue": "1.20.2",
63
+ "@bamboocss/reporter": "1.20.2",
64
+ "@bamboocss/shared": "1.20.2",
65
+ "@bamboocss/token-dictionary": "1.20.2",
66
+ "@bamboocss/types": "1.20.2"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/fs-extra": "11.0.4",