@devup-ui/vite-plugin 1.0.13 → 1.0.14
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 +52 -50
- package/package.json +2 -2
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node:fs"),w=require("node:fs/promises"),l=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node:fs"),w=require("node:fs/promises"),l=require("node:path"),c=require("@devup-ui/wasm"),m=require("vite");function y(e){var s;if(i.existsSync(e.interfacePath)||i.mkdirSync(e.interfacePath),i.existsSync(e.devupPath)){c.registerTheme((s=JSON.parse(i.readFileSync(e.devupPath,"utf-8")))==null?void 0:s.theme);const u=c.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");u&&i.writeFileSync(l.join(e.interfacePath,"theme.d.ts"),u,{encoding:"utf-8"})}i.existsSync(e.cssFile)||i.writeFileSync(e.cssFile,"",{encoding:"utf-8"}),i.writeFileSync(l.join(e.interfacePath,".gitignore"),"*",{encoding:"utf-8"})}let f="";function T({package:e="@devup-ui/react",devupPath:s="devup.json",interfacePath:u="df",cssFile:a=l.resolve(u,"devup-ui.css"),extractCss:d=!0,debug:v=!1,include:g=[]}={}){c.setDebug(v);try{y({package:e,cssFile:a,devupPath:s,interfacePath:u})}catch(t){console.error(t)}const h=c.getDefaultTheme();return h&&JSON.stringify(h),{name:"devup-ui",config(){const t=c.getDefaultTheme(),r={};t&&(r["process.env.DEVUP_UI_DEFAULT_THEME"]=JSON.stringify(t));const n={server:{watch:{ignored:[`!${s}`]}},define:r,optimizeDeps:{exclude:g}};return d&&(n.build={rollupOptions:{output:{manualChunks(o){if(o.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),n},apply(){return!0},watchChange(t){if(l.resolve(t)===l.resolve(s)&&i.existsSync(s))try{y({package:e,cssFile:a,devupPath:s,interfacePath:u})}catch(r){console.error(r)}},resolveId(t){if(m.normalizePath(t)===m.normalizePath(a))return`devup-ui.css?t=${Date.now().toString()+f.length}`},load(t){if(t.split("?")[0]==="devup-ui.css")return f=c.getCss()},enforce:"pre",async transform(t,r){if(!d)return;const n=r.split("?")[0];if((g.length?new RegExp(`node_modules(?!(${g.map(D=>`.*${D}`).join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(n):r.includes("node_modules"))||!/\.(tsx|ts|js|mjs|jsx)$/i.test(n))return;const{code:o,css:p,map:S}=c.codeExtract(n,t,e,a);return p&&f.length<p.length&&(f=p,await w.writeFile(a,`/* ${r} ${Date.now()} */`,{encoding:"utf-8"})),{code:o,map:S}},async generateBundle(t,r){if(!d)return;const n=Object.keys(r).find(o=>o.includes("devup-ui")&&o.endsWith(".css"));n&&"source"in r[n]&&(r[n].source=f)}}}exports.DevupUI=T;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,YAAY,EAAmB,MAAM,MAAM,CAAA;AAExE,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;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,YAAY,EAAmB,MAAM,MAAM,CAAA;AAExE,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;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAiCD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAoB,EACpB,OAAgD,EAChD,UAAiB,EACjB,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA8HnD"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,64 +1,66 @@
|
|
|
1
|
-
import { existsSync as f, mkdirSync as
|
|
2
|
-
import { writeFile as
|
|
3
|
-
import { resolve as
|
|
4
|
-
import { setDebug as E, getDefaultTheme as
|
|
5
|
-
import { normalizePath as
|
|
6
|
-
function
|
|
1
|
+
import { existsSync as f, mkdirSync as $, readFileSync as j, writeFileSync as d } from "node:fs";
|
|
2
|
+
import { writeFile as _ } from "node:fs/promises";
|
|
3
|
+
import { resolve as l, join as h } from "node:path";
|
|
4
|
+
import { setDebug as E, getDefaultTheme as v, codeExtract as k, getCss as x, registerTheme as C, getThemeInterface as O } from "@devup-ui/wasm";
|
|
5
|
+
import { normalizePath as y } from "vite";
|
|
6
|
+
function D(e) {
|
|
7
7
|
var i;
|
|
8
|
-
if (f(
|
|
8
|
+
if (f(e.interfacePath) || $(e.interfacePath), f(e.devupPath)) {
|
|
9
9
|
C(
|
|
10
|
-
(i = JSON.parse(
|
|
10
|
+
(i = JSON.parse(j(e.devupPath, "utf-8"))) == null ? void 0 : i.theme
|
|
11
11
|
);
|
|
12
12
|
const s = O(
|
|
13
|
-
|
|
13
|
+
e.package,
|
|
14
14
|
"DevupThemeColors",
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
s &&
|
|
18
|
+
s && d(h(e.interfacePath, "theme.d.ts"), s, {
|
|
19
19
|
encoding: "utf-8"
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
f(
|
|
22
|
+
f(e.cssFile) || d(e.cssFile, "", {
|
|
23
|
+
encoding: "utf-8"
|
|
24
|
+
}), d(h(e.interfacePath, ".gitignore"), "*", {
|
|
23
25
|
encoding: "utf-8"
|
|
24
26
|
});
|
|
25
27
|
}
|
|
26
28
|
let c = "";
|
|
27
29
|
function z({
|
|
28
|
-
package:
|
|
30
|
+
package: e = "@devup-ui/react",
|
|
29
31
|
devupPath: i = "devup.json",
|
|
30
|
-
interfacePath: s = "
|
|
31
|
-
cssFile: u =
|
|
32
|
+
interfacePath: s = "df",
|
|
33
|
+
cssFile: u = l(s, "devup-ui.css"),
|
|
32
34
|
extractCss: a = !0,
|
|
33
|
-
debug:
|
|
34
|
-
include:
|
|
35
|
+
debug: w = !1,
|
|
36
|
+
include: m = []
|
|
35
37
|
} = {}) {
|
|
36
|
-
E(
|
|
38
|
+
E(w);
|
|
37
39
|
try {
|
|
38
|
-
|
|
39
|
-
package:
|
|
40
|
+
D({
|
|
41
|
+
package: e,
|
|
40
42
|
cssFile: u,
|
|
41
43
|
devupPath: i,
|
|
42
44
|
interfacePath: s
|
|
43
45
|
});
|
|
44
|
-
} catch (
|
|
45
|
-
console.error(
|
|
46
|
+
} catch (t) {
|
|
47
|
+
console.error(t);
|
|
46
48
|
}
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
+
const g = v();
|
|
50
|
+
return g && JSON.stringify(g), {
|
|
49
51
|
name: "devup-ui",
|
|
50
52
|
config() {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
+
const t = v(), r = {};
|
|
54
|
+
t && (r["process.env.DEVUP_UI_DEFAULT_THEME"] = JSON.stringify(t));
|
|
53
55
|
const n = {
|
|
54
56
|
server: {
|
|
55
57
|
watch: {
|
|
56
58
|
ignored: [`!${i}`]
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
|
-
define:
|
|
61
|
+
define: r,
|
|
60
62
|
optimizeDeps: {
|
|
61
|
-
exclude:
|
|
63
|
+
exclude: m
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
66
|
return a && (n.build = {
|
|
@@ -75,52 +77,52 @@ function z({
|
|
|
75
77
|
apply() {
|
|
76
78
|
return !0;
|
|
77
79
|
},
|
|
78
|
-
watchChange(
|
|
79
|
-
if (
|
|
80
|
+
watchChange(t) {
|
|
81
|
+
if (l(t) === l(i) && f(i))
|
|
80
82
|
try {
|
|
81
|
-
|
|
82
|
-
package:
|
|
83
|
+
D({
|
|
84
|
+
package: e,
|
|
83
85
|
cssFile: u,
|
|
84
86
|
devupPath: i,
|
|
85
87
|
interfacePath: s
|
|
86
88
|
});
|
|
87
|
-
} catch (
|
|
88
|
-
console.error(
|
|
89
|
+
} catch (r) {
|
|
90
|
+
console.error(r);
|
|
89
91
|
}
|
|
90
92
|
},
|
|
91
|
-
resolveId(
|
|
92
|
-
if (
|
|
93
|
+
resolveId(t) {
|
|
94
|
+
if (y(t) === y(u))
|
|
93
95
|
return `devup-ui.css?t=${Date.now().toString() + c.length}`;
|
|
94
96
|
},
|
|
95
|
-
load(
|
|
96
|
-
if (
|
|
97
|
+
load(t) {
|
|
98
|
+
if (t.split("?")[0] === "devup-ui.css")
|
|
97
99
|
return c = x();
|
|
98
100
|
},
|
|
99
101
|
enforce: "pre",
|
|
100
|
-
async transform(
|
|
102
|
+
async transform(t, r) {
|
|
101
103
|
if (!a) return;
|
|
102
|
-
const n =
|
|
103
|
-
if ((
|
|
104
|
-
`node_modules(?!(${
|
|
105
|
-
).test(n) :
|
|
104
|
+
const n = r.split("?")[0];
|
|
105
|
+
if ((m.length ? new RegExp(
|
|
106
|
+
`node_modules(?!(${m.map((S) => `.*${S}`).join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
107
|
+
).test(n) : r.includes("node_modules")) || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
|
|
106
108
|
const {
|
|
107
109
|
code: o,
|
|
108
|
-
css:
|
|
109
|
-
map:
|
|
110
|
-
} = k(n,
|
|
111
|
-
return
|
|
110
|
+
css: p,
|
|
111
|
+
map: T
|
|
112
|
+
} = k(n, t, e, u);
|
|
113
|
+
return p && c.length < p.length && (c = p, await _(u, `/* ${r} ${Date.now()} */`, {
|
|
112
114
|
encoding: "utf-8"
|
|
113
115
|
})), {
|
|
114
116
|
code: o,
|
|
115
|
-
map:
|
|
117
|
+
map: T
|
|
116
118
|
};
|
|
117
119
|
},
|
|
118
|
-
async generateBundle(
|
|
120
|
+
async generateBundle(t, r) {
|
|
119
121
|
if (!a) return;
|
|
120
|
-
const n = Object.keys(
|
|
122
|
+
const n = Object.keys(r).find(
|
|
121
123
|
(o) => o.includes("devup-ui") && o.endsWith(".css")
|
|
122
124
|
);
|
|
123
|
-
n && "source" in
|
|
125
|
+
n && "source" in r[n] && (r[n].source = c);
|
|
124
126
|
}
|
|
125
127
|
};
|
|
126
128
|
}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"vite"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "1.0.
|
|
21
|
+
"version": "1.0.14",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@devup-ui/wasm": "1.0.
|
|
39
|
+
"@devup-ui/wasm": "1.0.14"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"vite-plugin-dts": "^4.5.4",
|