@unocss/vite 0.57.1 → 0.57.3

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
@@ -183,7 +183,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
183
183
  uno,
184
184
  extract,
185
185
  getConfig,
186
- root,
186
+ get root() {
187
+ return root;
188
+ },
187
189
  updateRoot,
188
190
  getConfigFileList: () => configFileList
189
191
  };
@@ -338,6 +340,7 @@ async function setupContentExtractor(ctx, shouldWatch = false) {
338
340
  if (content?.filesystem) {
339
341
  const files = await fg__default(content.filesystem, { cwd: root });
340
342
  async function extractFile(file) {
343
+ file = node_path.isAbsolute(file) ? file : node_path.resolve(root, file);
341
344
  const code = await fs__default.readFile(file, "utf-8");
342
345
  if (!filter(code, file))
343
346
  return;
@@ -420,8 +423,8 @@ function GlobalModeBuildPlugin(ctx) {
420
423
  return null;
421
424
  },
422
425
  transformIndexHtml: {
423
- enforce: "pre",
424
- transform(code, { filename }) {
426
+ order: "pre",
427
+ handler(code, { filename }) {
425
428
  tasks.push(extract(code, filename));
426
429
  }
427
430
  },
@@ -704,8 +707,8 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
704
707
  return null;
705
708
  },
706
709
  transformIndexHtml: {
707
- enforce: "pre",
708
- transform(code, { filename }) {
710
+ order: "pre",
711
+ handler(code, { filename }) {
709
712
  setWarnTimer();
710
713
  tasks.push(extract(code, filename));
711
714
  }
@@ -1049,8 +1052,8 @@ function createTransformerPlugins(ctx) {
1049
1052
  return applyTransformers(ctx, code, id, enforce);
1050
1053
  },
1051
1054
  transformIndexHtml: {
1052
- enforce: enforce === "default" ? void 0 : enforce,
1053
- transform(code) {
1055
+ order: enforce === "default" ? void 0 : enforce,
1056
+ handler(code) {
1054
1057
  return applyTransformers(ctx, code, "index.html", enforce).then((t) => t?.code);
1055
1058
  }
1056
1059
  }
package/dist/index.mjs CHANGED
@@ -168,7 +168,9 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
168
168
  uno,
169
169
  extract,
170
170
  getConfig,
171
- root,
171
+ get root() {
172
+ return root;
173
+ },
172
174
  updateRoot,
173
175
  getConfigFileList: () => configFileList
174
176
  };
@@ -323,6 +325,7 @@ async function setupContentExtractor(ctx, shouldWatch = false) {
323
325
  if (content?.filesystem) {
324
326
  const files = await fg(content.filesystem, { cwd: root });
325
327
  async function extractFile(file) {
328
+ file = isAbsolute(file) ? file : resolve(root, file);
326
329
  const code = await fs.readFile(file, "utf-8");
327
330
  if (!filter(code, file))
328
331
  return;
@@ -405,8 +408,8 @@ function GlobalModeBuildPlugin(ctx) {
405
408
  return null;
406
409
  },
407
410
  transformIndexHtml: {
408
- enforce: "pre",
409
- transform(code, { filename }) {
411
+ order: "pre",
412
+ handler(code, { filename }) {
410
413
  tasks.push(extract(code, filename));
411
414
  }
412
415
  },
@@ -689,8 +692,8 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
689
692
  return null;
690
693
  },
691
694
  transformIndexHtml: {
692
- enforce: "pre",
693
- transform(code, { filename }) {
695
+ order: "pre",
696
+ handler(code, { filename }) {
694
697
  setWarnTimer();
695
698
  tasks.push(extract(code, filename));
696
699
  }
@@ -1034,8 +1037,8 @@ function createTransformerPlugins(ctx) {
1034
1037
  return applyTransformers(ctx, code, id, enforce);
1035
1038
  },
1036
1039
  transformIndexHtml: {
1037
- enforce: enforce === "default" ? void 0 : enforce,
1038
- transform(code) {
1040
+ order: enforce === "default" ? void 0 : enforce,
1041
+ handler(code) {
1039
1042
  return applyTransformers(ctx, code, "index.html", enforce).then((t) => t?.code);
1040
1043
  }
1041
1044
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.57.1",
3
+ "version": "0.57.3",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -45,17 +45,17 @@
45
45
  "@ampproject/remapping": "^2.2.1",
46
46
  "@rollup/pluginutils": "^5.0.5",
47
47
  "chokidar": "^3.5.3",
48
- "fast-glob": "^3.3.1",
48
+ "fast-glob": "^3.3.2",
49
49
  "magic-string": "^0.30.5",
50
- "@unocss/config": "0.57.1",
51
- "@unocss/core": "0.57.1",
52
- "@unocss/inspector": "0.57.1",
53
- "@unocss/scope": "0.57.1",
54
- "@unocss/transformer-directives": "0.57.1"
50
+ "@unocss/config": "0.57.3",
51
+ "@unocss/core": "0.57.3",
52
+ "@unocss/inspector": "0.57.3",
53
+ "@unocss/scope": "0.57.3",
54
+ "@unocss/transformer-directives": "0.57.3"
55
55
  },
56
56
  "devDependencies": {
57
57
  "vite": "^4.5.0",
58
- "@unocss/shared-integration": "0.57.1"
58
+ "@unocss/shared-integration": "0.57.3"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "unbuild",