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