@animus-ui/next-plugin 0.1.0-next.65 → 0.1.1-beta.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/analyze-project-args.d.ts +33 -0
- package/dist/analyze-project-args.d.ts.map +1 -0
- package/dist/index.cjs +79 -13
- package/dist/index.mjs +79 -13
- package/dist/loader.cjs +3 -3
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.mjs +3 -3
- package/dist/manifest-diagnostics.d.ts +10 -0
- package/dist/manifest-diagnostics.d.ts.map +1 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/singleton-CmwFBCJ5.mjs +136 -0
- package/dist/singleton-CttvA4Rg.cjs +221 -0
- package/dist/singleton.d.ts +10 -0
- package/dist/singleton.d.ts.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/with-animus.d.ts.map +1 -1
- package/package.json +27 -37
- package/dist/singleton-BZ9F3FQ_.mjs +0 -56
- package/dist/singleton-Cyu9XArN.cjs +0 -123
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type AnalyzeProjectArgs = [
|
|
2
|
+
filesJson: string,
|
|
3
|
+
scalesJson: string,
|
|
4
|
+
variableMapJson: string,
|
|
5
|
+
contextualVarsJson: string | null,
|
|
6
|
+
propConfigJson: string,
|
|
7
|
+
groupRegistryJson: string,
|
|
8
|
+
packageResolutionJson: string,
|
|
9
|
+
devMode: boolean,
|
|
10
|
+
emitterConfigJson: string | null,
|
|
11
|
+
selectorAliasesJson: string | null,
|
|
12
|
+
selectorOrderJson: null,
|
|
13
|
+
globalStyleBlocksJson: string | null,
|
|
14
|
+
pathAliasesJson: string | null,
|
|
15
|
+
keyframesJson: string | null
|
|
16
|
+
];
|
|
17
|
+
export interface AnalyzeProjectInputs {
|
|
18
|
+
filesJson: string;
|
|
19
|
+
scalesJson: string;
|
|
20
|
+
variableMapJson: string;
|
|
21
|
+
contextualVarsJson: string | null;
|
|
22
|
+
propConfigJson: string;
|
|
23
|
+
groupRegistryJson: string;
|
|
24
|
+
packageResolutionJson: string;
|
|
25
|
+
emitterConfigJson: string | null;
|
|
26
|
+
selectorAliasesJson: string | null;
|
|
27
|
+
globalStyleBlocksJson: string | null;
|
|
28
|
+
pathAliasesJson: string | null;
|
|
29
|
+
keyframesJson: string | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function buildProductionAnalyzeProjectArgs(inputs: AnalyzeProjectInputs): AnalyzeProjectArgs;
|
|
32
|
+
export declare function buildHmrAnalyzeProjectArgs(inputs: AnalyzeProjectInputs): AnalyzeProjectArgs;
|
|
33
|
+
//# sourceMappingURL=analyze-project-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-project-args.d.ts","sourceRoot":"","sources":["../src/analyze-project-args.ts"],"names":[],"mappings":"AAAA,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;CAC7B,CAAC;AAEF,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,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;CAC9B;AAwBD,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,oBAAoB,GAC3B,kBAAkB,CAEpB;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,oBAAoB,GAC3B,kBAAkB,CAEpB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_singleton = require("./singleton-
|
|
2
|
+
const require_singleton = require("./singleton-CttvA4Rg.cjs");
|
|
3
3
|
let fs = require("fs");
|
|
4
4
|
let path = require("path");
|
|
5
5
|
let url = require("url");
|
|
6
|
-
let crypto = require("crypto");
|
|
7
6
|
let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
|
|
7
|
+
let crypto = require("crypto");
|
|
8
|
+
//#region src/analyze-project-args.ts
|
|
9
|
+
function buildAnalyzeProjectArgs(inputs, devMode) {
|
|
10
|
+
return [
|
|
11
|
+
inputs.filesJson,
|
|
12
|
+
inputs.scalesJson,
|
|
13
|
+
inputs.variableMapJson,
|
|
14
|
+
inputs.contextualVarsJson,
|
|
15
|
+
inputs.propConfigJson,
|
|
16
|
+
inputs.groupRegistryJson,
|
|
17
|
+
inputs.packageResolutionJson,
|
|
18
|
+
devMode,
|
|
19
|
+
inputs.emitterConfigJson,
|
|
20
|
+
inputs.selectorAliasesJson,
|
|
21
|
+
null,
|
|
22
|
+
inputs.globalStyleBlocksJson,
|
|
23
|
+
inputs.pathAliasesJson,
|
|
24
|
+
inputs.keyframesJson
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
function buildProductionAnalyzeProjectArgs(inputs) {
|
|
28
|
+
return buildAnalyzeProjectArgs(inputs, false);
|
|
29
|
+
}
|
|
30
|
+
function buildHmrAnalyzeProjectArgs(inputs) {
|
|
31
|
+
return buildAnalyzeProjectArgs(inputs, true);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/manifest-diagnostics.ts
|
|
35
|
+
function surfaceManifestDiagnostics(manifest, warn) {
|
|
36
|
+
for (const diagnostic of manifest.diagnostics ?? []) {
|
|
37
|
+
if (diagnostic.kind !== "warn") continue;
|
|
38
|
+
warn(`⚠ ${diagnostic.file}: ${diagnostic.component}: ${diagnostic.message}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
8
42
|
//#region src/plugin.ts
|
|
9
43
|
const PLUGIN_NAME = "AnimusWebpackPlugin";
|
|
10
44
|
var AnimusWebpackPlugin = class {
|
|
@@ -17,7 +51,6 @@ var AnimusWebpackPlugin = class {
|
|
|
17
51
|
variableCss = "";
|
|
18
52
|
contextualVarsJson = null;
|
|
19
53
|
selectorAliasesJson = null;
|
|
20
|
-
selectorOrderJson = null;
|
|
21
54
|
globalCss = "";
|
|
22
55
|
globalStyleBlocksJson = null;
|
|
23
56
|
keyframesBlocksJson = null;
|
|
@@ -29,6 +62,7 @@ var AnimusWebpackPlugin = class {
|
|
|
29
62
|
externalSourceEntries = /* @__PURE__ */ new Map();
|
|
30
63
|
constructor(options) {
|
|
31
64
|
this.options = options;
|
|
65
|
+
require_singleton.setSharedEngine(options.engine ?? "v2");
|
|
32
66
|
}
|
|
33
67
|
get verbose() {
|
|
34
68
|
return this.options.verbose === true || process.env.ANIMUS_DEBUG === "1" || process.env.ANIMUS_DEBUG === "true";
|
|
@@ -36,6 +70,9 @@ var AnimusWebpackPlugin = class {
|
|
|
36
70
|
log(msg) {
|
|
37
71
|
if (this.verbose) console.info(`[animus] ${msg}`);
|
|
38
72
|
}
|
|
73
|
+
warn(msg) {
|
|
74
|
+
console.warn(`[animus] ${msg}`);
|
|
75
|
+
}
|
|
39
76
|
now() {
|
|
40
77
|
return this.verbose ? performance.now() : 0;
|
|
41
78
|
}
|
|
@@ -232,7 +269,7 @@ var AnimusWebpackPlugin = class {
|
|
|
232
269
|
const pipelineStart = this.now();
|
|
233
270
|
const bt = {};
|
|
234
271
|
try {
|
|
235
|
-
const { clearAnalysisCache } =
|
|
272
|
+
const { clearAnalysisCache } = require_singleton.engineApi();
|
|
236
273
|
clearAnalysisCache();
|
|
237
274
|
} catch {}
|
|
238
275
|
const rootDir = this.rootDir;
|
|
@@ -349,7 +386,7 @@ var AnimusWebpackPlugin = class {
|
|
|
349
386
|
require_singleton.setSharedExternalDirs(collectedPkgDirs);
|
|
350
387
|
require_singleton.setSharedExternalEntries(this.externalSourceEntries);
|
|
351
388
|
bt.packageResolve = this.elapsed(t);
|
|
352
|
-
const { analyzeProject } =
|
|
389
|
+
const { analyzeProject } = require_singleton.engineApi();
|
|
353
390
|
const animusDirPath = (0, path.join)(rootDir, ".animus");
|
|
354
391
|
const emitterConfig = JSON.stringify({
|
|
355
392
|
runtime_import: "@animus-ui/system/runtime",
|
|
@@ -361,10 +398,24 @@ var AnimusWebpackPlugin = class {
|
|
|
361
398
|
const packageMapJson = JSON.stringify(packageMap);
|
|
362
399
|
bt.jsonSerialize = this.elapsed(t);
|
|
363
400
|
t = this.now();
|
|
364
|
-
const manifestJson = analyzeProject(
|
|
401
|
+
const manifestJson = analyzeProject(...buildProductionAnalyzeProjectArgs({
|
|
402
|
+
filesJson: fileEntriesJson,
|
|
403
|
+
scalesJson: this.themeJson,
|
|
404
|
+
variableMapJson: this.variableMapJson,
|
|
405
|
+
contextualVarsJson: this.contextualVarsJson || null,
|
|
406
|
+
propConfigJson: this.configJson,
|
|
407
|
+
groupRegistryJson: this.groupRegistryJson,
|
|
408
|
+
packageResolutionJson: packageMapJson,
|
|
409
|
+
emitterConfigJson: emitterConfig,
|
|
410
|
+
selectorAliasesJson: this.selectorAliasesJson,
|
|
411
|
+
globalStyleBlocksJson: this.globalStyleBlocksJson,
|
|
412
|
+
pathAliasesJson: this.pathAliasesJson,
|
|
413
|
+
keyframesJson: this.keyframesBlocksJson
|
|
414
|
+
}));
|
|
365
415
|
bt.rustExtract = this.elapsed(t);
|
|
366
416
|
t = this.now();
|
|
367
417
|
const manifest = JSON.parse(manifestJson);
|
|
418
|
+
surfaceManifestDiagnostics(manifest, (message) => this.warn(message));
|
|
368
419
|
bt.jsonParse = this.elapsed(t);
|
|
369
420
|
bt.analysis = (bt.jsonSerialize ?? 0) + (bt.rustExtract ?? 0) + (bt.jsonParse ?? 0);
|
|
370
421
|
if (manifest?.report) this.log(`Extracted ${manifest.report.components_extracted ?? "?"}/${manifest.report.components_total ?? "?"} components (${bt.analysis}ms)`);
|
|
@@ -411,7 +462,7 @@ var AnimusWebpackPlugin = class {
|
|
|
411
462
|
this.logBuildTimings(bt, manifest?.timing);
|
|
412
463
|
}
|
|
413
464
|
loadSystem(rootDir, systemPath) {
|
|
414
|
-
const { loadSystemModule } =
|
|
465
|
+
const { loadSystemModule } = require_singleton.engineApi();
|
|
415
466
|
const config = loadSystemModule(systemPath, rootDir);
|
|
416
467
|
this.configJson = config.propConfig;
|
|
417
468
|
this.groupRegistryJson = config.groupRegistry;
|
|
@@ -420,7 +471,6 @@ var AnimusWebpackPlugin = class {
|
|
|
420
471
|
this.variableCss = config.variableCss;
|
|
421
472
|
this.contextualVarsJson = config.contextualVarsJson;
|
|
422
473
|
this.selectorAliasesJson = config.selectorAliases || null;
|
|
423
|
-
this.selectorOrderJson = config.selectorOrder || null;
|
|
424
474
|
if (this.options.prefix) {
|
|
425
475
|
const prefixed = (0, _animus_ui_extract_pipeline.applyPrefix)(this.options.prefix, this.variableMapJson, this.variableCss, this.themeJson, this.contextualVarsJson || void 0);
|
|
426
476
|
this.variableMapJson = prefixed.variableMapJson;
|
|
@@ -496,7 +546,7 @@ var AnimusWebpackPlugin = class {
|
|
|
496
546
|
this.lastCssHash = null;
|
|
497
547
|
this.lastSystemPropsHash = null;
|
|
498
548
|
try {
|
|
499
|
-
const { clearAnalysisCache } =
|
|
549
|
+
const { clearAnalysisCache } = require_singleton.engineApi();
|
|
500
550
|
clearAnalysisCache();
|
|
501
551
|
} catch {}
|
|
502
552
|
}
|
|
@@ -506,10 +556,11 @@ var AnimusWebpackPlugin = class {
|
|
|
506
556
|
*/
|
|
507
557
|
buildFileEntriesFromCache(changedPaths) {
|
|
508
558
|
const changedSet = new Set(changedPaths);
|
|
559
|
+
const fullSources = require_singleton.getSharedEngine() === "v2";
|
|
509
560
|
const entries = [];
|
|
510
561
|
for (const [path$1, { hash, source }] of this.fileCache) entries.push({
|
|
511
562
|
path: path$1,
|
|
512
|
-
source: changedSet.has(path$1) ? source : "",
|
|
563
|
+
source: fullSources || changedSet.has(path$1) ? source : "",
|
|
513
564
|
hash
|
|
514
565
|
});
|
|
515
566
|
return entries;
|
|
@@ -522,7 +573,7 @@ var AnimusWebpackPlugin = class {
|
|
|
522
573
|
const rootDir = this.rootDir;
|
|
523
574
|
const bt = {};
|
|
524
575
|
const pipelineStart = this.now();
|
|
525
|
-
const { analyzeProject } =
|
|
576
|
+
const { analyzeProject } = require_singleton.engineApi();
|
|
526
577
|
const animusDirPath = (0, path.join)(rootDir, ".animus");
|
|
527
578
|
const emitterConfig = JSON.stringify({
|
|
528
579
|
runtime_import: "@animus-ui/system/runtime",
|
|
@@ -534,10 +585,24 @@ var AnimusWebpackPlugin = class {
|
|
|
534
585
|
const fileEntriesJson = JSON.stringify(fileEntries);
|
|
535
586
|
bt.jsonSerialize = this.elapsed(t);
|
|
536
587
|
t = this.now();
|
|
537
|
-
const manifestJson = analyzeProject(
|
|
588
|
+
const manifestJson = analyzeProject(...buildHmrAnalyzeProjectArgs({
|
|
589
|
+
filesJson: fileEntriesJson,
|
|
590
|
+
scalesJson: this.themeJson,
|
|
591
|
+
variableMapJson: this.variableMapJson,
|
|
592
|
+
contextualVarsJson: this.contextualVarsJson || null,
|
|
593
|
+
propConfigJson: this.configJson,
|
|
594
|
+
groupRegistryJson: this.groupRegistryJson,
|
|
595
|
+
packageResolutionJson: packageMapJson,
|
|
596
|
+
emitterConfigJson: emitterConfig,
|
|
597
|
+
selectorAliasesJson: this.selectorAliasesJson,
|
|
598
|
+
globalStyleBlocksJson: this.globalStyleBlocksJson,
|
|
599
|
+
pathAliasesJson: this.pathAliasesJson,
|
|
600
|
+
keyframesJson: this.keyframesBlocksJson
|
|
601
|
+
}));
|
|
538
602
|
bt.rustExtract = this.elapsed(t);
|
|
539
603
|
t = this.now();
|
|
540
604
|
const manifest = JSON.parse(manifestJson);
|
|
605
|
+
surfaceManifestDiagnostics(manifest, (message) => this.warn(message));
|
|
541
606
|
bt.jsonParse = this.elapsed(t);
|
|
542
607
|
this.globalCss = manifest?.sheets?.global || "";
|
|
543
608
|
let componentCss = manifest?.css || "";
|
|
@@ -642,7 +707,8 @@ function withAnimus(options) {
|
|
|
642
707
|
exclude: options.exclude,
|
|
643
708
|
strict: options.strict,
|
|
644
709
|
verbose: options.verbose,
|
|
645
|
-
prefix: options.prefix
|
|
710
|
+
prefix: options.prefix,
|
|
711
|
+
engine: options.engine
|
|
646
712
|
});
|
|
647
713
|
config.plugins = config.plugins || [];
|
|
648
714
|
config.plugins.push(plugin);
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as getSharedEngine, c as resetAnalysisPromise, d as setSharedCss, f as setSharedEngine, g as __require, h as setSharedSystemProps, i as getSharedCss, l as setAnalysisPromise, m as setSharedExternalEntries, n as getAnalysisPromise, o as getSharedExternalDirs, p as setSharedExternalDirs, s as getSharedExternalEntries, t as engineApi, u as setManifestJson } from "./singleton-CmwFBCJ5.mjs";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "fs";
|
|
3
3
|
import { dirname, extname, join, relative, resolve, sep } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
-
import { createHash } from "crypto";
|
|
6
5
|
import { DEFAULT_EXTENSIONS, applyPrefix, applyUnitFallback, assembleStylesheet, extractSystemFilePackages, preprocessMdx } from "@animus-ui/extract/pipeline";
|
|
6
|
+
import { createHash } from "crypto";
|
|
7
|
+
//#region src/analyze-project-args.ts
|
|
8
|
+
function buildAnalyzeProjectArgs(inputs, devMode) {
|
|
9
|
+
return [
|
|
10
|
+
inputs.filesJson,
|
|
11
|
+
inputs.scalesJson,
|
|
12
|
+
inputs.variableMapJson,
|
|
13
|
+
inputs.contextualVarsJson,
|
|
14
|
+
inputs.propConfigJson,
|
|
15
|
+
inputs.groupRegistryJson,
|
|
16
|
+
inputs.packageResolutionJson,
|
|
17
|
+
devMode,
|
|
18
|
+
inputs.emitterConfigJson,
|
|
19
|
+
inputs.selectorAliasesJson,
|
|
20
|
+
null,
|
|
21
|
+
inputs.globalStyleBlocksJson,
|
|
22
|
+
inputs.pathAliasesJson,
|
|
23
|
+
inputs.keyframesJson
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
function buildProductionAnalyzeProjectArgs(inputs) {
|
|
27
|
+
return buildAnalyzeProjectArgs(inputs, false);
|
|
28
|
+
}
|
|
29
|
+
function buildHmrAnalyzeProjectArgs(inputs) {
|
|
30
|
+
return buildAnalyzeProjectArgs(inputs, true);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/manifest-diagnostics.ts
|
|
34
|
+
function surfaceManifestDiagnostics(manifest, warn) {
|
|
35
|
+
for (const diagnostic of manifest.diagnostics ?? []) {
|
|
36
|
+
if (diagnostic.kind !== "warn") continue;
|
|
37
|
+
warn(`⚠ ${diagnostic.file}: ${diagnostic.component}: ${diagnostic.message}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
7
41
|
//#region src/plugin.ts
|
|
8
42
|
const PLUGIN_NAME = "AnimusWebpackPlugin";
|
|
9
43
|
var AnimusWebpackPlugin = class {
|
|
@@ -16,7 +50,6 @@ var AnimusWebpackPlugin = class {
|
|
|
16
50
|
variableCss = "";
|
|
17
51
|
contextualVarsJson = null;
|
|
18
52
|
selectorAliasesJson = null;
|
|
19
|
-
selectorOrderJson = null;
|
|
20
53
|
globalCss = "";
|
|
21
54
|
globalStyleBlocksJson = null;
|
|
22
55
|
keyframesBlocksJson = null;
|
|
@@ -28,6 +61,7 @@ var AnimusWebpackPlugin = class {
|
|
|
28
61
|
externalSourceEntries = /* @__PURE__ */ new Map();
|
|
29
62
|
constructor(options) {
|
|
30
63
|
this.options = options;
|
|
64
|
+
setSharedEngine(options.engine ?? "v2");
|
|
31
65
|
}
|
|
32
66
|
get verbose() {
|
|
33
67
|
return this.options.verbose === true || process.env.ANIMUS_DEBUG === "1" || process.env.ANIMUS_DEBUG === "true";
|
|
@@ -35,6 +69,9 @@ var AnimusWebpackPlugin = class {
|
|
|
35
69
|
log(msg) {
|
|
36
70
|
if (this.verbose) console.info(`[animus] ${msg}`);
|
|
37
71
|
}
|
|
72
|
+
warn(msg) {
|
|
73
|
+
console.warn(`[animus] ${msg}`);
|
|
74
|
+
}
|
|
38
75
|
now() {
|
|
39
76
|
return this.verbose ? performance.now() : 0;
|
|
40
77
|
}
|
|
@@ -231,7 +268,7 @@ var AnimusWebpackPlugin = class {
|
|
|
231
268
|
const pipelineStart = this.now();
|
|
232
269
|
const bt = {};
|
|
233
270
|
try {
|
|
234
|
-
const { clearAnalysisCache } =
|
|
271
|
+
const { clearAnalysisCache } = engineApi();
|
|
235
272
|
clearAnalysisCache();
|
|
236
273
|
} catch {}
|
|
237
274
|
const rootDir = this.rootDir;
|
|
@@ -348,7 +385,7 @@ var AnimusWebpackPlugin = class {
|
|
|
348
385
|
setSharedExternalDirs(collectedPkgDirs);
|
|
349
386
|
setSharedExternalEntries(this.externalSourceEntries);
|
|
350
387
|
bt.packageResolve = this.elapsed(t);
|
|
351
|
-
const { analyzeProject } =
|
|
388
|
+
const { analyzeProject } = engineApi();
|
|
352
389
|
const animusDirPath = join(rootDir, ".animus");
|
|
353
390
|
const emitterConfig = JSON.stringify({
|
|
354
391
|
runtime_import: "@animus-ui/system/runtime",
|
|
@@ -360,10 +397,24 @@ var AnimusWebpackPlugin = class {
|
|
|
360
397
|
const packageMapJson = JSON.stringify(packageMap);
|
|
361
398
|
bt.jsonSerialize = this.elapsed(t);
|
|
362
399
|
t = this.now();
|
|
363
|
-
const manifestJson = analyzeProject(
|
|
400
|
+
const manifestJson = analyzeProject(...buildProductionAnalyzeProjectArgs({
|
|
401
|
+
filesJson: fileEntriesJson,
|
|
402
|
+
scalesJson: this.themeJson,
|
|
403
|
+
variableMapJson: this.variableMapJson,
|
|
404
|
+
contextualVarsJson: this.contextualVarsJson || null,
|
|
405
|
+
propConfigJson: this.configJson,
|
|
406
|
+
groupRegistryJson: this.groupRegistryJson,
|
|
407
|
+
packageResolutionJson: packageMapJson,
|
|
408
|
+
emitterConfigJson: emitterConfig,
|
|
409
|
+
selectorAliasesJson: this.selectorAliasesJson,
|
|
410
|
+
globalStyleBlocksJson: this.globalStyleBlocksJson,
|
|
411
|
+
pathAliasesJson: this.pathAliasesJson,
|
|
412
|
+
keyframesJson: this.keyframesBlocksJson
|
|
413
|
+
}));
|
|
364
414
|
bt.rustExtract = this.elapsed(t);
|
|
365
415
|
t = this.now();
|
|
366
416
|
const manifest = JSON.parse(manifestJson);
|
|
417
|
+
surfaceManifestDiagnostics(manifest, (message) => this.warn(message));
|
|
367
418
|
bt.jsonParse = this.elapsed(t);
|
|
368
419
|
bt.analysis = (bt.jsonSerialize ?? 0) + (bt.rustExtract ?? 0) + (bt.jsonParse ?? 0);
|
|
369
420
|
if (manifest?.report) this.log(`Extracted ${manifest.report.components_extracted ?? "?"}/${manifest.report.components_total ?? "?"} components (${bt.analysis}ms)`);
|
|
@@ -410,7 +461,7 @@ var AnimusWebpackPlugin = class {
|
|
|
410
461
|
this.logBuildTimings(bt, manifest?.timing);
|
|
411
462
|
}
|
|
412
463
|
loadSystem(rootDir, systemPath) {
|
|
413
|
-
const { loadSystemModule } =
|
|
464
|
+
const { loadSystemModule } = engineApi();
|
|
414
465
|
const config = loadSystemModule(systemPath, rootDir);
|
|
415
466
|
this.configJson = config.propConfig;
|
|
416
467
|
this.groupRegistryJson = config.groupRegistry;
|
|
@@ -419,7 +470,6 @@ var AnimusWebpackPlugin = class {
|
|
|
419
470
|
this.variableCss = config.variableCss;
|
|
420
471
|
this.contextualVarsJson = config.contextualVarsJson;
|
|
421
472
|
this.selectorAliasesJson = config.selectorAliases || null;
|
|
422
|
-
this.selectorOrderJson = config.selectorOrder || null;
|
|
423
473
|
if (this.options.prefix) {
|
|
424
474
|
const prefixed = applyPrefix(this.options.prefix, this.variableMapJson, this.variableCss, this.themeJson, this.contextualVarsJson || void 0);
|
|
425
475
|
this.variableMapJson = prefixed.variableMapJson;
|
|
@@ -495,7 +545,7 @@ var AnimusWebpackPlugin = class {
|
|
|
495
545
|
this.lastCssHash = null;
|
|
496
546
|
this.lastSystemPropsHash = null;
|
|
497
547
|
try {
|
|
498
|
-
const { clearAnalysisCache } =
|
|
548
|
+
const { clearAnalysisCache } = engineApi();
|
|
499
549
|
clearAnalysisCache();
|
|
500
550
|
} catch {}
|
|
501
551
|
}
|
|
@@ -505,10 +555,11 @@ var AnimusWebpackPlugin = class {
|
|
|
505
555
|
*/
|
|
506
556
|
buildFileEntriesFromCache(changedPaths) {
|
|
507
557
|
const changedSet = new Set(changedPaths);
|
|
558
|
+
const fullSources = getSharedEngine() === "v2";
|
|
508
559
|
const entries = [];
|
|
509
560
|
for (const [path, { hash, source }] of this.fileCache) entries.push({
|
|
510
561
|
path,
|
|
511
|
-
source: changedSet.has(path) ? source : "",
|
|
562
|
+
source: fullSources || changedSet.has(path) ? source : "",
|
|
512
563
|
hash
|
|
513
564
|
});
|
|
514
565
|
return entries;
|
|
@@ -521,7 +572,7 @@ var AnimusWebpackPlugin = class {
|
|
|
521
572
|
const rootDir = this.rootDir;
|
|
522
573
|
const bt = {};
|
|
523
574
|
const pipelineStart = this.now();
|
|
524
|
-
const { analyzeProject } =
|
|
575
|
+
const { analyzeProject } = engineApi();
|
|
525
576
|
const animusDirPath = join(rootDir, ".animus");
|
|
526
577
|
const emitterConfig = JSON.stringify({
|
|
527
578
|
runtime_import: "@animus-ui/system/runtime",
|
|
@@ -533,10 +584,24 @@ var AnimusWebpackPlugin = class {
|
|
|
533
584
|
const fileEntriesJson = JSON.stringify(fileEntries);
|
|
534
585
|
bt.jsonSerialize = this.elapsed(t);
|
|
535
586
|
t = this.now();
|
|
536
|
-
const manifestJson = analyzeProject(
|
|
587
|
+
const manifestJson = analyzeProject(...buildHmrAnalyzeProjectArgs({
|
|
588
|
+
filesJson: fileEntriesJson,
|
|
589
|
+
scalesJson: this.themeJson,
|
|
590
|
+
variableMapJson: this.variableMapJson,
|
|
591
|
+
contextualVarsJson: this.contextualVarsJson || null,
|
|
592
|
+
propConfigJson: this.configJson,
|
|
593
|
+
groupRegistryJson: this.groupRegistryJson,
|
|
594
|
+
packageResolutionJson: packageMapJson,
|
|
595
|
+
emitterConfigJson: emitterConfig,
|
|
596
|
+
selectorAliasesJson: this.selectorAliasesJson,
|
|
597
|
+
globalStyleBlocksJson: this.globalStyleBlocksJson,
|
|
598
|
+
pathAliasesJson: this.pathAliasesJson,
|
|
599
|
+
keyframesJson: this.keyframesBlocksJson
|
|
600
|
+
}));
|
|
537
601
|
bt.rustExtract = this.elapsed(t);
|
|
538
602
|
t = this.now();
|
|
539
603
|
const manifest = JSON.parse(manifestJson);
|
|
604
|
+
surfaceManifestDiagnostics(manifest, (message) => this.warn(message));
|
|
540
605
|
bt.jsonParse = this.elapsed(t);
|
|
541
606
|
this.globalCss = manifest?.sheets?.global || "";
|
|
542
607
|
let componentCss = manifest?.css || "";
|
|
@@ -641,7 +706,8 @@ function withAnimus(options) {
|
|
|
641
706
|
exclude: options.exclude,
|
|
642
707
|
strict: options.strict,
|
|
643
708
|
verbose: options.verbose,
|
|
644
|
-
prefix: options.prefix
|
|
709
|
+
prefix: options.prefix,
|
|
710
|
+
engine: options.engine
|
|
645
711
|
});
|
|
646
712
|
config.plugins = config.plugins || [];
|
|
647
713
|
config.plugins.push(plugin);
|
package/dist/loader.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_singleton = require("./singleton-
|
|
1
|
+
const require_singleton = require("./singleton-CttvA4Rg.cjs");
|
|
2
2
|
let path = require("path");
|
|
3
3
|
//#region src/loader.ts
|
|
4
4
|
/**
|
|
@@ -35,7 +35,7 @@ function animusLoader(source) {
|
|
|
35
35
|
const filename = (0, path.relative)(this.rootContext, this.resourcePath);
|
|
36
36
|
const isRootEntry = ROOT_ENTRY_RE.test(filename);
|
|
37
37
|
try {
|
|
38
|
-
const { transformFile } =
|
|
38
|
+
const { transformFile } = require_singleton.engineApi();
|
|
39
39
|
const result = transformFile(source, filename, manifestJson);
|
|
40
40
|
let code = result.hasComponents ? result.code : source;
|
|
41
41
|
code = code.replace(CSS_IMPORT_RE, "");
|
|
@@ -46,7 +46,7 @@ function animusLoader(source) {
|
|
|
46
46
|
return code;
|
|
47
47
|
} catch (e) {
|
|
48
48
|
const msg = e instanceof Error ? e.message : String(e);
|
|
49
|
-
if ((this.getOptions?.() ?? {}).strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}
|
|
49
|
+
if ((this.getOptions?.() ?? {}).strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
50
50
|
console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
|
|
51
51
|
return source;
|
|
52
52
|
}
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACxC,CAAC;AAuBF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACxC,CAAC;AAuBF;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,GACb,MAAM,CA0CR"}
|
package/dist/loader.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as getManifestJson, t as engineApi } from "./singleton-CmwFBCJ5.mjs";
|
|
2
2
|
import { relative } from "path";
|
|
3
3
|
//#region src/loader.ts
|
|
4
4
|
/**
|
|
@@ -35,7 +35,7 @@ function animusLoader(source) {
|
|
|
35
35
|
const filename = relative(this.rootContext, this.resourcePath);
|
|
36
36
|
const isRootEntry = ROOT_ENTRY_RE.test(filename);
|
|
37
37
|
try {
|
|
38
|
-
const { transformFile } =
|
|
38
|
+
const { transformFile } = engineApi();
|
|
39
39
|
const result = transformFile(source, filename, manifestJson);
|
|
40
40
|
let code = result.hasComponents ? result.code : source;
|
|
41
41
|
code = code.replace(CSS_IMPORT_RE, "");
|
|
@@ -46,7 +46,7 @@ function animusLoader(source) {
|
|
|
46
46
|
return code;
|
|
47
47
|
} catch (e) {
|
|
48
48
|
const msg = e instanceof Error ? e.message : String(e);
|
|
49
|
-
if ((this.getOptions?.() ?? {}).strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}
|
|
49
|
+
if ((this.getOptions?.() ?? {}).strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
50
50
|
console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
|
|
51
51
|
return source;
|
|
52
52
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ export declare class AnimusWebpackPlugin {
|
|
|
55
55
|
private variableCss;
|
|
56
56
|
private contextualVarsJson;
|
|
57
57
|
private selectorAliasesJson;
|
|
58
|
-
private selectorOrderJson;
|
|
59
58
|
private globalCss;
|
|
60
59
|
private globalStyleBlocksJson;
|
|
61
60
|
private keyframesBlocksJson;
|
|
@@ -68,6 +67,7 @@ export declare class AnimusWebpackPlugin {
|
|
|
68
67
|
constructor(options: AnimusNextOptions);
|
|
69
68
|
private get verbose();
|
|
70
69
|
private log;
|
|
70
|
+
private warn;
|
|
71
71
|
private now;
|
|
72
72
|
private elapsed;
|
|
73
73
|
private logBuildTimings;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,136 @@
|
|
|
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 };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
//#region src/singleton.ts
|
|
2
|
+
/**
|
|
3
|
+
* Module-scope singleton for sharing analysis state between the webpack plugin and loader.
|
|
4
|
+
*
|
|
5
|
+
* Uses globalThis to survive the ESM/CJS module boundary: the plugin is loaded via ESM
|
|
6
|
+
* (next.config.ts import) while the loader is loaded by webpack via require(). Without
|
|
7
|
+
* globalThis, each module system gets its own singleton instance.
|
|
8
|
+
*/
|
|
9
|
+
const MANIFEST_KEY = "__animus_manifest_json__";
|
|
10
|
+
const PROMISE_KEY = "__animus_analysis_promise__";
|
|
11
|
+
const SHARED_CSS_KEY = "__animus_shared_css__";
|
|
12
|
+
const SHARED_SYSTEM_PROPS_KEY = "__animus_shared_system_props__";
|
|
13
|
+
const SHARED_EXTERNAL_DIRS_KEY = "__animus_external_pkg_dirs__";
|
|
14
|
+
const SHARED_EXTERNAL_ENTRIES_KEY = "__animus_external_source_entries__";
|
|
15
|
+
function getManifestJson() {
|
|
16
|
+
return globalThis[MANIFEST_KEY];
|
|
17
|
+
}
|
|
18
|
+
function setManifestJson(json) {
|
|
19
|
+
globalThis[MANIFEST_KEY] = json;
|
|
20
|
+
}
|
|
21
|
+
function getAnalysisPromise() {
|
|
22
|
+
return globalThis[PROMISE_KEY];
|
|
23
|
+
}
|
|
24
|
+
function setAnalysisPromise(promise) {
|
|
25
|
+
globalThis[PROMISE_KEY] = promise;
|
|
26
|
+
}
|
|
27
|
+
function resetAnalysisPromise() {
|
|
28
|
+
globalThis[PROMISE_KEY] = null;
|
|
29
|
+
}
|
|
30
|
+
function getSharedCss() {
|
|
31
|
+
return globalThis[SHARED_CSS_KEY] || "";
|
|
32
|
+
}
|
|
33
|
+
function setSharedCss(css) {
|
|
34
|
+
globalThis[SHARED_CSS_KEY] = css;
|
|
35
|
+
}
|
|
36
|
+
function setSharedSystemProps(content) {
|
|
37
|
+
globalThis[SHARED_SYSTEM_PROPS_KEY] = content;
|
|
38
|
+
}
|
|
39
|
+
function getSharedExternalDirs() {
|
|
40
|
+
return globalThis[SHARED_EXTERNAL_DIRS_KEY] || [];
|
|
41
|
+
}
|
|
42
|
+
function setSharedExternalDirs(dirs) {
|
|
43
|
+
globalThis[SHARED_EXTERNAL_DIRS_KEY] = dirs;
|
|
44
|
+
}
|
|
45
|
+
function getSharedExternalEntries() {
|
|
46
|
+
return globalThis[SHARED_EXTERNAL_ENTRIES_KEY] || /* @__PURE__ */ new Map();
|
|
47
|
+
}
|
|
48
|
+
function setSharedExternalEntries(entries) {
|
|
49
|
+
globalThis[SHARED_EXTERNAL_ENTRIES_KEY] = entries;
|
|
50
|
+
}
|
|
51
|
+
const ENGINE_KEY = "__animus_engine__";
|
|
52
|
+
/** Engine selection travels through the singleton so non-owning compiler
|
|
53
|
+
* instances and the webpack loader honor the same choice as the owner. */
|
|
54
|
+
function setSharedEngine(engine) {
|
|
55
|
+
globalThis[ENGINE_KEY] = engine;
|
|
56
|
+
}
|
|
57
|
+
function getSharedEngine() {
|
|
58
|
+
return globalThis[ENGINE_KEY] || "v2";
|
|
59
|
+
}
|
|
60
|
+
/** Single engine choke-point for every native extraction call. Return type
|
|
61
|
+
* mirrors the untyped `require` the call sites previously used — the NAPI
|
|
62
|
+
* module's own .d.ts is the authoritative surface. */
|
|
63
|
+
function requireEngine() {
|
|
64
|
+
return getSharedEngine() === "v2" ? require("@animus-ui/extract/engine-v2") : require("@animus-ui/extract");
|
|
65
|
+
}
|
|
66
|
+
const V2_ENGINE_KEY = "__animus_v2_engine__";
|
|
67
|
+
/**
|
|
68
|
+
* Engine-agnostic API over both engines (extract-v2-spine row 13). The
|
|
69
|
+
* v2 leg adapts the v1 function surface onto a stateful ExtractEngine;
|
|
70
|
+
* the INSTANCE lives on globalThis for the same reason the manifest
|
|
71
|
+
* does — the ESM plugin and the CJS webpack loader must see one engine.
|
|
72
|
+
* (The next-plugin is already process-singleton by design: manifest,
|
|
73
|
+
* css, and system props share the same globalThis keys.)
|
|
74
|
+
* loadSystemModule is exported by both bindings from one engine-neutral
|
|
75
|
+
* Rust crate, so the default path no longer loads the v1 binary.
|
|
76
|
+
*/
|
|
77
|
+
const V2_SENT_SOURCES_KEY = "__animus_v2_sent_sources__";
|
|
78
|
+
let v2DriftWarned = false;
|
|
79
|
+
function engineApi() {
|
|
80
|
+
if (getSharedEngine() !== "v2") return requireEngine();
|
|
81
|
+
const native = requireEngine();
|
|
82
|
+
return {
|
|
83
|
+
loadSystemModule: (...args) => native.loadSystemModule(...args),
|
|
84
|
+
analyzeProject: (filesJson, themeJson, variableMapJson, contextualVarsJson, configJson, groupRegistryJson, packageResolutionJson, devMode, emitterConfigJson, selectorAliasesJson, _selectorOrderJson, globalStyleBlocksJson, pathAliasesJson, keyframesJson) => {
|
|
85
|
+
const sent = /* @__PURE__ */ new Map();
|
|
86
|
+
for (const entry of JSON.parse(filesJson)) sent.set(entry.path, entry.source);
|
|
87
|
+
globalThis[V2_SENT_SOURCES_KEY] = sent;
|
|
88
|
+
const emitterConfig = emitterConfigJson ? JSON.parse(emitterConfigJson) : {};
|
|
89
|
+
globalThis[V2_ENGINE_KEY] = null;
|
|
90
|
+
const engine = new native.ExtractEngine({
|
|
91
|
+
runtimeImport: emitterConfig.runtime_import ?? void 0,
|
|
92
|
+
cssModuleId: emitterConfig.css_module_id ?? void 0,
|
|
93
|
+
systemPropsModuleId: emitterConfig.system_props_module_id ?? void 0,
|
|
94
|
+
themeJson,
|
|
95
|
+
variableMapJson,
|
|
96
|
+
contextualVarsJson: contextualVarsJson ?? void 0,
|
|
97
|
+
configJson,
|
|
98
|
+
groupRegistryJson,
|
|
99
|
+
selectorAliasesJson: selectorAliasesJson ?? void 0,
|
|
100
|
+
globalStyleBlocksJson: globalStyleBlocksJson ?? void 0,
|
|
101
|
+
keyframesJson: keyframesJson ?? void 0,
|
|
102
|
+
packageResolutionJson: packageResolutionJson ?? void 0,
|
|
103
|
+
pathAliasesJson: pathAliasesJson ?? void 0,
|
|
104
|
+
devMode
|
|
105
|
+
});
|
|
106
|
+
globalThis[V2_ENGINE_KEY] = engine;
|
|
107
|
+
return engine.analyze(filesJson);
|
|
108
|
+
},
|
|
109
|
+
transformFile: (source, path, _manifest) => {
|
|
110
|
+
const engine = globalThis[V2_ENGINE_KEY];
|
|
111
|
+
if (!engine) throw new Error("[animus-next] v2 transform before analyze — engine instance not initialized");
|
|
112
|
+
const sentMap = globalThis[V2_SENT_SOURCES_KEY];
|
|
113
|
+
if (sentMap && !sentMap.has(path)) return {
|
|
114
|
+
code: source,
|
|
115
|
+
hasComponents: false
|
|
116
|
+
};
|
|
117
|
+
const sent = sentMap?.get(path);
|
|
118
|
+
if (sent !== void 0 && sent !== source && !v2DriftWarned) {
|
|
119
|
+
v2DriftWarned = true;
|
|
120
|
+
console.warn(`[animus-next] v2: transform-time source for ${path} differs from analyze-time source — an upstream transform may be reverted`);
|
|
121
|
+
}
|
|
122
|
+
return JSON.parse(engine.transformFile(path));
|
|
123
|
+
},
|
|
124
|
+
clearAnalysisCache: () => {
|
|
125
|
+
const engine = globalThis[V2_ENGINE_KEY];
|
|
126
|
+
if (engine) engine.clearCache();
|
|
127
|
+
globalThis[V2_ENGINE_KEY] = null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
Object.defineProperty(exports, "engineApi", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return engineApi;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "getAnalysisPromise", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function() {
|
|
141
|
+
return getAnalysisPromise;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "getManifestJson", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function() {
|
|
147
|
+
return getManifestJson;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "getSharedCss", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function() {
|
|
153
|
+
return getSharedCss;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "getSharedEngine", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function() {
|
|
159
|
+
return getSharedEngine;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "getSharedExternalDirs", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function() {
|
|
165
|
+
return getSharedExternalDirs;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "getSharedExternalEntries", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function() {
|
|
171
|
+
return getSharedExternalEntries;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "resetAnalysisPromise", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function() {
|
|
177
|
+
return resetAnalysisPromise;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "setAnalysisPromise", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function() {
|
|
183
|
+
return setAnalysisPromise;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "setManifestJson", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function() {
|
|
189
|
+
return setManifestJson;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "setSharedCss", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function() {
|
|
195
|
+
return setSharedCss;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "setSharedEngine", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function() {
|
|
201
|
+
return setSharedEngine;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "setSharedExternalDirs", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function() {
|
|
207
|
+
return setSharedExternalDirs;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "setSharedExternalEntries", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function() {
|
|
213
|
+
return setSharedExternalEntries;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "setSharedSystemProps", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function() {
|
|
219
|
+
return setSharedSystemProps;
|
|
220
|
+
}
|
|
221
|
+
});
|
package/dist/singleton.d.ts
CHANGED
|
@@ -17,4 +17,14 @@ export declare function getSharedExternalDirs(): string[];
|
|
|
17
17
|
export declare function setSharedExternalDirs(dirs: string[]): void;
|
|
18
18
|
export declare function getSharedExternalEntries(): Map<string, string>;
|
|
19
19
|
export declare function setSharedExternalEntries(entries: Map<string, string>): void;
|
|
20
|
+
export type AnimusEngine = 'v1' | 'v2';
|
|
21
|
+
/** Engine selection travels through the singleton so non-owning compiler
|
|
22
|
+
* instances and the webpack loader honor the same choice as the owner. */
|
|
23
|
+
export declare function setSharedEngine(engine: AnimusEngine): void;
|
|
24
|
+
export declare function getSharedEngine(): AnimusEngine;
|
|
25
|
+
/** Single engine choke-point for every native extraction call. Return type
|
|
26
|
+
* mirrors the untyped `require` the call sites previously used — the NAPI
|
|
27
|
+
* module's own .d.ts is the authoritative surface. */
|
|
28
|
+
export declare function requireEngine(): any;
|
|
29
|
+
export declare function engineApi(): any;
|
|
20
30
|
//# sourceMappingURL=singleton.d.ts.map
|
package/dist/singleton.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../src/singleton.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAIzD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAE/D;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,wBAAgB,YAAY,IAAI,MAAM,CAIrC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1D;AAED,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAMhD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAE1D;AAED,wBAAgB,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAM9D;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAG3E"}
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../src/singleton.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAIzD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAE/D;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,wBAAgB,YAAY,IAAI,MAAM,CAIrC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1D;AAED,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAMhD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAE1D;AAED,wBAAgB,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAM9D;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAG3E;AAID,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC;2EAC2E;AAC3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,wBAAgB,eAAe,IAAI,YAAY,CAQ9C;AAED;;uDAEuD;AAEvD,wBAAgB,aAAa,IAAI,GAAG,CAOnC;AAiBD,wBAAgB,SAAS,IAAI,GAAG,CAmG/B"}
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ export interface AnimusNextOptions {
|
|
|
19
19
|
verbose?: boolean;
|
|
20
20
|
/** Namespace prefix for CSS variables and class names. */
|
|
21
21
|
prefix?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Extraction engine selection. `'v2'` (default) is the production
|
|
24
|
+
* engine — parity-proven against v1 with 8× fewer parses and no cache
|
|
25
|
+
* machinery. `'v1'` remains selectable and functional as the escape
|
|
26
|
+
* hatch until v1 retires. Propagated to every compiler instance,
|
|
27
|
+
* including non-owning ones.
|
|
28
|
+
*
|
|
29
|
+
* @default 'v2'
|
|
30
|
+
*/
|
|
31
|
+
engine?: 'v1' | 'v2';
|
|
22
32
|
/**
|
|
23
33
|
* Full `@layer` declaration order. Must include all 7 Animus layers
|
|
24
34
|
* (`global`, `base`, `variants`, `compounds`, `states`, `system`, `custom`)
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-animus.d.ts","sourceRoot":"","sources":["../src/with-animus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-animus.d.ts","sourceRoot":"","sources":["../src/with-animus.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAKjD,KAAK,aAAa,GAAG;IACnB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,KAAK,CAAC;YACZ,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;YAC5C,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;YAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,GAAG,CAAC,EAAE,KAAK,CAAC;gBAAE,MAAM,EAAE,MAAM,CAAC;gBAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;aAAE,CAAC,CAAC;SACpE,CAAC,CAAC;KACJ,CAAC;CACH,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC1C,OAAO,CAAC,EAAE,CACR,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC7B,aAAa,CAAC;CACpB,CAAC;AAIF;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,GACzB,CAAC,UAAU,EAAE,UAAU,KAAK,UAAU,CAgLxC"}
|
package/package.json
CHANGED
|
@@ -1,65 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/next-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-beta.2",
|
|
4
4
|
"description": "Animus static CSS extraction for Next.js (webpack)",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"animus",
|
|
7
|
+
"css",
|
|
8
|
+
"css-in-js",
|
|
9
|
+
"next",
|
|
10
|
+
"nextjs",
|
|
11
|
+
"styled",
|
|
12
|
+
"webpack",
|
|
13
|
+
"zero-runtime"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/codecaaron/animus/tree/main/packages/next-plugin#readme",
|
|
6
16
|
"license": "MIT",
|
|
17
|
+
"author": "codecaaron <airrobb@gmail.com>",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/codecaaron/animus",
|
|
21
|
+
"directory": "packages/next-plugin"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
7
26
|
"main": "./dist/index.cjs",
|
|
8
|
-
"module": "./dist/index.mjs",
|
|
9
27
|
"types": "./dist/index.d.ts",
|
|
10
28
|
"exports": {
|
|
11
29
|
".": {
|
|
12
30
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.mjs",
|
|
14
|
-
"require": "./dist/index.cjs",
|
|
15
31
|
"default": "./dist/index.cjs"
|
|
16
|
-
},
|
|
17
|
-
"./loader": {
|
|
18
|
-
"types": "./dist/loader.d.ts",
|
|
19
|
-
"import": "./dist/loader.mjs",
|
|
20
|
-
"require": "./dist/loader.cjs",
|
|
21
|
-
"default": "./dist/loader.cjs"
|
|
22
32
|
}
|
|
23
33
|
},
|
|
24
|
-
"files": [
|
|
25
|
-
"dist"
|
|
26
|
-
],
|
|
27
34
|
"publishConfig": {
|
|
28
35
|
"access": "public"
|
|
29
36
|
},
|
|
30
|
-
"homepage": "https://github.com/codecaaron/animus/tree/main/packages/next-plugin#readme",
|
|
31
|
-
"repository": {
|
|
32
|
-
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/codecaaron/animus",
|
|
34
|
-
"directory": "packages/next-plugin"
|
|
35
|
-
},
|
|
36
|
-
"keywords": [
|
|
37
|
-
"next",
|
|
38
|
-
"nextjs",
|
|
39
|
-
"webpack",
|
|
40
|
-
"css",
|
|
41
|
-
"css-in-js",
|
|
42
|
-
"zero-runtime",
|
|
43
|
-
"styled",
|
|
44
|
-
"animus"
|
|
45
|
-
],
|
|
46
37
|
"scripts": {
|
|
47
38
|
"build": "bun run build:ts",
|
|
48
39
|
"build:ts": "tsdown && tsgo -p tsconfig.build.json",
|
|
49
|
-
"compile": "tsgo --noEmit"
|
|
50
|
-
|
|
40
|
+
"compile": "tsgo --noEmit"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@animus-ui/extract": "0.1.1-beta.2"
|
|
51
44
|
},
|
|
52
45
|
"peerDependencies": {
|
|
53
46
|
"@mdx-js/mdx": "^3.0.0",
|
|
54
|
-
"next": ">=
|
|
55
|
-
"webpack": ">=5
|
|
47
|
+
"next": ">=15 <16",
|
|
48
|
+
"webpack": ">=5 <6"
|
|
56
49
|
},
|
|
57
50
|
"peerDependenciesMeta": {
|
|
58
51
|
"@mdx-js/mdx": {
|
|
59
52
|
"optional": true
|
|
60
53
|
}
|
|
61
|
-
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"@animus-ui/extract": "0.1.0-next.65"
|
|
64
54
|
}
|
|
65
55
|
}
|
|
@@ -1,56 +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
|
-
//#endregion
|
|
56
|
-
export { getSharedExternalEntries as a, setManifestJson as c, setSharedExternalEntries as d, setSharedSystemProps as f, getSharedExternalDirs as i, setSharedCss as l, getManifestJson as n, resetAnalysisPromise as o, __require as p, getSharedCss as r, setAnalysisPromise as s, getAnalysisPromise as t, setSharedExternalDirs as u };
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
//#region src/singleton.ts
|
|
2
|
-
/**
|
|
3
|
-
* Module-scope singleton for sharing analysis state between the webpack plugin and loader.
|
|
4
|
-
*
|
|
5
|
-
* Uses globalThis to survive the ESM/CJS module boundary: the plugin is loaded via ESM
|
|
6
|
-
* (next.config.ts import) while the loader is loaded by webpack via require(). Without
|
|
7
|
-
* globalThis, each module system gets its own singleton instance.
|
|
8
|
-
*/
|
|
9
|
-
const MANIFEST_KEY = "__animus_manifest_json__";
|
|
10
|
-
const PROMISE_KEY = "__animus_analysis_promise__";
|
|
11
|
-
const SHARED_CSS_KEY = "__animus_shared_css__";
|
|
12
|
-
const SHARED_SYSTEM_PROPS_KEY = "__animus_shared_system_props__";
|
|
13
|
-
const SHARED_EXTERNAL_DIRS_KEY = "__animus_external_pkg_dirs__";
|
|
14
|
-
const SHARED_EXTERNAL_ENTRIES_KEY = "__animus_external_source_entries__";
|
|
15
|
-
function getManifestJson() {
|
|
16
|
-
return globalThis[MANIFEST_KEY];
|
|
17
|
-
}
|
|
18
|
-
function setManifestJson(json) {
|
|
19
|
-
globalThis[MANIFEST_KEY] = json;
|
|
20
|
-
}
|
|
21
|
-
function getAnalysisPromise() {
|
|
22
|
-
return globalThis[PROMISE_KEY];
|
|
23
|
-
}
|
|
24
|
-
function setAnalysisPromise(promise) {
|
|
25
|
-
globalThis[PROMISE_KEY] = promise;
|
|
26
|
-
}
|
|
27
|
-
function resetAnalysisPromise() {
|
|
28
|
-
globalThis[PROMISE_KEY] = null;
|
|
29
|
-
}
|
|
30
|
-
function getSharedCss() {
|
|
31
|
-
return globalThis[SHARED_CSS_KEY] || "";
|
|
32
|
-
}
|
|
33
|
-
function setSharedCss(css) {
|
|
34
|
-
globalThis[SHARED_CSS_KEY] = css;
|
|
35
|
-
}
|
|
36
|
-
function setSharedSystemProps(content) {
|
|
37
|
-
globalThis[SHARED_SYSTEM_PROPS_KEY] = content;
|
|
38
|
-
}
|
|
39
|
-
function getSharedExternalDirs() {
|
|
40
|
-
return globalThis[SHARED_EXTERNAL_DIRS_KEY] || [];
|
|
41
|
-
}
|
|
42
|
-
function setSharedExternalDirs(dirs) {
|
|
43
|
-
globalThis[SHARED_EXTERNAL_DIRS_KEY] = dirs;
|
|
44
|
-
}
|
|
45
|
-
function getSharedExternalEntries() {
|
|
46
|
-
return globalThis[SHARED_EXTERNAL_ENTRIES_KEY] || /* @__PURE__ */ new Map();
|
|
47
|
-
}
|
|
48
|
-
function setSharedExternalEntries(entries) {
|
|
49
|
-
globalThis[SHARED_EXTERNAL_ENTRIES_KEY] = entries;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
Object.defineProperty(exports, "getAnalysisPromise", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function() {
|
|
55
|
-
return getAnalysisPromise;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(exports, "getManifestJson", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function() {
|
|
61
|
-
return getManifestJson;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(exports, "getSharedCss", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
get: function() {
|
|
67
|
-
return getSharedCss;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
Object.defineProperty(exports, "getSharedExternalDirs", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
get: function() {
|
|
73
|
-
return getSharedExternalDirs;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
Object.defineProperty(exports, "getSharedExternalEntries", {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function() {
|
|
79
|
-
return getSharedExternalEntries;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
Object.defineProperty(exports, "resetAnalysisPromise", {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
get: function() {
|
|
85
|
-
return resetAnalysisPromise;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
Object.defineProperty(exports, "setAnalysisPromise", {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
get: function() {
|
|
91
|
-
return setAnalysisPromise;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(exports, "setManifestJson", {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: function() {
|
|
97
|
-
return setManifestJson;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(exports, "setSharedCss", {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function() {
|
|
103
|
-
return setSharedCss;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
Object.defineProperty(exports, "setSharedExternalDirs", {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
get: function() {
|
|
109
|
-
return setSharedExternalDirs;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
Object.defineProperty(exports, "setSharedExternalEntries", {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
get: function() {
|
|
115
|
-
return setSharedExternalEntries;
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
Object.defineProperty(exports, "setSharedSystemProps", {
|
|
119
|
-
enumerable: true,
|
|
120
|
-
get: function() {
|
|
121
|
-
return setSharedSystemProps;
|
|
122
|
-
}
|
|
123
|
-
});
|