@unocss/core 0.52.7 → 0.53.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.cjs +6 -2
- package/dist/index.d.ts +73 -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.1";
|
|
507
511
|
|
|
508
512
|
class UnoGenerator {
|
|
509
513
|
constructor(userConfig = {}, defaults = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -729,16 +729,61 @@ interface SourceCodeTransformer {
|
|
|
729
729
|
*/
|
|
730
730
|
transform: (code: MagicString, id: string, ctx: UnocssPluginContext) => Awaitable<void>;
|
|
731
731
|
}
|
|
732
|
-
interface
|
|
732
|
+
interface ContentOptions {
|
|
733
733
|
/**
|
|
734
|
-
* Glob patterns to
|
|
735
|
-
*
|
|
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 []
|
|
736
739
|
*/
|
|
737
740
|
filesystem?: string[];
|
|
738
741
|
/**
|
|
739
|
-
*
|
|
742
|
+
* Inline text to be extracted
|
|
743
|
+
*/
|
|
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`
|
|
740
782
|
*/
|
|
741
|
-
plain?: string
|
|
783
|
+
plain?: (string | {
|
|
784
|
+
code: string;
|
|
785
|
+
id?: string;
|
|
786
|
+
})[];
|
|
742
787
|
}
|
|
743
788
|
/**
|
|
744
789
|
* For other modules to aggregate the options
|
|
@@ -755,21 +800,35 @@ interface PluginOptions {
|
|
|
755
800
|
*/
|
|
756
801
|
configDeps?: string[];
|
|
757
802
|
/**
|
|
758
|
-
*
|
|
803
|
+
* Custom transformers to the source code
|
|
759
804
|
*/
|
|
760
|
-
|
|
805
|
+
transformers?: SourceCodeTransformer[];
|
|
761
806
|
/**
|
|
762
|
-
*
|
|
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.
|
|
763
815
|
*/
|
|
764
|
-
|
|
816
|
+
content?: ContentOptions;
|
|
817
|
+
/** ========== DEPRECATED OPTIONS ========== **/
|
|
765
818
|
/**
|
|
766
|
-
*
|
|
819
|
+
* @deprecated Renamed to `content`
|
|
767
820
|
*/
|
|
768
|
-
|
|
821
|
+
extraContent?: ContentOptions;
|
|
769
822
|
/**
|
|
770
|
-
*
|
|
823
|
+
* Patterns that filter the files being extracted.
|
|
824
|
+
* @deprecated moved to `content.pipeline.include`
|
|
771
825
|
*/
|
|
772
|
-
|
|
826
|
+
include?: FilterPattern;
|
|
827
|
+
/**
|
|
828
|
+
* Patterns that filter the files NOT being extracted.
|
|
829
|
+
* @deprecated moved to `content.pipeline.exclude`
|
|
830
|
+
*/
|
|
831
|
+
exclude?: FilterPattern;
|
|
773
832
|
}
|
|
774
833
|
interface UserConfig<Theme extends {} = {}> extends ConfigBase<Theme>, UserOnlyOptions<Theme>, GeneratorOptions, PluginOptions, CliOptions {
|
|
775
834
|
}
|
|
@@ -886,4 +945,4 @@ declare function resolveConfig<Theme extends {} = {}>(userConfig?: UserConfig<Th
|
|
|
886
945
|
*/
|
|
887
946
|
declare function mergeConfigs<Theme extends {} = {}>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
|
|
888
947
|
|
|
889
|
-
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.1";
|
|
503
507
|
|
|
504
508
|
class UnoGenerator {
|
|
505
509
|
constructor(userConfig = {}, defaults = {}) {
|