@animus-ui/vite-plugin 0.1.0-next.45 → 0.1.0-next.49
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/index.d.ts +2 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +11 -18
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -29,22 +29,11 @@ export interface AnimusExtractOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
minify?: boolean;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* When set, all generated CSS variables become `--{prefix}-{name}`
|
|
34
|
-
* and class names become `{prefix}-{Component}-{hash}`.
|
|
35
|
-
* Defaults to no prefix.
|
|
36
|
-
*/
|
|
37
|
-
prefix?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Full `@layer` declaration order. Must include all 7 Animus layers
|
|
32
|
+
* Full `@layer` declaration order. Must include all 7 Animus `anm-*` layers
|
|
40
33
|
* as a subsequence in their required order. Consumer layers may be
|
|
41
34
|
* interleaved around them. Names are emitted as-is.
|
|
42
35
|
*
|
|
43
|
-
*
|
|
44
|
-
* `['reset', 'acme.global', 'acme.base', 'acme.variants', ..., 'overrides']`
|
|
45
|
-
*
|
|
46
|
-
* Without prefix:
|
|
47
|
-
* `['reset', 'global', 'base', 'variants', ..., 'overrides']`
|
|
36
|
+
* Example: `['reset', 'anm-global', 'anm-base', ..., 'anm-custom', 'overrides']`
|
|
48
37
|
*/
|
|
49
38
|
layers?: string[];
|
|
50
39
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6ID,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAihCnE;AAED,eAAe,aAAa,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { existsSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileS
|
|
|
5
5
|
import { tmpdir } from "os";
|
|
6
6
|
import { dirname, extname, join, relative, resolve } from "path";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
|
-
import {
|
|
8
|
+
import { applyUnitFallback, assembleStylesheet, detectRuntime, execSubprocess, extractSystemFilePackages, validateLayerOrder } from "@animus-ui/extract/pipeline";
|
|
9
9
|
import browserslist from "browserslist";
|
|
10
10
|
import { browserslistToTargets, transform } from "lightningcss";
|
|
11
11
|
//#region \0rolldown/runtime.js
|
|
@@ -168,13 +168,6 @@ function animusExtract(options) {
|
|
|
168
168
|
variableMapJson = parsed.serialized.variableMapJson;
|
|
169
169
|
variableCss = parsed.serialized.variableCss;
|
|
170
170
|
contextualVarsJson = parsed.serialized.contextualVarsJson;
|
|
171
|
-
if (options.prefix) {
|
|
172
|
-
const prefixed = applyPrefix(options.prefix, variableMapJson, variableCss, themeJson, contextualVarsJson);
|
|
173
|
-
variableMapJson = prefixed.variableMapJson;
|
|
174
|
-
variableCss = prefixed.variableCss;
|
|
175
|
-
if (prefixed.themeJson) themeJson = prefixed.themeJson;
|
|
176
|
-
if (prefixed.contextualVarsJson) contextualVarsJson = prefixed.contextualVarsJson;
|
|
177
|
-
}
|
|
178
171
|
} else throw new Error("[animus-extract] Theme must be built with createTheme().build(). No .serialize() method found on tokens export.");
|
|
179
172
|
if (parsed.globalStyleBlocks) {
|
|
180
173
|
if (Object.keys(parsed.globalStyleBlocks).length > 0) try {
|
|
@@ -203,7 +196,7 @@ function animusExtract(options) {
|
|
|
203
196
|
});
|
|
204
197
|
const gsResult = JSON.parse(readFileSync(gsOut, "utf-8"));
|
|
205
198
|
const parts = Object.values(gsResult).filter(Boolean);
|
|
206
|
-
if (parts.length > 0) globalCss = `@layer
|
|
199
|
+
if (parts.length > 0) globalCss = `@layer anm-global {\n${parts.join("\n\n")}\n}`;
|
|
207
200
|
try {
|
|
208
201
|
unlinkSync(gsThemeFile);
|
|
209
202
|
unlinkSync(gsOut);
|
|
@@ -238,7 +231,7 @@ function animusExtract(options) {
|
|
|
238
231
|
runtime_import: "@animus-ui/system",
|
|
239
232
|
css_module_id: "virtual:animus/styles.css"
|
|
240
233
|
});
|
|
241
|
-
const manifestJson = analyzeProject(JSON.stringify(fileEntries), themeJson, variableMapJson, contextualVarsJson || null, configJson, groupRegistryJson, JSON.stringify(packageMap), !isProd,
|
|
234
|
+
const manifestJson = analyzeProject(JSON.stringify(fileEntries), themeJson, variableMapJson, contextualVarsJson || null, configJson, groupRegistryJson, JSON.stringify(packageMap), !isProd, emitterConfig, selectorAliasesJson, selectorOrderJson);
|
|
242
235
|
storedManifest = JSON.parse(manifestJson);
|
|
243
236
|
storedManifestJson = manifestJson;
|
|
244
237
|
storedSystemPropMapJson = JSON.stringify(storedManifest?.system_prop_map ?? {});
|
|
@@ -297,15 +290,18 @@ function animusExtract(options) {
|
|
|
297
290
|
logger = config.logger;
|
|
298
291
|
lcssTargets = resolveLightningTargets(options.targets, rootDir);
|
|
299
292
|
log(`Lightning CSS targets resolved (${Object.keys(lcssTargets).length} browsers)`);
|
|
300
|
-
if (options.layers) {
|
|
301
|
-
validateLayerOrder(options.layers, options.prefix);
|
|
302
|
-
log(`Custom layers: [${options.layers.join(", ")}]`);
|
|
303
|
-
}
|
|
304
|
-
if (options.prefix) log(`Namespace prefix: "${options.prefix}"`);
|
|
305
293
|
},
|
|
306
294
|
async buildStart() {
|
|
295
|
+
try {
|
|
296
|
+
const { clearAnalysisCache } = __require("@animus-ui/extract");
|
|
297
|
+
clearAnalysisCache();
|
|
298
|
+
} catch {}
|
|
307
299
|
let t0 = performance.now();
|
|
308
300
|
loadSystem();
|
|
301
|
+
if (options.layers) {
|
|
302
|
+
validateLayerOrder(options.layers);
|
|
303
|
+
log(`Custom layers: [${options.layers.join(", ")}]`);
|
|
304
|
+
}
|
|
309
305
|
if (verbose) {
|
|
310
306
|
const propCount = Object.keys(JSON.parse(configJson)).length;
|
|
311
307
|
const groupCount = Object.keys(JSON.parse(groupRegistryJson)).length;
|
|
@@ -407,7 +403,6 @@ function animusExtract(options) {
|
|
|
407
403
|
if (!isProd && storedSheets) {
|
|
408
404
|
const staticSize = assembleStylesheet({
|
|
409
405
|
layers: options.layers,
|
|
410
|
-
prefix: options.prefix,
|
|
411
406
|
variableCss,
|
|
412
407
|
globalCss
|
|
413
408
|
}).length;
|
|
@@ -434,7 +429,6 @@ function animusExtract(options) {
|
|
|
434
429
|
if (id === RESOLVED_CSS_ID) {
|
|
435
430
|
if (!isProd && storedSheets) return postProcessCss(assembleStylesheet({
|
|
436
431
|
layers: options.layers,
|
|
437
|
-
prefix: options.prefix,
|
|
438
432
|
variableCss,
|
|
439
433
|
globalCss
|
|
440
434
|
}), {
|
|
@@ -443,7 +437,6 @@ function animusExtract(options) {
|
|
|
443
437
|
});
|
|
444
438
|
return postProcessCss(assembleStylesheet({
|
|
445
439
|
layers: options.layers,
|
|
446
|
-
prefix: options.prefix,
|
|
447
440
|
variableCss,
|
|
448
441
|
globalCss,
|
|
449
442
|
componentCss: resolvedComponentCss
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/vite-plugin",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.49",
|
|
4
4
|
"description": "Animus static CSS extraction Vite plugin",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"vite": ">=5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@animus-ui/extract": "0.1.0-next.
|
|
41
|
-
"@animus-ui/system": "0.1.0-next.
|
|
40
|
+
"@animus-ui/extract": "0.1.0-next.49",
|
|
41
|
+
"@animus-ui/system": "0.1.0-next.49",
|
|
42
42
|
"browserslist": "^4.24.0",
|
|
43
43
|
"lightningcss": "^1.29.0"
|
|
44
44
|
}
|