@unocss/cli 0.28.0 → 0.28.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/chunks/index.cjs +8 -5
- package/dist/chunks/index.mjs +9 -6
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/dist/chunks/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const fs = require('fs');
|
|
4
4
|
const pathe = require('pathe');
|
|
5
5
|
const fg = require('fast-glob');
|
|
6
6
|
const consola = require('consola');
|
|
@@ -15,7 +15,7 @@ const fg__default = /*#__PURE__*/_interopDefaultLegacy(fg);
|
|
|
15
15
|
const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
|
|
16
16
|
const presetUno__default = /*#__PURE__*/_interopDefaultLegacy(presetUno);
|
|
17
17
|
|
|
18
|
-
const version = "0.28.
|
|
18
|
+
const version = "0.28.1";
|
|
19
19
|
|
|
20
20
|
class PrettyError extends Error {
|
|
21
21
|
constructor(message) {
|
|
@@ -71,7 +71,10 @@ const fileCache = /* @__PURE__ */ new Map();
|
|
|
71
71
|
async function generate(options) {
|
|
72
72
|
const outFile = options.outFile ?? pathe.resolve(process.cwd(), "uno.css");
|
|
73
73
|
const { css, matched } = await uno.generate([...fileCache].join("\n"));
|
|
74
|
-
|
|
74
|
+
const dir = pathe.dirname(outFile);
|
|
75
|
+
if (!fs.existsSync(dir))
|
|
76
|
+
await fs.promises.mkdir(dir, { recursive: true });
|
|
77
|
+
await fs.promises.writeFile(outFile, css, "utf-8");
|
|
75
78
|
if (!options.watch) {
|
|
76
79
|
consola__default.success(`${[...matched].length} utilities generated to ${colorette.cyan(pathe.relative(process.cwd(), outFile))}
|
|
77
80
|
`);
|
|
@@ -90,7 +93,7 @@ async function build(_options) {
|
|
|
90
93
|
uno = core.createGenerator(config$1, defaultConfig);
|
|
91
94
|
const files = await fg__default(options.patterns);
|
|
92
95
|
await Promise.all(files.map(async (file) => {
|
|
93
|
-
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
96
|
+
fileCache.set(file, await fs.promises.readFile(file, "utf8"));
|
|
94
97
|
}));
|
|
95
98
|
consola__default.log(colorette.green(`${name} v${version}`));
|
|
96
99
|
consola__default.start(`UnoCSS ${options.watch ? "in watch mode..." : "for production..."}`);
|
|
@@ -120,7 +123,7 @@ async function build(_options) {
|
|
|
120
123
|
if (type.startsWith("unlink"))
|
|
121
124
|
fileCache.delete(file);
|
|
122
125
|
else
|
|
123
|
-
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
126
|
+
fileCache.set(file, await fs.promises.readFile(file, "utf8"));
|
|
124
127
|
}
|
|
125
128
|
debouncedBuild();
|
|
126
129
|
});
|
package/dist/chunks/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolve, relative, basename } from 'pathe';
|
|
1
|
+
import { existsSync, promises } from 'fs';
|
|
2
|
+
import { resolve, dirname, relative, basename } from 'pathe';
|
|
3
3
|
import fg from 'fast-glob';
|
|
4
4
|
import consola from 'consola';
|
|
5
5
|
import { cyan, green, dim } from 'colorette';
|
|
@@ -7,7 +7,7 @@ import { createGenerator, toArray } from '@unocss/core';
|
|
|
7
7
|
import { createConfigLoader } from '@unocss/config';
|
|
8
8
|
import presetUno from '@unocss/preset-uno';
|
|
9
9
|
|
|
10
|
-
const version = "0.28.
|
|
10
|
+
const version = "0.28.1";
|
|
11
11
|
|
|
12
12
|
class PrettyError extends Error {
|
|
13
13
|
constructor(message) {
|
|
@@ -63,7 +63,10 @@ const fileCache = /* @__PURE__ */ new Map();
|
|
|
63
63
|
async function generate(options) {
|
|
64
64
|
const outFile = options.outFile ?? resolve(process.cwd(), "uno.css");
|
|
65
65
|
const { css, matched } = await uno.generate([...fileCache].join("\n"));
|
|
66
|
-
|
|
66
|
+
const dir = dirname(outFile);
|
|
67
|
+
if (!existsSync(dir))
|
|
68
|
+
await promises.mkdir(dir, { recursive: true });
|
|
69
|
+
await promises.writeFile(outFile, css, "utf-8");
|
|
67
70
|
if (!options.watch) {
|
|
68
71
|
consola.success(`${[...matched].length} utilities generated to ${cyan(relative(process.cwd(), outFile))}
|
|
69
72
|
`);
|
|
@@ -82,7 +85,7 @@ async function build(_options) {
|
|
|
82
85
|
uno = createGenerator(config, defaultConfig);
|
|
83
86
|
const files = await fg(options.patterns);
|
|
84
87
|
await Promise.all(files.map(async (file) => {
|
|
85
|
-
fileCache.set(file, await readFile(file, "utf8"));
|
|
88
|
+
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
86
89
|
}));
|
|
87
90
|
consola.log(green(`${name} v${version}`));
|
|
88
91
|
consola.start(`UnoCSS ${options.watch ? "in watch mode..." : "for production..."}`);
|
|
@@ -112,7 +115,7 @@ async function build(_options) {
|
|
|
112
115
|
if (type.startsWith("unlink"))
|
|
113
116
|
fileCache.delete(file);
|
|
114
117
|
else
|
|
115
|
-
fileCache.set(file, await readFile(file, "utf8"));
|
|
118
|
+
fileCache.set(file, await promises.readFile(file, "utf8"));
|
|
116
119
|
}
|
|
117
120
|
debouncedBuild();
|
|
118
121
|
});
|
package/dist/cli.cjs
CHANGED
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/cli",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "CLI for UnoCSS",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/unocss/unocss/tree/main/packages/cli#readme",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"node": ">=14"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@unocss/config": "0.28.
|
|
37
|
-
"@unocss/core": "0.28.
|
|
38
|
-
"@unocss/preset-uno": "0.28.
|
|
36
|
+
"@unocss/config": "0.28.1",
|
|
37
|
+
"@unocss/core": "0.28.1",
|
|
38
|
+
"@unocss/preset-uno": "0.28.1",
|
|
39
39
|
"cac": "^6.7.12",
|
|
40
40
|
"chokidar": "^3.5.3",
|
|
41
41
|
"colorette": "^2.0.16",
|