@unocss/cli 0.37.1 → 0.37.2
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.mjs +9 -6
- package/package.json +4 -4
package/dist/chunks/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { createGenerator, toArray } from '@unocss/core';
|
|
|
8
8
|
import { loadConfig } from '@unocss/config';
|
|
9
9
|
import presetUno from '@unocss/preset-uno';
|
|
10
10
|
|
|
11
|
-
const version = "0.37.
|
|
11
|
+
const version = "0.37.2";
|
|
12
12
|
|
|
13
13
|
class PrettyError extends Error {
|
|
14
14
|
constructor(message) {
|
|
@@ -36,8 +36,9 @@ const defaultConfig = {
|
|
|
36
36
|
const name = "unocss";
|
|
37
37
|
let uno;
|
|
38
38
|
const fileCache = /* @__PURE__ */ new Map();
|
|
39
|
+
const getAbsolutePath = (file) => resolve(process.cwd(), file);
|
|
39
40
|
async function generate(options) {
|
|
40
|
-
const outFile = options.outFile ??
|
|
41
|
+
const outFile = options.outFile ?? getAbsolutePath("uno.css");
|
|
41
42
|
const { css, matched } = await uno.generate([...fileCache].join("\n"));
|
|
42
43
|
const dir = dirname(outFile);
|
|
43
44
|
if (!existsSync(dir))
|
|
@@ -60,7 +61,8 @@ async function build(_options) {
|
|
|
60
61
|
uno = createGenerator(config, defaultConfig);
|
|
61
62
|
const files = await fg(options.patterns);
|
|
62
63
|
await Promise.all(files.map(async (file) => {
|
|
63
|
-
|
|
64
|
+
const absolutePath = getAbsolutePath(file);
|
|
65
|
+
fileCache.set(absolutePath, await promises.readFile(absolutePath, "utf8"));
|
|
64
66
|
}));
|
|
65
67
|
consola.log(green(`${name} v${version}`));
|
|
66
68
|
consola.start(`UnoCSS ${options.watch ? "in watch mode..." : "for production..."}`);
|
|
@@ -73,7 +75,6 @@ async function build(_options) {
|
|
|
73
75
|
const { watch } = await import('chokidar');
|
|
74
76
|
const { patterns } = options;
|
|
75
77
|
const ignored = ["**/{.git,node_modules}/**"];
|
|
76
|
-
consola.info(`Watching for changes in ${toArray(patterns).map((i) => cyan(i)).join(", ")}`);
|
|
77
78
|
const watcher = watch(patterns, {
|
|
78
79
|
ignoreInitial: true,
|
|
79
80
|
ignorePermissionErrors: true,
|
|
@@ -87,13 +88,15 @@ async function build(_options) {
|
|
|
87
88
|
consola.info(`${cyan(basename(file))} changed, setting new config`);
|
|
88
89
|
} else {
|
|
89
90
|
consola.log(`${green(type)} ${dim(file)}`);
|
|
91
|
+
const absolutePath = getAbsolutePath(file);
|
|
90
92
|
if (type.startsWith("unlink"))
|
|
91
|
-
fileCache.delete(
|
|
93
|
+
fileCache.delete(absolutePath);
|
|
92
94
|
else
|
|
93
|
-
fileCache.set(
|
|
95
|
+
fileCache.set(absolutePath, await promises.readFile(absolutePath, "utf8"));
|
|
94
96
|
}
|
|
95
97
|
debouncedBuild();
|
|
96
98
|
});
|
|
99
|
+
consola.info(`Watching for changes in ${toArray(patterns).map((i) => cyan(i)).join(", ")}`);
|
|
97
100
|
};
|
|
98
101
|
await generate(options);
|
|
99
102
|
startWatcher();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/cli",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.2",
|
|
4
4
|
"description": "CLI for UnoCSS",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Johann Schopplich",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"node": ">=14"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@unocss/config": "0.37.
|
|
43
|
-
"@unocss/core": "0.37.
|
|
44
|
-
"@unocss/preset-uno": "0.37.
|
|
42
|
+
"@unocss/config": "0.37.2",
|
|
43
|
+
"@unocss/core": "0.37.2",
|
|
44
|
+
"@unocss/preset-uno": "0.37.2",
|
|
45
45
|
"cac": "^6.7.12",
|
|
46
46
|
"chokidar": "^3.5.3",
|
|
47
47
|
"colorette": "^2.0.16",
|