@devup-ui/vite-plugin 1.0.31 → 1.0.33
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 +5 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +108 -90
- 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 d=require("node:fs"),l=require("node:fs/promises"),n=require("node:path"),c=require("@devup-ui/wasm");function g(e){return e.endsWith("devup-ui.css")?null:parseInt(e.split("devup-ui-")[1].split(".")[0])}async function _(e){var a;try{const i=d.existsSync(e.devupFile)?await l.readFile(e.devupFile,"utf-8"):void 0;if(i){c.registerTheme(((a=JSON.parse(i))==null?void 0:a.theme)??{});const o=c.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");o&&await l.writeFile(n.join(e.distDir,"theme.d.ts"),o,"utf-8")}else c.registerTheme({})}catch(i){console.error(i),c.registerTheme({})}await Promise.all([d.existsSync(e.cssDir)?Promise.resolve():l.mkdir(e.cssDir,{recursive:!0}),e.singleCss?Promise.resolve():l.writeFile(n.join(e.cssDir,"devup-ui.css"),c.getCss())])}const m=new Map;function N({package:e="@devup-ui/react",devupFile:a="devup.json",distDir:i="df",cssDir:o=n.resolve(i,"devup-ui"),extractCss:v=!0,debug:D=!1,include:w=[],singleCss:f=!1}={}){return c.setDebug(D),{name:"devup-ui",async configResolved(){d.existsSync(i)||await l.mkdir(i,{recursive:!0}),await l.writeFile(n.join(i,".gitignore"),"*","utf-8"),await _({package:e,cssDir:o,devupFile:a,distDir:i,singleCss:f})},config(){const u=c.getDefaultTheme(),t={};u&&(t["process.env.DEVUP_UI_DEFAULT_THEME"]=JSON.stringify(u));const s={server:{watch:{ignored:[`!${a}`]}},define:t,optimizeDeps:{exclude:w}};return v&&(s.build={rollupOptions:{output:{manualChunks(r){if(f&&r.endsWith("devup-ui.css"))return"devup-ui.css"}}}}),s},apply(){return!0},async watchChange(u){if(n.resolve(u)===n.resolve(a)&&d.existsSync(a))try{await _({package:e,cssDir:o,devupFile:a,distDir:i,singleCss:f})}catch(t){console.error(t)}},load(u){const t=n.basename(u).split("?")[0];if(t.startsWith("devup-ui")&&t.endsWith(".css")){const s=g(u),r=c.getCss(s);return m.set(s,r),r}},enforce:"pre",async transform(u,t){if(!v)return;const s=t.split("?")[0];if(!/\.(tsx|ts|js|mjs|jsx)$/i.test(s)||new RegExp(`node_modules(?!.*(${["@devup-ui",...w].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(s))return;let r=n.relative(n.dirname(t),o).replaceAll("\\","/");r.startsWith("./")||(r=`./${r}`);const{code:p,css:h,map:F,css_file:y}=c.codeExtract(s,u,e,r,f);if(h){const T=g(y),j=m.get(T);j&&j.length<h.length&&m.set(T,h),await l.writeFile(n.join(o,n.basename(y)),`/* ${t} ${Date.now()} */`,"utf-8")}return{code:p,map:F}},async generateBundle(u,t){if(!v)return;const s=Object.keys(t).find(r=>r.includes("devup-ui")&&r.endsWith(".css"));if(s&&"source"in t[s]){const r=g(s),p=m.get(r);p&&(t[s].source=p)}}}}exports.DevupUI=N;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PluginOption } from 'vite';
|
|
2
2
|
export interface DevupUIPluginOptions {
|
|
3
3
|
package: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
cssDir: string;
|
|
5
|
+
devupFile: string;
|
|
6
|
+
distDir: string;
|
|
7
7
|
extractCss: boolean;
|
|
8
8
|
debug: boolean;
|
|
9
9
|
include: string[];
|
|
10
|
+
singleCss: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare function DevupUI({ package: libPackage,
|
|
12
|
+
export declare function DevupUI({ package: libPackage, devupFile, distDir, cssDir, extractCss, debug, include, singleCss, }?: Partial<DevupUIPluginOptions>): PluginOption;
|
|
12
13
|
//# sourceMappingURL=plugin.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,MAAM,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;CACnB;AAkDD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,OAAc,EACd,MAAqC,EACrC,UAAiB,EACjB,KAAa,EACb,OAAY,EACZ,SAAiB,GAClB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CAmInD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,131 +1,149 @@
|
|
|
1
|
-
import { existsSync as
|
|
2
|
-
import { writeFile as
|
|
3
|
-
import { resolve as
|
|
4
|
-
import { setDebug as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { existsSync as l } from "node:fs";
|
|
2
|
+
import { writeFile as p, mkdir as $, readFile as x } from "node:fs/promises";
|
|
3
|
+
import { relative as F, dirname as I, resolve as h, join as m, basename as D } from "node:path";
|
|
4
|
+
import { setDebug as O, codeExtract as U, getCss as E, getDefaultTheme as A, registerTheme as g, getThemeInterface as C } from "@devup-ui/wasm";
|
|
5
|
+
function w(e) {
|
|
6
|
+
return e.endsWith("devup-ui.css") ? null : parseInt(e.split("devup-ui-")[1].split(".")[0]);
|
|
7
|
+
}
|
|
8
|
+
async function _(e) {
|
|
9
|
+
var u;
|
|
10
|
+
try {
|
|
11
|
+
const i = l(e.devupFile) ? await x(e.devupFile, "utf-8") : void 0;
|
|
12
|
+
if (i) {
|
|
13
|
+
g(((u = JSON.parse(i)) == null ? void 0 : u.theme) ?? {});
|
|
14
|
+
const c = C(
|
|
15
|
+
e.package,
|
|
16
|
+
"DevupThemeColors",
|
|
17
|
+
"DevupThemeTypography",
|
|
18
|
+
"DevupTheme"
|
|
19
|
+
);
|
|
20
|
+
c && await p(
|
|
21
|
+
m(e.distDir, "theme.d.ts"),
|
|
22
|
+
c,
|
|
23
|
+
"utf-8"
|
|
24
|
+
);
|
|
25
|
+
} else
|
|
26
|
+
g({});
|
|
27
|
+
} catch (i) {
|
|
28
|
+
console.error(i), g({});
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
30
|
+
await Promise.all([
|
|
31
|
+
l(e.cssDir) ? Promise.resolve() : $(e.cssDir, { recursive: !0 }),
|
|
32
|
+
e.singleCss ? Promise.resolve() : p(m(e.cssDir, "devup-ui.css"), E())
|
|
33
|
+
]);
|
|
27
34
|
}
|
|
28
|
-
|
|
29
|
-
function
|
|
35
|
+
const f = /* @__PURE__ */ new Map();
|
|
36
|
+
function P({
|
|
30
37
|
package: e = "@devup-ui/react",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
extractCss:
|
|
35
|
-
debug:
|
|
36
|
-
include:
|
|
38
|
+
devupFile: u = "devup.json",
|
|
39
|
+
distDir: i = "df",
|
|
40
|
+
cssDir: c = h(i, "devup-ui"),
|
|
41
|
+
extractCss: d = !0,
|
|
42
|
+
debug: W = !1,
|
|
43
|
+
include: y = [],
|
|
44
|
+
singleCss: a = !1
|
|
37
45
|
} = {}) {
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
D({
|
|
41
|
-
package: e,
|
|
42
|
-
cssFile: u,
|
|
43
|
-
devupPath: i,
|
|
44
|
-
interfacePath: s
|
|
45
|
-
});
|
|
46
|
-
} catch (t) {
|
|
47
|
-
console.error(t);
|
|
48
|
-
}
|
|
49
|
-
const g = v();
|
|
50
|
-
return g && JSON.stringify(g), {
|
|
46
|
+
return O(W), {
|
|
51
47
|
name: "devup-ui",
|
|
48
|
+
async configResolved() {
|
|
49
|
+
l(i) || await $(i, { recursive: !0 }), await p(m(i, ".gitignore"), "*", "utf-8"), await _({
|
|
50
|
+
package: e,
|
|
51
|
+
cssDir: c,
|
|
52
|
+
devupFile: u,
|
|
53
|
+
distDir: i,
|
|
54
|
+
singleCss: a
|
|
55
|
+
});
|
|
56
|
+
},
|
|
52
57
|
config() {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
58
|
+
const n = A(), t = {};
|
|
59
|
+
n && (t["process.env.DEVUP_UI_DEFAULT_THEME"] = JSON.stringify(n));
|
|
60
|
+
const r = {
|
|
56
61
|
server: {
|
|
57
62
|
watch: {
|
|
58
|
-
ignored: [`!${
|
|
63
|
+
ignored: [`!${u}`]
|
|
59
64
|
}
|
|
60
65
|
},
|
|
61
|
-
define:
|
|
66
|
+
define: t,
|
|
62
67
|
optimizeDeps: {
|
|
63
|
-
exclude:
|
|
68
|
+
exclude: y
|
|
64
69
|
}
|
|
65
70
|
};
|
|
66
|
-
return
|
|
71
|
+
return d && (r.build = {
|
|
67
72
|
rollupOptions: {
|
|
68
73
|
output: {
|
|
69
|
-
manualChunks(
|
|
70
|
-
if (
|
|
74
|
+
manualChunks(s) {
|
|
75
|
+
if (a && s.endsWith("devup-ui.css"))
|
|
71
76
|
return "devup-ui.css";
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
|
-
}),
|
|
80
|
+
}), r;
|
|
76
81
|
},
|
|
77
82
|
apply() {
|
|
78
83
|
return !0;
|
|
79
84
|
},
|
|
80
|
-
watchChange(
|
|
81
|
-
if (
|
|
85
|
+
async watchChange(n) {
|
|
86
|
+
if (h(n) === h(u) && l(u))
|
|
82
87
|
try {
|
|
83
|
-
|
|
88
|
+
await _({
|
|
84
89
|
package: e,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
cssDir: c,
|
|
91
|
+
devupFile: u,
|
|
92
|
+
distDir: i,
|
|
93
|
+
singleCss: a
|
|
88
94
|
});
|
|
89
|
-
} catch (
|
|
90
|
-
console.error(
|
|
95
|
+
} catch (t) {
|
|
96
|
+
console.error(t);
|
|
91
97
|
}
|
|
92
98
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return c = x();
|
|
99
|
+
load(n) {
|
|
100
|
+
const t = D(n).split("?")[0];
|
|
101
|
+
if (t.startsWith("devup-ui") && t.endsWith(".css")) {
|
|
102
|
+
const r = w(n), s = E(r);
|
|
103
|
+
return f.set(r, s), s;
|
|
104
|
+
}
|
|
100
105
|
},
|
|
101
106
|
enforce: "pre",
|
|
102
|
-
async transform(
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
if ((
|
|
106
|
-
`node_modules(
|
|
107
|
-
).test(
|
|
107
|
+
async transform(n, t) {
|
|
108
|
+
if (!d) return;
|
|
109
|
+
const r = t.split("?")[0];
|
|
110
|
+
if (!/\.(tsx|ts|js|mjs|jsx)$/i.test(r) || new RegExp(
|
|
111
|
+
`node_modules(?!.*(${["@devup-ui", ...y].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
112
|
+
).test(r))
|
|
113
|
+
return;
|
|
114
|
+
let s = F(I(t), c).replaceAll("\\", "/");
|
|
115
|
+
s.startsWith("./") || (s = `./${s}`);
|
|
108
116
|
const {
|
|
109
117
|
code: o,
|
|
110
|
-
css:
|
|
111
|
-
map:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
css: v,
|
|
119
|
+
map: k,
|
|
120
|
+
css_file: T
|
|
121
|
+
} = U(r, n, e, s, a);
|
|
122
|
+
if (v) {
|
|
123
|
+
const N = w(T), j = f.get(N);
|
|
124
|
+
j && j.length < v.length && f.set(N, v), await p(
|
|
125
|
+
m(c, D(T)),
|
|
126
|
+
`/* ${t} ${Date.now()} */`,
|
|
127
|
+
"utf-8"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
116
131
|
code: o,
|
|
117
|
-
map:
|
|
132
|
+
map: k
|
|
118
133
|
};
|
|
119
134
|
},
|
|
120
|
-
async generateBundle(
|
|
121
|
-
if (!
|
|
122
|
-
const
|
|
123
|
-
(
|
|
135
|
+
async generateBundle(n, t) {
|
|
136
|
+
if (!d) return;
|
|
137
|
+
const r = Object.keys(t).find(
|
|
138
|
+
(s) => s.includes("devup-ui") && s.endsWith(".css")
|
|
124
139
|
);
|
|
125
|
-
|
|
140
|
+
if (r && "source" in t[r]) {
|
|
141
|
+
const s = w(r), o = f.get(s);
|
|
142
|
+
o && (t[r].source = o);
|
|
143
|
+
}
|
|
126
144
|
}
|
|
127
145
|
};
|
|
128
146
|
}
|
|
129
147
|
export {
|
|
130
|
-
|
|
148
|
+
P as DevupUI
|
|
131
149
|
};
|
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.33",
|
|
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.33"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"vite-plugin-dts": "^4.5.4",
|