@unocss/vite 0.57.7 → 0.58.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 CHANGED
@@ -92,7 +92,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
92
92
  let rawConfig = {};
93
93
  let configFileList = [];
94
94
  const uno = core.createGenerator(rawConfig, defaults);
95
- let rollupFilter = pluginutils.createFilter(defaultPipelineInclude, defaultPipelineExclude);
95
+ let rollupFilter = pluginutils.createFilter(
96
+ defaultPipelineInclude,
97
+ defaultPipelineExclude,
98
+ { resolve: typeof configOrPath === "string" ? configOrPath : root }
99
+ );
96
100
  const invalidations = [];
97
101
  const reloadListeners = [];
98
102
  const modules = new core.BetterMap();
@@ -110,7 +114,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
110
114
  uno.config.envMode = "dev";
111
115
  rollupFilter = rawConfig.content?.pipeline === false ? () => false : pluginutils.createFilter(
112
116
  rawConfig.content?.pipeline?.include || rawConfig.include || defaultPipelineInclude,
113
- rawConfig.content?.pipeline?.exclude || rawConfig.exclude || defaultPipelineExclude
117
+ rawConfig.content?.pipeline?.exclude || rawConfig.exclude || defaultPipelineExclude,
118
+ { resolve: typeof configOrPath === "string" ? configOrPath : root }
114
119
  );
115
120
  tokens.clear();
116
121
  await Promise.all(modules.map((code, id) => uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens)));
@@ -487,7 +492,7 @@ function GlobalModeBuildPlugin(ctx) {
487
492
  async renderChunk(_, chunk, options) {
488
493
  if (isLegacyChunk(chunk, options))
489
494
  return null;
490
- if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
495
+ if (!Object.keys(chunk.modules).some((i) => RESOLVED_ID_RE.test(i)))
491
496
  return null;
492
497
  const cssPost = cssPostPlugins.get(options.dir);
493
498
  if (!cssPost) {
@@ -526,7 +531,7 @@ function GlobalModeBuildPlugin(ctx) {
526
531
  async renderChunk(code, chunk, options) {
527
532
  if (isLegacyChunk(chunk, options))
528
533
  return null;
529
- if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
534
+ if (!Object.keys(chunk.modules).some((i) => RESOLVED_ID_RE.test(i)))
530
535
  return null;
531
536
  const cssPost = cssPostPlugins.get(options.dir);
532
537
  if (!cssPost) {
@@ -843,7 +848,7 @@ function PerModuleModePlugin({ uno, filter }) {
843
848
  if (!filter(code, id))
844
849
  return;
845
850
  const hash = getHash(id);
846
- const hasScope = code.match(SCOPE_IMPORT_RE);
851
+ const hasScope = SCOPE_IMPORT_RE.test(code);
847
852
  const { css } = await uno.generate(code, { id, scope: hasScope ? `.${hash}` : void 0, preflights: false });
848
853
  if (!css && !hasScope)
849
854
  return null;
package/dist/index.mjs CHANGED
@@ -77,7 +77,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
77
77
  let rawConfig = {};
78
78
  let configFileList = [];
79
79
  const uno = createGenerator(rawConfig, defaults);
80
- let rollupFilter = createFilter(defaultPipelineInclude, defaultPipelineExclude);
80
+ let rollupFilter = createFilter(
81
+ defaultPipelineInclude,
82
+ defaultPipelineExclude,
83
+ { resolve: typeof configOrPath === "string" ? configOrPath : root }
84
+ );
81
85
  const invalidations = [];
82
86
  const reloadListeners = [];
83
87
  const modules = new BetterMap();
@@ -95,7 +99,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
95
99
  uno.config.envMode = "dev";
96
100
  rollupFilter = rawConfig.content?.pipeline === false ? () => false : createFilter(
97
101
  rawConfig.content?.pipeline?.include || rawConfig.include || defaultPipelineInclude,
98
- rawConfig.content?.pipeline?.exclude || rawConfig.exclude || defaultPipelineExclude
102
+ rawConfig.content?.pipeline?.exclude || rawConfig.exclude || defaultPipelineExclude,
103
+ { resolve: typeof configOrPath === "string" ? configOrPath : root }
99
104
  );
100
105
  tokens.clear();
101
106
  await Promise.all(modules.map((code, id) => uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens)));
@@ -472,7 +477,7 @@ function GlobalModeBuildPlugin(ctx) {
472
477
  async renderChunk(_, chunk, options) {
473
478
  if (isLegacyChunk(chunk, options))
474
479
  return null;
475
- if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
480
+ if (!Object.keys(chunk.modules).some((i) => RESOLVED_ID_RE.test(i)))
476
481
  return null;
477
482
  const cssPost = cssPostPlugins.get(options.dir);
478
483
  if (!cssPost) {
@@ -511,7 +516,7 @@ function GlobalModeBuildPlugin(ctx) {
511
516
  async renderChunk(code, chunk, options) {
512
517
  if (isLegacyChunk(chunk, options))
513
518
  return null;
514
- if (!Object.keys(chunk.modules).some((i) => i.match(RESOLVED_ID_RE)))
519
+ if (!Object.keys(chunk.modules).some((i) => RESOLVED_ID_RE.test(i)))
515
520
  return null;
516
521
  const cssPost = cssPostPlugins.get(options.dir);
517
522
  if (!cssPost) {
@@ -828,7 +833,7 @@ function PerModuleModePlugin({ uno, filter }) {
828
833
  if (!filter(code, id))
829
834
  return;
830
835
  const hash = getHash(id);
831
- const hasScope = code.match(SCOPE_IMPORT_RE);
836
+ const hasScope = SCOPE_IMPORT_RE.test(code);
832
837
  const { css } = await uno.generate(code, { id, scope: hasScope ? `.${hash}` : void 0, preflights: false });
833
838
  if (!css && !hasScope)
834
839
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.57.7",
3
+ "version": "0.58.1",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -43,19 +43,19 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@ampproject/remapping": "^2.2.1",
46
- "@rollup/pluginutils": "^5.0.5",
46
+ "@rollup/pluginutils": "^5.1.0",
47
47
  "chokidar": "^3.5.3",
48
48
  "fast-glob": "^3.3.2",
49
49
  "magic-string": "^0.30.5",
50
- "@unocss/config": "0.57.7",
51
- "@unocss/core": "0.57.7",
52
- "@unocss/inspector": "0.57.7",
53
- "@unocss/scope": "0.57.7",
54
- "@unocss/transformer-directives": "0.57.7"
50
+ "@unocss/config": "0.58.1",
51
+ "@unocss/core": "0.58.1",
52
+ "@unocss/inspector": "0.58.1",
53
+ "@unocss/scope": "0.58.1",
54
+ "@unocss/transformer-directives": "0.58.1"
55
55
  },
56
56
  "devDependencies": {
57
- "vite": "^5.0.0",
58
- "@unocss/shared-integration": "0.57.7"
57
+ "vite": "^5.0.10",
58
+ "@unocss/shared-integration": "0.58.1"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "unbuild",