@unocss/vite 0.65.3 → 0.65.4

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.d.mts CHANGED
@@ -54,6 +54,12 @@ interface VitePluginConfig<Theme extends object = object> extends UserConfig<The
54
54
  * @default 'cors'
55
55
  */
56
56
  fetchMode?: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
57
+ /**
58
+ * Disable `import 'uno.css'` existing check.
59
+ *
60
+ * @default true
61
+ */
62
+ checkImport?: boolean;
57
63
  }
58
64
 
59
65
  declare function ChunkModeBuildPlugin(ctx: UnocssPluginContext): Plugin;
package/dist/index.d.ts CHANGED
@@ -54,6 +54,12 @@ interface VitePluginConfig<Theme extends object = object> extends UserConfig<The
54
54
  * @default 'cors'
55
55
  */
56
56
  fetchMode?: 'cors' | 'navigate' | 'no-cors' | 'same-origin';
57
+ /**
58
+ * Disable `import 'uno.css'` existing check.
59
+ *
60
+ * @default true
61
+ */
62
+ checkImport?: boolean;
57
63
  }
58
64
 
59
65
  declare function ChunkModeBuildPlugin(ctx: UnocssPluginContext): Plugin;
package/dist/index.mjs CHANGED
@@ -525,6 +525,8 @@ async function setupContentExtractor(ctx, shouldWatch = false) {
525
525
  }
526
526
  }
527
527
 
528
+ const MESSAGE_UNOCSS_ENTRY_NOT_FOUND = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
529
+
528
530
  function isLegacyChunk(chunk, options) {
529
531
  return options.format === "system" && chunk.fileName.includes("-legacy");
530
532
  }
@@ -733,8 +735,9 @@ function GlobalModeBuildPlugin(ctx) {
733
735
  if (!vfsLayers.size) {
734
736
  if (replaced)
735
737
  return;
736
- const msg = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
737
- this.warn(msg);
738
+ if ((await getConfig()).checkImport) {
739
+ this.warn(MESSAGE_UNOCSS_ENTRY_NOT_FOUND);
740
+ }
738
741
  return;
739
742
  }
740
743
  const getLayer = (layer, input, replace = false) => {
@@ -843,17 +846,16 @@ function GlobalModeDevPlugin(ctx) {
843
846
  });
844
847
  }
845
848
  }
846
- function setWarnTimer() {
847
- if (!resolved && !resolvedWarnTimer) {
849
+ async function setWarnTimer() {
850
+ if (!resolved && !resolvedWarnTimer && (await getConfig()).checkImport) {
848
851
  resolvedWarnTimer = setTimeout(() => {
849
852
  if (process$1.env.TEST || process$1.env.NODE_ENV === "test")
850
853
  return;
851
854
  if (!resolved) {
852
- const msg = "[unocss] Entry module not found. Did you add `import 'uno.css'` in your main entry?";
853
- console.warn(msg);
855
+ console.warn(MESSAGE_UNOCSS_ENTRY_NOT_FOUND);
854
856
  servers.forEach(({ ws }) => ws.send({
855
857
  type: "error",
856
- err: { message: msg, stack: "" }
858
+ err: { message: MESSAGE_UNOCSS_ENTRY_NOT_FOUND, stack: "" }
857
859
  }));
858
860
  }
859
861
  }, WARN_TIMEOUT);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
3
  "type": "module",
4
- "version": "0.65.3",
4
+ "version": "0.65.4",
5
5
  "description": "The Vite plugin for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -54,13 +54,13 @@
54
54
  "chokidar": "^3.6.0",
55
55
  "magic-string": "^0.30.17",
56
56
  "tinyglobby": "^0.2.10",
57
- "@unocss/config": "0.65.3",
58
- "@unocss/core": "0.65.3",
59
- "@unocss/inspector": "0.65.3"
57
+ "@unocss/config": "0.65.4",
58
+ "@unocss/core": "0.65.4",
59
+ "@unocss/inspector": "0.65.4"
60
60
  },
61
61
  "devDependencies": {
62
62
  "vite": "^6.0.5",
63
- "@unocss/shared-integration": "0.65.3"
63
+ "@unocss/shared-integration": "0.65.4"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "unbuild",