@unocss/vite 0.55.7 → 0.56.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 CHANGED
@@ -17,6 +17,7 @@ const fs$1 = require('node:fs');
17
17
  const node_url = require('node:url');
18
18
  const config = require('@unocss/config');
19
19
 
20
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
20
21
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
21
22
 
22
23
  const process__default = /*#__PURE__*/_interopDefaultCompat(process$1);
@@ -602,7 +603,6 @@ const WS_EVENT_PREFIX = "unocss:hmr";
602
603
  const HASH_LENGTH = 6;
603
604
  function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules, onInvalidate, extract, filter, getConfig }) {
604
605
  const servers = [];
605
- let base = "";
606
606
  const entries = /* @__PURE__ */ new Set();
607
607
  let invalidateTimer;
608
608
  const lastServedHash = /* @__PURE__ */ new Map();
@@ -625,13 +625,6 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
625
625
  lastServedTime = Date.now();
626
626
  return { hash, css };
627
627
  }
628
- function configResolved(config) {
629
- base = config.base || "";
630
- if (base === "/")
631
- base = "";
632
- else if (base.endsWith("/"))
633
- base = base.slice(0, base.length - 1);
634
- }
635
628
  function invalidate(timer = 10, ids = entries) {
636
629
  for (const server of servers) {
637
630
  for (const id of ids) {
@@ -695,7 +688,6 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
695
688
  name: "unocss:global",
696
689
  apply: "serve",
697
690
  enforce: "pre",
698
- configResolved,
699
691
  async configureServer(_server) {
700
692
  servers.push(_server);
701
693
  _server.ws.on(WS_EVENT_PREFIX, async ([layer, hash]) => {
@@ -745,7 +737,6 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
745
737
  },
746
738
  {
747
739
  name: "unocss:global:post",
748
- configResolved,
749
740
  apply(config, env) {
750
741
  return env.command === "serve" && !config.build?.ssr;
751
742
  },
@@ -1067,7 +1058,7 @@ function createTransformerPlugins(ctx) {
1067
1058
  }));
1068
1059
  }
1069
1060
 
1070
- const _dirname = typeof __dirname !== "undefined" ? __dirname : node_path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href))));
1061
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : node_path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
1071
1062
  const DEVTOOLS_MODULE_ID = "virtual:unocss-devtools";
1072
1063
  const MOCK_CLASSES_MODULE_ID = "virtual:unocss-mock-classes";
1073
1064
  const MOCK_CLASSES_PATH = "/@unocss/mock-classes";
package/dist/index.mjs CHANGED
@@ -588,7 +588,6 @@ const WS_EVENT_PREFIX = "unocss:hmr";
588
588
  const HASH_LENGTH = 6;
589
589
  function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules, onInvalidate, extract, filter, getConfig }) {
590
590
  const servers = [];
591
- let base = "";
592
591
  const entries = /* @__PURE__ */ new Set();
593
592
  let invalidateTimer;
594
593
  const lastServedHash = /* @__PURE__ */ new Map();
@@ -611,13 +610,6 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
611
610
  lastServedTime = Date.now();
612
611
  return { hash, css };
613
612
  }
614
- function configResolved(config) {
615
- base = config.base || "";
616
- if (base === "/")
617
- base = "";
618
- else if (base.endsWith("/"))
619
- base = base.slice(0, base.length - 1);
620
- }
621
613
  function invalidate(timer = 10, ids = entries) {
622
614
  for (const server of servers) {
623
615
  for (const id of ids) {
@@ -681,7 +673,6 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
681
673
  name: "unocss:global",
682
674
  apply: "serve",
683
675
  enforce: "pre",
684
- configResolved,
685
676
  async configureServer(_server) {
686
677
  servers.push(_server);
687
678
  _server.ws.on(WS_EVENT_PREFIX, async ([layer, hash]) => {
@@ -731,7 +722,6 @@ function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedModules,
731
722
  },
732
723
  {
733
724
  name: "unocss:global:post",
734
- configResolved,
735
725
  apply(config, env) {
736
726
  return env.command === "serve" && !config.build?.ssr;
737
727
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.55.7",
3
+ "version": "0.56.0",
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.3",
46
+ "@rollup/pluginutils": "^5.0.4",
47
47
  "chokidar": "^3.5.3",
48
48
  "fast-glob": "^3.3.1",
49
49
  "magic-string": "^0.30.3",
50
- "@unocss/config": "0.55.7",
51
- "@unocss/core": "0.55.7",
52
- "@unocss/inspector": "0.55.7",
53
- "@unocss/scope": "0.55.7",
54
- "@unocss/transformer-directives": "0.55.7"
50
+ "@unocss/config": "0.56.0",
51
+ "@unocss/core": "0.56.0",
52
+ "@unocss/inspector": "0.56.0",
53
+ "@unocss/scope": "0.56.0",
54
+ "@unocss/transformer-directives": "0.56.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "vite": "^4.4.9",
58
- "@unocss/shared-integration": "0.55.7"
58
+ "@unocss/shared-integration": "0.56.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "unbuild",