@animus-ui/extract 0.1.0-next.62 → 0.1.0-next.65

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.
Binary file
Binary file
Binary file
@@ -2,7 +2,7 @@
2
2
  * The 7 Animus cascade layers. Always prefixed with `anm-` to avoid
3
3
  * collision with other frameworks' layer names (e.g., Tailwind's `base`).
4
4
  */
5
- export declare const ANIMUS_LAYERS: readonly ["anm-global", "anm-base", "anm-variants", "anm-compounds", "anm-states", "anm-system", "anm-custom"];
5
+ export declare const ANIMUS_LAYERS: readonly ['anm-global', 'anm-base', 'anm-variants', 'anm-compounds', 'anm-states', 'anm-system', 'anm-custom'];
6
6
  /**
7
7
  * Validate that a consumer `layers` array contains all 7 Animus layers
8
8
  * in the correct relative order. Consumer layers may be interleaved.
@@ -1 +1 @@
1
- {"version":3,"file":"assemble-stylesheet.d.ts","sourceRoot":"","sources":["../pipeline/assemble-stylesheet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,gHAQhB,CAAC;AAiBX;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CA2BzD;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACnD,uBAAuB,CAAC;AAC3B,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACrD,MAAM,CAAC;AACV,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,MAAM,GAAG,uBAAuB,CAAC"}
1
+ {"version":3,"file":"assemble-stylesheet.d.ts","sourceRoot":"","sources":["../pipeline/assemble-stylesheet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,YACxB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,YAAY,CACJ,CAAC;AAiBX;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CA2BzD;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACnD,uBAAuB,CAAC;AAC3B,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACrD,MAAM,CAAC;AACV,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,MAAM,GAAG,uBAAuB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export type { AssembleStylesheetOptions, AssembleStylesheetParts, } from './assemble-stylesheet';
2
2
  export { ANIMUS_LAYERS, assembleStylesheet, stripLeadingLayerDeclaration, validateLayerOrder, } from './assemble-stylesheet';
3
3
  export { extractSystemFilePackages } from './discover-packages';
4
+ export type { DefaultExtension, PreprocessMdxResult, } from './mdx-preprocessor';
5
+ export { DEFAULT_EXTENSIONS, preprocessMdx, } from './mdx-preprocessor';
4
6
  export { applyPrefix } from './prefix';
5
7
  export { resolveGlobalStyles, resolveTokenAliases, resolveValue, } from './resolve-global-styles';
6
8
  export { resolveTransformPlaceholders } from './resolve-transforms';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../pipeline/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../pipeline/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EACV,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.mjs CHANGED
@@ -133,6 +133,63 @@ function extractSystemFilePackages(systemFilePath) {
133
133
  return Array.from(packages);
134
134
  }
135
135
  //#endregion
136
+ //#region pipeline/mdx-preprocessor.ts
137
+ /**
138
+ * MDX source preprocessor for the extraction pipeline.
139
+ *
140
+ * MDX files are first-class consumers of ds-built components but are not
141
+ * directly parseable by OXC (which the scanner uses for .tsx/.jsx). This
142
+ * module compiles MDX sources to scanner-consumable JSX using @mdx-js/mdx.
143
+ *
144
+ * @mdx-js/mdx is declared as `peerDependenciesMeta.optional` on the
145
+ * plugin packages that import this module. The dynamic import with
146
+ * .catch() ensures non-MDX consumers (who configure `extensions` to
147
+ * exclude .mdx) never trigger the resolution — zero install-footprint
148
+ * cost for them.
149
+ *
150
+ * The `DEFAULT_EXTENSIONS` constant is the shared source of truth for
151
+ * both `@animus-ui/vite-plugin` and `@animus-ui/next-plugin`. Each plugin
152
+ * imports it directly; independent redeclaration of default extensions
153
+ * is considered a regression.
154
+ */
155
+ const DEFAULT_EXTENSIONS = [
156
+ ".ts",
157
+ ".tsx",
158
+ ".js",
159
+ ".jsx",
160
+ ".mdx"
161
+ ];
162
+ /**
163
+ * Preprocess an MDX source string into scanner-consumable JSX.
164
+ *
165
+ * - Returns `{ kind: 'ok', source }` with JSX-compiled output on success.
166
+ * - Returns `{ kind: 'missing-dep' }` if @mdx-js/mdx is not resolvable
167
+ * (consumer needs to install it).
168
+ * - Returns `{ kind: 'error', error }` on compile failure (e.g. malformed
169
+ * MDX syntax). Plugins SHALL warn + skip affected files; the build
170
+ * continues with remaining files.
171
+ */
172
+ async function preprocessMdx(source, filename) {
173
+ const mdxMod = await import("@mdx-js/mdx").catch(() => null);
174
+ if (mdxMod === null) return { kind: "missing-dep" };
175
+ try {
176
+ const vfile = await mdxMod.compile(source, {
177
+ outputFormat: "program",
178
+ development: false,
179
+ jsx: true
180
+ });
181
+ return {
182
+ kind: "ok",
183
+ source: `/* @mdx-source: ${filename} */\n${String(vfile)}`
184
+ };
185
+ } catch (err) {
186
+ return {
187
+ kind: "error",
188
+ error: err instanceof Error ? err.message : String(err)
189
+ };
190
+ }
191
+ }
192
+ //#endregion
136
193
  //#region pipeline/prefix.ts
137
194
  /**
138
195
  * Apply namespace prefix to a variable map, CSS variable declarations, and theme JSON.
@@ -319,4 +376,4 @@ function applyUnitFallback(css) {
319
376
  });
320
377
  }
321
378
  //#endregion
322
- export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, extractSystemFilePackages, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, stripLeadingLayerDeclaration, validateLayerOrder };
379
+ export { ANIMUS_LAYERS, DEFAULT_EXTENSIONS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, extractSystemFilePackages, preprocessMdx, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, stripLeadingLayerDeclaration, validateLayerOrder };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * MDX source preprocessor for the extraction pipeline.
3
+ *
4
+ * MDX files are first-class consumers of ds-built components but are not
5
+ * directly parseable by OXC (which the scanner uses for .tsx/.jsx). This
6
+ * module compiles MDX sources to scanner-consumable JSX using @mdx-js/mdx.
7
+ *
8
+ * @mdx-js/mdx is declared as `peerDependenciesMeta.optional` on the
9
+ * plugin packages that import this module. The dynamic import with
10
+ * .catch() ensures non-MDX consumers (who configure `extensions` to
11
+ * exclude .mdx) never trigger the resolution — zero install-footprint
12
+ * cost for them.
13
+ *
14
+ * The `DEFAULT_EXTENSIONS` constant is the shared source of truth for
15
+ * both `@animus-ui/vite-plugin` and `@animus-ui/next-plugin`. Each plugin
16
+ * imports it directly; independent redeclaration of default extensions
17
+ * is considered a regression.
18
+ */
19
+ export declare const DEFAULT_EXTENSIONS: readonly ['.ts', '.tsx', '.js', '.jsx', '.mdx'];
20
+ export type DefaultExtension = (typeof DEFAULT_EXTENSIONS)[number];
21
+ export interface PreprocessMdxResult {
22
+ kind: 'ok' | 'missing-dep' | 'error';
23
+ /** Preprocessed JSX source. Present when kind === 'ok'. */
24
+ source?: string;
25
+ /** Error message. Present when kind === 'error'. */
26
+ error?: string;
27
+ }
28
+ /**
29
+ * Preprocess an MDX source string into scanner-consumable JSX.
30
+ *
31
+ * - Returns `{ kind: 'ok', source }` with JSX-compiled output on success.
32
+ * - Returns `{ kind: 'missing-dep' }` if @mdx-js/mdx is not resolvable
33
+ * (consumer needs to install it).
34
+ * - Returns `{ kind: 'error', error }` on compile failure (e.g. malformed
35
+ * MDX syntax). Plugins SHALL warn + skip affected files; the build
36
+ * continues with remaining files.
37
+ */
38
+ export declare function preprocessMdx(source: string, filename: string): Promise<PreprocessMdxResult>;
39
+ //# sourceMappingURL=mdx-preprocessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-preprocessor.d.ts","sourceRoot":"","sources":["../pipeline/mdx-preprocessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,kBAAkB,YAC7B,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,CACE,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,IAAI,GAAG,aAAa,GAAG,OAAO,CAAC;IACrC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CA4B9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/extract",
3
- "version": "0.1.0-next.62",
3
+ "version": "0.1.0-next.65",
4
4
  "description": "Animus static CSS extraction pipeline (Rust/NAPI)",
5
5
  "author": "codecaaron <airrobb@gmail.com>",
6
6
  "license": "MIT",
@@ -54,20 +54,30 @@
54
54
  },
55
55
  "scripts": {
56
56
  "build": "napi build --platform --release && bun run build:ts",
57
- "build:ts": "tsdown && tsc -p tsconfig.build.json",
57
+ "build:ts": "tsdown && tsgo -p tsconfig.build.json",
58
58
  "build:debug": "napi build --platform",
59
- "compile": "tsc -p tsconfig.build.json --noEmit"
59
+ "compile": "tsgo -p tsconfig.build.json --noEmit",
60
+ "compile:tsc-fallback": "tsc -p tsconfig.build.json --noEmit"
60
61
  },
61
62
  "optionalDependencies": {
62
- "@animus-ui/extract-darwin-arm64": "0.1.0-next.62",
63
- "@animus-ui/extract-linux-x64-gnu": "0.1.0-next.62",
64
- "@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.62"
63
+ "@animus-ui/extract-darwin-arm64": "0.1.0-next.65",
64
+ "@animus-ui/extract-linux-x64-gnu": "0.1.0-next.65",
65
+ "@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.65"
65
66
  },
66
67
  "dependencies": {
67
- "@animus-ui/properties": "0.1.0-next.62"
68
+ "@animus-ui/properties": "0.1.0-next.65"
69
+ },
70
+ "peerDependencies": {
71
+ "@mdx-js/mdx": "^3.0.0"
72
+ },
73
+ "peerDependenciesMeta": {
74
+ "@mdx-js/mdx": {
75
+ "optional": true
76
+ }
68
77
  },
69
78
  "devDependencies": {
70
79
  "@animus-ui/system": "workspace:*",
80
+ "@mdx-js/mdx": "^3.0.0",
71
81
  "@napi-rs/cli": "^3.0.0"
72
82
  }
73
83
  }