@devup-ui/vite-plugin 0.1.40 → 0.1.42
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 +2 -2
- package/dist/plugin.d.ts +2 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +19 -18
- package/package.json +2 -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"),i=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),i=require("node:path"),g=require("node:url"),o=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=i.dirname(h);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 S({package:e="@devup-ui/react",cssFile:n=i.join(v,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:p=!0,debug:y=!1}={}){if(o.setDebug(y),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
2
|
const exists = !!document.getElementById('devup-ui');
|
|
3
3
|
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
4
4
|
style.id = 'devup-ui';
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
${s}
|
|
7
7
|
\`;
|
|
8
8
|
if (!exists) document.head.appendChild(style);
|
|
9
|
-
`}:{code:m}}}}exports.DevupUI=
|
|
9
|
+
`}:{code:m}}}}exports.DevupUI=S;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface DevupUIPluginOptions {
|
|
|
5
5
|
devupPath: string;
|
|
6
6
|
interfacePath: string;
|
|
7
7
|
extractCss: boolean;
|
|
8
|
+
debug: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function DevupUI({ package: libPackage, cssFile, devupPath, interfacePath, extractCss, }?: Partial<DevupUIPluginOptions>): PluginOption;
|
|
10
|
+
export declare function DevupUI({ package: libPackage, cssFile, devupPath, interfacePath, extractCss, debug, }?: Partial<DevupUIPluginOptions>): PluginOption;
|
|
10
11
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,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;IACnB,KAAK,EAAE,OAAO,CAAA;CACf;AAuBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,EACjB,KAAa,GACd,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA4EnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { existsSync as i, writeFileSync as u, readFileSync as
|
|
2
|
-
import { dirname as
|
|
3
|
-
import { fileURLToPath as
|
|
4
|
-
import { codeExtract as
|
|
5
|
-
const
|
|
1
|
+
import { existsSync as i, writeFileSync as u, readFileSync as g, mkdirSync as h } from "node:fs";
|
|
2
|
+
import { dirname as v, join as l, resolve as d } from "node:path";
|
|
3
|
+
import { fileURLToPath as x } from "node:url";
|
|
4
|
+
import { setDebug as C, codeExtract as T, registerTheme as D, getThemeInterface as j, getCss as S } from "@devup-ui/wasm";
|
|
5
|
+
const w = x(import.meta.url), E = v(w);
|
|
6
6
|
function f(e) {
|
|
7
7
|
var t;
|
|
8
|
-
|
|
9
|
-
const r =
|
|
8
|
+
D((t = JSON.parse(g(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
|
|
9
|
+
const r = j(
|
|
10
10
|
e.package,
|
|
11
11
|
"DevupThemeColors",
|
|
12
12
|
"DevupThemeTypography",
|
|
13
13
|
"DevupTheme"
|
|
14
14
|
);
|
|
15
|
-
r && (i(e.interfacePath) ||
|
|
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, S(), {
|
|
18
18
|
encoding: "utf-8"
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function B({
|
|
22
22
|
package: e = "@devup-ui/react",
|
|
23
|
-
cssFile: r = l(
|
|
23
|
+
cssFile: r = l(E, "devup-ui.css"),
|
|
24
24
|
devupPath: t = "devup.json",
|
|
25
25
|
interfacePath: m = ".df",
|
|
26
|
-
extractCss: p = !0
|
|
26
|
+
extractCss: p = !0,
|
|
27
|
+
debug: y = !1
|
|
27
28
|
} = {}) {
|
|
28
|
-
if (i(t))
|
|
29
|
+
if (C(y), i(t))
|
|
29
30
|
try {
|
|
30
31
|
f({
|
|
31
32
|
package: e,
|
|
@@ -52,7 +53,7 @@ function $({
|
|
|
52
53
|
return s = n.command, !0;
|
|
53
54
|
},
|
|
54
55
|
watchChange(c) {
|
|
55
|
-
if (
|
|
56
|
+
if (d(c) === d(t) && i(t))
|
|
56
57
|
try {
|
|
57
58
|
f({
|
|
58
59
|
package: e,
|
|
@@ -67,11 +68,11 @@ function $({
|
|
|
67
68
|
enforce: "pre",
|
|
68
69
|
transform(c, n) {
|
|
69
70
|
if (!p || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
70
|
-
const { code:
|
|
71
|
+
const { code: a, css: o } = T(n, c, e, r);
|
|
71
72
|
return o && (u(r, o, {
|
|
72
73
|
encoding: "utf-8"
|
|
73
74
|
}), s === "serve") ? {
|
|
74
|
-
code: `${
|
|
75
|
+
code: `${a}
|
|
75
76
|
const exists = !!document.getElementById('devup-ui');
|
|
76
77
|
const style = document.getElementById('devup-ui') || document.createElement('style');
|
|
77
78
|
style.id = 'devup-ui';
|
|
@@ -81,11 +82,11 @@ function $({
|
|
|
81
82
|
if (!exists) document.head.appendChild(style);
|
|
82
83
|
`
|
|
83
84
|
} : {
|
|
84
|
-
code:
|
|
85
|
+
code: a
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
90
|
export {
|
|
90
|
-
|
|
91
|
+
B as DevupUI
|
|
91
92
|
};
|
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.42",
|
|
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.44"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vite-plugin-dts": "^4.5.0",
|