@devup-ui/vite-plugin 0.1.20 → 0.1.22
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 +9 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +60 -44
- package/package.json +2 -2
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),i=require("node:path"),y=require("node:url"),o=require("@devup-ui/wasm");var d=typeof document<"u"?document.currentScript:null;const g=y.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.tagName.toUpperCase()==="SCRIPT"&&d.src||new URL("plugin.cjs",document.baseURI).href),h=i.dirname(g);function l(e){var t;o.registerTheme((t=JSON.parse(r.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const n=o.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&(r.existsSync(e.interfacePath)||r.mkdirSync(e.interfacePath),r.writeFileSync(i.join(e.interfacePath,"theme.d.ts"),n,{encoding:"utf-8"})),r.writeFileSync(e.cssFile,o.getCss(),{encoding:"utf-8"})}function v({package:e="@devup-ui/react",cssFile:n=i.join(h,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:p=!0}={}){if(r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(u){console.error(u)}let f=null;return{name:"devup-ui",config(){return{server:{watch:{ignored:[`!${t}`]}}}},apply(u,c){return f=c.command,!0},watchChange(u){if(i.resolve(u)===i.resolve(t)&&r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(c){console.error(c)}},enforce:"pre",transform(u,c){if(!p||c.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(c))return;const{code:m,css:s}=o.codeExtract(c,u,e,n);return s&&(r.writeFileSync(n,s,{encoding:"utf-8"}),f==="serve")?{code:`${m}
|
|
2
|
+
const exists = !!document.getElementById('devup-ui');
|
|
3
|
+
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
4
|
+
style.id = 'devup-ui';
|
|
5
|
+
style.textContent = \`
|
|
6
|
+
${s}
|
|
7
|
+
\`;
|
|
8
|
+
if (!exists) document.head.appendChild(style);
|
|
9
|
+
`}:{code:m}}}}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,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC,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;CACpB;AAqBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,GAClB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC,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;CACpB;AAqBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,GAClB,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA2EnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,75 +1,91 @@
|
|
|
1
|
-
import { existsSync as
|
|
2
|
-
import { dirname as
|
|
3
|
-
import { fileURLToPath as
|
|
4
|
-
import { codeExtract as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
const
|
|
1
|
+
import { existsSync as i, writeFileSync as u, readFileSync as y, mkdirSync as g } from "node:fs";
|
|
2
|
+
import { dirname as h, resolve as a, join as l } from "node:path";
|
|
3
|
+
import { fileURLToPath as v } from "node:url";
|
|
4
|
+
import { codeExtract as x, registerTheme as C, getThemeInterface as T, getCss as j } from "@devup-ui/wasm";
|
|
5
|
+
const D = v(import.meta.url), S = h(D);
|
|
6
|
+
function f(e) {
|
|
7
|
+
var t;
|
|
8
|
+
C((t = JSON.parse(y(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
|
|
9
|
+
const r = T(
|
|
10
10
|
e.package,
|
|
11
11
|
"DevupThemeColors",
|
|
12
12
|
"DevupThemeTypography",
|
|
13
13
|
"DevupTheme"
|
|
14
14
|
);
|
|
15
|
-
|
|
15
|
+
r && (i(e.interfacePath) || g(e.interfacePath), u(l(e.interfacePath, "theme.d.ts"), r, {
|
|
16
16
|
encoding: "utf-8"
|
|
17
|
-
})),
|
|
17
|
+
})), u(e.cssFile, j(), {
|
|
18
18
|
encoding: "utf-8"
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function $({
|
|
22
22
|
package: e = "@devup-ui/react",
|
|
23
|
-
cssFile:
|
|
24
|
-
devupPath:
|
|
25
|
-
interfacePath:
|
|
26
|
-
extractCss:
|
|
23
|
+
cssFile: r = l(S, "devup-ui.css"),
|
|
24
|
+
devupPath: t = "devup.json",
|
|
25
|
+
interfacePath: m = ".df",
|
|
26
|
+
extractCss: p = !0
|
|
27
27
|
} = {}) {
|
|
28
|
-
if (
|
|
28
|
+
if (i(t))
|
|
29
29
|
try {
|
|
30
|
-
|
|
30
|
+
f({
|
|
31
31
|
package: e,
|
|
32
|
-
cssFile:
|
|
33
|
-
devupPath:
|
|
34
|
-
interfacePath:
|
|
32
|
+
cssFile: r,
|
|
33
|
+
devupPath: t,
|
|
34
|
+
interfacePath: m
|
|
35
35
|
});
|
|
36
|
-
} catch (
|
|
37
|
-
console.error(
|
|
36
|
+
} catch (c) {
|
|
37
|
+
console.error(c);
|
|
38
38
|
}
|
|
39
|
+
let s = null;
|
|
39
40
|
return {
|
|
40
41
|
name: "devup-ui",
|
|
41
|
-
config
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
config() {
|
|
43
|
+
return {
|
|
44
|
+
server: {
|
|
45
|
+
watch: {
|
|
46
|
+
ignored: [`!${t}`]
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
apply(c, n) {
|
|
52
|
+
return s = n.command, !0;
|
|
53
|
+
},
|
|
54
|
+
watchChange(c) {
|
|
55
|
+
if (a(c) === a(t) && i(t))
|
|
50
56
|
try {
|
|
51
|
-
|
|
57
|
+
f({
|
|
52
58
|
package: e,
|
|
53
|
-
cssFile:
|
|
54
|
-
devupPath:
|
|
55
|
-
interfacePath:
|
|
59
|
+
cssFile: r,
|
|
60
|
+
devupPath: t,
|
|
61
|
+
interfacePath: m
|
|
56
62
|
});
|
|
57
|
-
} catch (
|
|
58
|
-
console.error(
|
|
63
|
+
} catch (n) {
|
|
64
|
+
console.error(n);
|
|
59
65
|
}
|
|
60
66
|
},
|
|
61
67
|
enforce: "pre",
|
|
62
|
-
transform(
|
|
63
|
-
if (!
|
|
64
|
-
const { code:
|
|
65
|
-
return
|
|
68
|
+
transform(c, n) {
|
|
69
|
+
if (!p || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
70
|
+
const { code: d, css: o } = x(n, c, e, r);
|
|
71
|
+
return o && (u(r, o, {
|
|
66
72
|
encoding: "utf-8"
|
|
67
|
-
}), {
|
|
68
|
-
code:
|
|
73
|
+
}), s === "serve") ? {
|
|
74
|
+
code: `${d}
|
|
75
|
+
const exists = !!document.getElementById('devup-ui');
|
|
76
|
+
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
77
|
+
style.id = 'devup-ui';
|
|
78
|
+
style.textContent = \`
|
|
79
|
+
${o}
|
|
80
|
+
\`;
|
|
81
|
+
if (!exists) document.head.appendChild(style);
|
|
82
|
+
`
|
|
83
|
+
} : {
|
|
84
|
+
code: d
|
|
69
85
|
};
|
|
70
86
|
}
|
|
71
87
|
};
|
|
72
88
|
}
|
|
73
89
|
export {
|
|
74
|
-
|
|
90
|
+
$ as DevupUI
|
|
75
91
|
};
|
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.22",
|
|
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.24"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vite-plugin-dts": "^4.5.0",
|