@devup-ui/vite-plugin 0.1.20 → 0.1.21
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 +49 -37
- 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"),o=require("node:path"),p=require("node:url"),u=require("@devup-ui/wasm");var d=typeof document<"u"?document.currentScript:null;const y=p.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.tagName.toUpperCase()==="SCRIPT"&&d.src||new URL("plugin.cjs",document.baseURI).href),g=o.dirname(y);function m(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 h({package:e="@devup-ui/react",cssFile:n=o.join(g,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:l=!0}={}){if(r.existsSync(t))try{m({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(c){console.error(c)}return{name:"devup-ui",config(){return{server:{watch:{ignored:[`!${t}`]}}}},watchChange(c){if(o.resolve(c)===o.resolve(t)&&r.existsSync(t))try{m({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(i){console.error(i)}},enforce:"pre",transform(c,i){if(!l||i.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(i))return;const{code:f,css:s}=u.codeExtract(i,c,e,n);return s?(r.writeFileSync(n,s,{encoding:"utf-8"}),{code:`${f}
|
|
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:f}}}}exports.DevupUI=h;
|
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,CAqEnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,58 +1,60 @@
|
|
|
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 l, mkdirSync as y } from "node:fs";
|
|
2
|
+
import { dirname as g, resolve as d, join as a } from "node:path";
|
|
3
|
+
import { fileURLToPath as h } from "node:url";
|
|
4
|
+
import { codeExtract as v, registerTheme as x, getThemeInterface as C, getCss as T } from "@devup-ui/wasm";
|
|
5
|
+
const j = h(import.meta.url), D = g(j);
|
|
6
|
+
function f(e) {
|
|
7
|
+
var t;
|
|
8
|
+
x((t = JSON.parse(l(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
|
|
9
|
+
const r = C(
|
|
10
10
|
e.package,
|
|
11
11
|
"DevupThemeColors",
|
|
12
12
|
"DevupThemeTypography",
|
|
13
13
|
"DevupTheme"
|
|
14
14
|
);
|
|
15
|
-
|
|
15
|
+
r && (i(e.interfacePath) || y(e.interfacePath), u(a(e.interfacePath, "theme.d.ts"), r, {
|
|
16
16
|
encoding: "utf-8"
|
|
17
|
-
})),
|
|
17
|
+
})), u(e.cssFile, T(), {
|
|
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 = a(D, "devup-ui.css"),
|
|
24
|
+
devupPath: t = "devup.json",
|
|
25
|
+
interfacePath: s = ".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: s
|
|
35
35
|
});
|
|
36
36
|
} catch (n) {
|
|
37
37
|
console.error(n);
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
40
|
name: "devup-ui",
|
|
41
|
-
config
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
config() {
|
|
42
|
+
return {
|
|
43
|
+
server: {
|
|
44
|
+
watch: {
|
|
45
|
+
ignored: [`!${t}`]
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
+
};
|
|
49
|
+
},
|
|
48
50
|
watchChange(n) {
|
|
49
|
-
if (
|
|
51
|
+
if (d(n) === d(t) && i(t))
|
|
50
52
|
try {
|
|
51
|
-
|
|
53
|
+
f({
|
|
52
54
|
package: e,
|
|
53
|
-
cssFile:
|
|
54
|
-
devupPath:
|
|
55
|
-
interfacePath:
|
|
55
|
+
cssFile: r,
|
|
56
|
+
devupPath: t,
|
|
57
|
+
interfacePath: s
|
|
56
58
|
});
|
|
57
59
|
} catch (c) {
|
|
58
60
|
console.error(c);
|
|
@@ -60,16 +62,26 @@ function I({
|
|
|
60
62
|
},
|
|
61
63
|
enforce: "pre",
|
|
62
64
|
transform(n, c) {
|
|
63
|
-
if (!
|
|
64
|
-
const { code:
|
|
65
|
-
return
|
|
65
|
+
if (!p || c.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(c)) return;
|
|
66
|
+
const { code: m, css: o } = v(c, n, e, r);
|
|
67
|
+
return o ? (u(r, o, {
|
|
66
68
|
encoding: "utf-8"
|
|
67
69
|
}), {
|
|
68
|
-
code:
|
|
70
|
+
code: `${m}
|
|
71
|
+
const exists = !!document.getElementById('devup-ui');
|
|
72
|
+
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
73
|
+
style.id = 'devup-ui';
|
|
74
|
+
style.textContent = \`
|
|
75
|
+
${o}
|
|
76
|
+
\`;
|
|
77
|
+
if (!exists) document.head.appendChild(style);
|
|
78
|
+
`
|
|
79
|
+
}) : {
|
|
80
|
+
code: m
|
|
69
81
|
};
|
|
70
82
|
}
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
85
|
export {
|
|
74
|
-
|
|
86
|
+
$ as DevupUI
|
|
75
87
|
};
|
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.21",
|
|
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",
|