@animus-ui/vite-plugin 0.1.0-next.v7 → 0.1.1-beta.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.d.ts CHANGED
@@ -1,60 +1,70 @@
1
1
  import type { Plugin } from 'vite';
2
2
  export interface AnimusExtractOptions {
3
3
  /**
4
- * Theme data for the extraction pipeline.
5
- *
6
- * Two forms are accepted:
7
- * - `string` — pre-serialized flat JSON (legacy; no CSS variable emission)
8
- * - `{ scales: string; variables: string }` — pre-evaluated scales JSON
9
- * plus fully-formed CSS variable declarations to prepend to the virtual
10
- * stylesheet. The caller is responsible for evaluating the theme module
11
- * (e.g. via `evaluateTheme` or a Bun subprocess) before passing it here.
4
+ * Path to a module exporting a SystemInstance from `@animus-ui/system`.
5
+ * The module is loaded via Rust NAPI (OXC + rquickjs) at build start.
6
+ * It provides prop config, group registry, theme tokens, selector aliases,
7
+ * and global styles — everything the extraction pipeline needs.
8
+ */
9
+ system: string;
10
+ /** Glob patterns to include. Defaults to .ts/.tsx/.js/.jsx files. */
11
+ include?: string[];
12
+ /** Glob patterns to exclude. */
13
+ exclude?: string[];
14
+ /**
15
+ * File extensions to scan for component definitions and JSX usages.
16
+ * Replaces the default list entirely (not additive). Include `.mdx` to
17
+ * extract components rendered from MDX files — `@mdx-js/mdx` must be
18
+ * installed as a peer for MDX files to be preprocessed; otherwise the
19
+ * plugin warns once at buildStart and skips them.
12
20
  *
13
- * When omitted, the plugin auto-detects `src/theme.ts`, `src/theme.js`,
14
- * `theme.ts`, or `theme.js` relative to the project root.
21
+ * @default ['.ts', '.tsx', '.js', '.jsx', '.mdx']
22
+ */
23
+ extensions?: string[];
24
+ /** When true, extraction failures throw instead of warning. Use in CI to enforce full extraction. */
25
+ strict?: boolean;
26
+ /**
27
+ * When true, run structural self-verification at the end of `buildStart`:
28
+ * component CSS non-empty, assembled layer ordering correct, `:root` block
29
+ * present in variable CSS, no unresolved `__TRANSFORM__` placeholders. Prefix
30
+ * output with `[animus:verify]`. Failures throw when `strict: true`,
31
+ * otherwise warn.
15
32
  */
16
- theme?: string | {
17
- scales: string;
18
- variables: string;
19
- };
33
+ verify?: boolean;
34
+ /** Enable verbose logging. Also activatable via ANIMUS_DEBUG=1 env var. */
35
+ verbose?: boolean;
20
36
  /**
21
- * Explicit path to the theme module (relative to project root or absolute).
22
- * Takes precedence over auto-detection, but lower priority than `theme`.
37
+ * Browser targets for CSS autoprefixing and syntax lowering.
38
+ * Accepts a browserslist query string or array of queries.
39
+ * Falls back to project's browserslist config, then to `defaults`.
23
40
  */
24
- themePath?: string;
41
+ targets?: string | string[];
25
42
  /**
26
- * Path to a module exporting a SystemInstance from `@animus-ui/system`.
27
- * The module is loaded via a single bun subprocess at build start.
28
- * Replaces configPath + themePath when using the system package.
43
+ * Control CSS minification.
44
+ * - `true`: always minify (dev + prod)
45
+ * - `false`: never minify (autoprefixing still applies)
46
+ * - `undefined` (default): minify in prod only
29
47
  */
30
- system?: string;
48
+ minify?: boolean;
31
49
  /**
32
- * Path to a module exporting `getExtractConfig()`. The module is loaded via
33
- * bun subprocess at build start. Use this for custom Animus instances created
34
- * with `createAnimus().addGroup(...).build()`.
50
+ * Full `@layer` declaration order. Must include all 7 Animus `anm-*` layers
51
+ * as a subsequence in their required order. Consumer layers may be
52
+ * interleaved around them. Names are emitted as-is.
35
53
  *
36
- * When omitted, automatically imported from `@animus-ui/core`.
54
+ * Example: `['reset', 'anm-global', 'anm-base', ..., 'anm-custom', 'overrides']`
37
55
  */
38
- configPath?: string;
56
+ layers?: string[];
39
57
  /**
40
- * Pre-serialized prop config JSON. When omitted, automatically imported from
41
- * `@animus-ui/core` via `getExtractConfig()`.
58
+ * Extraction engine selection. `'v2'` (default) is the production
59
+ * engine — parity-proven against v1 with 8× fewer parses and no cache
60
+ * machinery. `'v1'` remains selectable and functional as the escape
61
+ * hatch until v1 retires.
62
+ *
63
+ * @default 'v2'
42
64
  */
43
- config?: string;
44
- /** Pre-serialized group registry JSON. Maps group names to prop name arrays. */
45
- groupRegistry?: string;
46
- /** Glob patterns to include. Defaults to .ts/.tsx/.js/.jsx files. */
47
- include?: string[];
48
- /** Glob patterns to exclude. */
49
- exclude?: string[];
50
- /** Package name patterns to resolve and include in analysis. Defaults to ['@animus-ui/*']. */
51
- packagePatterns?: string[];
52
- /** When true, extraction failures throw instead of warning. Use in CI to enforce full extraction. */
53
- strict?: boolean;
54
- /** Enable verbose logging. Also activatable via ANIMUS_DEBUG=1 env var. */
55
- verbose?: boolean;
65
+ engine?: 'v1' | 'v2';
56
66
  }
57
- export declare function animusExtract(options?: AnimusExtractOptions): Plugin;
58
- export { evaluateTheme, evaluateThemeObject } from './theme-evaluator';
67
+ export declare function discoverFiles(dir: string, rootDir: string, excludePatterns: string[], extensionsSet: ReadonlySet<string>): string[];
68
+ export declare function animusExtract(options: AnimusExtractOptions): Plugin;
59
69
  export default animusExtract;
60
70
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAM3C,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAA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,EACzB,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,MAAM,EAAE,CAqCV;AAqFD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAgzCnE;eAEc,aAAa"}
@@ -0,0 +1,10 @@
1
+ export type ManifestDiagnostic = {
2
+ file: string;
3
+ component: string;
4
+ kind: string;
5
+ message: string;
6
+ };
7
+ export declare function surfaceManifestDiagnostics(manifest: {
8
+ diagnostics?: ManifestDiagnostic[];
9
+ }, warn: (message: string) => void): void;
10
+ //# sourceMappingURL=manifest-diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-diagnostics.d.ts","sourceRoot":"","sources":["../src/manifest-diagnostics.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE;IAAE,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAE,EAChD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,IAAI,CAYN"}
package/package.json CHANGED
@@ -1,31 +1,55 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.0-next.v7",
3
+ "version": "0.1.1-beta.2",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
- "author": "codecaaron <airrobb@gmail.com>",
5
+ "keywords": [
6
+ "animus",
7
+ "css",
8
+ "css-in-js",
9
+ "styled",
10
+ "vite",
11
+ "vite-plugin",
12
+ "zero-runtime"
13
+ ],
14
+ "homepage": "https://github.com/codecaaron/animus/tree/main/packages/vite-plugin#readme",
6
15
  "license": "MIT",
7
- "main": "./dist/index.mjs",
8
- "module": "./dist/index.mjs",
9
- "types": "./dist/index.d.ts",
16
+ "author": "codecaaron <airrobb@gmail.com>",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/codecaaron/animus",
20
+ "directory": "packages/vite-plugin"
21
+ },
10
22
  "files": [
11
23
  "dist"
12
24
  ],
25
+ "main": "./dist/index.cjs",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.cjs"
31
+ }
32
+ },
13
33
  "publishConfig": {
14
34
  "access": "public"
15
35
  },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/codecaaron/animus"
19
- },
20
36
  "scripts": {
21
- "build": "tsdown && tsc -p tsconfig.build.json",
22
- "compile": "tsc --noEmit"
37
+ "build": "bun run build:ts",
38
+ "build:ts": "tsdown && tsgo -p tsconfig.build.json",
39
+ "compile": "tsgo --noEmit"
40
+ },
41
+ "dependencies": {
42
+ "@animus-ui/extract": "0.1.1-beta.2",
43
+ "browserslist": "^4.24.0",
44
+ "lightningcss": "^1.29.0"
23
45
  },
24
46
  "peerDependencies": {
25
- "vite": ">=5.0.0"
47
+ "@mdx-js/mdx": "^3.0.0",
48
+ "vite": ">=8 <9"
26
49
  },
27
- "dependencies": {
28
- "@animus-ui/core": "0.1.0-next.v7",
29
- "@animus-ui/extract": "0.1.0-next.v7"
50
+ "peerDependenciesMeta": {
51
+ "@mdx-js/mdx": {
52
+ "optional": true
53
+ }
30
54
  }
31
55
  }
@@ -1,25 +0,0 @@
1
- /**
2
- * Serialize the prop config from @animus-ui/core for the Rust extraction pipeline.
3
- *
4
- * Maps JS transform functions to string identifiers that the Rust crate
5
- * can dispatch to its native implementations.
6
- */
7
- interface PropConfig {
8
- property: string;
9
- properties?: string[];
10
- scale?: string | Record<string, any> | any[];
11
- transform?: Function;
12
- }
13
- /**
14
- * Serialize all prop groups from the animus config into a JSON map.
15
- * Prop config entries with inline scales (object/array) are skipped
16
- * since the Rust crate only handles named theme scales.
17
- */
18
- export declare function serializeConfig(propRegistry: Record<string, PropConfig>): string;
19
- /**
20
- * Serialize the group registry from the Animus config.
21
- * Maps each group name to its array of constituent prop names.
22
- */
23
- export declare function serializeGroupRegistry(groupRegistry: Record<string, string[]>): string;
24
- export {};
25
- //# sourceMappingURL=config-serializer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-serializer.d.ts","sourceRoot":"","sources":["../src/config-serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC;IAC7C,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB;AASD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GACvC,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACtC,MAAM,CAER"}