@devup-ui/vite-plugin 0.1.50 → 0.1.52
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 +38 -37
- package/package.json +1 -1
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),m=require("node:fs/promises"),a=require("node:path"),c=require("@devup-ui/wasm"),d=require("vite");function p(e){var t;if(s.existsSync(e.interfacePath)||s.mkdirSync(e.interfacePath),s.existsSync(e.devupPath)){c.registerTheme((t=JSON.parse(s.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const u=c.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");u&&s.writeFileSync(a.join(e.interfacePath,"theme.d.ts"),u,{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:u=".df",cssFile:i=a.resolve(u,"devup-ui.css"),extractCss:l=!0,debug:g=!1}={}){c.setDebug(g);try{p({package:e,cssFile:i,devupPath:t,interfacePath:u})}catch(r){console.error(r)}return{name:"devup-ui",config(){const r={server:{watch:{ignored:[`!${t}`]}}};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{p({package:e,cssFile:i,devupPath:t,interfacePath:u})}catch(n){console.error(n)}},resolveId(r){if(d.normalizePath(r)===d.normalizePath(i))return`devup-ui.css?t=${Date.now().toString()+o.length}`},load(r){if(r.split("?")[0]==="devup-ui.css")return o=c.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}=c.codeExtract(n,r,e,i);return f&&o.length<f.length&&(o=f,await m.writeFile(i,`/* ${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":"AAWA,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,CAoFnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { existsSync as c, mkdirSync as
|
|
1
|
+
import { existsSync as c, mkdirSync as h, readFileSync as v, writeFileSync as m } from "node:fs";
|
|
2
2
|
import { writeFile as y } from "node:fs/promises";
|
|
3
3
|
import { resolve as a, join as w } from "node:path";
|
|
4
|
-
import { setDebug as D, codeExtract as C,
|
|
5
|
-
import { normalizePath as
|
|
6
|
-
function
|
|
4
|
+
import { setDebug as D, codeExtract as C, getCss as S, registerTheme as T, getThemeInterface as j } from "@devup-ui/wasm";
|
|
5
|
+
import { normalizePath as p } from "vite";
|
|
6
|
+
function d(e) {
|
|
7
7
|
var t;
|
|
8
|
-
if (c(e.interfacePath) ||
|
|
9
|
-
|
|
8
|
+
if (c(e.interfacePath) || h(e.interfacePath), c(e.devupPath)) {
|
|
9
|
+
T(
|
|
10
10
|
(t = JSON.parse(v(e.devupPath, "utf-8"))) == null ? void 0 : t.theme
|
|
11
11
|
);
|
|
12
|
-
const
|
|
12
|
+
const u = j(
|
|
13
13
|
e.package,
|
|
14
14
|
"DevupThemeColors",
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
|
|
18
|
+
u && m(w(e.interfacePath, "theme.d.ts"), u, {
|
|
19
19
|
encoding: "utf-8"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
c(e.cssFile) ||
|
|
22
|
+
c(e.cssFile) || m(e.cssFile, "", {
|
|
23
23
|
encoding: "utf-8"
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
let o = "";
|
|
27
|
-
function
|
|
27
|
+
function O({
|
|
28
28
|
package: e = "@devup-ui/react",
|
|
29
29
|
devupPath: t = "devup.json",
|
|
30
|
-
interfacePath:
|
|
31
|
-
cssFile: i = a(
|
|
32
|
-
extractCss:
|
|
30
|
+
interfacePath: u = ".df",
|
|
31
|
+
cssFile: i = a(u, "devup-ui.css"),
|
|
32
|
+
extractCss: f = !0,
|
|
33
33
|
debug: l = !1
|
|
34
34
|
} = {}) {
|
|
35
35
|
D(l);
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
d({
|
|
38
38
|
package: e,
|
|
39
39
|
cssFile: i,
|
|
40
40
|
devupPath: t,
|
|
41
|
-
interfacePath:
|
|
41
|
+
interfacePath: u
|
|
42
42
|
});
|
|
43
43
|
} catch (r) {
|
|
44
44
|
console.error(r);
|
|
@@ -46,23 +46,23 @@ function F({
|
|
|
46
46
|
return {
|
|
47
47
|
name: "devup-ui",
|
|
48
48
|
config() {
|
|
49
|
-
|
|
49
|
+
const r = {
|
|
50
50
|
server: {
|
|
51
51
|
watch: {
|
|
52
52
|
ignored: [`!${t}`]
|
|
53
53
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return f && (r.build = {
|
|
57
|
+
rollupOptions: {
|
|
58
|
+
output: {
|
|
59
|
+
manualChunks(n) {
|
|
60
|
+
if (n.startsWith("devup-ui.css"))
|
|
61
|
+
return "devup-ui.css";
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
};
|
|
65
|
+
}), r;
|
|
66
66
|
},
|
|
67
67
|
apply() {
|
|
68
68
|
return !0;
|
|
@@ -70,35 +70,36 @@ function F({
|
|
|
70
70
|
watchChange(r) {
|
|
71
71
|
if (a(r) === a(t) && c(t))
|
|
72
72
|
try {
|
|
73
|
-
|
|
73
|
+
d({
|
|
74
74
|
package: e,
|
|
75
75
|
cssFile: i,
|
|
76
76
|
devupPath: t,
|
|
77
|
-
interfacePath:
|
|
77
|
+
interfacePath: u
|
|
78
78
|
});
|
|
79
|
-
} catch (
|
|
80
|
-
console.error(
|
|
79
|
+
} catch (n) {
|
|
80
|
+
console.error(n);
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
resolveId(r) {
|
|
84
|
-
if (
|
|
84
|
+
if (p(r) === p(i))
|
|
85
85
|
return `devup-ui.css?t=${Date.now().toString() + o.length}`;
|
|
86
86
|
},
|
|
87
87
|
load(r) {
|
|
88
|
-
if (r.split("?")[0] === "devup-ui.css")
|
|
88
|
+
if (r.split("?")[0] === "devup-ui.css")
|
|
89
|
+
return o = S();
|
|
89
90
|
},
|
|
90
91
|
enforce: "pre",
|
|
91
|
-
async transform(r,
|
|
92
|
-
if (!
|
|
93
|
-
const { code:
|
|
94
|
-
return s && o.length < s.length && (o = s, await y(i, `/* ${
|
|
92
|
+
async transform(r, n) {
|
|
93
|
+
if (!f || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
94
|
+
const { code: g, css: s } = C(n, r, e, i);
|
|
95
|
+
return s && o.length < s.length && (o = s, await y(i, `/* ${n} ${Date.now()} */`, {
|
|
95
96
|
encoding: "utf-8"
|
|
96
97
|
})), {
|
|
97
|
-
code:
|
|
98
|
+
code: g
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
O as DevupUI
|
|
104
105
|
};
|