@unocss/core 0.52.6 → 0.53.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.cjs +6 -2
- package/dist/index.d.ts +80 -14
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -442,7 +442,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
442
442
|
}
|
|
443
443
|
return [i, ...rule];
|
|
444
444
|
}).filter(Boolean).reverse();
|
|
445
|
-
let theme = sources.map((p) => p.theme
|
|
445
|
+
let theme = mergeThemes(sources.map((p) => p.theme));
|
|
446
446
|
const extendThemes = getMerged("extendTheme");
|
|
447
447
|
for (const extendTheme of extendThemes)
|
|
448
448
|
theme = extendTheme(theme) || theme;
|
|
@@ -489,6 +489,7 @@ function mergeConfigs(configs) {
|
|
|
489
489
|
{},
|
|
490
490
|
...configs,
|
|
491
491
|
{
|
|
492
|
+
theme: mergeThemes(configs.map((c) => c.theme)),
|
|
492
493
|
presets: getMerged("presets"),
|
|
493
494
|
safelist: getMerged("safelist"),
|
|
494
495
|
preprocess: getMerged("preprocess"),
|
|
@@ -502,8 +503,11 @@ function mergeConfigs(configs) {
|
|
|
502
503
|
);
|
|
503
504
|
return merged;
|
|
504
505
|
}
|
|
506
|
+
function mergeThemes(themes) {
|
|
507
|
+
return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
|
|
508
|
+
}
|
|
505
509
|
|
|
506
|
-
const version = "0.
|
|
510
|
+
const version = "0.53.0";
|
|
507
511
|
|
|
508
512
|
class UnoGenerator {
|
|
509
513
|
constructor(userConfig = {}, defaults = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -317,6 +317,13 @@ interface RuleMeta {
|
|
|
317
317
|
* @default false
|
|
318
318
|
*/
|
|
319
319
|
internal?: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Store the hash of the rule boy
|
|
322
|
+
*
|
|
323
|
+
* @internal
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
326
|
+
__hash?: string;
|
|
320
327
|
}
|
|
321
328
|
type CSSValue = CSSObject | CSSEntries;
|
|
322
329
|
type CSSValues = CSSValue | CSSValue[];
|
|
@@ -722,16 +729,61 @@ interface SourceCodeTransformer {
|
|
|
722
729
|
*/
|
|
723
730
|
transform: (code: MagicString, id: string, ctx: UnocssPluginContext) => Awaitable<void>;
|
|
724
731
|
}
|
|
725
|
-
interface
|
|
732
|
+
interface ContentOptions {
|
|
726
733
|
/**
|
|
727
|
-
* Glob patterns to
|
|
728
|
-
*
|
|
734
|
+
* Glob patterns to extract from the file system, in addition to other content sources.
|
|
735
|
+
*
|
|
736
|
+
* In dev mode, the files will be watched and trigger HMR.
|
|
737
|
+
*
|
|
738
|
+
* @default []
|
|
729
739
|
*/
|
|
730
740
|
filesystem?: string[];
|
|
731
741
|
/**
|
|
732
|
-
*
|
|
742
|
+
* Inline text to be extracted
|
|
733
743
|
*/
|
|
734
|
-
|
|
744
|
+
inline?: (string | {
|
|
745
|
+
code: string;
|
|
746
|
+
id?: string;
|
|
747
|
+
} | (() => Awaitable<string | {
|
|
748
|
+
code: string;
|
|
749
|
+
id?: string;
|
|
750
|
+
}>))[];
|
|
751
|
+
/**
|
|
752
|
+
* Filters to determine whether to extract certain modules from the build tools' transformation pipeline.
|
|
753
|
+
*
|
|
754
|
+
* Currently only works for Vite and Webpack integration.
|
|
755
|
+
*
|
|
756
|
+
* Set `false` to disable.
|
|
757
|
+
*/
|
|
758
|
+
pipeline?: false | {
|
|
759
|
+
/**
|
|
760
|
+
* Patterns that filter the files being extracted.
|
|
761
|
+
* Supports regular expressions and `picomatch` glob patterns.
|
|
762
|
+
*
|
|
763
|
+
* By default, `.ts` and `.js` files are NOT extracted.
|
|
764
|
+
*
|
|
765
|
+
* @see https://www.npmjs.com/package/picomatch
|
|
766
|
+
* @default [/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/]
|
|
767
|
+
*/
|
|
768
|
+
include?: FilterPattern;
|
|
769
|
+
/**
|
|
770
|
+
* Patterns that filter the files NOT being extracted.
|
|
771
|
+
* Supports regular expressions and `picomatch` glob patterns.
|
|
772
|
+
*
|
|
773
|
+
* By default, `node_modules` and `dist` are also extracted.
|
|
774
|
+
*
|
|
775
|
+
* @see https://www.npmjs.com/package/picomatch
|
|
776
|
+
* @default [/\.(css|postcss|sass|scss|less|stylus|styl)($|\?)/]
|
|
777
|
+
*/
|
|
778
|
+
exclude?: FilterPattern;
|
|
779
|
+
};
|
|
780
|
+
/**
|
|
781
|
+
* @deprecated Renamed to `inline`
|
|
782
|
+
*/
|
|
783
|
+
plain?: (string | {
|
|
784
|
+
code: string;
|
|
785
|
+
id?: string;
|
|
786
|
+
})[];
|
|
735
787
|
}
|
|
736
788
|
/**
|
|
737
789
|
* For other modules to aggregate the options
|
|
@@ -748,21 +800,35 @@ interface PluginOptions {
|
|
|
748
800
|
*/
|
|
749
801
|
configDeps?: string[];
|
|
750
802
|
/**
|
|
751
|
-
*
|
|
803
|
+
* Custom transformers to the source code
|
|
752
804
|
*/
|
|
753
|
-
|
|
805
|
+
transformers?: SourceCodeTransformer[];
|
|
754
806
|
/**
|
|
755
|
-
*
|
|
807
|
+
* Options for sources to be extracted as utilities usages
|
|
808
|
+
*
|
|
809
|
+
* Supported sources:
|
|
810
|
+
* - `filesystem` - extract from file system
|
|
811
|
+
* - `plain` - extract from plain inline text
|
|
812
|
+
* - `pipeline` - extract from build tools' transformation pipeline, such as Vite and Webpack
|
|
813
|
+
*
|
|
814
|
+
* The usage extracted from each source will be **merged** together.
|
|
756
815
|
*/
|
|
757
|
-
|
|
816
|
+
content?: ContentOptions;
|
|
817
|
+
/** ========== DEPRECATED OPTIONS ========== **/
|
|
758
818
|
/**
|
|
759
|
-
*
|
|
819
|
+
* @deprecated Renamed to `content`
|
|
760
820
|
*/
|
|
761
|
-
|
|
821
|
+
extraContent?: ContentOptions;
|
|
762
822
|
/**
|
|
763
|
-
*
|
|
823
|
+
* Patterns that filter the files being extracted.
|
|
824
|
+
* @deprecated moved to `content.pipeline.include`
|
|
764
825
|
*/
|
|
765
|
-
|
|
826
|
+
include?: FilterPattern;
|
|
827
|
+
/**
|
|
828
|
+
* Patterns that filter the files NOT being extracted.
|
|
829
|
+
* @deprecated moved to `content.pipeline.exclude`
|
|
830
|
+
*/
|
|
831
|
+
exclude?: FilterPattern;
|
|
766
832
|
}
|
|
767
833
|
interface UserConfig<Theme extends {} = {}> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {
|
|
768
834
|
}
|
|
@@ -879,4 +945,4 @@ declare function resolveConfig<Theme extends {} = {}>(userConfig?: UserConfig<Th
|
|
|
879
945
|
*/
|
|
880
946
|
declare function mergeConfigs<Theme extends {} = {}>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
|
|
881
947
|
|
|
882
|
-
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher,
|
|
948
|
+
export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, ContentOptions, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetOptions, RGBAColorValue, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, ToArray, TransformResult, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
|
package/dist/index.mjs
CHANGED
|
@@ -438,7 +438,7 @@ function resolveConfig(userConfig = {}, defaults = {}) {
|
|
|
438
438
|
}
|
|
439
439
|
return [i, ...rule];
|
|
440
440
|
}).filter(Boolean).reverse();
|
|
441
|
-
let theme = sources.map((p) => p.theme
|
|
441
|
+
let theme = mergeThemes(sources.map((p) => p.theme));
|
|
442
442
|
const extendThemes = getMerged("extendTheme");
|
|
443
443
|
for (const extendTheme of extendThemes)
|
|
444
444
|
theme = extendTheme(theme) || theme;
|
|
@@ -485,6 +485,7 @@ function mergeConfigs(configs) {
|
|
|
485
485
|
{},
|
|
486
486
|
...configs,
|
|
487
487
|
{
|
|
488
|
+
theme: mergeThemes(configs.map((c) => c.theme)),
|
|
488
489
|
presets: getMerged("presets"),
|
|
489
490
|
safelist: getMerged("safelist"),
|
|
490
491
|
preprocess: getMerged("preprocess"),
|
|
@@ -498,8 +499,11 @@ function mergeConfigs(configs) {
|
|
|
498
499
|
);
|
|
499
500
|
return merged;
|
|
500
501
|
}
|
|
502
|
+
function mergeThemes(themes) {
|
|
503
|
+
return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
|
|
504
|
+
}
|
|
501
505
|
|
|
502
|
-
const version = "0.
|
|
506
|
+
const version = "0.53.0";
|
|
503
507
|
|
|
504
508
|
class UnoGenerator {
|
|
505
509
|
constructor(userConfig = {}, defaults = {}) {
|