@unocss/cli 0.50.3 → 0.50.5

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/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { cac } from 'cac';
2
2
  import { loadConfig } from '@unocss/config';
3
3
  import { toArray } from '@unocss/core';
4
- import { b as build, v as version, h as handleError } from './shared/cli.8efac0a5.mjs';
5
- import 'fs';
4
+ import { b as build, v as version, h as handleError } from './shared/cli.5840707b.mjs';
5
+ import 'node:fs';
6
6
  import 'pathe';
7
7
  import 'fast-glob';
8
8
  import 'consola';
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import 'fs';
1
+ import 'node:fs';
2
2
  import 'pathe';
3
3
  import 'fast-glob';
4
4
  import 'consola';
5
5
  import 'colorette';
6
6
  import 'perfect-debounce';
7
7
  import '@unocss/core';
8
- export { b as build, r as resolveOptions } from './shared/cli.8efac0a5.mjs';
8
+ export { b as build, r as resolveOptions } from './shared/cli.5840707b.mjs';
9
9
  import '@rollup/pluginutils';
10
10
  import '@unocss/config';
11
11
  import 'magic-string';
@@ -1,4 +1,4 @@
1
- import { promises, existsSync } from 'fs';
1
+ import { promises, existsSync } from 'node:fs';
2
2
  import { resolve, dirname, relative, normalize, basename } from 'pathe';
3
3
  import fg from 'fast-glob';
4
4
  import consola from 'consola';
@@ -11,7 +11,7 @@ import MagicString from 'magic-string';
11
11
  import remapping from '@ampproject/remapping';
12
12
  import presetUno from '@unocss/preset-uno';
13
13
 
14
- const version = "0.50.3";
14
+ const version = "0.50.5";
15
15
 
16
16
  const INCLUDE_COMMENT = "@unocss-include";
17
17
  const IGNORE_COMMENT = "@unocss-ignore";
@@ -177,6 +177,22 @@ const defaultConfig = {
177
177
  ]
178
178
  };
179
179
 
180
+ let watcher;
181
+ const getWatcher = async (options) => {
182
+ if (watcher && !options)
183
+ return watcher;
184
+ const { watch } = await import('chokidar');
185
+ const ignored = ["**/{.git,node_modules}/**"];
186
+ const newWatcher = watch(options?.patterns, {
187
+ ignoreInitial: true,
188
+ ignorePermissionErrors: true,
189
+ ignored,
190
+ cwd: options?.cwd || process.cwd()
191
+ });
192
+ watcher = newWatcher;
193
+ return newWatcher;
194
+ };
195
+
180
196
  const name = "unocss";
181
197
  async function resolveOptions(options) {
182
198
  if (!options.patterns?.length) {
@@ -213,15 +229,8 @@ async function build(_options) {
213
229
  const startWatcher = async () => {
214
230
  if (!options.watch)
215
231
  return;
216
- const { watch } = await import('chokidar');
217
232
  const { patterns } = options;
218
- const ignored = ["**/{.git,node_modules}/**"];
219
- const watcher = watch(patterns, {
220
- ignoreInitial: true,
221
- ignorePermissionErrors: true,
222
- ignored,
223
- cwd
224
- });
233
+ const watcher = await getWatcher(options);
225
234
  if (configSources.length)
226
235
  watcher.add(configSources);
227
236
  watcher.on("all", async (type, file) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/cli",
3
- "version": "0.50.3",
3
+ "version": "0.50.5",
4
4
  "description": "CLI for UnoCSS",
5
5
  "author": {
6
6
  "name": "Johann Schopplich",
@@ -41,9 +41,6 @@
41
41
  "dependencies": {
42
42
  "@ampproject/remapping": "^2.2.0",
43
43
  "@rollup/pluginutils": "^5.0.2",
44
- "@unocss/config": "0.50.3",
45
- "@unocss/core": "0.50.3",
46
- "@unocss/preset-uno": "0.50.3",
47
44
  "cac": "^6.7.14",
48
45
  "chokidar": "^3.5.3",
49
46
  "colorette": "^2.0.19",
@@ -51,7 +48,10 @@
51
48
  "fast-glob": "^3.2.12",
52
49
  "magic-string": "^0.30.0",
53
50
  "pathe": "^1.1.0",
54
- "perfect-debounce": "^0.1.3"
51
+ "perfect-debounce": "^0.1.3",
52
+ "@unocss/config": "0.50.5",
53
+ "@unocss/core": "0.50.5",
54
+ "@unocss/preset-uno": "0.50.5"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "unbuild",