@devup-ui/vite-plugin 0.1.49 → 0.1.51
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 +28 -28
- 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 u=require("node:fs"),m=require("node:fs/promises"),o=require("node:path"),a=require("@devup-ui/wasm"),d=require("vite");function p(e){var t;if(u.existsSync(e.interfacePath)||u.mkdirSync(e.interfacePath),u.existsSync(e.devupPath)){a.registerTheme((t=JSON.parse(u.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const s=a.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");s&&u.writeFileSync(o.join(e.interfacePath,"theme.d.ts"),s,{encoding:"utf-8"})}u.existsSync(e.cssFile)||u.writeFileSync(e.cssFile,"",{encoding:"utf-8"})}let c="";function v({package:e="@devup-ui/react",devupPath:t="devup.json",interfacePath:s=".df",cssFile:i=o.resolve(s,"devup-ui.css"),extractCss:l=!0,debug:h=!1}={}){a.setDebug(h);try{p({package:e,cssFile:i,devupPath:t,interfacePath:s})}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(o.resolve(r)===o.resolve(t)&&u.existsSync(t))try{p({package:e,cssFile:i,devupPath:t,interfacePath:s})}catch(n){console.error(n)}},resolveId(r){if(d.normalizePath(r)===d.normalizePath(i))return`devup-ui.css?t=${Date.now().toString()+c.length}`},load(r){if(r.split("?")[0]==="devup-ui.css")return c},enforce:"pre",async transform(r,n){if(!l||n.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(n))return;const{code:g,css:f}=a.codeExtract(n,r,e,i);return f&&c.length<f.length&&(c=f,await m.writeFile(i,`/* ${n} ${Date.now()} */`,{encoding:"utf-8"})),{code:g}}}}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":"AAUA,OAAO,EAAiB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,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,CAkFnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { existsSync as
|
|
1
|
+
import { existsSync as c, mkdirSync as g, 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
|
|
5
|
-
import { normalizePath as
|
|
6
|
-
function
|
|
4
|
+
import { setDebug as D, codeExtract 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 (
|
|
8
|
+
if (c(e.interfacePath) || g(e.interfacePath), c(e.devupPath)) {
|
|
9
9
|
T(
|
|
10
10
|
(t = JSON.parse(v(e.devupPath, "utf-8"))) == null ? void 0 : t.theme
|
|
11
11
|
);
|
|
@@ -15,26 +15,26 @@ function p(e) {
|
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
u &&
|
|
18
|
+
u && m(w(e.interfacePath, "theme.d.ts"), u, {
|
|
19
19
|
encoding: "utf-8"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
c(e.cssFile) || m(e.cssFile, "", {
|
|
23
23
|
encoding: "utf-8"
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
let
|
|
26
|
+
let o = "";
|
|
27
27
|
function F({
|
|
28
28
|
package: e = "@devup-ui/react",
|
|
29
29
|
devupPath: t = "devup.json",
|
|
30
30
|
interfacePath: u = ".df",
|
|
31
31
|
cssFile: i = a(u, "devup-ui.css"),
|
|
32
|
-
extractCss:
|
|
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,
|
|
@@ -46,31 +46,31 @@ 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;
|
|
69
69
|
},
|
|
70
70
|
watchChange(r) {
|
|
71
|
-
if (a(r) === a(t) &&
|
|
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,
|
|
@@ -81,17 +81,17 @@ function F({
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
resolveId(r) {
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
84
|
+
if (p(r) === p(i))
|
|
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") return
|
|
88
|
+
if (r.split("?")[0] === "devup-ui.css") return o;
|
|
89
89
|
},
|
|
90
90
|
enforce: "pre",
|
|
91
91
|
async transform(r, n) {
|
|
92
|
-
if (!
|
|
93
|
-
const { code: h, css: s } =
|
|
94
|
-
return s &&
|
|
92
|
+
if (!f || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
93
|
+
const { code: h, css: s } = S(n, r, e, i);
|
|
94
|
+
return s && o.length < s.length && (o = s, await y(i, `/* ${n} ${Date.now()} */`, {
|
|
95
95
|
encoding: "utf-8"
|
|
96
96
|
})), {
|
|
97
97
|
code: h
|
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.51",
|
|
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.48"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vite-plugin-dts": "^4.5.0",
|