@animus-ui/vite-plugin 0.1.0-next.60 → 0.1.0-next.61

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.d.ts CHANGED
@@ -13,6 +13,14 @@ export interface AnimusExtractOptions {
13
13
  exclude?: string[];
14
14
  /** When true, extraction failures throw instead of warning. Use in CI to enforce full extraction. */
15
15
  strict?: boolean;
16
+ /**
17
+ * When true, run structural self-verification at the end of `buildStart`:
18
+ * component CSS non-empty, assembled layer ordering correct, `:root` block
19
+ * present in variable CSS, no unresolved `__TRANSFORM__` placeholders. Prefix
20
+ * output with `[animus:verify]`. Failures throw when `strict: true`,
21
+ * otherwise warn.
22
+ */
23
+ verify?: boolean;
16
24
  /** Enable verbose logging. Also activatable via ANIMUS_DEBUG=1 env var. */
17
25
  verbose?: boolean;
18
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6ID,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA8+BnE;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6ID,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAsjCnE;AAED,eAAe,aAAa,CAAC"}
package/dist/index.mjs CHANGED
@@ -236,6 +236,30 @@ function animusExtract(options) {
236
236
  console.warn("[animus-extract] analyzeProject failed:", e);
237
237
  }
238
238
  }
239
+ function runSelfVerify() {
240
+ const failures = [];
241
+ if (resolvedComponentCss.trim().length === 0) failures.push("No component CSS produced — check system file and include patterns");
242
+ if (!variableCss.includes(":root")) failures.push("No :root variable block found in variable CSS");
243
+ if (`${variableCss}\n${globalCss}\n${resolvedComponentCss}`.includes("__TRANSFORM__")) failures.push("Unresolved __TRANSFORM__ placeholders found in CSS output");
244
+ if (storedManifest && resolvedComponentCss.length > 0) {
245
+ const assembled = assembleStylesheet({
246
+ layers: options.layers,
247
+ variableCss,
248
+ globalCss,
249
+ componentCss: resolvedComponentCss
250
+ });
251
+ const baseIdx = assembled.search(/@layer\s+anm-base\s*\{/);
252
+ const variantsIdx = assembled.search(/@layer\s+anm-variants\s*\{/);
253
+ if (baseIdx !== -1 && variantsIdx !== -1 && baseIdx >= variantsIdx) failures.push(`CSS layer ordering violated — @layer anm-base (offset ${baseIdx}) must precede @layer anm-variants (offset ${variantsIdx})`);
254
+ }
255
+ for (const message of failures) {
256
+ const line = `[animus:verify] ${message}`;
257
+ if (options.strict) throw new Error(line);
258
+ if (logger) logger.warn(line, { timestamp: true });
259
+ else console.warn(line);
260
+ }
261
+ if (failures.length === 0) log("[animus:verify] structural self-check passed");
262
+ }
239
263
  return {
240
264
  name: "animus-extract",
241
265
  enforce: "pre",
@@ -402,6 +426,7 @@ function animusExtract(options) {
402
426
  log(`Delivery: split mode — static ${staticSize} bytes, components ${componentSize} bytes (adopted stylesheet)`);
403
427
  } else log("Delivery: single file mode (production)");
404
428
  }
429
+ if (options.verify) runSelfVerify();
405
430
  },
406
431
  resolveId(id) {
407
432
  if (id === VIRTUAL_CSS_ID) return RESOLVED_CSS_ID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.0-next.60",
3
+ "version": "0.1.0-next.61",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
5
  "author": "codecaaron <airrobb@gmail.com>",
6
6
  "license": "MIT",
@@ -37,8 +37,8 @@
37
37
  "vite": ">=5.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@animus-ui/extract": "0.1.0-next.60",
41
- "@animus-ui/system": "0.1.0-next.60",
40
+ "@animus-ui/extract": "0.1.0-next.61",
41
+ "@animus-ui/system": "0.1.0-next.61",
42
42
  "browserslist": "^4.24.0",
43
43
  "lightningcss": "^1.29.0"
44
44
  }