@animus-ui/extract 0.1.1 → 0.1.3
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/README.md +12 -11
- package/crates/extract-v2/animus-extract-v2.darwin-arm64.node +0 -0
- package/crates/extract-v2/animus-extract-v2.linux-arm64-gnu.node +0 -0
- package/crates/extract-v2/animus-extract-v2.linux-x64-gnu.node +0 -0
- package/crates/extract-v2/index.d.ts +22 -0
- package/dist/analyze-project-args.d.ts +50 -0
- package/dist/analyze-project-args.d.ts.map +1 -0
- package/dist/content-hash.d.ts +7 -0
- package/dist/content-hash.d.ts.map +1 -0
- package/dist/discover-files.d.ts +10 -0
- package/dist/discover-files.d.ts.map +1 -0
- package/dist/discover-packages.d.ts +101 -2
- package/dist/discover-packages.d.ts.map +1 -1
- package/dist/dynamic-prop-config.d.ts +23 -0
- package/dist/dynamic-prop-config.d.ts.map +1 -0
- package/dist/engine-adapter.d.ts +95 -0
- package/dist/engine-adapter.d.ts.map +1 -0
- package/dist/engine-retirement.d.ts +22 -0
- package/dist/engine-retirement.d.ts.map +1 -0
- package/dist/index.cjs +939 -179
- package/dist/index.d.ts +26 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +899 -177
- package/dist/manifest-diagnostics.d.ts +17 -0
- package/dist/manifest-diagnostics.d.ts.map +1 -0
- package/dist/path-aliases.d.ts +34 -0
- package/dist/path-aliases.d.ts.map +1 -0
- package/dist/post-process-css.d.ts +17 -0
- package/dist/post-process-css.d.ts.map +1 -0
- package/dist/run-analysis.d.ts +67 -0
- package/dist/run-analysis.d.ts.map +1 -0
- package/dist/static-css.d.ts +25 -0
- package/dist/static-css.d.ts.map +1 -0
- package/dist/system-config.d.ts +44 -0
- package/dist/system-config.d.ts.map +1 -0
- package/dist/system-props-module.d.ts +18 -0
- package/dist/system-props-module.d.ts.map +1 -0
- package/dist/timing-waterfall.d.ts +17 -0
- package/dist/timing-waterfall.d.ts.map +1 -0
- package/dist/tsconfig-paths.d.ts +8 -0
- package/dist/tsconfig-paths.d.ts.map +1 -0
- package/dist/watch-keys.d.ts +12 -0
- package/dist/watch-keys.d.ts.map +1 -0
- package/index-v2.js +6 -5
- package/package.json +14 -35
- package/animus-extract.darwin-arm64.node +0 -0
- package/animus-extract.linux-arm64-gnu.node +0 -0
- package/animus-extract.linux-x64-gnu.node +0 -0
- package/crates/extract-v2/index.js +0 -594
- package/dist/resolve-global-styles.d.ts +0 -25
- package/dist/resolve-global-styles.d.ts.map +0 -1
- package/dist/resolve-transforms.d.ts +0 -9
- package/dist/resolve-transforms.d.ts.map +0 -1
- package/index.d.ts +0 -65
- package/index.js +0 -594
package/README.md
CHANGED
|
@@ -14,20 +14,21 @@ Pre-built binaries for:
|
|
|
14
14
|
|
|
15
15
|
## API
|
|
16
16
|
|
|
17
|
+
v2 is the only engine (v1 was retired — openspec: `retire-extract-v1`); the
|
|
18
|
+
package root entry is the engine.
|
|
19
|
+
|
|
17
20
|
```tsx
|
|
18
|
-
import {
|
|
21
|
+
import { ExtractEngine, loadSystemModule } from '@animus-ui/extract';
|
|
19
22
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
const engine = new ExtractEngine({
|
|
24
|
+
configJson,
|
|
25
|
+
groupRegistryJson,
|
|
26
|
+
themeJson,
|
|
23
27
|
variableMapJson,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
devMode,
|
|
29
|
-
prefix
|
|
30
|
-
);
|
|
28
|
+
devMode: false,
|
|
29
|
+
});
|
|
30
|
+
const manifest = engine.analyze(fileEntriesJson);
|
|
31
|
+
const { code, hasComponents } = JSON.parse(engine.transformFile(path));
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
## License
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -57,6 +57,12 @@ export interface EngineOptions {
|
|
|
57
57
|
groupRegistryJson?: string
|
|
58
58
|
/** Selector aliases JSON (v1 `selector_aliases_json`). */
|
|
59
59
|
selectorAliasesJson?: string
|
|
60
|
+
/**
|
|
61
|
+
* Condition aliases JSON (inc 03 — `conditionAliases` manifest field):
|
|
62
|
+
* `{ "_motionReduce": { "value": "@media …", "order": 500, "kind":
|
|
63
|
+
* "media" } }`. Absent = no registrations.
|
|
64
|
+
*/
|
|
65
|
+
conditionAliasesJson?: string
|
|
60
66
|
/** Global style blocks JSON (v1 `global_style_blocks_json`). */
|
|
61
67
|
globalStyleBlocksJson?: string
|
|
62
68
|
/**
|
|
@@ -68,6 +74,11 @@ export interface EngineOptions {
|
|
|
68
74
|
packageResolutionJson?: string
|
|
69
75
|
/** Path aliases JSON (`{aliases: [...]}` wrapper, v1 shape). */
|
|
70
76
|
pathAliasesJson?: string
|
|
77
|
+
/**
|
|
78
|
+
* Forced-emission declarations (spec: static-emission-overrides) —
|
|
79
|
+
* the serialized `staticCss` plugin option.
|
|
80
|
+
*/
|
|
81
|
+
staticCssJson?: string
|
|
71
82
|
/** v1 `dev_mode`: retain all components (skip reconciliation pruning). */
|
|
72
83
|
devMode?: boolean
|
|
73
84
|
}
|
|
@@ -99,6 +110,17 @@ export interface NapiSystemConfig {
|
|
|
99
110
|
contextualVarsJson: string
|
|
100
111
|
selectorAliases?: string
|
|
101
112
|
selectorOrder?: string
|
|
113
|
+
/**
|
|
114
|
+
* Condition alias map JSON (inc 03 — `conditionAliases`): alias →
|
|
115
|
+
* `{ value, order, kind }`. Absent when the system registers none.
|
|
116
|
+
*/
|
|
117
|
+
conditionAliases?: string
|
|
102
118
|
globalStyleBlocks?: string
|
|
103
119
|
keyframesBlocks?: string
|
|
120
|
+
/**
|
|
121
|
+
* Canonical absolute paths of every module evaluated for the system
|
|
122
|
+
* (sorted; entry included, runtime stubs excluded). The plugins use this
|
|
123
|
+
* as the geological-reset membership set.
|
|
124
|
+
*/
|
|
125
|
+
dependencies: Array<string>
|
|
104
126
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The positional argument tuple for the NAPI `analyzeProject` call.
|
|
3
|
+
*
|
|
4
|
+
* This is the single authoritative copy of the 14-slot contract consumed by
|
|
5
|
+
* both extraction plugins (vite-plugin and next-plugin). The slot order is
|
|
6
|
+
* mirrored by the Rust NAPI surface — changing it requires a coordinated
|
|
7
|
+
* Rust-side update.
|
|
8
|
+
*/
|
|
9
|
+
/** @internal */
|
|
10
|
+
export type AnalyzeProjectArgs = [
|
|
11
|
+
filesJson: string,
|
|
12
|
+
scalesJson: string,
|
|
13
|
+
variableMapJson: string,
|
|
14
|
+
contextualVarsJson: string | null,
|
|
15
|
+
propConfigJson: string,
|
|
16
|
+
groupRegistryJson: string,
|
|
17
|
+
packageResolutionJson: string,
|
|
18
|
+
devMode: boolean,
|
|
19
|
+
emitterConfigJson: string | null,
|
|
20
|
+
selectorAliasesJson: string | null,
|
|
21
|
+
selectorOrderJson: null,
|
|
22
|
+
globalStyleBlocksJson: string | null,
|
|
23
|
+
pathAliasesJson: string | null,
|
|
24
|
+
keyframesJson: string | null,
|
|
25
|
+
staticCssJson: string | null,
|
|
26
|
+
conditionAliasesJson: string | null
|
|
27
|
+
];
|
|
28
|
+
/** @internal */
|
|
29
|
+
export interface AnalyzeProjectInputs {
|
|
30
|
+
filesJson: string;
|
|
31
|
+
scalesJson: string;
|
|
32
|
+
variableMapJson: string;
|
|
33
|
+
contextualVarsJson: string | null;
|
|
34
|
+
propConfigJson: string;
|
|
35
|
+
groupRegistryJson: string;
|
|
36
|
+
packageResolutionJson: string;
|
|
37
|
+
devMode: boolean;
|
|
38
|
+
emitterConfigJson: string | null;
|
|
39
|
+
selectorAliasesJson: string | null;
|
|
40
|
+
globalStyleBlocksJson: string | null;
|
|
41
|
+
pathAliasesJson: string | null;
|
|
42
|
+
keyframesJson: string | null;
|
|
43
|
+
/** Forced-emission declarations (spec: static-emission-overrides). */
|
|
44
|
+
staticCssJson: string | null;
|
|
45
|
+
/** Condition alias map JSON (modern-css-surface inc 03), or null. */
|
|
46
|
+
conditionAliasesJson: string | null;
|
|
47
|
+
}
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare function buildAnalyzeProjectArgs(inputs: AnalyzeProjectInputs): AnalyzeProjectArgs;
|
|
50
|
+
//# sourceMappingURL=analyze-project-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-project-args.d.ts","sourceRoot":"","sources":["../pipeline/analyze-project-args.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gBAAgB;AAChB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,MAAM;IAClB,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,MAAM,GAAG,IAAI;IACjC,cAAc,EAAE,MAAM;IACtB,iBAAiB,EAAE,MAAM;IACzB,qBAAqB,EAAE,MAAM;IAC7B,OAAO,EAAE,OAAO;IAChB,iBAAiB,EAAE,MAAM,GAAG,IAAI;IAChC,mBAAmB,EAAE,MAAM,GAAG,IAAI;IAClC,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,MAAM,GAAG,IAAI;IACpC,eAAe,EAAE,MAAM,GAAG,IAAI;IAC9B,aAAa,EAAE,MAAM,GAAG,IAAI;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI;IAG5B,oBAAoB,EAAE,MAAM,GAAG,IAAI;CACpC,CAAC;AAEF,gBAAgB;AAChB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qEAAqE;IACrE,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,oBAAoB,GAC3B,kBAAkB,CAmBpB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MD5 content hash used for file-change detection (HMR diffing) by both
|
|
3
|
+
* extraction plugins. The algorithm/encoding is a cross-plugin contract:
|
|
4
|
+
* cache keys written by one build path must compare equal in the next.
|
|
5
|
+
*/
|
|
6
|
+
export declare function contentHash(source: string): string;
|
|
7
|
+
//# sourceMappingURL=content-hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-hash.d.ts","sourceRoot":"","sources":["../pipeline/content-hash.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively discover source files under `dir`, skipping any path that
|
|
3
|
+
* contains one of `excludePatterns` (matched as substrings of both the full
|
|
4
|
+
* and root-relative path) and keeping files whose extension is in
|
|
5
|
+
* `extensionsSet`.
|
|
6
|
+
*
|
|
7
|
+
* Single authoritative copy for both extraction plugins.
|
|
8
|
+
*/
|
|
9
|
+
export declare function discoverFiles(dir: string, rootDir: string, excludePatterns: string[], extensionsSet: ReadonlySet<string>): string[];
|
|
10
|
+
//# sourceMappingURL=discover-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-files.d.ts","sourceRoot":"","sources":["../pipeline/discover-files.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EAAE,EACzB,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,GACjC,MAAM,EAAE,CAoCV"}
|
|
@@ -1,3 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk up from a resolved package entry file to the nearest directory
|
|
3
|
+
* containing a package.json (the package root). Stops at the filesystem
|
|
4
|
+
* root and returns it if no package.json is found on the way up.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findPackageRoot(absEntryPath: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Exclusion fragments for discovery inside an external package's src/,
|
|
9
|
+
* matched against paths RELATIVE TO the src dir. Per spec
|
|
10
|
+
* external-package-file-discovery, the filters apply "within the package" —
|
|
11
|
+
* an npm-installed package whose own location is under node_modules (or a
|
|
12
|
+
* repo path containing 'dist') must still have its sources discovered.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PACKAGE_SRC_EXCLUDES: string[];
|
|
15
|
+
/**
|
|
16
|
+
* What one declared include specifier produced, so callers can tell a package
|
|
17
|
+
* that contributed sources apart from one that silently contributed nothing.
|
|
18
|
+
* Collection itself never warns — reporting is the caller's policy.
|
|
19
|
+
*/
|
|
20
|
+
export interface ExternalPackageOutcome {
|
|
21
|
+
/** The declared specifier, exactly as it appeared in the system file. */
|
|
22
|
+
specifier: string;
|
|
23
|
+
/**
|
|
24
|
+
* - `resolved` — resolved to a package and accounted for at least one source
|
|
25
|
+
* - `unresolvable` — specifier could not be resolved (skipped, per spec)
|
|
26
|
+
* - `empty` — resolved to a package root but accounted for no sources
|
|
27
|
+
*/
|
|
28
|
+
outcome: 'resolved' | 'unresolvable' | 'empty';
|
|
29
|
+
/**
|
|
30
|
+
* Source files this specifier accounted for in the analysis set: files it
|
|
31
|
+
* contributed, plus files a previous specifier or the caller's own file set
|
|
32
|
+
* already supplied (those are in the set, just not attributable to this
|
|
33
|
+
* collection pass). Files skipped by `preprocessFile` or unreadable ones are
|
|
34
|
+
* NOT counted — they never reach the analysis set.
|
|
35
|
+
*/
|
|
36
|
+
fileCount: number;
|
|
37
|
+
}
|
|
38
|
+
export interface CollectedExternalPackages {
|
|
39
|
+
/** New file entries (rootDir-relative, preprocessed) for the analysis set. */
|
|
40
|
+
entries: Array<{
|
|
41
|
+
path: string;
|
|
42
|
+
source: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** specifier → rootDir-relative module-resolution entry (src/index.ts when present). */
|
|
45
|
+
packageMap: Record<string, string>;
|
|
46
|
+
/** specifier → absolute src/index.ts path, only for packages with one. */
|
|
47
|
+
sourceEntries: Map<string, string>;
|
|
48
|
+
/** Absolute directories for bundler loader allowlisting (src/ or dist entry dir). */
|
|
49
|
+
packageDirs: string[];
|
|
50
|
+
/** One record per declared specifier, in declaration order. */
|
|
51
|
+
outcomes: ExternalPackageOutcome[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Shared external-package source collection (spec:
|
|
55
|
+
* external-package-file-discovery), consumed by both extraction plugins.
|
|
56
|
+
* For each specifier: resolve to an absolute entry (null/throw → silently
|
|
57
|
+
* skip; an absolute-path specifier falls back to a filesystem probe), walk up
|
|
58
|
+
* to the package root, then either discover sources under src/ (redirecting
|
|
59
|
+
* module resolution to src/index.ts when present) or fall back to ingesting
|
|
60
|
+
* the resolved entry file itself.
|
|
61
|
+
*
|
|
62
|
+
* The only bundler-specific seams are callbacks: specifier resolution,
|
|
63
|
+
* dedup against already-ingested files, per-file preprocessing (MDX), and
|
|
64
|
+
* the unreadable-file warning. Hashing and caching stay in the plugins —
|
|
65
|
+
* their cache policies legitimately differ.
|
|
66
|
+
*
|
|
67
|
+
* Alongside the aggregates, one `ExternalPackageOutcome` per declared
|
|
68
|
+
* specifier records what that specifier produced. Collection never reports on
|
|
69
|
+
* them — any warning or gate is the caller's policy.
|
|
70
|
+
*/
|
|
71
|
+
export declare function collectExternalPackageSources(opts: {
|
|
72
|
+
specifiers: string[];
|
|
73
|
+
/** Resolve a specifier to an absolute entry path; null (or a throw) skips it. */
|
|
74
|
+
resolveSpecifier: (specifier: string) => string | null | Promise<string | null>;
|
|
75
|
+
rootDir: string;
|
|
76
|
+
extensionsSet: ReadonlySet<string>;
|
|
77
|
+
/** Does the caller's file set already contain this rootDir-relative path? */
|
|
78
|
+
hasEntry: (relPath: string) => boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Preprocess a discovered source (e.g. MDX→tsx with a path rewrite).
|
|
81
|
+
* Return null to skip the file; return the input unchanged to pass through.
|
|
82
|
+
*/
|
|
83
|
+
preprocessFile: (source: string, relPath: string, absPath: string) => Promise<{
|
|
84
|
+
source: string;
|
|
85
|
+
relPath: string;
|
|
86
|
+
} | null>;
|
|
87
|
+
/** Called when a discovered file cannot be read; the file is skipped. */
|
|
88
|
+
onUnreadable: (relPath: string, error: unknown) => void;
|
|
89
|
+
}): Promise<CollectedExternalPackages>;
|
|
1
90
|
/**
|
|
2
91
|
* Extract external DS package names from `includes` declarations in the system file.
|
|
3
92
|
*
|
|
@@ -6,10 +95,20 @@
|
|
|
6
95
|
* - Legacy: `.includes([identifier, ...])` chain method (RC migration fallback)
|
|
7
96
|
*
|
|
8
97
|
* For each identifier found, traces back to its import declaration and returns
|
|
9
|
-
* the import specifier
|
|
10
|
-
*
|
|
98
|
+
* the import specifier: a bare specifier normalized to its package name, a
|
|
99
|
+
* relative specifier resolved against the system file's directory into an
|
|
100
|
+
* absolute path (so a sibling package referenced by path contributes discovery
|
|
101
|
+
* too). Only packages explicitly declared via `includes` are treated as
|
|
102
|
+
* external DS dependencies.
|
|
11
103
|
*
|
|
12
104
|
* Falls back to empty array if no `includes` declaration is found.
|
|
13
105
|
*/
|
|
106
|
+
/**
|
|
107
|
+
* The message for the strict/warn gate over unresolvable includes, or null
|
|
108
|
+
* when every declared specifier resolved (external-package-file-discovery:
|
|
109
|
+
* silence is never an outcome — non-strict consumers warn with this line,
|
|
110
|
+
* strict consumers throw it).
|
|
111
|
+
*/
|
|
112
|
+
export declare function unresolvableIncludesMessage(outcomes: ExternalPackageOutcome[]): string | null;
|
|
14
113
|
export declare function extractSystemFilePackages(systemFilePath: string): string[];
|
|
15
114
|
//# sourceMappingURL=discover-packages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-packages.d.ts","sourceRoot":"","sources":["../pipeline/discover-packages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discover-packages.d.ts","sourceRoot":"","sources":["../pipeline/discover-packages.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAS5D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,UAKhC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,UAAU,GAAG,cAAc,GAAG,OAAO,CAAC;IAC/C;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AA6BD,MAAM,WAAW,yBAAyB;IACxC,8EAA8E;IAC9E,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,0EAA0E;IAC1E,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,qFAAqF;IACrF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,6BAA6B,CAAC,IAAI,EAAE;IACxD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iFAAiF;IACjF,gBAAgB,EAAE,CAChB,SAAS,EAAE,MAAM,KACd,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,6EAA6E;IAC7E,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC;;;OAGG;IACH,cAAc,EAAE,CACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IACzD,yEAAyE;IACzE,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzD,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAuHrC;AAED;;;;;;;;;;;;;;;GAeG;AACH;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,sBAAsB,EAAE,GACjC,MAAM,GAAG,IAAI,CAMf;AAED,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CA2F1E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* snake_case → camelCase mapping for the manifest's `dynamic_props` block.
|
|
3
|
+
*
|
|
4
|
+
* Single authoritative copy for both extraction plugins: the emitted
|
|
5
|
+
* `dynamicPropConfig` object in each plugin's system-props module is
|
|
6
|
+
* `JSON.stringify(buildDynamicPropConfig(...))`, so field order and the
|
|
7
|
+
* omission rules (no `transformName` when absent, no `scaleValues` when
|
|
8
|
+
* empty) are part of the emitted-bundle contract.
|
|
9
|
+
*/
|
|
10
|
+
export interface DynamicPropMeta {
|
|
11
|
+
var_name: string;
|
|
12
|
+
slot_class: string;
|
|
13
|
+
transform_name?: string | null;
|
|
14
|
+
scale_values?: Record<string, string> | null;
|
|
15
|
+
}
|
|
16
|
+
export interface DynamicPropConfigEntry {
|
|
17
|
+
varName: string;
|
|
18
|
+
slotClass: string;
|
|
19
|
+
transformName?: string;
|
|
20
|
+
scaleValues?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
export declare function buildDynamicPropConfig(dynamicProps: Record<string, DynamicPropMeta>): Record<string, DynamicPropConfigEntry>;
|
|
23
|
+
//# sourceMappingURL=dynamic-prop-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-prop-config.d.ts","sourceRoot":"","sources":["../pipeline/dynamic-prop-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAC5C,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAaxC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The v2 `ExtractEngine` adapter, hoisted to one authoritative copy.
|
|
3
|
+
*
|
|
4
|
+
* Both extraction plugins (next-plugin, vite-plugin) drive the stateful v2
|
|
5
|
+
* `ExtractEngine` through the engine-agnostic surface the v1 native module
|
|
6
|
+
* already exposes (loadSystemModule / analyzeProject / transformFile /
|
|
7
|
+
* clearAnalysisCache). This factory builds that surface once; the plugins
|
|
8
|
+
* differ only in (a) how the engine option is resolved, (b) how the native
|
|
9
|
+
* module is loaded, and (c) where the per-run state lives — so those are the
|
|
10
|
+
* injected dependencies.
|
|
11
|
+
*
|
|
12
|
+
* State storage is the pivotal difference: next-plugin must survive the
|
|
13
|
+
* ESM/CJS double-load (the plugin loads as ESM via next.config, the webpack
|
|
14
|
+
* loader via CJS require), so it backs the store with globalThis; vite-plugin
|
|
15
|
+
* keeps per-plugin-instance state in closure variables. The one-shot drift
|
|
16
|
+
* flag lives in the store too, so next's warning stays one-shot across the
|
|
17
|
+
* double-load.
|
|
18
|
+
*
|
|
19
|
+
* Loading semantics (lazy CJS require, fail-loud, no silent fallback to the
|
|
20
|
+
* other engine) live at the call site via `loadNativeEngine`; this module
|
|
21
|
+
* never imports the native binding, and never imports from either plugin,
|
|
22
|
+
* webpack, or vite (dependency direction: plugins -> extract).
|
|
23
|
+
*/
|
|
24
|
+
/** The stateful v2 engine handle produced by `new native.ExtractEngine(...)`. */
|
|
25
|
+
export interface V2ExtractEngine {
|
|
26
|
+
analyze(filesJson: string): string;
|
|
27
|
+
transformFile(path: string): string;
|
|
28
|
+
clearCache(): void;
|
|
29
|
+
}
|
|
30
|
+
/** Per-file transform result, as both plugins consume it. */
|
|
31
|
+
export interface TransformFileResult {
|
|
32
|
+
code: string;
|
|
33
|
+
hasComponents: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The engine-agnostic API surface. The v1 leg is the raw native module (which
|
|
37
|
+
* already exposes these methods); the v2 leg is the adapter this factory
|
|
38
|
+
* builds. The positional `analyzeProject` tuple mirrors the NAPI contract in
|
|
39
|
+
* `analyze-project-args.ts`.
|
|
40
|
+
*/
|
|
41
|
+
export interface EngineApi {
|
|
42
|
+
loadSystemModule: (...args: unknown[]) => any;
|
|
43
|
+
analyzeProject: (filesJson: string, scalesJson: string, variableMapJson: string, contextualVarsJson: string | null, propConfigJson: string, groupRegistryJson: string, packageResolutionJson: string, devMode: boolean, emitterConfigJson: string | null, selectorAliasesJson: string | null, selectorOrderJson: string | null, globalStyleBlocksJson: string | null, pathAliasesJson: string | null, keyframesJson: string | null, staticCssJson: string | null, conditionAliasesJson: string | null) => string;
|
|
44
|
+
transformFile: (source: string, path: string, manifest: string) => TransformFileResult;
|
|
45
|
+
clearAnalysisCache: () => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Storage for the per-run engine instance, the analyze-time sources (drift
|
|
49
|
+
* detection), and the one-shot drift flag. next backs this with globalThis;
|
|
50
|
+
* vite with closure variables.
|
|
51
|
+
*/
|
|
52
|
+
export interface V2EngineStateStore {
|
|
53
|
+
getEngine(): V2ExtractEngine | null;
|
|
54
|
+
setEngine(engine: V2ExtractEngine | null): void;
|
|
55
|
+
getSentSources(): Map<string, string> | null;
|
|
56
|
+
setSentSources(sources: Map<string, string> | null): void;
|
|
57
|
+
getDriftWarned(): boolean;
|
|
58
|
+
setDriftWarned(value: boolean): void;
|
|
59
|
+
}
|
|
60
|
+
/** The native engine module. Its own generated `.d.ts` is authoritative. */
|
|
61
|
+
type NativeEngineModule = any;
|
|
62
|
+
export interface V2EngineAdapterDeps {
|
|
63
|
+
/** Log label for the drift warning and the fail-loud transform error
|
|
64
|
+
* (e.g. 'animus-next', 'animus-extract'). */
|
|
65
|
+
label: string;
|
|
66
|
+
/** Whether v2 is selected. When false, `engineApi()` returns the raw native
|
|
67
|
+
* module unchanged (the v1 leg). next reads the shared engine choice from
|
|
68
|
+
* globalThis; vite the per-plugin resolved option. */
|
|
69
|
+
isV2(): boolean;
|
|
70
|
+
/** Require the native engine module. Loading semantics — lazy CJS require,
|
|
71
|
+
* fail-loud, no silent fallback — live here. */
|
|
72
|
+
loadNativeEngine(): NativeEngineModule;
|
|
73
|
+
/** Per-run state storage (globalThis for next, closure for vite). */
|
|
74
|
+
store: V2EngineStateStore;
|
|
75
|
+
/** When true, `transformFile` passes paths absent from the last `analyze()`
|
|
76
|
+
* set through unchanged (v1 parity: the webpack loader hands the adapter
|
|
77
|
+
* files outside the analysis universe — generated `.animus/*` modules,
|
|
78
|
+
* workspace-resolved library dist; vite pre-filters them, so it leaves this
|
|
79
|
+
* off). */
|
|
80
|
+
passThroughUnknownPaths?: boolean;
|
|
81
|
+
/** Optional pre-analyze re-hydration of empty sources. vite's HMR sends
|
|
82
|
+
* empty sources for unchanged files and v2 has no Rust-side cache, so vite
|
|
83
|
+
* refills them from its own file cache before analyze; next always sends
|
|
84
|
+
* full sources. Identity when omitted. */
|
|
85
|
+
rehydrateFilesJson?(filesJsonRaw: string): string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Build the engine-agnostic `engineApi()` both plugins call. Returns a function
|
|
89
|
+
* (invoked per call site) so `isV2()` and `loadNativeEngine()` re-evaluate each
|
|
90
|
+
* time — next reads its engine choice and native module dynamically from
|
|
91
|
+
* globalThis.
|
|
92
|
+
*/
|
|
93
|
+
export declare function createV2EngineApi(deps: V2EngineAdapterDeps): () => EngineApi;
|
|
94
|
+
export {};
|
|
95
|
+
//# sourceMappingURL=engine-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-adapter.d.ts","sourceRoot":"","sources":["../pipeline/engine-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,6DAA6D;AAC7D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IAIxB,gBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC;IAC9C,cAAc,EAAE,CACd,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,kBAAkB,EAAE,MAAM,GAAG,IAAI,EACjC,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,OAAO,EAAE,OAAO,EAChB,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,mBAAmB,EAAE,MAAM,GAAG,IAAI,EAClC,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,qBAAqB,EAAE,MAAM,GAAG,IAAI,EACpC,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,KAChC,MAAM,CAAC;IACZ,aAAa,EAAE,CACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,KACb,mBAAmB,CAAC;IACzB,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,IAAI,eAAe,GAAG,IAAI,CAAC;IACpC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;IAChD,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7C,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1D,cAAc,IAAI,OAAO,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACtC;AAED,4EAA4E;AAE5E,KAAK,kBAAkB,GAAG,GAAG,CAAC;AA0B9B,MAAM,WAAW,mBAAmB;IAClC;kDAC8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd;;2DAEuD;IACvD,IAAI,IAAI,OAAO,CAAC;IAChB;qDACiD;IACjD,gBAAgB,IAAI,kBAAkB,CAAC;IACvC,qEAAqE;IACrE,KAAK,EAAE,kBAAkB,CAAC;IAC1B;;;;gBAIY;IACZ,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;+CAG2C;IAC3C,kBAAkB,CAAC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,SAAS,CAgH5E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loud rejection of the retired v1 extraction engine (openspec:
|
|
3
|
+
* retire-extract-v1).
|
|
4
|
+
*
|
|
5
|
+
* v2 is the only engine. Selecting v1 — via a plugin `engine: 'v1'` option or
|
|
6
|
+
* the `ANIMUS_ENGINE=v1` fixture env override — is a build-stopping error, never
|
|
7
|
+
* a silent upgrade to v2 (design D1: a silent flip would let a pinned consumer's
|
|
8
|
+
* build change engines without notice). Both extraction plugins call this before
|
|
9
|
+
* any engine selection so the rejection is uniform and the message is defined
|
|
10
|
+
* once.
|
|
11
|
+
*/
|
|
12
|
+
/** The one canonical retirement message, shared verbatim by both plugins and
|
|
13
|
+
* the env path (tasks.md cross-cutting: define once, reuse). */
|
|
14
|
+
export declare const RETIRED_ENGINE_MESSAGE: string;
|
|
15
|
+
/**
|
|
16
|
+
* Throw the canonical retirement error when v1 is selected through either
|
|
17
|
+
* surface. Accepts the raw engine option as a string because the option type no
|
|
18
|
+
* longer admits `'v1'` — callers cast it so a stale `'v1'` config still fails
|
|
19
|
+
* loud at runtime instead of being silently coerced.
|
|
20
|
+
*/
|
|
21
|
+
export declare function assertNoRetiredEngineSelection(engineOption: string | undefined): void;
|
|
22
|
+
//# sourceMappingURL=engine-retirement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-retirement.d.ts","sourceRoot":"","sources":["../pipeline/engine-retirement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;iEACiE;AACjE,eAAO,MAAM,sBAAsB,QAEyC,CAAC;AAE7E;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,IAAI,CAIN"}
|