@unocss/core 0.61.9 → 0.62.0
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.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +48 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -601,6 +601,11 @@ interface ConfigBase<Theme extends object = object> {
|
|
|
601
601
|
* @default `true` when `envMode` is `dev`, otherwise `false`
|
|
602
602
|
*/
|
|
603
603
|
details?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Options for sources to be extracted as utilities usages.
|
|
606
|
+
*
|
|
607
|
+
*/
|
|
608
|
+
content?: ContentOptions;
|
|
604
609
|
}
|
|
605
610
|
interface OutputCssLayersOptions {
|
|
606
611
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -601,6 +601,11 @@ interface ConfigBase<Theme extends object = object> {
|
|
|
601
601
|
* @default `true` when `envMode` is `dev`, otherwise `false`
|
|
602
602
|
*/
|
|
603
603
|
details?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Options for sources to be extracted as utilities usages.
|
|
606
|
+
*
|
|
607
|
+
*/
|
|
608
|
+
content?: ContentOptions;
|
|
604
609
|
}
|
|
605
610
|
interface OutputCssLayersOptions {
|
|
606
611
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -488,6 +488,49 @@ function resolvePresets(preset) {
|
|
|
488
488
|
const nested = (root.presets || []).flatMap(toArray).flatMap(resolvePresets);
|
|
489
489
|
return [root, ...nested];
|
|
490
490
|
}
|
|
491
|
+
function mergeContentOptions(optionsArray) {
|
|
492
|
+
const mergedResult = {
|
|
493
|
+
filesystem: [],
|
|
494
|
+
inline: [],
|
|
495
|
+
pipeline: {
|
|
496
|
+
include: [],
|
|
497
|
+
exclude: []
|
|
498
|
+
},
|
|
499
|
+
plain: []
|
|
500
|
+
};
|
|
501
|
+
for (const options of optionsArray) {
|
|
502
|
+
if (options.filesystem) {
|
|
503
|
+
mergedResult.filesystem.push(...options.filesystem);
|
|
504
|
+
}
|
|
505
|
+
if (options.inline) {
|
|
506
|
+
mergedResult.inline.push(...options.inline);
|
|
507
|
+
}
|
|
508
|
+
if (options.plain) {
|
|
509
|
+
mergedResult.inline.push(...options.plain);
|
|
510
|
+
}
|
|
511
|
+
if (options.pipeline !== false) {
|
|
512
|
+
if (options.pipeline?.include) {
|
|
513
|
+
mergedResult.pipeline?.include?.push(...options.pipeline?.include);
|
|
514
|
+
}
|
|
515
|
+
if (options.pipeline?.exclude) {
|
|
516
|
+
mergedResult.pipeline?.exclude?.push(...options.pipeline?.exclude);
|
|
517
|
+
}
|
|
518
|
+
} else {
|
|
519
|
+
mergedResult.pipeline = false;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (mergedResult.filesystem) {
|
|
523
|
+
mergedResult.filesystem = Array.from(new Set(mergedResult.filesystem));
|
|
524
|
+
}
|
|
525
|
+
if (mergedResult.inline) {
|
|
526
|
+
mergedResult.inline = Array.from(new Set(mergedResult.inline));
|
|
527
|
+
}
|
|
528
|
+
if (mergedResult.pipeline !== false) {
|
|
529
|
+
mergedResult.pipeline.include = Array.from(new Set(mergedResult.pipeline?.include));
|
|
530
|
+
mergedResult.pipeline.exclude = Array.from(new Set(mergedResult.pipeline?.exclude));
|
|
531
|
+
}
|
|
532
|
+
return mergedResult;
|
|
533
|
+
}
|
|
491
534
|
function resolveConfig(userConfig = {}, defaults = {}) {
|
|
492
535
|
const config = Object.assign({}, defaults, userConfig);
|
|
493
536
|
const rawPresets = uniqueBy((config.presets || []).flatMap(toArray).flatMap(resolvePresets), (a, b) => a.name === b.name);
|
|
@@ -537,6 +580,8 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
537
580
|
let separators = getMerged("separators");
|
|
538
581
|
if (!separators.length)
|
|
539
582
|
separators = [":", "-"];
|
|
583
|
+
const contents = getMerged("content");
|
|
584
|
+
const content = mergeContentOptions(contents);
|
|
540
585
|
const resolved = {
|
|
541
586
|
mergeSelectors: true,
|
|
542
587
|
warn: true,
|
|
@@ -560,7 +605,8 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
560
605
|
extractors,
|
|
561
606
|
safelist: getMerged("safelist"),
|
|
562
607
|
separators,
|
|
563
|
-
details: config.details ?? config.envMode === "dev"
|
|
608
|
+
details: config.details ?? config.envMode === "dev",
|
|
609
|
+
content
|
|
564
610
|
};
|
|
565
611
|
for (const p of sources)
|
|
566
612
|
p?.configResolved?.(resolved);
|
|
@@ -602,7 +648,7 @@ function definePreset(preset) {
|
|
|
602
648
|
return preset;
|
|
603
649
|
}
|
|
604
650
|
|
|
605
|
-
const version = "0.
|
|
651
|
+
const version = "0.62.0";
|
|
606
652
|
|
|
607
653
|
var __defProp = Object.defineProperty;
|
|
608
654
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.62.0",
|
|
5
5
|
"description": "The instant on-demand Atomic CSS engine.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"magic-string": "^0.30.11",
|
|
41
|
-
"unconfig": "^0.5.
|
|
41
|
+
"unconfig": "^0.5.5"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "unbuild",
|