@animus-ui/vite-plugin 0.1.1 → 0.1.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,4 +1,6 @@
1
+ import type { StaticCssConfig } from '@animus-ui/extract/pipeline';
1
2
  import type { Plugin } from 'vite';
3
+ export { discoverFiles } from '@animus-ui/extract/pipeline';
2
4
  export interface AnimusExtractOptions {
3
5
  /**
4
6
  * Path to a module exporting a SystemInstance from `@animus-ui/system`.
@@ -7,8 +9,6 @@ export interface AnimusExtractOptions {
7
9
  * and global styles — everything the extraction pipeline needs.
8
10
  */
9
11
  system: string;
10
- /** Glob patterns to include. Defaults to .ts/.tsx/.js/.jsx files. */
11
- include?: string[];
12
12
  /** Glob patterns to exclude. */
13
13
  exclude?: string[];
14
14
  /**
@@ -46,6 +46,19 @@ export interface AnimusExtractOptions {
46
46
  * - `undefined` (default): minify in prod only
47
47
  */
48
48
  minify?: boolean;
49
+ /**
50
+ * Namespace prefix for CSS variables and class names, applied to the
51
+ * variable map/css (and theme + contextual vars) at system load.
52
+ */
53
+ prefix?: string;
54
+ /**
55
+ * Forced-emission declarations for usage the scanner cannot observe
56
+ * (CMS-driven variants, spread-hidden props, dynamically selected
57
+ * components). Declared variants/states/system-prop values and custom
58
+ * dynamic slots are emitted as if used; entries are labeled as forced
59
+ * in the extraction report. Empty/absent is a no-op.
60
+ */
61
+ staticCss?: StaticCssConfig;
49
62
  /**
50
63
  * Full `@layer` declaration order. Must include all 7 Animus `anm-*` layers
51
64
  * as a subsequence in their required order. Consumer layers may be
@@ -55,16 +68,50 @@ export interface AnimusExtractOptions {
55
68
  */
56
69
  layers?: string[];
57
70
  /**
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.
71
+ * Extraction engine selection. `'v2'` is the only engine and the default.
72
+ * The v1 engine was retired (openspec: retire-extract-v1); configuring
73
+ * `engine: 'v1'` (or setting `ANIMUS_ENGINE=v1`) throws — the selection is
74
+ * never silently upgraded.
62
75
  *
63
76
  * @default 'v2'
64
77
  */
65
- engine?: 'v1' | 'v2';
78
+ engine?: 'v2';
79
+ /**
80
+ * Pre-generated appearance bootstrap artifact — DELIVERY ONLY.
81
+ *
82
+ * When set, the plugin injects `code` verbatim as an inline
83
+ * `<script data-animus-bootstrap>` at the start of `<head>` in built HTML
84
+ * (in dev, Vite's own client script precedes it); always ahead of every
85
+ * stylesheet reference. When absent — or when `code` is empty — no
86
+ * bootstrap script is emitted and the built HTML is unchanged.
87
+ *
88
+ * The plugin performs NO generation and interprets NO appearance semantics:
89
+ * produce the artifact in your Vite config with `createAppearanceBootstrap`
90
+ * from `@animus-ui/system/bootstrap` (a build-time-only subpath) and pass the
91
+ * result through. The shape is declared structurally here so the plugin never
92
+ * imports the generator.
93
+ *
94
+ * `cspHash` is carried for the application's own `script-src` policy — the
95
+ * plugin does not read it. Serve it single-quoted, exactly as returned.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { createAppearanceBootstrap } from '@animus-ui/system/bootstrap';
100
+ * import { theme } from './src/ds';
101
+ *
102
+ * animusExtract({ system: './src/ds.ts', appearanceBootstrap: createAppearanceBootstrap(theme) })
103
+ * ```
104
+ */
105
+ appearanceBootstrap?: {
106
+ code: string;
107
+ cspHash: string;
108
+ };
66
109
  }
67
- export declare function discoverFiles(dir: string, rootDir: string, excludePatterns: string[], extensionsSet: ReadonlySet<string>): string[];
110
+ /**
111
+ * Vite adapter for the extraction pipeline. State and pipeline operations
112
+ * live in PluginContext; hook bodies live in their own modules — this
113
+ * factory only validates options and wires Vite hooks to those functions.
114
+ */
68
115
  export declare function animusExtract(options: AnimusExtractOptions): Plugin;
69
116
  export default animusExtract;
70
117
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/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oB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,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;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,mBAAmB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA0DnE;eAEc,aAAa"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Coalesces bursts of system-dependency events into single geological
3
+ * resets: a quiescence window before starting, at most one reset in
4
+ * flight, and exactly one follow-up when requests arrive mid-reset. A
5
+ * package build regenerating its dist fires one reset, not one per file.
6
+ *
7
+ * Timer functions are injected seams — `vi.mock` on node builtins silently
8
+ * no-ops under vite-plus-test, so tests drive a manual scheduler instead.
9
+ */
10
+ export declare class ResetCoalescer {
11
+ private readonly run;
12
+ private readonly quietMs;
13
+ private readonly schedule;
14
+ private readonly cancel;
15
+ private timer;
16
+ private running;
17
+ private dirty;
18
+ constructor(run: () => void, quietMs?: number, schedule?: (fn: () => void, ms: number) => unknown, cancel?: (timer: unknown) => void);
19
+ /** Ask for a reset; bursts within the quiescence window collapse. */
20
+ request(): void;
21
+ }
22
+ //# sourceMappingURL=reset-coalescer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-coalescer.d.ts","sourceRoot":"","sources":["../src/reset-coalescer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,cAAc;IAMvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAIzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAXzB,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IAEtB,YACmB,GAAG,EAAE,MAAM,IAAI,EACf,OAAO,SAAK,EACZ,QAAQ,GAAE,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,KAAK,OAGpC,EACN,MAAM,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IACS,EACpD;IAEJ,qEAAqE;IACrE,OAAO,IAAI,IAAI,CAmBd;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { PluginContext } from './context';
2
+ /**
3
+ * transform: replace builder chains with `createComponent()` calls using
4
+ * the pre-built manifest; inject the HMR bridge import once in dev; detect
5
+ * files created after buildStart and fold them into the analysis.
6
+ */
7
+ export declare function transformSource(ctx: PluginContext, code: string, id: string): {
8
+ code: string;
9
+ map: null;
10
+ } | null;
11
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,GAAG,IAAI,CA4EpC"}
@@ -0,0 +1,7 @@
1
+ import type { PluginContext } from './context';
2
+ /** resolveId: map virtual ids and redirect external DS package imports. */
3
+ export declare function resolveVirtualId(ctx: PluginContext, id: string): string | null;
4
+ /** load: serve the virtual stylesheet, components CSS, HMR bridge, and
5
+ * system-props modules from manifest-derived state. */
6
+ export declare function loadVirtualModule(ctx: PluginContext, id: string): string | null;
7
+ //# sourceMappingURL=virtual-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CAYf;AAED;wDACwD;AACxD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CAyGf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/vite-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Animus static CSS extraction Vite plugin",
5
5
  "keywords": [
6
6
  "animus",
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "scripts": {
37
37
  "build": "bun run build:ts",
38
- "build:ts": "tsdown && tsgo -p tsconfig.build.json",
39
- "compile": "tsgo --noEmit"
38
+ "build:ts": "tsdown && tsc -p tsconfig.build.json",
39
+ "compile": "tsc --noEmit"
40
40
  },
41
41
  "dependencies": {
42
- "@animus-ui/extract": "0.1.1",
42
+ "@animus-ui/extract": "0.1.2",
43
43
  "browserslist": "^4.24.0",
44
44
  "lightningcss": "^1.29.0"
45
45
  },
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=analyze-project-args.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyze-project-args.d.ts","sourceRoot":"","sources":["../src/analyze-project-args.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
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
@@ -1 +0,0 @@
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"}