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