@animus-ui/vite-plugin 0.1.0-next.61 → 0.1.0-next.62
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.map +1 -1
- package/dist/index.mjs +42 -14
- package/package.json +3 -3
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":"AAiBA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAE3C,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;;;;;;OAMG;IACH,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,CAylCnE;AAED,eAAe,aAAa,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { createHash } from "crypto";
|
|
3
3
|
import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
4
4
|
import { dirname, extname, join, relative, resolve } from "path";
|
|
5
|
-
import { applyUnitFallback, assembleStylesheet, extractSystemFilePackages, validateLayerOrder } from "@animus-ui/extract/pipeline";
|
|
5
|
+
import { applyUnitFallback, assembleStylesheet, extractSystemFilePackages, stripLeadingLayerDeclaration, validateLayerOrder } from "@animus-ui/extract/pipeline";
|
|
6
6
|
import browserslist from "browserslist";
|
|
7
7
|
import { browserslistToTargets, transform } from "lightningcss";
|
|
8
8
|
//#region \0rolldown/runtime.js
|
|
@@ -146,11 +146,13 @@ function animusExtract(options) {
|
|
|
146
146
|
let variableCss = "";
|
|
147
147
|
let globalCss = "";
|
|
148
148
|
let globalStyleBlocksJson = null;
|
|
149
|
+
let keyframesBlocksJson = null;
|
|
149
150
|
let pathAliasesJson = null;
|
|
150
151
|
let storedManifest = null;
|
|
151
152
|
let storedManifestJson = "";
|
|
152
153
|
let resolvedComponentCss = "";
|
|
153
154
|
let storedSheets = null;
|
|
155
|
+
let layerDeclaration = "";
|
|
154
156
|
let fragmentCache = /* @__PURE__ */ new Map();
|
|
155
157
|
let reverseProvenance = {};
|
|
156
158
|
let storedSystemPropMapJson = "{}";
|
|
@@ -183,6 +185,7 @@ function animusExtract(options) {
|
|
|
183
185
|
variableCss = config.variableCss;
|
|
184
186
|
contextualVarsJson = config.contextualVarsJson;
|
|
185
187
|
globalStyleBlocksJson = config.globalStyleBlocks || null;
|
|
188
|
+
keyframesBlocksJson = config.keyframesBlocks || null;
|
|
186
189
|
} catch (e) {
|
|
187
190
|
if (options.strict) throw new Error(`[animus-extract] Failed to load system from ${resolvedSystemPath}: ${e}`);
|
|
188
191
|
console.warn(`[animus-extract] Failed to load system from ${resolvedSystemPath}:`, e);
|
|
@@ -202,7 +205,7 @@ function animusExtract(options) {
|
|
|
202
205
|
runtime_import: "@animus-ui/system",
|
|
203
206
|
css_module_id: "virtual:animus/styles.css"
|
|
204
207
|
});
|
|
205
|
-
const manifestJson = analyzeProject(JSON.stringify(fileEntries), themeJson, variableMapJson, contextualVarsJson || null, configJson, groupRegistryJson, JSON.stringify(packageMap), !isProd, emitterConfig, selectorAliasesJson, selectorOrderJson, globalStyleBlocksJson, pathAliasesJson);
|
|
208
|
+
const manifestJson = analyzeProject(JSON.stringify(fileEntries), themeJson, variableMapJson, contextualVarsJson || null, configJson, groupRegistryJson, JSON.stringify(packageMap), !isProd, emitterConfig, selectorAliasesJson, selectorOrderJson, globalStyleBlocksJson, pathAliasesJson, keyframesBlocksJson);
|
|
206
209
|
storedManifest = JSON.parse(manifestJson);
|
|
207
210
|
storedManifestJson = manifestJson;
|
|
208
211
|
storedSystemPropMapJson = JSON.stringify(storedManifest?.system_prop_map ?? {});
|
|
@@ -426,6 +429,13 @@ function animusExtract(options) {
|
|
|
426
429
|
log(`Delivery: split mode — static ${staticSize} bytes, components ${componentSize} bytes (adopted stylesheet)`);
|
|
427
430
|
} else log("Delivery: single file mode (production)");
|
|
428
431
|
}
|
|
432
|
+
const { declaration } = assembleStylesheet({
|
|
433
|
+
layers: options.layers,
|
|
434
|
+
variableCss: "",
|
|
435
|
+
globalCss: "",
|
|
436
|
+
split: true
|
|
437
|
+
});
|
|
438
|
+
layerDeclaration = declaration;
|
|
429
439
|
if (options.verify) runSelfVerify();
|
|
430
440
|
},
|
|
431
441
|
resolveId(id) {
|
|
@@ -444,22 +454,28 @@ function animusExtract(options) {
|
|
|
444
454
|
warnFn: warn
|
|
445
455
|
};
|
|
446
456
|
if (id === RESOLVED_CSS_ID) {
|
|
447
|
-
if (!isProd && storedSheets)
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
457
|
+
if (!isProd && storedSheets) {
|
|
458
|
+
const { variables, body } = assembleStylesheet({
|
|
459
|
+
layers: options.layers,
|
|
460
|
+
variableCss,
|
|
461
|
+
globalCss,
|
|
462
|
+
split: true
|
|
463
|
+
});
|
|
464
|
+
return [variables, postProcessCss(body, {
|
|
465
|
+
...lcssOpts,
|
|
466
|
+
minify: false
|
|
467
|
+
})].filter(Boolean).join("\n");
|
|
468
|
+
}
|
|
469
|
+
const { variables, body } = assembleStylesheet({
|
|
456
470
|
layers: options.layers,
|
|
457
471
|
variableCss,
|
|
458
472
|
globalCss,
|
|
459
|
-
componentCss: resolvedComponentCss
|
|
460
|
-
|
|
473
|
+
componentCss: resolvedComponentCss,
|
|
474
|
+
split: true
|
|
475
|
+
});
|
|
476
|
+
return [variables, postProcessCss(body, lcssOpts)].filter(Boolean).join("\n");
|
|
461
477
|
}
|
|
462
|
-
if (id === RESOLVED_COMPONENTS_ID) return `export default \`${postProcessCss(resolvedComponentCss || "", {
|
|
478
|
+
if (id === RESOLVED_COMPONENTS_ID) return `export default \`${postProcessCss(stripLeadingLayerDeclaration(resolvedComponentCss || ""), {
|
|
463
479
|
...lcssOpts,
|
|
464
480
|
minify: false
|
|
465
481
|
}).replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;`;
|
|
@@ -566,6 +582,18 @@ if (import.meta.hot) {
|
|
|
566
582
|
return null;
|
|
567
583
|
}
|
|
568
584
|
},
|
|
585
|
+
transformIndexHtml: {
|
|
586
|
+
order: "pre",
|
|
587
|
+
handler() {
|
|
588
|
+
if (!layerDeclaration) return [];
|
|
589
|
+
return [{
|
|
590
|
+
tag: "style",
|
|
591
|
+
attrs: { "data-animus-layers": "" },
|
|
592
|
+
children: layerDeclaration,
|
|
593
|
+
injectTo: "head-prepend"
|
|
594
|
+
}];
|
|
595
|
+
}
|
|
596
|
+
},
|
|
569
597
|
handleHotUpdate({ file, server: hmrServer, modules }) {
|
|
570
598
|
if (isProd) return;
|
|
571
599
|
const ext = extname(file);
|
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.62",
|
|
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.62",
|
|
41
|
+
"@animus-ui/system": "0.1.0-next.62",
|
|
42
42
|
"browserslist": "^4.24.0",
|
|
43
43
|
"lightningcss": "^1.29.0"
|
|
44
44
|
}
|