@unocss/cli 66.7.0 → 66.7.2-beta.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/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as handleError, r as version, t as build } from "./src-uJ02cLnZ.mjs";
1
+ import { n as handleError, r as version, t as build } from "./src-BL_tSn-o.mjs";
2
2
  import process from "node:process";
3
3
  import { green } from "colorette";
4
4
  import { resolve } from "pathe";
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as build } from "./src-uJ02cLnZ.mjs";
1
+ import { t as build } from "./src-BL_tSn-o.mjs";
2
2
  export { build };
@@ -192,7 +192,7 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
192
192
  }
193
193
  //#endregion
194
194
  //#region package.json
195
- var version = "66.7.0";
195
+ var version = "66.7.2-beta.1";
196
196
  //#endregion
197
197
  //#region src/debug.ts
198
198
  /**
@@ -261,6 +261,9 @@ async function getWatcher(options) {
261
261
  }
262
262
  //#endregion
263
263
  //#region src/index.ts
264
+ function createCliLogger(options) {
265
+ return options.stdout ? consola$1.create({ stdout: process.stderr }) : consola$1;
266
+ }
264
267
  async function resolveOptions(options, userConfig) {
265
268
  const resolvedOptions = {
266
269
  ...options,
@@ -280,7 +283,7 @@ async function resolveOptions(options, userConfig) {
280
283
  }));
281
284
  resolvedOptions.entries.push(...configEntries);
282
285
  if (!resolvedOptions.entries.length) throw new PrettyError(`No glob patterns provided. Try ${cyan("unocss <path/to/**/*>")} or configure entries in ${cyan("uno.config")} file. See ${cyan("https://unocss.dev/integrations/cli#configurations")}`);
283
- if (resolvedOptions.writeTransformed) consola$1.warn(`--write-transformed is deprecated, please use ${yellow("--rewrite")} instead.`);
286
+ if (resolvedOptions.writeTransformed) createCliLogger(options).warn(`--write-transformed is deprecated, please use ${yellow("--rewrite")} instead.`);
284
287
  return resolvedOptions;
285
288
  }
286
289
  async function initializeConfig(options) {
@@ -349,17 +352,18 @@ async function build(_options) {
349
352
  const fileCache = /* @__PURE__ */ new Map();
350
353
  const configResult = await initializeConfig(_options);
351
354
  const options = await resolveOptions(_options, configResult.config);
355
+ const logger = createCliLogger(options);
352
356
  options.ctx = configResult.ctx;
353
357
  if (options.stdout && options.outFile) {
354
- consola$1.fatal(`Cannot use --stdout and --out-file at the same time`);
358
+ logger.fatal(`Cannot use --stdout and --out-file at the same time`);
355
359
  return;
356
360
  }
357
- consola$1.log(green(`UnoCSS v${version}`));
358
- if (options.watch) consola$1.start(`UnoCSS in watch mode...`);
359
- else consola$1.start(`UnoCSS for production...`);
361
+ logger.log(green(`UnoCSS v${version}`));
362
+ if (options.watch) logger.start(`UnoCSS in watch mode...`);
363
+ else logger.start(`UnoCSS for production...`);
360
364
  await parseEntries(options, fileCache);
361
365
  if (fileCache.size === 0) {
362
- consola$1.warn("No files matched the provided patterns.");
366
+ logger.warn("No files matched the provided patterns.");
363
367
  return;
364
368
  }
365
369
  if (!options.watch) return await generate(options);
@@ -386,10 +390,10 @@ async function build(_options) {
386
390
  await parseEntries(options, fileCache);
387
391
  const configSources = ctx.getConfigFileList().map(normalize);
388
392
  if (configSources.length) watcher.add(configSources);
389
- if (type === "change") consola$1.info(`${cyan(basename(file))} changed, setting new config`);
390
- consola$1.info(`Watching for changes in ${[...options.entries.flatMap((i) => i.patterns), ...configSources].map(cyan).join(", ")}`);
393
+ if (type === "change") logger.info(`${cyan(basename(file))} changed, setting new config`);
394
+ logger.info(`Watching for changes in ${[...options.entries.flatMap((i) => i.patterns), ...configSources].map(cyan).join(", ")}`);
391
395
  } else if (type === "change") {
392
- consola$1.log(`${green(type)} ${dim(file)}`);
396
+ logger.log(`${green(type)} ${dim(file)}`);
393
397
  const content = await promises.readFile(absolutePath, "utf8");
394
398
  if (fileCache.keys().find((outfile) => outfile === absolutePath)) return;
395
399
  for (const [, files] of fileCache.entries()) {
@@ -397,13 +401,13 @@ async function build(_options) {
397
401
  if (fileEntry) fileEntry.code = content;
398
402
  }
399
403
  } else if (type === "unlink") {
400
- consola$1.log(`${green(type)} ${dim(file)}`);
404
+ logger.log(`${green(type)} ${dim(file)}`);
401
405
  for (const [, files] of fileCache.entries()) {
402
406
  const index = files.findIndex((f) => f.id === absolutePath);
403
407
  if (index !== -1) files.splice(index, 1);
404
408
  }
405
409
  } else if (type === "add") {
406
- consola$1.log(`${green(type)} ${dim(file)}`);
410
+ logger.log(`${green(type)} ${dim(file)}`);
407
411
  await parseEntries(options, fileCache);
408
412
  }
409
413
  debouncedBuild();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/cli",
3
3
  "type": "module",
4
- "version": "66.7.0",
4
+ "version": "66.7.2-beta.1",
5
5
  "description": "CLI for UnoCSS",
6
6
  "author": {
7
7
  "name": "Johann Schopplich",
@@ -43,11 +43,11 @@
43
43
  "perfect-debounce": "^2.1.0",
44
44
  "tinyglobby": "^0.2.16",
45
45
  "unplugin-utils": "^0.3.1",
46
- "@unocss/config": "66.7.0",
47
- "@unocss/core": "66.7.0",
48
- "@unocss/preset-wind3": "66.7.0",
49
- "@unocss/transformer-directives": "66.7.0",
50
- "@unocss/preset-wind4": "66.7.0"
46
+ "@unocss/config": "66.7.2-beta.1",
47
+ "@unocss/core": "66.7.2-beta.1",
48
+ "@unocss/preset-wind3": "66.7.2-beta.1",
49
+ "@unocss/preset-wind4": "66.7.2-beta.1",
50
+ "@unocss/transformer-directives": "66.7.2-beta.1"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsdown --config-loader unrun",