@animus-ui/vite-plugin 0.1.19 → 0.1.20
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 +73 -17
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/rediscovery.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":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/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,CA4Nf"}
|
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, ManifestSheets, ProjectManifest, RawSourceEntry, SourceCorpus, SourceIngestionResult, SystemConfig } from '@animus-ui/extract/pipeline';
|
|
4
|
+
import type { ExcludeMatcher, ExternalPackageOutcome, ManifestDiagnostic, 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. */
|
|
@@ -89,6 +89,9 @@ export declare class PluginContext {
|
|
|
89
89
|
externalFileOwners: Record<string, string>;
|
|
90
90
|
externalSourceEntries: Map<string, string>;
|
|
91
91
|
externalPackageOutcomes: ExternalPackageOutcome[];
|
|
92
|
+
/** Configured files buildStart could not read. Later analyses read no
|
|
93
|
+
* files themselves, so they replay these. */
|
|
94
|
+
ingestionFailureDiagnostics: ManifestDiagnostic[];
|
|
92
95
|
devServer: any;
|
|
93
96
|
resolvedSystemPath: string | null;
|
|
94
97
|
systemDependencyKeys: Set<string>;
|
|
@@ -111,12 +114,14 @@ export declare class PluginContext {
|
|
|
111
114
|
* kept; strict mode throws instead. */
|
|
112
115
|
loadSystem(): void;
|
|
113
116
|
/** Runs project analysis and updates every manifest-derived state. Returns
|
|
114
|
-
* false when nothing published, and the caller must roll its cache back.
|
|
117
|
+
* false when nothing published, and the caller must roll its cache back.
|
|
118
|
+
* While a source is skipped or unreadable, its renders are unseen, so
|
|
119
|
+
* nothing is pruned. */
|
|
115
120
|
runAnalysis(fileEntries: Array<{
|
|
116
121
|
path: string;
|
|
117
122
|
source: string;
|
|
118
123
|
hash?: string;
|
|
119
|
-
}
|
|
124
|
+
}>, skippedOriginals?: readonly string[]): boolean;
|
|
120
125
|
private assertRuntimeImportSuppliesTerminals;
|
|
121
126
|
/** The one ingest → quarantine → analyze → publish transaction. The corpus
|
|
122
127
|
* publishes only on success. `afterIngestion` runs after quarantine even
|
|
@@ -155,8 +160,9 @@ export declare class PluginContext {
|
|
|
155
160
|
* `system`, however and whenever that was assigned; `system` keeps the
|
|
156
161
|
* placeholders for the next asset pass. */
|
|
157
162
|
get variableCss(): string;
|
|
158
|
-
/** Substitutes the analysis sheets in place
|
|
159
|
-
* substituted on read
|
|
163
|
+
/** Substitutes the analysis sheets in place, through the same step as the
|
|
164
|
+
* session; the theme's variable CSS is substituted on read
|
|
165
|
+
* (`variableCss`). */
|
|
160
166
|
substituteSheets(): void;
|
|
161
167
|
/** Resolves asset specifiers a system reload introduced. Node-side only —
|
|
162
168
|
* the plugin hook context is unavailable here, so results can differ. */
|
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":"AAoCA,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,EAEV,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,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;AAQD,qBAAa,aAAa;IACxB,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAA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AAE,OAAO,GAAG,IAAI,CAOvE;IAED,8DAA8D;IAC9D,oBAAoB,IAAI,MAAM,EAAE,CAM/B;IAED;;;gDAG4C;IAC5C,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED;;2BAEuB;IACvB,gBAAgB,IAAI,IAAI,CAWvB;IAED;8EAC0E;IAC1E,OAAO,CAAC,uBAAuB;IAyB/B,OAAO,CAAC,cAAc,CAA+B;IAErD,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,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
|
@@ -33,16 +33,23 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
|
|
|
33
33
|
ctx.extensionsSet = new Set(ctx.options.extensions ?? _animus_ui_extract_pipeline.DEFAULT_EXTENSIONS);
|
|
34
34
|
const filePaths = (0, _animus_ui_extract_pipeline.discoverFiles)(ctx.rootDir, ctx.rootDir, excludePatterns, ctx.extensionsSet);
|
|
35
35
|
const rawEntries = [];
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const ingestionFailures = [];
|
|
37
|
+
for (const filePath of filePaths) {
|
|
38
38
|
const relPath = (0, path.relative)(ctx.rootDir, filePath);
|
|
39
|
+
let source;
|
|
40
|
+
try {
|
|
41
|
+
source = (0, fs.readFileSync)(filePath, "utf-8");
|
|
42
|
+
} catch (err) {
|
|
43
|
+
if (!(0, _animus_ui_extract_pipeline.isDeletedSource)(err)) ingestionFailures.push((0, _animus_ui_extract_pipeline.unreadableSourceDiagnostic)(relPath, err));
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
39
46
|
const hash = !ctx.isProd ? (0, _animus_ui_extract_pipeline.contentHash)(source) : void 0;
|
|
40
47
|
rawEntries.push({
|
|
41
48
|
path: relPath,
|
|
42
49
|
source,
|
|
43
50
|
hash
|
|
44
51
|
});
|
|
45
|
-
}
|
|
52
|
+
}
|
|
46
53
|
const localFileCount = rawEntries.length;
|
|
47
54
|
const packageSpecifiers = (0, _animus_ui_extract_pipeline.extractSystemFilePackages)(ctx.resolvedSystemPath);
|
|
48
55
|
ctx.externalSourceEntries.clear();
|
|
@@ -52,8 +59,11 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
|
|
|
52
59
|
rootDir: ctx.rootDir,
|
|
53
60
|
extensionsSet: ctx.extensionsSet,
|
|
54
61
|
hasEntry: (relPath) => rawEntries.some((entry) => entry.path === relPath),
|
|
55
|
-
onUnreadable: (relPath, err) =>
|
|
62
|
+
onUnreadable: (relPath, err) => {
|
|
63
|
+
if (!(0, _animus_ui_extract_pipeline.isDeletedSource)(err)) ingestionFailures.push((0, _animus_ui_extract_pipeline.unreadableSourceDiagnostic)(relPath, err));
|
|
64
|
+
}
|
|
56
65
|
});
|
|
66
|
+
ctx.ingestionFailureDiagnostics = ingestionFailures;
|
|
57
67
|
ctx.packageMap = collected.packageMap;
|
|
58
68
|
ctx.externalPackageOutcomes = collected.outcomes;
|
|
59
69
|
ctx.externalDirOwners = (0, _animus_ui_extract_pipeline.firstOwners)(collected.dirOwnerSets);
|
|
@@ -107,7 +117,7 @@ async function runBuildStart(ctx, resolveSpecifier, emitAsset) {
|
|
|
107
117
|
ctx.log(`Extracted ${report.components_extracted}/${report.components_total} components (${Math.round(performance.now() - t0)}ms)`);
|
|
108
118
|
ctx.log(`Reconciliation: ${report.components_extracted} kept, ${report.variants_eliminated} variants pruned, ${report.states_eliminated} states pruned`);
|
|
109
119
|
for (const d of report.eliminated_details) if (d.kind === "component") ctx.warn(`⚠ ${d.component} eliminated: ${d.reason}`);
|
|
110
|
-
else if (d.kind === "prospective_component") ctx.warn(`⚠ ${d.component} would be eliminated in production: ${d.reason}`);
|
|
120
|
+
else if (d.kind === "prospective_component" && !ctx.emissionProd) ctx.warn(`⚠ ${d.component} would be eliminated in production: ${d.reason}`);
|
|
111
121
|
else if (d.kind === "variant") ctx.trace(`${d.component} variant '${d.name}' pruned: ${d.reason}`);
|
|
112
122
|
else if (d.kind === "state") ctx.trace(`${d.component} state '${d.name}' pruned: ${d.reason}`);
|
|
113
123
|
ctx.log(`CSS: ${ctx.resolvedComponentCss.length} bytes (${Object.keys(ctx.storedManifest.components).length} components)`);
|
|
@@ -372,6 +382,11 @@ function pruneFileCache(cache, rootDir, absPath) {
|
|
|
372
382
|
const rel = (0, path.relative)(rootDir, (0, path.resolve)(absPath));
|
|
373
383
|
return cache.delete(rel);
|
|
374
384
|
}
|
|
385
|
+
const NO_SHEETS = {
|
|
386
|
+
variableCss: "",
|
|
387
|
+
globalCss: "",
|
|
388
|
+
componentCss: ""
|
|
389
|
+
};
|
|
375
390
|
var PluginContext = class {
|
|
376
391
|
options;
|
|
377
392
|
verbose;
|
|
@@ -456,6 +471,9 @@ var PluginContext = class {
|
|
|
456
471
|
externalFileOwners = {};
|
|
457
472
|
externalSourceEntries = /* @__PURE__ */ new Map();
|
|
458
473
|
externalPackageOutcomes = [];
|
|
474
|
+
/** Configured files buildStart could not read. Later analyses read no
|
|
475
|
+
* files themselves, so they replay these. */
|
|
476
|
+
ingestionFailureDiagnostics = [];
|
|
459
477
|
devServer;
|
|
460
478
|
resolvedSystemPath = null;
|
|
461
479
|
systemDependencyKeys = /* @__PURE__ */ new Set();
|
|
@@ -530,7 +548,8 @@ var PluginContext = class {
|
|
|
530
548
|
this.system = (0, _animus_ui_extract_pipeline.loadSystemConfig)(this.engineApi, {
|
|
531
549
|
systemPath: this.resolvedSystemPath,
|
|
532
550
|
rootDir: this.rootDir,
|
|
533
|
-
prefix: this.options.prefix
|
|
551
|
+
prefix: this.options.prefix,
|
|
552
|
+
prefixContextualVars: this.options.prefixContextualVars
|
|
534
553
|
});
|
|
535
554
|
const deps = this.system.dependencies ?? [];
|
|
536
555
|
const keys = /* @__PURE__ */ new Set();
|
|
@@ -545,8 +564,10 @@ var PluginContext = class {
|
|
|
545
564
|
}
|
|
546
565
|
}
|
|
547
566
|
/** Runs project analysis and updates every manifest-derived state. Returns
|
|
548
|
-
* false when nothing published, and the caller must roll its cache back.
|
|
549
|
-
|
|
567
|
+
* false when nothing published, and the caller must roll its cache back.
|
|
568
|
+
* While a source is skipped or unreadable, its renders are unseen, so
|
|
569
|
+
* nothing is pruned. */
|
|
570
|
+
runAnalysis(fileEntries, skippedOriginals = []) {
|
|
550
571
|
let result;
|
|
551
572
|
try {
|
|
552
573
|
result = (0, _animus_ui_extract_pipeline.runProjectAnalysis)(this.engineApi, {
|
|
@@ -561,9 +582,15 @@ var PluginContext = class {
|
|
|
561
582
|
staticCssJson: this.staticCssJson,
|
|
562
583
|
externalDirs: this.externalPackageDirs.map((dir) => (0, path.relative)(this.rootDir, dir)),
|
|
563
584
|
devMode: !this.emissionProd,
|
|
585
|
+
analysisContext: {
|
|
586
|
+
skippedSources: [...skippedOriginals, ...this.ingestionFailureDiagnostics.map((d) => d.file)].map((file) => (0, path.isAbsolute)(file) ? (0, path.relative)(this.rootDir, file) : file),
|
|
587
|
+
unbundledComputedImports: true,
|
|
588
|
+
packageDirs: this.externalPackageDirs.map((dir) => (0, path.relative)(this.rootDir, dir))
|
|
589
|
+
},
|
|
564
590
|
warn: (m) => this.warn(m),
|
|
565
591
|
info: (m) => this.log(m),
|
|
566
|
-
strict: this.options.strict
|
|
592
|
+
strict: this.options.strict,
|
|
593
|
+
extraDiagnostics: this.ingestionFailureDiagnostics
|
|
567
594
|
});
|
|
568
595
|
} catch (e) {
|
|
569
596
|
if (this.options.strict) throw new Error(`[animus-extract] analyzeProject failed: ${e}`, { cause: e });
|
|
@@ -572,6 +599,12 @@ var PluginContext = class {
|
|
|
572
599
|
}
|
|
573
600
|
(0, _animus_ui_extract_pipeline.assertNoErrorDiagnostics)(result.manifest.diagnostics);
|
|
574
601
|
this.assertRuntimeImportSuppliesTerminals(result.manifest);
|
|
602
|
+
(0, _animus_ui_extract_pipeline.reportSurvivingAssetPlaceholders)((0, _animus_ui_extract_pipeline.generatedModuleCode)(result.manifest), {
|
|
603
|
+
strict: this.options.strict,
|
|
604
|
+
warn: (message) => this.warn(message),
|
|
605
|
+
prefix: "[animus-extract]",
|
|
606
|
+
surface: "generated runtime modules"
|
|
607
|
+
});
|
|
575
608
|
this.storedManifest = result.manifest;
|
|
576
609
|
this.storedManifestJson = result.manifestJson;
|
|
577
610
|
this.storedSystemPropMapJson = JSON.stringify(result.manifest.system_prop_map);
|
|
@@ -638,7 +671,7 @@ var PluginContext = class {
|
|
|
638
671
|
}
|
|
639
672
|
if (reloadingSystem) (0, _animus_ui_extract_pipeline.clearEngineCache)(this.engineApi);
|
|
640
673
|
options?.beforeAnalysis?.(accepted);
|
|
641
|
-
const ok = this.runAnalysis(accepted.analysisEntries) !== false;
|
|
674
|
+
const ok = this.runAnalysis(accepted.analysisEntries, accepted.skippedOriginals) !== false;
|
|
642
675
|
if (!ok) return {
|
|
643
676
|
ok,
|
|
644
677
|
accepted,
|
|
@@ -699,13 +732,22 @@ var PluginContext = class {
|
|
|
699
732
|
* `system`, however and whenever that was assigned; `system` keeps the
|
|
700
733
|
* placeholders for the next asset pass. */
|
|
701
734
|
get variableCss() {
|
|
702
|
-
return (0, _animus_ui_extract_pipeline.
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
735
|
+
return (0, _animus_ui_extract_pipeline.substituteSheetAssets)({
|
|
736
|
+
...NO_SHEETS,
|
|
737
|
+
variableCss: this.system.variableCss
|
|
738
|
+
}, this.assetUrlBySpecifier).variableCss;
|
|
739
|
+
}
|
|
740
|
+
/** Substitutes the analysis sheets in place, through the same step as the
|
|
741
|
+
* session; the theme's variable CSS is substituted on read
|
|
742
|
+
* (`variableCss`). */
|
|
706
743
|
substituteSheets() {
|
|
707
|
-
|
|
708
|
-
|
|
744
|
+
const substituted = (0, _animus_ui_extract_pipeline.substituteSheetAssets)({
|
|
745
|
+
...NO_SHEETS,
|
|
746
|
+
globalCss: this.globalCss,
|
|
747
|
+
componentCss: this.resolvedComponentCss
|
|
748
|
+
}, this.assetUrlBySpecifier);
|
|
749
|
+
this.globalCss = substituted.globalCss;
|
|
750
|
+
this.resolvedComponentCss = substituted.componentCss;
|
|
709
751
|
}
|
|
710
752
|
/** Resolves asset specifiers a system reload introduced. Node-side only —
|
|
711
753
|
* the plugin hook context is unavailable here, so results can differ. */
|
|
@@ -874,6 +916,7 @@ async function reconcileSourceCorpus(ctx) {
|
|
|
874
916
|
for (let iteration = 0; iteration < 3; iteration++) {
|
|
875
917
|
if (unresolvedDropFiles(ctx).size === 0) {
|
|
876
918
|
warnedVerdicts.get(ctx)?.clear();
|
|
919
|
+
warnedUnreadable.get(ctx)?.clear();
|
|
877
920
|
return reanalyzed;
|
|
878
921
|
}
|
|
879
922
|
const drops = unresolvedParentDrops(ctx);
|
|
@@ -922,7 +965,17 @@ function foldUndiscoveredFiles(ctx) {
|
|
|
922
965
|
let source;
|
|
923
966
|
try {
|
|
924
967
|
source = (0, fs.readFileSync)(filePath, "utf-8");
|
|
925
|
-
} catch {
|
|
968
|
+
} catch (err) {
|
|
969
|
+
let warned = warnedUnreadable.get(ctx);
|
|
970
|
+
if (!warned) {
|
|
971
|
+
warned = /* @__PURE__ */ new Set();
|
|
972
|
+
warnedUnreadable.set(ctx, warned);
|
|
973
|
+
}
|
|
974
|
+
if (!(0, _animus_ui_extract_pipeline.isDeletedSource)(err) && !warned.has(relPath)) {
|
|
975
|
+
warned.add(relPath);
|
|
976
|
+
const diagnostic = (0, _animus_ui_extract_pipeline.unreadableSourceDiagnostic)(relPath, err);
|
|
977
|
+
ctx.warn(`${diagnostic.code} ${diagnostic.message}`);
|
|
978
|
+
}
|
|
926
979
|
continue;
|
|
927
980
|
}
|
|
928
981
|
pending.push([relPath, {
|
|
@@ -942,6 +995,9 @@ const barrenWalkMemos = /* @__PURE__ */ new WeakMap();
|
|
|
942
995
|
/** Per-context (file, parent, condition) verdicts already warned — each
|
|
943
996
|
* condition warns once; cleared when the drops disappear. */
|
|
944
997
|
const warnedVerdicts = /* @__PURE__ */ new WeakMap();
|
|
998
|
+
/** Late files already reported unreadable, until the drops resolve: the
|
|
999
|
+
* bounded retries walk them again. */
|
|
1000
|
+
const warnedUnreadable = /* @__PURE__ */ new WeakMap();
|
|
945
1001
|
const PARENT_PROBE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
946
1002
|
".tsx",
|
|
947
1003
|
".ts",
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export interface AnimusExtractOptions {
|
|
|
48
48
|
mode?: 'development' | 'production';
|
|
49
49
|
/** Namespace prefix for CSS variables and class names. */
|
|
50
50
|
prefix?: string;
|
|
51
|
+
/** With `prefix` set, contextual variables take the prefixed name
|
|
52
|
+
* everywhere Animus emits them, while authors keep writing the declared
|
|
53
|
+
* name. */
|
|
54
|
+
prefixContextualVars?: boolean;
|
|
51
55
|
/**
|
|
52
56
|
* Forced-emission declarations for usage the scanner cannot observe;
|
|
53
57
|
* declared variants, states and prop values are emitted as if used.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,MAAM,EAAE,MA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;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;+CAE2C;IAC3C,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IACpC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;gBAEY;IACZ,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;;;OAGG;IACH,mBAAmB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAMD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAsFnE;eAEc,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rediscovery.d.ts","sourceRoot":"","sources":["../src/rediscovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rediscovery.d.ts","sourceRoot":"","sources":["../src/rediscovery.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,aAAa,GACjB,oBAAoB,EAAE,CAWxB;AAOD,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,CAa3E;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,OAAO,CAAC,CA0ElB"}
|
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.20",
|
|
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.20",
|
|
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.20"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@mdx-js/mdx": "^3.0.0",
|