@devup-ui/vite-plugin 0.1.43 → 0.1.45
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.js +15 -15
- package/package.json +3 -2
package/dist/plugin.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),o=require("node:path"),g=require("node:url"),u=require("@devup-ui/wasm");var d=typeof document<"u"?document.currentScript:null;const h=g.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.tagName.toUpperCase()==="SCRIPT"&&d.src||new URL("plugin.cjs",document.baseURI).href),v=o.dirname(h);function l(e){var t;u.registerTheme((t=JSON.parse(r.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const n=u.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&(r.existsSync(e.interfacePath)||r.mkdirSync(e.interfacePath),r.writeFileSync(o.join(e.interfacePath,"theme.d.ts"),n,{encoding:"utf-8"})),r.writeFileSync(e.cssFile,u.getCss(),{encoding:"utf-8"})}function S({package:e="@devup-ui/react",cssFile:n=o.join(v,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:p=!0,debug:y=!1}={}){if(u.setDebug(y),r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(i){console.error(i)}let f=null;return{name:"devup-ui",config(){return{server:{watch:{ignored:[`!${t}`]}}}},apply(i,c){return f=c.command,!0},watchChange(i){if(o.resolve(i)===o.resolve(t)&&r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(c){console.error(c)}},enforce:"pre",transform(i,c){if(!p||c.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(c))return;const{code:m,css:s}=u.codeExtract(c,i,e,n);return s&&(r.writeFileSync(n,s,{encoding:"utf-8"}),f==="serve"&&process.env.NODE_ENV!=="test")?{code:`${m}
|
|
2
2
|
if(typeof window !== 'undefined'){
|
|
3
3
|
const exists = !!document.getElementById('devup-ui');
|
|
4
4
|
const style = document.getElementById('devup-ui') || document.createElement('style');
|
package/dist/plugin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { existsSync as i, writeFileSync as u, readFileSync as g, mkdirSync as h } from "node:fs";
|
|
2
2
|
import { dirname as v, join as l, resolve as f } from "node:path";
|
|
3
3
|
import { fileURLToPath as x } from "node:url";
|
|
4
|
-
import { setDebug as C, codeExtract as
|
|
5
|
-
const
|
|
4
|
+
import { setDebug as C, codeExtract as D, registerTheme as T, getThemeInterface as w, getCss as E } from "@devup-ui/wasm";
|
|
5
|
+
const j = x(import.meta.url), S = v(j);
|
|
6
6
|
function a(e) {
|
|
7
7
|
var t;
|
|
8
|
-
|
|
9
|
-
const r =
|
|
8
|
+
T((t = JSON.parse(g(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
|
|
9
|
+
const r = w(
|
|
10
10
|
e.package,
|
|
11
11
|
"DevupThemeColors",
|
|
12
12
|
"DevupThemeTypography",
|
|
@@ -14,15 +14,15 @@ function a(e) {
|
|
|
14
14
|
);
|
|
15
15
|
r && (i(e.interfacePath) || h(e.interfacePath), u(l(e.interfacePath, "theme.d.ts"), r, {
|
|
16
16
|
encoding: "utf-8"
|
|
17
|
-
})), u(e.cssFile,
|
|
17
|
+
})), u(e.cssFile, E(), {
|
|
18
18
|
encoding: "utf-8"
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function N({
|
|
22
22
|
package: e = "@devup-ui/react",
|
|
23
|
-
cssFile: r = l(
|
|
23
|
+
cssFile: r = l(S, "devup-ui.css"),
|
|
24
24
|
devupPath: t = "devup.json",
|
|
25
|
-
interfacePath:
|
|
25
|
+
interfacePath: s = ".df",
|
|
26
26
|
extractCss: p = !0,
|
|
27
27
|
debug: y = !1
|
|
28
28
|
} = {}) {
|
|
@@ -32,12 +32,12 @@ function B({
|
|
|
32
32
|
package: e,
|
|
33
33
|
cssFile: r,
|
|
34
34
|
devupPath: t,
|
|
35
|
-
interfacePath:
|
|
35
|
+
interfacePath: s
|
|
36
36
|
});
|
|
37
37
|
} catch (o) {
|
|
38
38
|
console.error(o);
|
|
39
39
|
}
|
|
40
|
-
let
|
|
40
|
+
let m = null;
|
|
41
41
|
return {
|
|
42
42
|
name: "devup-ui",
|
|
43
43
|
config() {
|
|
@@ -50,7 +50,7 @@ function B({
|
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
52
|
apply(o, n) {
|
|
53
|
-
return
|
|
53
|
+
return m = n.command, !0;
|
|
54
54
|
},
|
|
55
55
|
watchChange(o) {
|
|
56
56
|
if (f(o) === f(t) && i(t))
|
|
@@ -59,7 +59,7 @@ function B({
|
|
|
59
59
|
package: e,
|
|
60
60
|
cssFile: r,
|
|
61
61
|
devupPath: t,
|
|
62
|
-
interfacePath:
|
|
62
|
+
interfacePath: s
|
|
63
63
|
});
|
|
64
64
|
} catch (n) {
|
|
65
65
|
console.error(n);
|
|
@@ -68,10 +68,10 @@ function B({
|
|
|
68
68
|
enforce: "pre",
|
|
69
69
|
transform(o, n) {
|
|
70
70
|
if (!p || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
71
|
-
const { code: d, css: c } =
|
|
71
|
+
const { code: d, css: c } = D(n, o, e, r);
|
|
72
72
|
return c && (u(r, c, {
|
|
73
73
|
encoding: "utf-8"
|
|
74
|
-
}),
|
|
74
|
+
}), m === "serve" && process.env.NODE_ENV !== "test") ? {
|
|
75
75
|
code: `${d}
|
|
76
76
|
if(typeof window !== 'undefined'){
|
|
77
77
|
const exists = !!document.getElementById('devup-ui');
|
|
@@ -90,5 +90,5 @@ function B({
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
export {
|
|
93
|
-
|
|
93
|
+
N as DevupUI
|
|
94
94
|
};
|
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.45",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"typescript": "^5.7.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"vite": "*"
|
|
29
|
+
"vite": "*",
|
|
30
|
+
"@devup-ui/wasm": "*"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"lint": "eslint",
|