@animus-ui/next-plugin 0.1.1-beta.2 → 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.
Files changed (42) hide show
  1. package/README.md +83 -4
  2. package/dist/chunk-y_GBKt04.mjs +5 -0
  3. package/dist/extraction-session.d.ts +138 -0
  4. package/dist/extraction-session.d.ts.map +1 -0
  5. package/dist/index.cjs +762 -541
  6. package/dist/index.mjs +762 -540
  7. package/dist/loader-core-CbaYNhBu.cjs +71 -0
  8. package/dist/loader-core-D6Tm_b8F.mjs +66 -0
  9. package/dist/loader-core.d.ts +26 -0
  10. package/dist/loader-core.d.ts.map +1 -0
  11. package/dist/loader.cjs +12 -43
  12. package/dist/loader.d.ts +5 -9
  13. package/dist/loader.d.ts.map +1 -1
  14. package/dist/loader.mjs +12 -43
  15. package/dist/plugin.d.ts +24 -42
  16. package/dist/plugin.d.ts.map +1 -1
  17. package/dist/resolve-packages.d.ts +8 -0
  18. package/dist/resolve-packages.d.ts.map +1 -0
  19. package/dist/singleton-BKALu7Mk.mjs +108 -0
  20. package/dist/{singleton-CttvA4Rg.cjs → singleton-DH7yeWZa.cjs} +29 -60
  21. package/dist/singleton.d.ts +1 -8
  22. package/dist/singleton.d.ts.map +1 -1
  23. package/dist/timing.d.ts +7 -0
  24. package/dist/timing.d.ts.map +1 -0
  25. package/dist/turbopack-config.d.ts +55 -0
  26. package/dist/turbopack-config.d.ts.map +1 -0
  27. package/dist/turbopack-loader.cjs +90 -0
  28. package/dist/turbopack-loader.d.ts +16 -0
  29. package/dist/turbopack-loader.d.ts.map +1 -0
  30. package/dist/turbopack-loader.mjs +91 -0
  31. package/dist/turbopack-orchestrator.d.ts +31 -0
  32. package/dist/turbopack-orchestrator.d.ts.map +1 -0
  33. package/dist/types.d.ts +67 -10
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/with-animus.d.ts +1 -1
  36. package/dist/with-animus.d.ts.map +1 -1
  37. package/package.json +5 -5
  38. package/dist/analyze-project-args.d.ts +0 -33
  39. package/dist/analyze-project-args.d.ts.map +0 -1
  40. package/dist/manifest-diagnostics.d.ts +0 -10
  41. package/dist/manifest-diagnostics.d.ts.map +0 -1
  42. package/dist/singleton-CmwFBCJ5.mjs +0 -136
@@ -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,CAON"}
@@ -1,136 +0,0 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
- //#endregion
5
- //#region src/singleton.ts
6
- /**
7
- * Module-scope singleton for sharing analysis state between the webpack plugin and loader.
8
- *
9
- * Uses globalThis to survive the ESM/CJS module boundary: the plugin is loaded via ESM
10
- * (next.config.ts import) while the loader is loaded by webpack via require(). Without
11
- * globalThis, each module system gets its own singleton instance.
12
- */
13
- const MANIFEST_KEY = "__animus_manifest_json__";
14
- const PROMISE_KEY = "__animus_analysis_promise__";
15
- const SHARED_CSS_KEY = "__animus_shared_css__";
16
- const SHARED_SYSTEM_PROPS_KEY = "__animus_shared_system_props__";
17
- const SHARED_EXTERNAL_DIRS_KEY = "__animus_external_pkg_dirs__";
18
- const SHARED_EXTERNAL_ENTRIES_KEY = "__animus_external_source_entries__";
19
- function getManifestJson() {
20
- return globalThis[MANIFEST_KEY];
21
- }
22
- function setManifestJson(json) {
23
- globalThis[MANIFEST_KEY] = json;
24
- }
25
- function getAnalysisPromise() {
26
- return globalThis[PROMISE_KEY];
27
- }
28
- function setAnalysisPromise(promise) {
29
- globalThis[PROMISE_KEY] = promise;
30
- }
31
- function resetAnalysisPromise() {
32
- globalThis[PROMISE_KEY] = null;
33
- }
34
- function getSharedCss() {
35
- return globalThis[SHARED_CSS_KEY] || "";
36
- }
37
- function setSharedCss(css) {
38
- globalThis[SHARED_CSS_KEY] = css;
39
- }
40
- function setSharedSystemProps(content) {
41
- globalThis[SHARED_SYSTEM_PROPS_KEY] = content;
42
- }
43
- function getSharedExternalDirs() {
44
- return globalThis[SHARED_EXTERNAL_DIRS_KEY] || [];
45
- }
46
- function setSharedExternalDirs(dirs) {
47
- globalThis[SHARED_EXTERNAL_DIRS_KEY] = dirs;
48
- }
49
- function getSharedExternalEntries() {
50
- return globalThis[SHARED_EXTERNAL_ENTRIES_KEY] || /* @__PURE__ */ new Map();
51
- }
52
- function setSharedExternalEntries(entries) {
53
- globalThis[SHARED_EXTERNAL_ENTRIES_KEY] = entries;
54
- }
55
- const ENGINE_KEY = "__animus_engine__";
56
- /** Engine selection travels through the singleton so non-owning compiler
57
- * instances and the webpack loader honor the same choice as the owner. */
58
- function setSharedEngine(engine) {
59
- globalThis[ENGINE_KEY] = engine;
60
- }
61
- function getSharedEngine() {
62
- return globalThis[ENGINE_KEY] || "v2";
63
- }
64
- /** Single engine choke-point for every native extraction call. Return type
65
- * mirrors the untyped `require` the call sites previously used — the NAPI
66
- * module's own .d.ts is the authoritative surface. */
67
- function requireEngine() {
68
- return getSharedEngine() === "v2" ? __require("@animus-ui/extract/engine-v2") : __require("@animus-ui/extract");
69
- }
70
- const V2_ENGINE_KEY = "__animus_v2_engine__";
71
- /**
72
- * Engine-agnostic API over both engines (extract-v2-spine row 13). The
73
- * v2 leg adapts the v1 function surface onto a stateful ExtractEngine;
74
- * the INSTANCE lives on globalThis for the same reason the manifest
75
- * does — the ESM plugin and the CJS webpack loader must see one engine.
76
- * (The next-plugin is already process-singleton by design: manifest,
77
- * css, and system props share the same globalThis keys.)
78
- * loadSystemModule is exported by both bindings from one engine-neutral
79
- * Rust crate, so the default path no longer loads the v1 binary.
80
- */
81
- const V2_SENT_SOURCES_KEY = "__animus_v2_sent_sources__";
82
- let v2DriftWarned = false;
83
- function engineApi() {
84
- if (getSharedEngine() !== "v2") return requireEngine();
85
- const native = requireEngine();
86
- return {
87
- loadSystemModule: (...args) => native.loadSystemModule(...args),
88
- analyzeProject: (filesJson, themeJson, variableMapJson, contextualVarsJson, configJson, groupRegistryJson, packageResolutionJson, devMode, emitterConfigJson, selectorAliasesJson, _selectorOrderJson, globalStyleBlocksJson, pathAliasesJson, keyframesJson) => {
89
- const sent = /* @__PURE__ */ new Map();
90
- for (const entry of JSON.parse(filesJson)) sent.set(entry.path, entry.source);
91
- globalThis[V2_SENT_SOURCES_KEY] = sent;
92
- const emitterConfig = emitterConfigJson ? JSON.parse(emitterConfigJson) : {};
93
- globalThis[V2_ENGINE_KEY] = null;
94
- const engine = new native.ExtractEngine({
95
- runtimeImport: emitterConfig.runtime_import ?? void 0,
96
- cssModuleId: emitterConfig.css_module_id ?? void 0,
97
- systemPropsModuleId: emitterConfig.system_props_module_id ?? void 0,
98
- themeJson,
99
- variableMapJson,
100
- contextualVarsJson: contextualVarsJson ?? void 0,
101
- configJson,
102
- groupRegistryJson,
103
- selectorAliasesJson: selectorAliasesJson ?? void 0,
104
- globalStyleBlocksJson: globalStyleBlocksJson ?? void 0,
105
- keyframesJson: keyframesJson ?? void 0,
106
- packageResolutionJson: packageResolutionJson ?? void 0,
107
- pathAliasesJson: pathAliasesJson ?? void 0,
108
- devMode
109
- });
110
- globalThis[V2_ENGINE_KEY] = engine;
111
- return engine.analyze(filesJson);
112
- },
113
- transformFile: (source, path, _manifest) => {
114
- const engine = globalThis[V2_ENGINE_KEY];
115
- if (!engine) throw new Error("[animus-next] v2 transform before analyze — engine instance not initialized");
116
- const sentMap = globalThis[V2_SENT_SOURCES_KEY];
117
- if (sentMap && !sentMap.has(path)) return {
118
- code: source,
119
- hasComponents: false
120
- };
121
- const sent = sentMap?.get(path);
122
- if (sent !== void 0 && sent !== source && !v2DriftWarned) {
123
- v2DriftWarned = true;
124
- console.warn(`[animus-next] v2: transform-time source for ${path} differs from analyze-time source — an upstream transform may be reverted`);
125
- }
126
- return JSON.parse(engine.transformFile(path));
127
- },
128
- clearAnalysisCache: () => {
129
- const engine = globalThis[V2_ENGINE_KEY];
130
- if (engine) engine.clearCache();
131
- globalThis[V2_ENGINE_KEY] = null;
132
- }
133
- };
134
- }
135
- //#endregion
136
- export { getSharedEngine as a, resetAnalysisPromise as c, setSharedCss as d, setSharedEngine as f, __require as g, setSharedSystemProps as h, getSharedCss as i, setAnalysisPromise as l, setSharedExternalEntries as m, getAnalysisPromise as n, getSharedExternalDirs as o, setSharedExternalDirs as p, getManifestJson as r, getSharedExternalEntries as s, engineApi as t, setManifestJson as u };