@animus-ui/vite-plugin 0.1.0-next.40 → 0.1.0-next.45
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 +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +32 -4
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -37,12 +37,14 @@ export interface AnimusExtractOptions {
|
|
|
37
37
|
prefix?: string;
|
|
38
38
|
/**
|
|
39
39
|
* Full `@layer` declaration order. Must include all 7 Animus layers
|
|
40
|
-
*
|
|
41
|
-
*
|
|
40
|
+
* as a subsequence in their required order. Consumer layers may be
|
|
41
|
+
* interleaved around them. Names are emitted as-is.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
43
|
+
* When `prefix` is set, use prefixed Animus names:
|
|
44
|
+
* `['reset', 'acme.global', 'acme.base', 'acme.variants', ..., 'overrides']`
|
|
44
45
|
*
|
|
45
|
-
*
|
|
46
|
+
* Without prefix:
|
|
47
|
+
* `['reset', 'global', 'base', 'variants', ..., 'overrides']`
|
|
46
48
|
*/
|
|
47
49
|
layers?: string[];
|
|
48
50
|
}
|
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":"AA8BA,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;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AA6ID,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA8hCnE;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 { applyPrefix, applyUnitFallback, assembleStylesheet, detectRuntime, execSubprocess, extractSystemFilePackages, validateLayerOrder } from "@animus-ui/extract/pipeline";
|
|
8
|
+
import { applyPrefix, applyUnitFallback, assembleStylesheet, detectRuntime, execSubprocess, extractSystemFilePackages, prefixLayerName, 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
|
|
@@ -140,6 +140,7 @@ function animusExtract(options) {
|
|
|
140
140
|
let packageMap = {};
|
|
141
141
|
let externalPackageDirs = [];
|
|
142
142
|
const externalSourceEntries = /* @__PURE__ */ new Map();
|
|
143
|
+
let devServer;
|
|
143
144
|
let bridgeInjected = false;
|
|
144
145
|
let resolvedSystemPath = null;
|
|
145
146
|
/**
|
|
@@ -202,7 +203,7 @@ function animusExtract(options) {
|
|
|
202
203
|
});
|
|
203
204
|
const gsResult = JSON.parse(readFileSync(gsOut, "utf-8"));
|
|
204
205
|
const parts = Object.values(gsResult).filter(Boolean);
|
|
205
|
-
if (parts.length > 0) globalCss = `@layer global {\n${parts.join("\n\n")}\n}`;
|
|
206
|
+
if (parts.length > 0) globalCss = `@layer ${prefixLayerName("global", options.prefix)} {\n${parts.join("\n\n")}\n}`;
|
|
206
207
|
try {
|
|
207
208
|
unlinkSync(gsThemeFile);
|
|
208
209
|
unlinkSync(gsOut);
|
|
@@ -287,6 +288,9 @@ function animusExtract(options) {
|
|
|
287
288
|
return {
|
|
288
289
|
name: "animus-extract",
|
|
289
290
|
enforce: "pre",
|
|
291
|
+
configureServer(server) {
|
|
292
|
+
devServer = server;
|
|
293
|
+
},
|
|
290
294
|
configResolved(config) {
|
|
291
295
|
isProd = config.command === "build";
|
|
292
296
|
rootDir = config.root;
|
|
@@ -294,7 +298,7 @@ function animusExtract(options) {
|
|
|
294
298
|
lcssTargets = resolveLightningTargets(options.targets, rootDir);
|
|
295
299
|
log(`Lightning CSS targets resolved (${Object.keys(lcssTargets).length} browsers)`);
|
|
296
300
|
if (options.layers) {
|
|
297
|
-
validateLayerOrder(options.layers);
|
|
301
|
+
validateLayerOrder(options.layers, options.prefix);
|
|
298
302
|
log(`Custom layers: [${options.layers.join(", ")}]`);
|
|
299
303
|
}
|
|
300
304
|
if (options.prefix) log(`Namespace prefix: "${options.prefix}"`);
|
|
@@ -403,6 +407,7 @@ function animusExtract(options) {
|
|
|
403
407
|
if (!isProd && storedSheets) {
|
|
404
408
|
const staticSize = assembleStylesheet({
|
|
405
409
|
layers: options.layers,
|
|
410
|
+
prefix: options.prefix,
|
|
406
411
|
variableCss,
|
|
407
412
|
globalCss
|
|
408
413
|
}).length;
|
|
@@ -429,6 +434,7 @@ function animusExtract(options) {
|
|
|
429
434
|
if (id === RESOLVED_CSS_ID) {
|
|
430
435
|
if (!isProd && storedSheets) return postProcessCss(assembleStylesheet({
|
|
431
436
|
layers: options.layers,
|
|
437
|
+
prefix: options.prefix,
|
|
432
438
|
variableCss,
|
|
433
439
|
globalCss
|
|
434
440
|
}), {
|
|
@@ -437,6 +443,7 @@ function animusExtract(options) {
|
|
|
437
443
|
});
|
|
438
444
|
return postProcessCss(assembleStylesheet({
|
|
439
445
|
layers: options.layers,
|
|
446
|
+
prefix: options.prefix,
|
|
440
447
|
variableCss,
|
|
441
448
|
globalCss,
|
|
442
449
|
componentCss: resolvedComponentCss
|
|
@@ -506,7 +513,28 @@ if (import.meta.hot) {
|
|
|
506
513
|
if (id.includes("node_modules")) return null;
|
|
507
514
|
}
|
|
508
515
|
const relativePath = relative(rootDir, id);
|
|
509
|
-
if (!storedManifest.files?.[relativePath]?.length)
|
|
516
|
+
if (!storedManifest.files?.[relativePath]?.length) {
|
|
517
|
+
if (!isProd && !fileCache.has(relativePath)) {
|
|
518
|
+
const hash = contentHash(code);
|
|
519
|
+
fileCache.set(relativePath, {
|
|
520
|
+
hash,
|
|
521
|
+
source: code
|
|
522
|
+
});
|
|
523
|
+
runAnalysis(buildFileEntriesFromCache(fileCache, relativePath));
|
|
524
|
+
const compCount = storedManifest.files?.[relativePath]?.length ?? 0;
|
|
525
|
+
log(`New file detected: ${relativePath} — ${compCount ? `${compCount} components extracted` : "no components"}`);
|
|
526
|
+
if (compCount && devServer) {
|
|
527
|
+
const compModule = devServer.moduleGraph.getModuleById(RESOLVED_COMPONENTS_ID);
|
|
528
|
+
if (compModule) devServer.moduleGraph.invalidateModule(compModule);
|
|
529
|
+
const sysPropModule = devServer.moduleGraph.getModuleById(RESOLVED_SYSTEM_PROPS_ID);
|
|
530
|
+
if (sysPropModule) devServer.moduleGraph.invalidateModule(sysPropModule);
|
|
531
|
+
setTimeout(() => {
|
|
532
|
+
devServer.hot.send({ type: "full-reload" });
|
|
533
|
+
}, 100);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (!storedManifest.files?.[relativePath]?.length) return null;
|
|
537
|
+
}
|
|
510
538
|
try {
|
|
511
539
|
const { transformFile } = __require("@animus-ui/extract");
|
|
512
540
|
const result = transformFile(code, relativePath, storedManifestJson);
|
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.45",
|
|
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.45",
|
|
41
|
+
"@animus-ui/system": "0.1.0-next.45",
|
|
42
42
|
"browserslist": "^4.24.0",
|
|
43
43
|
"lightningcss": "^1.29.0"
|
|
44
44
|
}
|