@unocss/core 0.61.9 → 0.62.1
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 +39 -3
- 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,31 @@ 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
|
+
if (optionsArray.length === 0) {
|
|
493
|
+
return {};
|
|
494
|
+
}
|
|
495
|
+
const pipelineIncludes = [];
|
|
496
|
+
const pipelineExcludes = [];
|
|
497
|
+
let pipelineDisabled = false;
|
|
498
|
+
for (const options of optionsArray) {
|
|
499
|
+
if (options.pipeline === false) {
|
|
500
|
+
pipelineDisabled = true;
|
|
501
|
+
} else {
|
|
502
|
+
pipelineIncludes.push(options.pipeline?.include ?? []);
|
|
503
|
+
pipelineExcludes.push(options.pipeline?.exclude ?? []);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return {
|
|
507
|
+
filesystem: uniq(optionsArray.flatMap((options) => options.filesystem ?? [])),
|
|
508
|
+
inline: uniq(optionsArray.flatMap((options) => options.inline ?? [])),
|
|
509
|
+
plain: uniq(optionsArray.flatMap((options) => options.plain ?? [])),
|
|
510
|
+
pipeline: pipelineDisabled ? false : {
|
|
511
|
+
include: uniq(mergeFilterPatterns(...pipelineIncludes)),
|
|
512
|
+
exclude: uniq(mergeFilterPatterns(...pipelineExcludes))
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
}
|
|
491
516
|
function resolveConfig(userConfig = {}, defaults = {}) {
|
|
492
517
|
const config = Object.assign({}, defaults, userConfig);
|
|
493
518
|
const rawPresets = uniqueBy((config.presets || []).flatMap(toArray).flatMap(resolvePresets), (a, b) => a.name === b.name);
|
|
@@ -537,6 +562,8 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
537
562
|
let separators = getMerged("separators");
|
|
538
563
|
if (!separators.length)
|
|
539
564
|
separators = [":", "-"];
|
|
565
|
+
const contents = getMerged("content");
|
|
566
|
+
const content = mergeContentOptions(contents);
|
|
540
567
|
const resolved = {
|
|
541
568
|
mergeSelectors: true,
|
|
542
569
|
warn: true,
|
|
@@ -560,7 +587,8 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
560
587
|
extractors,
|
|
561
588
|
safelist: getMerged("safelist"),
|
|
562
589
|
separators,
|
|
563
|
-
details: config.details ?? config.envMode === "dev"
|
|
590
|
+
details: config.details ?? config.envMode === "dev",
|
|
591
|
+
content
|
|
564
592
|
};
|
|
565
593
|
for (const p of sources)
|
|
566
594
|
p?.configResolved?.(resolved);
|
|
@@ -571,10 +599,12 @@ function mergeConfigs(configs) {
|
|
|
571
599
|
const config = configs.map((config2) => Object.entries(config2).reduce((acc, [key, value]) => ({
|
|
572
600
|
...acc,
|
|
573
601
|
[key]: maybeArrays.includes(key) ? toArray(value) : value
|
|
574
|
-
}), {})).reduce(({ theme: themeA, ...a }, { theme: themeB, ...b }) => {
|
|
602
|
+
}), {})).reduce(({ theme: themeA, content: contentA, ...a }, { theme: themeB, content: contentB, ...b }) => {
|
|
575
603
|
const c = mergeDeep(a, b, true);
|
|
576
604
|
if (themeA || themeB)
|
|
577
605
|
c.theme = mergeThemes([themeA, themeB]);
|
|
606
|
+
if (contentA || contentB)
|
|
607
|
+
c.content = mergeContentOptions([contentA || {}, contentB || {}]);
|
|
578
608
|
return c;
|
|
579
609
|
}, {});
|
|
580
610
|
return config;
|
|
@@ -598,11 +628,17 @@ function mergeAutocompleteShorthands(shorthands) {
|
|
|
598
628
|
};
|
|
599
629
|
}, {});
|
|
600
630
|
}
|
|
631
|
+
function mergeFilterPatterns(...filterPatterns) {
|
|
632
|
+
return filterPatterns.flatMap(flatternFilterPattern);
|
|
633
|
+
}
|
|
634
|
+
function flatternFilterPattern(pattern) {
|
|
635
|
+
return Array.isArray(pattern) ? pattern : pattern ? [pattern] : [];
|
|
636
|
+
}
|
|
601
637
|
function definePreset(preset) {
|
|
602
638
|
return preset;
|
|
603
639
|
}
|
|
604
640
|
|
|
605
|
-
const version = "0.
|
|
641
|
+
const version = "0.62.1";
|
|
606
642
|
|
|
607
643
|
var __defProp = Object.defineProperty;
|
|
608
644
|
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.1",
|
|
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",
|