@unocss/inspector 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.mjs +13 -2
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dirname, resolve } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { escapeSelector, CountableSet, BetterMap } from '@unocss/core';
|
|
4
|
+
import { green, bold, cyan } from 'colorette';
|
|
4
5
|
import gzipSize from 'gzip-size';
|
|
5
6
|
import sirv from 'sirv';
|
|
6
7
|
import { createValueHandler, parseCssColor, getStringComponent } from '@unocss/rule-utils';
|
|
@@ -817,11 +818,12 @@ const _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLT
|
|
|
817
818
|
function UnocssInspector(ctx) {
|
|
818
819
|
async function configureServer(server) {
|
|
819
820
|
await ctx.ready;
|
|
820
|
-
|
|
821
|
+
const baseUrl = "__unocss";
|
|
822
|
+
server.middlewares.use(`/${baseUrl}`, sirv(resolve(_dirname, "../dist/client"), {
|
|
821
823
|
single: true,
|
|
822
824
|
dev: true
|
|
823
825
|
}));
|
|
824
|
-
server.middlewares.use(
|
|
826
|
+
server.middlewares.use(`/$baseUrl}_api`, async (req, res, next) => {
|
|
825
827
|
if (!req.url)
|
|
826
828
|
return next();
|
|
827
829
|
if (req.url === "/") {
|
|
@@ -894,6 +896,15 @@ function UnocssInspector(ctx) {
|
|
|
894
896
|
}
|
|
895
897
|
next();
|
|
896
898
|
});
|
|
899
|
+
const _printUrls = server.printUrls;
|
|
900
|
+
const colorUrl = (url) => cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`));
|
|
901
|
+
server.printUrls = () => {
|
|
902
|
+
_printUrls();
|
|
903
|
+
for (const url of server.resolvedUrls?.local ?? []) {
|
|
904
|
+
const inspectorUrl = url.endsWith("/") ? `${url}${baseUrl}/` : `${url}/${baseUrl}/`;
|
|
905
|
+
console.log(` ${green("\u279C")} ${bold("UnoCSS Inspector")}: ${colorUrl(`${inspectorUrl}`)}`);
|
|
906
|
+
}
|
|
907
|
+
};
|
|
897
908
|
}
|
|
898
909
|
return {
|
|
899
910
|
name: "unocss:inspector",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/inspector",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.65.
|
|
4
|
+
"version": "0.65.4",
|
|
5
5
|
"description": "The inspector UI for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,11 +34,12 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"colorette": "^2.0.20",
|
|
37
38
|
"gzip-size": "^6.0.0",
|
|
38
39
|
"sirv": "^3.0.0",
|
|
39
40
|
"vue-flow-layout": "^0.1.1",
|
|
40
|
-
"@unocss/core": "0.65.
|
|
41
|
-
"@unocss/rule-utils": "0.65.
|
|
41
|
+
"@unocss/core": "0.65.4",
|
|
42
|
+
"@unocss/rule-utils": "0.65.4"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "unbuild",
|