@animus-ui/extract 0.1.0-next.48 → 0.1.0-next.58

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
package/dist/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export { extractSystemFilePackages } from './discover-packages';
4
4
  export { applyPrefix } from './prefix';
5
5
  export { resolveGlobalStyles, resolveTokenAliases, resolveValue, } from './resolve-global-styles';
6
6
  export { resolveTransformPlaceholders } from './resolve-transforms';
7
- export { detectRuntime, execSubprocess } from './subprocess';
8
7
  export { applyUnitFallback } from './unit-fallback';
9
8
  export { camelToKebab } from './utils';
10
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../pipeline/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,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,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,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,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,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"}
package/dist/index.mjs CHANGED
@@ -1,10 +1,5 @@
1
- import { createRequire } from "node:module";
2
1
  import { readFileSync } from "fs";
3
- import { execSync } from "child_process";
4
2
  import { UNITLESS_PROPERTIES } from "@animus-ui/properties";
5
- //#region \0rolldown/runtime.js
6
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
7
- //#endregion
8
3
  //#region pipeline/assemble-stylesheet.ts
9
4
  /**
10
5
  * The 7 Animus cascade layers. Always prefixed with `anm-` to avoid
@@ -281,53 +276,6 @@ function resolveTransformPlaceholders(css, transforms) {
281
276
  });
282
277
  }
283
278
  //#endregion
284
- //#region pipeline/subprocess.ts
285
- let cachedRuntime = null;
286
- /**
287
- * Detect which JS runtime is available for subprocess execution.
288
- * Prefers bun (faster startup), falls back to node.
289
- * Result is cached for the process lifetime.
290
- */
291
- function detectRuntime() {
292
- if (cachedRuntime) return cachedRuntime;
293
- try {
294
- execSync("bun --version", { stdio: "ignore" });
295
- cachedRuntime = "bun";
296
- } catch {
297
- cachedRuntime = "node";
298
- }
299
- return cachedRuntime;
300
- }
301
- /**
302
- * Execute a CJS script string via the detected runtime.
303
- * The script must use `require()` and synchronous Node APIs — compatible with both bun and node.
304
- *
305
- * @param script - The CJS script content to execute
306
- * @param cwd - Working directory for the subprocess
307
- * @param args - Optional CLI arguments passed after the script path
308
- * @returns stdout of the subprocess
309
- */
310
- function execSubprocess(script, cwd, args = []) {
311
- const { writeFileSync, unlinkSync } = __require("fs");
312
- const { join } = __require("path");
313
- const { tmpdir } = __require("os");
314
- const runtime = detectRuntime();
315
- const ts = Date.now();
316
- const tmpScript = join(tmpdir(), `animus-subprocess-${ts}.cjs`);
317
- writeFileSync(tmpScript, script);
318
- try {
319
- const argsStr = args.map((a) => `"${a}"`).join(" ");
320
- return execSync(runtime === "bun" ? `bun run "${tmpScript}" ${argsStr}` : `node "${tmpScript}" ${argsStr}`, {
321
- cwd,
322
- encoding: "utf-8"
323
- });
324
- } finally {
325
- try {
326
- unlinkSync(tmpScript);
327
- } catch {}
328
- }
329
- }
330
- //#endregion
331
279
  //#region pipeline/unit-fallback.ts
332
280
  /**
333
281
  * Append `px` to bare numeric values in CSS declarations for properties
@@ -368,4 +316,4 @@ function applyUnitFallback(css) {
368
316
  });
369
317
  }
370
318
  //#endregion
371
- export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, detectRuntime, execSubprocess, extractSystemFilePackages, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, validateLayerOrder };
319
+ export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, extractSystemFilePackages, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, validateLayerOrder };
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * Overrides hardcoded import paths in generated source. When `None`, defaults to
17
17
  * `@animus-ui/system` and `virtual:animus/styles.css`.
18
18
  */
19
- export declare function analyzeProject(fileEntriesJson: string, themeJson: string, variableMapJson: string, contextualVarsJson: string | undefined | null, configJson: string, groupRegistryJson: string, packageResolutionJson: string, devMode?: boolean | undefined | null, emitterConfigJson?: string | undefined | null, selectorAliasesJson?: string | undefined | null, selectorOrderJson?: string | undefined | null): string
19
+ export declare function analyzeProject(fileEntriesJson: string, themeJson: string, variableMapJson: string, contextualVarsJson: string | undefined | null, configJson: string, groupRegistryJson: string, packageResolutionJson: string, devMode?: boolean | undefined | null, emitterConfigJson?: string | undefined | null, selectorAliasesJson?: string | undefined | null, selectorOrderJson?: string | undefined | null, globalStyleBlocksJson?: string | undefined | null, pathAliasesJson?: string | undefined | null): string
20
20
 
21
21
  /**
22
22
  * Clear the per-file extraction cache used by `analyze_project()`.
@@ -35,6 +35,20 @@ export interface ExtractionResult {
35
35
  errors: Array<string>
36
36
  }
37
37
 
38
+ export declare function loadSystemModule(systemPath: string, rootDir: string, exportName?: string | undefined | null): NapiSystemConfig
39
+
40
+ export interface NapiSystemConfig {
41
+ propConfig: string
42
+ groupRegistry: string
43
+ scalesJson: string
44
+ variableMapJson: string
45
+ variableCss: string
46
+ contextualVarsJson: string
47
+ selectorAliases?: string
48
+ selectorOrder?: string
49
+ globalStyleBlocks?: string
50
+ }
51
+
38
52
  /**
39
53
  * Transform a single source file using a pre-built `UniverseManifest`.
40
54
  *
package/index.js CHANGED
@@ -579,4 +579,5 @@ module.exports = nativeBinding
579
579
  module.exports.analyzeProject = nativeBinding.analyzeProject
580
580
  module.exports.clearAnalysisCache = nativeBinding.clearAnalysisCache
581
581
  module.exports.extract = nativeBinding.extract
582
+ module.exports.loadSystemModule = nativeBinding.loadSystemModule
582
583
  module.exports.transformFile = nativeBinding.transformFile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@animus-ui/extract",
3
- "version": "0.1.0-next.48",
3
+ "version": "0.1.0-next.58",
4
4
  "description": "Animus static CSS extraction pipeline (Rust/NAPI)",
5
5
  "author": "codecaaron <airrobb@gmail.com>",
6
6
  "license": "MIT",
@@ -8,8 +8,9 @@
8
8
  "types": "index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./index.d.ts",
12
- "require": "./index.js"
11
+ "import": "./index.js",
12
+ "require": "./index.js",
13
+ "default": "./index.js"
13
14
  },
14
15
  "./pipeline": {
15
16
  "types": "./dist/index.d.ts",
@@ -58,12 +59,12 @@
58
59
  "compile": "tsc -p tsconfig.build.json --noEmit"
59
60
  },
60
61
  "optionalDependencies": {
61
- "@animus-ui/extract-darwin-arm64": "0.1.0-next.48",
62
- "@animus-ui/extract-linux-x64-gnu": "0.1.0-next.48",
63
- "@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.48"
62
+ "@animus-ui/extract-darwin-arm64": "0.1.0-next.58",
63
+ "@animus-ui/extract-linux-x64-gnu": "0.1.0-next.58",
64
+ "@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.58"
64
65
  },
65
66
  "dependencies": {
66
- "@animus-ui/properties": "0.1.0-next.48"
67
+ "@animus-ui/properties": "0.1.0-next.58"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@animus-ui/system": "workspace:*",
@@ -1,17 +0,0 @@
1
- /**
2
- * Detect which JS runtime is available for subprocess execution.
3
- * Prefers bun (faster startup), falls back to node.
4
- * Result is cached for the process lifetime.
5
- */
6
- export declare function detectRuntime(): 'bun' | 'node';
7
- /**
8
- * Execute a CJS script string via the detected runtime.
9
- * The script must use `require()` and synchronous Node APIs — compatible with both bun and node.
10
- *
11
- * @param script - The CJS script content to execute
12
- * @param cwd - Working directory for the subprocess
13
- * @param args - Optional CLI arguments passed after the script path
14
- * @returns stdout of the subprocess
15
- */
16
- export declare function execSubprocess(script: string, cwd: string, args?: string[]): string;
17
- //# sourceMappingURL=subprocess.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subprocess.d.ts","sourceRoot":"","sources":["../pipeline/subprocess.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,KAAK,GAAG,MAAM,CAW9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,MAAM,EAAO,GAClB,MAAM,CAwBR"}