@unocss/core 0.62.0 → 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.
Files changed (2) hide show
  1. package/dist/index.mjs +29 -39
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -489,47 +489,29 @@ function resolvePresets(preset) {
489
489
  return [root, ...nested];
490
490
  }
491
491
  function mergeContentOptions(optionsArray) {
492
- const mergedResult = {
493
- filesystem: [],
494
- inline: [],
495
- pipeline: {
496
- include: [],
497
- exclude: []
498
- },
499
- plain: []
500
- };
492
+ if (optionsArray.length === 0) {
493
+ return {};
494
+ }
495
+ const pipelineIncludes = [];
496
+ const pipelineExcludes = [];
497
+ let pipelineDisabled = false;
501
498
  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
- }
499
+ if (options.pipeline === false) {
500
+ pipelineDisabled = true;
518
501
  } else {
519
- mergedResult.pipeline = false;
502
+ pipelineIncludes.push(options.pipeline?.include ?? []);
503
+ pipelineExcludes.push(options.pipeline?.exclude ?? []);
520
504
  }
521
505
  }
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;
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
+ };
533
515
  }
534
516
  function resolveConfig(userConfig = {}, defaults = {}) {
535
517
  const config = Object.assign({}, defaults, userConfig);
@@ -617,10 +599,12 @@ function mergeConfigs(configs) {
617
599
  const config = configs.map((config2) => Object.entries(config2).reduce((acc, [key, value]) => ({
618
600
  ...acc,
619
601
  [key]: maybeArrays.includes(key) ? toArray(value) : value
620
- }), {})).reduce(({ theme: themeA, ...a }, { theme: themeB, ...b }) => {
602
+ }), {})).reduce(({ theme: themeA, content: contentA, ...a }, { theme: themeB, content: contentB, ...b }) => {
621
603
  const c = mergeDeep(a, b, true);
622
604
  if (themeA || themeB)
623
605
  c.theme = mergeThemes([themeA, themeB]);
606
+ if (contentA || contentB)
607
+ c.content = mergeContentOptions([contentA || {}, contentB || {}]);
624
608
  return c;
625
609
  }, {});
626
610
  return config;
@@ -644,11 +628,17 @@ function mergeAutocompleteShorthands(shorthands) {
644
628
  };
645
629
  }, {});
646
630
  }
631
+ function mergeFilterPatterns(...filterPatterns) {
632
+ return filterPatterns.flatMap(flatternFilterPattern);
633
+ }
634
+ function flatternFilterPattern(pattern) {
635
+ return Array.isArray(pattern) ? pattern : pattern ? [pattern] : [];
636
+ }
647
637
  function definePreset(preset) {
648
638
  return preset;
649
639
  }
650
640
 
651
- const version = "0.62.0";
641
+ const version = "0.62.1";
652
642
 
653
643
  var __defProp = Object.defineProperty;
654
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.62.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",