@devup-ui/vite-plugin 0.1.49 → 0.1.50
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 +21 -21
- package/package.json +2 -2
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("node:fs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("node:fs"),m=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 v({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?t=${Date.now().toString()+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:g,css:f}=a.codeExtract(u,r,e,i);return f&&c.length<f.length&&(c=f,await m.writeFile(i,`/* ${u} ${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,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,
|
|
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,CA+EnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { existsSync as
|
|
1
|
+
import { existsSync as c, mkdirSync as g, readFileSync as v, writeFileSync as f } 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 C, registerTheme as
|
|
4
|
+
import { setDebug as D, codeExtract as C, registerTheme as S, getThemeInterface as T } from "@devup-ui/wasm";
|
|
5
5
|
import { normalizePath as m } from "vite";
|
|
6
6
|
function p(e) {
|
|
7
7
|
var t;
|
|
8
|
-
if (
|
|
9
|
-
|
|
8
|
+
if (c(e.interfacePath) || g(e.interfacePath), c(e.devupPath)) {
|
|
9
|
+
S(
|
|
10
10
|
(t = JSON.parse(v(e.devupPath, "utf-8"))) == null ? void 0 : t.theme
|
|
11
11
|
);
|
|
12
|
-
const
|
|
12
|
+
const n = T(
|
|
13
13
|
e.package,
|
|
14
14
|
"DevupThemeColors",
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
|
|
18
|
+
n && f(w(e.interfacePath, "theme.d.ts"), n, {
|
|
19
19
|
encoding: "utf-8"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
c(e.cssFile) || f(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
|
-
interfacePath:
|
|
31
|
-
cssFile: i = a(
|
|
30
|
+
interfacePath: n = ".df",
|
|
31
|
+
cssFile: i = a(n, "devup-ui.css"),
|
|
32
32
|
extractCss: d = !0,
|
|
33
33
|
debug: l = !1
|
|
34
34
|
} = {}) {
|
|
@@ -38,7 +38,7 @@ function F({
|
|
|
38
38
|
package: e,
|
|
39
39
|
cssFile: i,
|
|
40
40
|
devupPath: t,
|
|
41
|
-
interfacePath:
|
|
41
|
+
interfacePath: n
|
|
42
42
|
});
|
|
43
43
|
} catch (r) {
|
|
44
44
|
console.error(r);
|
|
@@ -68,30 +68,30 @@ function F({
|
|
|
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
|
p({
|
|
74
74
|
package: e,
|
|
75
75
|
cssFile: i,
|
|
76
76
|
devupPath: t,
|
|
77
|
-
interfacePath:
|
|
77
|
+
interfacePath: n
|
|
78
78
|
});
|
|
79
|
-
} catch (
|
|
80
|
-
console.error(
|
|
79
|
+
} catch (u) {
|
|
80
|
+
console.error(u);
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
resolveId(r) {
|
|
84
84
|
if (m(r) === m(i))
|
|
85
|
-
return
|
|
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
|
-
async transform(r,
|
|
92
|
-
if (!d ||
|
|
93
|
-
const { code: h, css: s } = C(
|
|
94
|
-
return s &&
|
|
91
|
+
async transform(r, u) {
|
|
92
|
+
if (!d || u.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(u)) return;
|
|
93
|
+
const { code: h, css: s } = C(u, r, e, i);
|
|
94
|
+
return s && o.length < s.length && (o = s, await y(i, `/* ${u} ${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.50",
|
|
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",
|