@devup-ui/vite-plugin 0.1.21 → 0.1.23
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/plugin.cjs +2 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +31 -27
- package/package.json +2 -2
package/dist/plugin.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),i=require("node:path"),y=require("node:url"),o=require("@devup-ui/wasm");var d=typeof document<"u"?document.currentScript:null;const g=y.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.tagName.toUpperCase()==="SCRIPT"&&d.src||new URL("plugin.cjs",document.baseURI).href),h=i.dirname(g);function l(e){var t;o.registerTheme((t=JSON.parse(r.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const n=o.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&(r.existsSync(e.interfacePath)||r.mkdirSync(e.interfacePath),r.writeFileSync(i.join(e.interfacePath,"theme.d.ts"),n,{encoding:"utf-8"})),r.writeFileSync(e.cssFile,o.getCss(),{encoding:"utf-8"})}function v({package:e="@devup-ui/react",cssFile:n=i.join(h,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:p=!0}={}){if(r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(u){console.error(u)}let f=null;return{name:"devup-ui",config(){return{server:{watch:{ignored:[`!${t}`]}}}},apply(u,c){return f=c.command,!0},watchChange(u){if(i.resolve(u)===i.resolve(t)&&r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(c){console.error(c)}},enforce:"pre",transform(u,c){if(!p||c.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(c))return;const{code:m,css:s}=o.codeExtract(c,u,e,n);return s&&(r.writeFileSync(n,s,{encoding:"utf-8"}),f==="serve")?{code:`${m}
|
|
2
2
|
const exists = !!document.getElementById('devup-ui');
|
|
3
3
|
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
4
4
|
style.id = 'devup-ui';
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
${s}
|
|
7
7
|
\`;
|
|
8
8
|
if (!exists) document.head.appendChild(style);
|
|
9
|
-
`}
|
|
9
|
+
`}:{code:m}}}}exports.DevupUI=v;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;CACpB;AAqBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,GAClB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;CACpB;AAqBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,GAClB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA2EnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { existsSync as i, writeFileSync as u, readFileSync as
|
|
2
|
-
import { dirname as
|
|
3
|
-
import { fileURLToPath as
|
|
4
|
-
import { codeExtract as
|
|
5
|
-
const
|
|
1
|
+
import { existsSync as i, writeFileSync as u, readFileSync as y, mkdirSync as g } from "node:fs";
|
|
2
|
+
import { dirname as h, resolve as a, join as l } from "node:path";
|
|
3
|
+
import { fileURLToPath as v } from "node:url";
|
|
4
|
+
import { codeExtract as x, registerTheme as C, getThemeInterface as T, getCss as j } from "@devup-ui/wasm";
|
|
5
|
+
const D = v(import.meta.url), S = h(D);
|
|
6
6
|
function f(e) {
|
|
7
7
|
var t;
|
|
8
|
-
|
|
9
|
-
const r =
|
|
8
|
+
C((t = JSON.parse(y(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
|
|
9
|
+
const r = T(
|
|
10
10
|
e.package,
|
|
11
11
|
"DevupThemeColors",
|
|
12
12
|
"DevupThemeTypography",
|
|
13
13
|
"DevupTheme"
|
|
14
14
|
);
|
|
15
|
-
r && (i(e.interfacePath) ||
|
|
15
|
+
r && (i(e.interfacePath) || g(e.interfacePath), u(l(e.interfacePath, "theme.d.ts"), r, {
|
|
16
16
|
encoding: "utf-8"
|
|
17
|
-
})), u(e.cssFile,
|
|
17
|
+
})), u(e.cssFile, j(), {
|
|
18
18
|
encoding: "utf-8"
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
function $({
|
|
22
22
|
package: e = "@devup-ui/react",
|
|
23
|
-
cssFile: r =
|
|
23
|
+
cssFile: r = l(S, "devup-ui.css"),
|
|
24
24
|
devupPath: t = "devup.json",
|
|
25
|
-
interfacePath:
|
|
25
|
+
interfacePath: m = ".df",
|
|
26
26
|
extractCss: p = !0
|
|
27
27
|
} = {}) {
|
|
28
28
|
if (i(t))
|
|
@@ -31,11 +31,12 @@ function $({
|
|
|
31
31
|
package: e,
|
|
32
32
|
cssFile: r,
|
|
33
33
|
devupPath: t,
|
|
34
|
-
interfacePath:
|
|
34
|
+
interfacePath: m
|
|
35
35
|
});
|
|
36
|
-
} catch (
|
|
37
|
-
console.error(
|
|
36
|
+
} catch (c) {
|
|
37
|
+
console.error(c);
|
|
38
38
|
}
|
|
39
|
+
let s = null;
|
|
39
40
|
return {
|
|
40
41
|
name: "devup-ui",
|
|
41
42
|
config() {
|
|
@@ -47,27 +48,30 @@ function $({
|
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
},
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
apply(c, n) {
|
|
52
|
+
return s = n.command, !0;
|
|
53
|
+
},
|
|
54
|
+
watchChange(c) {
|
|
55
|
+
if (a(c) === a(t) && i(t))
|
|
52
56
|
try {
|
|
53
57
|
f({
|
|
54
58
|
package: e,
|
|
55
59
|
cssFile: r,
|
|
56
60
|
devupPath: t,
|
|
57
|
-
interfacePath:
|
|
61
|
+
interfacePath: m
|
|
58
62
|
});
|
|
59
|
-
} catch (
|
|
60
|
-
console.error(
|
|
63
|
+
} catch (n) {
|
|
64
|
+
console.error(n);
|
|
61
65
|
}
|
|
62
66
|
},
|
|
63
67
|
enforce: "pre",
|
|
64
|
-
transform(
|
|
65
|
-
if (!p ||
|
|
66
|
-
const { code:
|
|
67
|
-
return o
|
|
68
|
+
transform(c, n) {
|
|
69
|
+
if (!p || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
70
|
+
const { code: d, css: o } = x(n, c, e, r);
|
|
71
|
+
return o && (u(r, o, {
|
|
68
72
|
encoding: "utf-8"
|
|
69
|
-
}), {
|
|
70
|
-
code: `${
|
|
73
|
+
}), s === "serve") ? {
|
|
74
|
+
code: `${d}
|
|
71
75
|
const exists = !!document.getElementById('devup-ui');
|
|
72
76
|
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
73
77
|
style.id = 'devup-ui';
|
|
@@ -76,8 +80,8 @@ function $({
|
|
|
76
80
|
\`;
|
|
77
81
|
if (!exists) document.head.appendChild(style);
|
|
78
82
|
`
|
|
79
|
-
}
|
|
80
|
-
code:
|
|
83
|
+
} : {
|
|
84
|
+
code: d
|
|
81
85
|
};
|
|
82
86
|
}
|
|
83
87
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devup-ui/vite-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.23",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@devup-ui/wasm": "0.1.
|
|
22
|
+
"@devup-ui/wasm": "0.1.25"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vite-plugin-dts": "^4.5.0",
|