@devup-ui/vite-plugin 1.0.12 → 1.0.13
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 +44 -42
- package/package.json +2 -2
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 i=require("node:fs"),w=require("node:fs/promises"),l=require("node:path"),u=require("@devup-ui/wasm"),h=require("vite");function v(t){var s;if(i.existsSync(t.interfacePath)||i.mkdirSync(t.interfacePath),i.existsSync(t.devupPath)){u.registerTheme((s=JSON.parse(i.readFileSync(t.devupPath,"utf-8")))==null?void 0:s.theme);const c=u.getThemeInterface(t.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");c&&i.writeFileSync(l.join(t.interfacePath,"theme.d.ts"),c,{encoding:"utf-8"})}i.existsSync(t.cssFile)||i.writeFileSync(t.cssFile,"",{encoding:"utf-8"})}let f="";function T({package:t="@devup-ui/react",devupPath:s="devup.json",interfacePath:c=".df",cssFile:a=l.resolve(c,"devup-ui.css"),extractCss:d=!0,debug:y=!1,include:p=[]}={}){u.setDebug(y);try{v({package:t,cssFile:a,devupPath:s,interfacePath:c})}catch(e){console.error(e)}const m=u.getDefaultTheme();return m&&JSON.stringify(m),{name:"devup-ui",config(){const e=u.getDefaultTheme(),r={};e&&(r["process.env.DEVUP_UI_DEFAULT_THEME"]=JSON.stringify(e));const n={server:{watch:{ignored:[`!${s}`]}},define:r,optimizeDeps:{exclude:p}};return d&&(n.build={rollupOptions:{output:{manualChunks(o){if(o.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),n},apply(){return!0},watchChange(e){if(l.resolve(e)===l.resolve(s)&&i.existsSync(s))try{v({package:t,cssFile:a,devupPath:s,interfacePath:c})}catch(r){console.error(r)}},resolveId(e){if(h.normalizePath(e)===h.normalizePath(a))return`devup-ui.css?t=${Date.now().toString()+f.length}`},load(e){if(e.split("?")[0]==="devup-ui.css")return f=u.getCss()},enforce:"pre",async transform(e,r){if(!d)return;const n=r.split("?")[0];if((p.length?new RegExp(`node_modules(?!(${p.map(S=>`.*${S}`).join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(n):r.includes("node_modules"))||!/\.(tsx|ts|js|mjs|jsx)$/i.test(n))return;const{code:o,css:g,map:D}=u.codeExtract(n,e,t,a);return g&&f.length<g.length&&(f=g,await w.writeFile(a,`/* ${r} ${Date.now()} */`,{encoding:"utf-8"})),{code:o,map:D}},async generateBundle(e,r){if(!d)return;const n=Object.keys(r).find(o=>o.includes("devup-ui")&&o.endsWith(".css"));n&&"source"in r[n]&&(r[n].source=f)}}}exports.DevupUI=T;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AA8BD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,UAAiB,EACjB,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,
|
|
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;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AA8BD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,UAAiB,EACjB,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA8HnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { existsSync as f, mkdirSync as
|
|
2
|
-
import { writeFile as
|
|
3
|
-
import { resolve as
|
|
4
|
-
import { setDebug as E, getDefaultTheme as
|
|
1
|
+
import { existsSync as f, mkdirSync as S, readFileSync as $, writeFileSync as g } from "node:fs";
|
|
2
|
+
import { writeFile as j } from "node:fs/promises";
|
|
3
|
+
import { resolve as d, join as _ } from "node:path";
|
|
4
|
+
import { setDebug as E, getDefaultTheme as h, codeExtract as k, getCss as x, registerTheme as C, getThemeInterface as O } from "@devup-ui/wasm";
|
|
5
5
|
import { normalizePath as v } from "vite";
|
|
6
6
|
function y(r) {
|
|
7
|
-
var
|
|
8
|
-
if (f(r.interfacePath) ||
|
|
9
|
-
|
|
10
|
-
(
|
|
7
|
+
var i;
|
|
8
|
+
if (f(r.interfacePath) || S(r.interfacePath), f(r.devupPath)) {
|
|
9
|
+
C(
|
|
10
|
+
(i = JSON.parse($(r.devupPath, "utf-8"))) == null ? void 0 : i.theme
|
|
11
11
|
);
|
|
12
|
-
const s =
|
|
12
|
+
const s = O(
|
|
13
13
|
r.package,
|
|
14
14
|
"DevupThemeColors",
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
s &&
|
|
18
|
+
s && g(_(r.interfacePath, "theme.d.ts"), s, {
|
|
19
19
|
encoding: "utf-8"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
f(r.cssFile) ||
|
|
22
|
+
f(r.cssFile) || g(r.cssFile, "", {
|
|
23
23
|
encoding: "utf-8"
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
let
|
|
27
|
-
function
|
|
26
|
+
let c = "";
|
|
27
|
+
function z({
|
|
28
28
|
package: r = "@devup-ui/react",
|
|
29
|
-
devupPath:
|
|
29
|
+
devupPath: i = "devup.json",
|
|
30
30
|
interfacePath: s = ".df",
|
|
31
|
-
cssFile:
|
|
31
|
+
cssFile: u = d(s, "devup-ui.css"),
|
|
32
32
|
extractCss: a = !0,
|
|
33
33
|
debug: D = !1,
|
|
34
34
|
include: p = []
|
|
@@ -37,49 +37,51 @@ function J({
|
|
|
37
37
|
try {
|
|
38
38
|
y({
|
|
39
39
|
package: r,
|
|
40
|
-
cssFile:
|
|
41
|
-
devupPath:
|
|
40
|
+
cssFile: u,
|
|
41
|
+
devupPath: i,
|
|
42
42
|
interfacePath: s
|
|
43
43
|
});
|
|
44
44
|
} catch (e) {
|
|
45
45
|
console.error(e);
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
return
|
|
47
|
+
const l = h();
|
|
48
|
+
return l && JSON.stringify(l), {
|
|
49
49
|
name: "devup-ui",
|
|
50
50
|
config() {
|
|
51
|
-
const e = {
|
|
51
|
+
const e = h(), t = {};
|
|
52
|
+
e && (t["process.env.DEVUP_UI_DEFAULT_THEME"] = JSON.stringify(e));
|
|
53
|
+
const n = {
|
|
52
54
|
server: {
|
|
53
55
|
watch: {
|
|
54
|
-
ignored: [`!${
|
|
56
|
+
ignored: [`!${i}`]
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
|
-
define:
|
|
59
|
+
define: t,
|
|
58
60
|
optimizeDeps: {
|
|
59
61
|
exclude: p
|
|
60
62
|
}
|
|
61
63
|
};
|
|
62
|
-
return a && (
|
|
64
|
+
return a && (n.build = {
|
|
63
65
|
rollupOptions: {
|
|
64
66
|
output: {
|
|
65
|
-
manualChunks(
|
|
66
|
-
if (
|
|
67
|
+
manualChunks(o) {
|
|
68
|
+
if (o.startsWith("devup-ui.css"))
|
|
67
69
|
return "devup-ui.css";
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
}),
|
|
73
|
+
}), n;
|
|
72
74
|
},
|
|
73
75
|
apply() {
|
|
74
76
|
return !0;
|
|
75
77
|
},
|
|
76
78
|
watchChange(e) {
|
|
77
|
-
if (
|
|
79
|
+
if (d(e) === d(i) && f(i))
|
|
78
80
|
try {
|
|
79
81
|
y({
|
|
80
82
|
package: r,
|
|
81
|
-
cssFile:
|
|
82
|
-
devupPath:
|
|
83
|
+
cssFile: u,
|
|
84
|
+
devupPath: i,
|
|
83
85
|
interfacePath: s
|
|
84
86
|
});
|
|
85
87
|
} catch (t) {
|
|
@@ -87,41 +89,41 @@ function J({
|
|
|
87
89
|
}
|
|
88
90
|
},
|
|
89
91
|
resolveId(e) {
|
|
90
|
-
if (v(e) === v(
|
|
91
|
-
return `devup-ui.css?t=${Date.now().toString() +
|
|
92
|
+
if (v(e) === v(u))
|
|
93
|
+
return `devup-ui.css?t=${Date.now().toString() + c.length}`;
|
|
92
94
|
},
|
|
93
95
|
load(e) {
|
|
94
96
|
if (e.split("?")[0] === "devup-ui.css")
|
|
95
|
-
return
|
|
97
|
+
return c = x();
|
|
96
98
|
},
|
|
97
99
|
enforce: "pre",
|
|
98
100
|
async transform(e, t) {
|
|
99
101
|
if (!a) return;
|
|
100
|
-
const
|
|
102
|
+
const n = t.split("?")[0];
|
|
101
103
|
if ((p.length ? new RegExp(
|
|
102
104
|
`node_modules(?!(${p.map((T) => `.*${T}`).join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
103
|
-
).test(
|
|
105
|
+
).test(n) : t.includes("node_modules")) || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
104
106
|
const {
|
|
105
|
-
code:
|
|
107
|
+
code: o,
|
|
106
108
|
css: m,
|
|
107
109
|
map: w
|
|
108
|
-
} =
|
|
109
|
-
return m &&
|
|
110
|
+
} = k(n, e, r, u);
|
|
111
|
+
return m && c.length < m.length && (c = m, await j(u, `/* ${t} ${Date.now()} */`, {
|
|
110
112
|
encoding: "utf-8"
|
|
111
113
|
})), {
|
|
112
|
-
code:
|
|
114
|
+
code: o,
|
|
113
115
|
map: w
|
|
114
116
|
};
|
|
115
117
|
},
|
|
116
118
|
async generateBundle(e, t) {
|
|
117
119
|
if (!a) return;
|
|
118
|
-
const
|
|
119
|
-
(
|
|
120
|
+
const n = Object.keys(t).find(
|
|
121
|
+
(o) => o.includes("devup-ui") && o.endsWith(".css")
|
|
120
122
|
);
|
|
121
|
-
|
|
123
|
+
n && "source" in t[n] && (t[n].source = c);
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
126
|
}
|
|
125
127
|
export {
|
|
126
|
-
|
|
128
|
+
z as DevupUI
|
|
127
129
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"vite"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "1.0.
|
|
21
|
+
"version": "1.0.13",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@devup-ui/wasm": "1.0.
|
|
39
|
+
"@devup-ui/wasm": "1.0.13"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"vite-plugin-dts": "^4.5.4",
|