@devup-ui/vite-plugin 0.1.57 → 0.1.58
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 +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +21 -18
- package/package.json +4 -4
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),m=require("node:fs/promises"),a=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),m=require("node:fs/promises"),a=require("node:path"),u=require("@devup-ui/wasm"),d=require("vite");function g(e){var t;if(s.existsSync(e.interfacePath)||s.mkdirSync(e.interfacePath),s.existsSync(e.devupPath)){u.registerTheme((t=JSON.parse(s.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const i=u.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");i&&s.writeFileSync(a.join(e.interfacePath,"theme.d.ts"),i,{encoding:"utf-8"})}s.existsSync(e.cssFile)||s.writeFileSync(e.cssFile,"",{encoding:"utf-8"})}let o="";function v({package:e="@devup-ui/react",devupPath:t="devup.json",interfacePath:i=".df",cssFile:c=a.resolve(i,"devup-ui.css"),extractCss:l=!0,debug:p=!1}={}){u.setDebug(p);try{g({package:e,cssFile:c,devupPath:t,interfacePath:i})}catch(r){console.error(r)}return{name:"devup-ui",config(){const r={server:{watch:{ignored:[`!${t}`]}},define:{"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(u.getDefaultTheme())}};return l&&(r.build={rollupOptions:{output:{manualChunks(n){if(n.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),r},apply(){return!0},watchChange(r){if(a.resolve(r)===a.resolve(t)&&s.existsSync(t))try{g({package:e,cssFile:c,devupPath:t,interfacePath:i})}catch(n){console.error(n)}},resolveId(r){if(d.normalizePath(r)===d.normalizePath(c))return`devup-ui.css?t=${Date.now().toString()+o.length}`},load(r){if(r.split("?")[0]==="devup-ui.css")return o=u.getCss()},enforce:"pre",async transform(r,n){if(!l||n.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(n))return;const{code:h,css:f}=u.codeExtract(n,r,e,c);return f&&o.length<f.length&&(o=f,await m.writeFile(c,`/* ${n} ${Date.now()} */`,{encoding:"utf-8"})),{code:h}}}}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":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,YAAY,EAAmB,MAAM,MAAM,CAAA;AAExE,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;IACnB,KAAK,EAAE,OAAO,CAAA;CACf;AA8BD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,UAAiB,EACjB,KAAa,GACd,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CAwFnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { existsSync as
|
|
1
|
+
import { existsSync as s, mkdirSync as h, readFileSync as v, writeFileSync as m } from "node:fs";
|
|
2
2
|
import { writeFile as y } from "node:fs/promises";
|
|
3
|
-
import { resolve as
|
|
4
|
-
import { setDebug as
|
|
3
|
+
import { resolve as f, join as D } from "node:path";
|
|
4
|
+
import { setDebug as T, codeExtract as w, getCss as S, getDefaultTheme as C, registerTheme as j, getThemeInterface as E } from "@devup-ui/wasm";
|
|
5
5
|
import { normalizePath as p } from "vite";
|
|
6
6
|
function d(e) {
|
|
7
7
|
var t;
|
|
8
|
-
if (
|
|
9
|
-
|
|
8
|
+
if (s(e.interfacePath) || h(e.interfacePath), s(e.devupPath)) {
|
|
9
|
+
j(
|
|
10
10
|
(t = JSON.parse(v(e.devupPath, "utf-8"))) == null ? void 0 : t.theme
|
|
11
11
|
);
|
|
12
|
-
const u =
|
|
12
|
+
const u = E(
|
|
13
13
|
e.package,
|
|
14
14
|
"DevupThemeColors",
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
u && m(
|
|
18
|
+
u && m(D(e.interfacePath, "theme.d.ts"), u, {
|
|
19
19
|
encoding: "utf-8"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
s(e.cssFile) || m(e.cssFile, "", {
|
|
23
23
|
encoding: "utf-8"
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
let o = "";
|
|
27
|
-
function
|
|
27
|
+
function _({
|
|
28
28
|
package: e = "@devup-ui/react",
|
|
29
29
|
devupPath: t = "devup.json",
|
|
30
30
|
interfacePath: u = ".df",
|
|
31
|
-
cssFile: i =
|
|
32
|
-
extractCss:
|
|
31
|
+
cssFile: i = f(u, "devup-ui.css"),
|
|
32
|
+
extractCss: a = !0,
|
|
33
33
|
debug: l = !1
|
|
34
34
|
} = {}) {
|
|
35
|
-
|
|
35
|
+
T(l);
|
|
36
36
|
try {
|
|
37
37
|
d({
|
|
38
38
|
package: e,
|
|
@@ -51,9 +51,12 @@ function O({
|
|
|
51
51
|
watch: {
|
|
52
52
|
ignored: [`!${t}`]
|
|
53
53
|
}
|
|
54
|
+
},
|
|
55
|
+
define: {
|
|
56
|
+
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(C())
|
|
54
57
|
}
|
|
55
58
|
};
|
|
56
|
-
return
|
|
59
|
+
return a && (r.build = {
|
|
57
60
|
rollupOptions: {
|
|
58
61
|
output: {
|
|
59
62
|
manualChunks(n) {
|
|
@@ -68,7 +71,7 @@ function O({
|
|
|
68
71
|
return !0;
|
|
69
72
|
},
|
|
70
73
|
watchChange(r) {
|
|
71
|
-
if (
|
|
74
|
+
if (f(r) === f(t) && s(t))
|
|
72
75
|
try {
|
|
73
76
|
d({
|
|
74
77
|
package: e,
|
|
@@ -90,9 +93,9 @@ function O({
|
|
|
90
93
|
},
|
|
91
94
|
enforce: "pre",
|
|
92
95
|
async transform(r, n) {
|
|
93
|
-
if (!
|
|
94
|
-
const { code: g, css:
|
|
95
|
-
return
|
|
96
|
+
if (!a || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
97
|
+
const { code: g, css: c } = w(n, r, e, i);
|
|
98
|
+
return c && o.length < c.length && (o = c, await y(i, `/* ${n} ${Date.now()} */`, {
|
|
96
99
|
encoding: "utf-8"
|
|
97
100
|
})), {
|
|
98
101
|
code: g
|
|
@@ -101,5 +104,5 @@ function O({
|
|
|
101
104
|
};
|
|
102
105
|
}
|
|
103
106
|
export {
|
|
104
|
-
|
|
107
|
+
_ as DevupUI
|
|
105
108
|
};
|
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.58",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@devup-ui/wasm": "0.1.
|
|
22
|
+
"@devup-ui/wasm": "0.1.54"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"vite-plugin-dts": "^4.5.
|
|
26
|
-
"typescript": "^5.
|
|
25
|
+
"vite-plugin-dts": "^4.5.3",
|
|
26
|
+
"typescript": "^5.8.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vite": "*",
|