@animus-ui/vite-plugin 0.1.17 → 0.1.19
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/build-start.d.ts.map +1 -1
- package/dist/context.d.ts +11 -5
- package/dist/context.d.ts.map +1 -1
- package/dist/index.cjs +46 -33
- package/dist/virtual-modules.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-start.d.ts","sourceRoot":"","sources":["../src/build-start.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-start.d.ts","sourceRoot":"","sources":["../src/build-start.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAC/D,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,MAAM,GAC3D,OAAO,CAAC,IAAI,CAAC,CA+Mf"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HotUpdateEvents } from './hot-update-events';
|
|
2
2
|
import type { LightningTargets } from './css';
|
|
3
3
|
import type { AnimusExtractOptions } from './index';
|
|
4
|
-
import type { ExcludeMatcher, ExternalPackageOutcome,
|
|
4
|
+
import type { ExcludeMatcher, ExternalPackageOutcome, ManifestSheets, ProjectManifest, RawSourceEntry, SourceCorpus, SourceIngestionResult, SystemConfig } from '@animus-ui/extract/pipeline';
|
|
5
5
|
import type { Logger } from 'vite';
|
|
6
6
|
/** Runs `task` after every analysis transaction already scheduled for this
|
|
7
7
|
* context. Entry points only — a nested call waits on its own chain. */
|
|
@@ -40,9 +40,6 @@ export declare class PluginContext {
|
|
|
40
40
|
layerDeclaration: string;
|
|
41
41
|
transformOutputHashes: Map<string, string>;
|
|
42
42
|
recordTransformOutput(relativePath: string, code: string): void;
|
|
43
|
-
/** Vocabulary witnesses from the sealed system, awaiting the next analysis.
|
|
44
|
-
* Surfacing happens only inside `runProjectAnalysis`. */
|
|
45
|
-
systemVocabularyDiagnostics: ManifestDiagnostic[];
|
|
46
43
|
reverseProvenance: Record<string, string[]>;
|
|
47
44
|
storedSystemPropMapJson: string;
|
|
48
45
|
storedDynamicPropsJson: string;
|
|
@@ -110,7 +107,6 @@ export declare class PluginContext {
|
|
|
110
107
|
* without opting in. */
|
|
111
108
|
info(msg: string): void;
|
|
112
109
|
warn(msg: string): void;
|
|
113
|
-
logTimingWaterfall(timing: Record<string, number>): void;
|
|
114
110
|
/** Load the system into `this.system`. On failure the previous config is
|
|
115
111
|
* kept; strict mode throws instead. */
|
|
116
112
|
loadSystem(): void;
|
|
@@ -152,6 +148,16 @@ export declare class PluginContext {
|
|
|
152
148
|
publishSourceIngestion(result: SourceIngestionResult): void;
|
|
153
149
|
devFsUrl(absPath: string): string;
|
|
154
150
|
assetFallback(specifier: string, message: string, cause?: unknown): void;
|
|
151
|
+
/** Every asset() specifier in the sheets the plugin emits. */
|
|
152
|
+
sheetAssetSpecifiers(): string[];
|
|
153
|
+
/** `system.variableCss` with its asset() placeholders substituted from
|
|
154
|
+
* the current asset map. Derived on every read, so it always matches
|
|
155
|
+
* `system`, however and whenever that was assigned; `system` keeps the
|
|
156
|
+
* placeholders for the next asset pass. */
|
|
157
|
+
get variableCss(): string;
|
|
158
|
+
/** Substitutes the analysis sheets in place; the theme's variable CSS is
|
|
159
|
+
* substituted on read (`variableCss`). */
|
|
160
|
+
substituteSheets(): void;
|
|
155
161
|
/** Resolves asset specifiers a system reload introduced. Node-side only —
|
|
156
162
|
* the plugin hook context is unavailable here, so results can differ. */
|
|
157
163
|
private applyAssetSubstitutions;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAItD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,cAAc,EAEd,eAAe,EACf,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,YAAY,EAEb,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAoBnC;yEACyE;AACzE,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAWZ;AA8BD;sEACsE;AACtE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAOlE;AAED;uEACuE;AACvE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACpD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAGT;AAED,qBAAa,aAAa;IACxB,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,MAAM,UAAS;IACf;8EAC0E;IAC1E,YAAY,UAAS;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CAkBzC;IAEK,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAIzC;YAEa,4BAA4B;IAU1C,OAAO,CAAC,6BAA6B;IAcrC,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI3C;IAED;2EACuE;IACvE,wBAAwB,IAAI,IAAI,CAS/B;IAED;;;yEAGqE;IACrE,0BAA0B,IAAI,IAAI,CAkBjC;IAED;sEACkE;IAClE,wBAAwB,IAAI,IAAI,CAW/B;IAED,6BAA6B,IAAI,IAAI,CAUpC;IAED,aAAa,IAAI,IAAI,CAyBpB;CACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -85,7 +85,7 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
const assetSpecifiers =
|
|
88
|
+
const assetSpecifiers = ctx.sheetAssetSpecifiers();
|
|
89
89
|
for (const specifier of assetSpecifiers) {
|
|
90
90
|
const resolvedPath = await resolveSpecifier(specifier);
|
|
91
91
|
if (!resolvedPath) {
|
|
@@ -100,12 +100,11 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
|
|
|
100
100
|
}
|
|
101
101
|
else ctx.assetUrlBySpecifier.set(specifier, ctx.devFsUrl(resolvedPath));
|
|
102
102
|
}
|
|
103
|
-
ctx.
|
|
103
|
+
ctx.substituteSheets();
|
|
104
104
|
ctx.assetPassComplete = true;
|
|
105
105
|
if (ctx.storedManifest) {
|
|
106
106
|
const report = ctx.storedManifest.report;
|
|
107
107
|
ctx.log(`Extracted ${report.components_extracted}/${report.components_total} components (${Math.round(performance.now() - t0)}ms)`);
|
|
108
|
-
ctx.logTimingWaterfall(ctx.storedManifest.timing);
|
|
109
108
|
ctx.log(`Reconciliation: ${report.components_extracted} kept, ${report.variants_eliminated} variants pruned, ${report.states_eliminated} states pruned`);
|
|
110
109
|
for (const d of report.eliminated_details) if (d.kind === "component") ctx.warn(`⚠ ${d.component} eliminated: ${d.reason}`);
|
|
111
110
|
else if (d.kind === "prospective_component") ctx.warn(`⚠ ${d.component} would be eliminated in production: ${d.reason}`);
|
|
@@ -115,7 +114,7 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
|
|
|
115
114
|
if (!ctx.isProd && ctx.storedSheets) {
|
|
116
115
|
const staticSize = (0, _animus_ui_extract_pipeline.assembleStylesheet)({
|
|
117
116
|
layers: ctx.options.layers,
|
|
118
|
-
variableCss: ctx.
|
|
117
|
+
variableCss: ctx.variableCss,
|
|
119
118
|
globalCss: ctx.globalCss
|
|
120
119
|
}).length;
|
|
121
120
|
const componentSize = ctx.resolvedComponentCss.length;
|
|
@@ -400,9 +399,6 @@ var PluginContext = class {
|
|
|
400
399
|
recordTransformOutput(relativePath, code) {
|
|
401
400
|
this.transformOutputHashes.set(relativePath, (0, _animus_ui_extract_pipeline.contentHash)(code));
|
|
402
401
|
}
|
|
403
|
-
/** Vocabulary witnesses from the sealed system, awaiting the next analysis.
|
|
404
|
-
* Surfacing happens only inside `runProjectAnalysis`. */
|
|
405
|
-
systemVocabularyDiagnostics = [];
|
|
406
402
|
reverseProvenance = {};
|
|
407
403
|
storedSystemPropMapJson = "{}";
|
|
408
404
|
storedDynamicPropsJson = "{}";
|
|
@@ -525,13 +521,6 @@ var PluginContext = class {
|
|
|
525
521
|
warn(msg) {
|
|
526
522
|
(this.logger ?? console).warn(`[animus] ${msg}`);
|
|
527
523
|
}
|
|
528
|
-
logTimingWaterfall(timing) {
|
|
529
|
-
if (!this.verbose) return;
|
|
530
|
-
for (const line of (0, _animus_ui_extract_pipeline.formatRustTimingWaterfall)(timing, {
|
|
531
|
-
indent: " ",
|
|
532
|
-
labelWidth: 15
|
|
533
|
-
})) this.log(line);
|
|
534
|
-
}
|
|
535
524
|
/** Load the system into `this.system`. On failure the previous config is
|
|
536
525
|
* kept; strict mode throws instead. */
|
|
537
526
|
loadSystem() {
|
|
@@ -550,7 +539,6 @@ var PluginContext = class {
|
|
|
550
539
|
this.systemDependencyKeys = keys;
|
|
551
540
|
this.systemDependencyPaths = deps;
|
|
552
541
|
this.registerSystemWatchPaths();
|
|
553
|
-
this.systemVocabularyDiagnostics = (0, _animus_ui_extract_pipeline.vocabularyWitnessDiagnostics)(this.system.vocabularyWitnessesJson);
|
|
554
542
|
} catch (e) {
|
|
555
543
|
if (this.options.strict) throw new Error(`[animus-extract] Failed to load system from ${this.resolvedSystemPath}: ${e}`, { cause: e });
|
|
556
544
|
console.warn(`[animus-extract] Failed to load system from ${this.resolvedSystemPath}:`, e);
|
|
@@ -574,8 +562,8 @@ var PluginContext = class {
|
|
|
574
562
|
externalDirs: this.externalPackageDirs.map((dir) => (0, path.relative)(this.rootDir, dir)),
|
|
575
563
|
devMode: !this.emissionProd,
|
|
576
564
|
warn: (m) => this.warn(m),
|
|
577
|
-
|
|
578
|
-
|
|
565
|
+
info: (m) => this.log(m),
|
|
566
|
+
strict: this.options.strict
|
|
579
567
|
});
|
|
580
568
|
} catch (e) {
|
|
581
569
|
if (this.options.strict) throw new Error(`[animus-extract] analyzeProject failed: ${e}`, { cause: e });
|
|
@@ -627,7 +615,6 @@ var PluginContext = class {
|
|
|
627
615
|
const reloadingSystem = this.systemReloadOwed;
|
|
628
616
|
const prevPlans = reloadingSystem ? (0, _animus_ui_extract_pipeline.snapshotFilePlans)(this.storedManifest) : null;
|
|
629
617
|
const publishedSystem = this.system;
|
|
630
|
-
const publishedVocabulary = this.systemVocabularyDiagnostics;
|
|
631
618
|
let published = false;
|
|
632
619
|
try {
|
|
633
620
|
if (reloadingSystem) this.loadSystem();
|
|
@@ -677,10 +664,8 @@ var PluginContext = class {
|
|
|
677
664
|
};
|
|
678
665
|
} finally {
|
|
679
666
|
const systemHeld = reloadingSystem && this.abortedParseHashes.size > 0;
|
|
680
|
-
if (systemHeld)
|
|
681
|
-
|
|
682
|
-
this.systemVocabularyDiagnostics = publishedVocabulary;
|
|
683
|
-
} else if (reloadingSystem) {
|
|
667
|
+
if (systemHeld) this.system = publishedSystem;
|
|
668
|
+
else if (reloadingSystem) {
|
|
684
669
|
this.systemReloadOwed = false;
|
|
685
670
|
if (published && prevPlans) invalidateFileModules(this, (0, _animus_ui_extract_pipeline.diffFilePlans)(prevPlans, (0, _animus_ui_extract_pipeline.snapshotFilePlans)(this.storedManifest)));
|
|
686
671
|
}
|
|
@@ -701,17 +686,38 @@ var PluginContext = class {
|
|
|
701
686
|
this.assetUrlBySpecifier.set(specifier, specifier);
|
|
702
687
|
this.assetResolutionFailures.add(specifier);
|
|
703
688
|
}
|
|
689
|
+
/** Every asset() specifier in the sheets the plugin emits. */
|
|
690
|
+
sheetAssetSpecifiers() {
|
|
691
|
+
return (0, _animus_ui_extract_pipeline.findSheetAssetSpecifiers)({
|
|
692
|
+
variableCss: this.system.variableCss,
|
|
693
|
+
globalCss: this.globalCss,
|
|
694
|
+
componentCss: this.resolvedComponentCss
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
/** `system.variableCss` with its asset() placeholders substituted from
|
|
698
|
+
* the current asset map. Derived on every read, so it always matches
|
|
699
|
+
* `system`, however and whenever that was assigned; `system` keeps the
|
|
700
|
+
* placeholders for the next asset pass. */
|
|
701
|
+
get variableCss() {
|
|
702
|
+
return (0, _animus_ui_extract_pipeline.substituteAssetPlaceholders)(this.system.variableCss, this.assetUrlBySpecifier);
|
|
703
|
+
}
|
|
704
|
+
/** Substitutes the analysis sheets in place; the theme's variable CSS is
|
|
705
|
+
* substituted on read (`variableCss`). */
|
|
706
|
+
substituteSheets() {
|
|
707
|
+
this.globalCss = (0, _animus_ui_extract_pipeline.substituteAssetPlaceholders)(this.globalCss, this.assetUrlBySpecifier);
|
|
708
|
+
this.resolvedComponentCss = (0, _animus_ui_extract_pipeline.substituteAssetPlaceholders)(this.resolvedComponentCss, this.assetUrlBySpecifier);
|
|
709
|
+
}
|
|
704
710
|
/** Resolves asset specifiers a system reload introduced. Node-side only —
|
|
705
711
|
* the plugin hook context is unavailable here, so results can differ. */
|
|
706
712
|
applyAssetSubstitutions() {
|
|
707
|
-
if (!this.isProd && this.assetPassComplete) for (const specifier of
|
|
713
|
+
if (!this.isProd && this.assetPassComplete) for (const specifier of this.sheetAssetSpecifiers()) {
|
|
708
714
|
if (this.assetResolutionFailures.delete(specifier)) this.assetUrlBySpecifier.delete(specifier);
|
|
709
715
|
if (this.assetUrlBySpecifier.has(specifier)) continue;
|
|
710
716
|
const resolved = (0, _animus_ui_extract_pipeline.resolveAssetFile)(specifier, this.rootDir, this.pathAliasesJson);
|
|
711
717
|
if (resolved) this.assetUrlBySpecifier.set(specifier, this.devFsUrl(resolved));
|
|
712
718
|
else this.assetFallback(specifier, `[animus-extract] unresolvable asset() specifier: ${specifier}`);
|
|
713
719
|
}
|
|
714
|
-
this.
|
|
720
|
+
this.substituteSheets();
|
|
715
721
|
}
|
|
716
722
|
resetCoalescer = null;
|
|
717
723
|
requestSystemReload(trigger) {
|
|
@@ -811,7 +817,7 @@ var PluginContext = class {
|
|
|
811
817
|
runSelfVerify() {
|
|
812
818
|
const failures = (0, _animus_ui_extract_pipeline.runStructuralSelfCheck)({
|
|
813
819
|
componentCount: Object.keys(this.storedManifest?.components ?? {}).length,
|
|
814
|
-
variableCss: this.
|
|
820
|
+
variableCss: this.variableCss,
|
|
815
821
|
globalCss: this.globalCss,
|
|
816
822
|
componentCss: this.resolvedComponentCss,
|
|
817
823
|
layers: this.options.layers,
|
|
@@ -1235,7 +1241,6 @@ async function analyzeChangedFile(ctx, file, absFile, read) {
|
|
|
1235
1241
|
])].filter((defFile) => (0, path.resolve)(ctx.rootDir, defFile) !== absFile);
|
|
1236
1242
|
const hmrMs = Math.round(performance.now() - hmrStart);
|
|
1237
1243
|
ctx.log(`HMR update: ${relPath} — analysis ${analysisMs}ms, total ${hmrMs}ms${presentationOnly ? " (presentation-only)" : ""}`);
|
|
1238
|
-
ctx.logTimingWaterfall(ctx.storedManifest?.timing ?? {});
|
|
1239
1244
|
return {
|
|
1240
1245
|
kind: "analyzed",
|
|
1241
1246
|
staleDefinitionFiles,
|
|
@@ -1361,34 +1366,42 @@ function loadVirtualModule(ctx, id) {
|
|
|
1361
1366
|
targets: ctx.lcssTargets,
|
|
1362
1367
|
warnFn: (msg) => ctx.warn(msg)
|
|
1363
1368
|
};
|
|
1369
|
+
const checked = (css) => {
|
|
1370
|
+
(0, _animus_ui_extract_pipeline.reportSurvivingAssetPlaceholders)(css, {
|
|
1371
|
+
strict: ctx.options.strict,
|
|
1372
|
+
warn: (message) => ctx.warn(message),
|
|
1373
|
+
prefix: "[animus-extract]"
|
|
1374
|
+
});
|
|
1375
|
+
return css;
|
|
1376
|
+
};
|
|
1364
1377
|
if (id === RESOLVED_CSS_ID) {
|
|
1365
1378
|
if (!ctx.isProd && ctx.storedSheets) {
|
|
1366
1379
|
const { variables, body } = (0, _animus_ui_extract_pipeline.assembleStylesheet)({
|
|
1367
1380
|
layers: ctx.options.layers,
|
|
1368
|
-
variableCss: ctx.
|
|
1381
|
+
variableCss: ctx.variableCss,
|
|
1369
1382
|
globalCss: ctx.globalCss,
|
|
1370
1383
|
split: true
|
|
1371
1384
|
});
|
|
1372
|
-
return [variables, (0, _animus_ui_extract_pipeline.postProcessCss)(body, {
|
|
1385
|
+
return checked([variables, (0, _animus_ui_extract_pipeline.postProcessCss)(body, {
|
|
1373
1386
|
...lcssOpts,
|
|
1374
1387
|
minify: false
|
|
1375
|
-
})].filter(Boolean).join("\n");
|
|
1388
|
+
})].filter(Boolean).join("\n"));
|
|
1376
1389
|
}
|
|
1377
1390
|
const { variables, body } = (0, _animus_ui_extract_pipeline.assembleStylesheet)({
|
|
1378
1391
|
layers: ctx.options.layers,
|
|
1379
|
-
variableCss: ctx.
|
|
1392
|
+
variableCss: ctx.variableCss,
|
|
1380
1393
|
globalCss: ctx.globalCss,
|
|
1381
1394
|
componentCss: ctx.resolvedComponentCss,
|
|
1382
1395
|
split: true
|
|
1383
1396
|
});
|
|
1384
|
-
return [variables, (0, _animus_ui_extract_pipeline.postProcessCss)(body, lcssOpts)].filter(Boolean).join("\n");
|
|
1397
|
+
return checked([variables, (0, _animus_ui_extract_pipeline.postProcessCss)(body, lcssOpts)].filter(Boolean).join("\n"));
|
|
1385
1398
|
}
|
|
1386
1399
|
if (id === RESOLVED_COMPONENTS_ID) {
|
|
1387
1400
|
const strippedCss = (0, _animus_ui_extract_pipeline.stripLeadingLayerDeclaration)(ctx.resolvedComponentCss || "");
|
|
1388
|
-
return `export default \`${(0, _animus_ui_extract_pipeline.postProcessCss)(strippedCss, {
|
|
1401
|
+
return `export default \`${checked((0, _animus_ui_extract_pipeline.postProcessCss)(strippedCss, {
|
|
1389
1402
|
...lcssOpts,
|
|
1390
1403
|
minify: false
|
|
1391
|
-
}).replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;`;
|
|
1404
|
+
})).replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;`;
|
|
1392
1405
|
}
|
|
1393
1406
|
if (id === RESOLVED_BRIDGE_ID) {
|
|
1394
1407
|
const sheetHash = sheetRegistryHash(ctx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual-modules.d.ts","sourceRoot":"","sources":["../src/virtual-modules.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAa/C,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CAYf;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,MAAM,GACT,MAAM,GAAG,IAAI,CA+Gf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Animus static CSS extraction Vite plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animus",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"compile": "tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@animus-ui/extract": "0.1.
|
|
42
|
+
"@animus-ui/extract": "0.1.19",
|
|
43
43
|
"browserslist": "^4.28.8",
|
|
44
44
|
"lightningcss": "^1.33.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@animus-ui/assertions": "0.1.
|
|
47
|
+
"@animus-ui/assertions": "0.1.19"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@mdx-js/mdx": "^3.0.0",
|