@devup-ui/rsbuild-plugin 1.0.29 → 1.0.30
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 +60 -43
- package/package.json +4 -4
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("node:fs"),i=require("node:fs/promises"),u=require("node:path"),t=require("@devup-ui/wasm");let f="";async function F(e){var l;try{const a=p.existsSync(e.devupFile)?await i.readFile(e.devupFile,"utf-8"):void 0;if(a){t.registerTheme(((l=JSON.parse(a))==null?void 0:l.theme)??{});const r=t.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");r&&await i.writeFile(u.join(e.distDir,"theme.d.ts"),r,"utf-8")}else t.registerTheme({})}catch(a){console.error(a),t.registerTheme({})}await Promise.all([p.existsSync(e.cssDir)?Promise.resolve():i.mkdir(e.cssDir,{recursive:!0}),e.singleCss?Promise.resolve():i.writeFile(u.join(e.cssDir,"devup-ui.css"),t.getCss(null,!1))])}const D=({include:e=[],package:l="@devup-ui/react",extractCss:a=!0,distDir:r="df",cssDir:n=u.resolve(r,"devup-ui"),devupFile:h="devup.json",debug:g=!1,singleCss:v=!1}={})=>({name:"devup-ui-rsbuild-plugin",async setup(c){t.setDebug(g),p.existsSync(r)||await i.mkdir(r,{recursive:!0}),await i.writeFile(u.join(r,".gitignore"),"*","utf-8"),await F({package:l,cssDir:n,devupFile:h,distDir:r,singleCss:v}),a&&(c.transform({test:n},()=>f),c.modifyRsbuildConfig(s=>(t.getDefaultTheme()&&(s.source??(s.source={}),s.source.define={"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(t.getDefaultTheme()),...s.source.define}),s)),c.transform({test:/\.(tsx|ts|js|mjs|jsx)$/},async({code:s,resourcePath:o})=>{if(new RegExp(`node_modules(?!.*(${["@devup-ui",...e].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(o))return s;const{code:w,css:m,map:y,cssFile:T,updatedBaseStyle:j}=t.codeExtract(o,s,l,n,v,!1,!0),d=[];return j&&d.push(i.writeFile(u.join(n,"devup-ui.css"),t.getCss(null,!1),"utf-8")),m&&(f.length<m.length&&(f=m),d.push(i.writeFile(u.join(n,u.basename(T)),`/* ${o} ${Date.now()} */`,"utf-8"))),await Promise.all(d),{code:w,map:y}}))}});exports.DevupUI=D;
|
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,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;CACnB;AAgDD,eAAO,MAAM,OAAO,GAAI,8FASrB,OAAO,CAAC,2BAA2B,CAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;CACnB;AAgDD,eAAO,MAAM,OAAO,GAAI,8FASrB,OAAO,CAAC,2BAA2B,CAAM,KAAG,aA+F7C,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,88 +1,105 @@
|
|
|
1
1
|
import { existsSync as d } from "node:fs";
|
|
2
|
-
import { mkdir as
|
|
3
|
-
import { join as
|
|
4
|
-
import { setDebug as
|
|
2
|
+
import { mkdir as w, writeFile as l, readFile as D } from "node:fs/promises";
|
|
3
|
+
import { join as i, resolve as E, basename as _ } from "node:path";
|
|
4
|
+
import { setDebug as $, getDefaultTheme as h, codeExtract as b, getCss as g, registerTheme as p, getThemeInterface as S } from "@devup-ui/wasm";
|
|
5
5
|
let c = "";
|
|
6
|
-
async function
|
|
7
|
-
var
|
|
6
|
+
async function U(e) {
|
|
7
|
+
var u;
|
|
8
8
|
try {
|
|
9
|
-
const s = d(e.devupFile) ? await
|
|
9
|
+
const s = d(e.devupFile) ? await D(e.devupFile, "utf-8") : void 0;
|
|
10
10
|
if (s) {
|
|
11
|
-
|
|
12
|
-
const r =
|
|
11
|
+
p(((u = JSON.parse(s)) == null ? void 0 : u.theme) ?? {});
|
|
12
|
+
const r = S(
|
|
13
13
|
e.package,
|
|
14
14
|
"DevupThemeColors",
|
|
15
15
|
"DevupThemeTypography",
|
|
16
16
|
"DevupTheme"
|
|
17
17
|
);
|
|
18
|
-
r && await
|
|
19
|
-
|
|
18
|
+
r && await l(
|
|
19
|
+
i(e.distDir, "theme.d.ts"),
|
|
20
20
|
r,
|
|
21
21
|
"utf-8"
|
|
22
22
|
);
|
|
23
23
|
} else
|
|
24
|
-
|
|
24
|
+
p({});
|
|
25
25
|
} catch (s) {
|
|
26
|
-
console.error(s),
|
|
26
|
+
console.error(s), p({});
|
|
27
27
|
}
|
|
28
28
|
await Promise.all([
|
|
29
|
-
d(e.cssDir) ? Promise.resolve() :
|
|
30
|
-
e.singleCss ? Promise.resolve() :
|
|
29
|
+
d(e.cssDir) ? Promise.resolve() : w(e.cssDir, { recursive: !0 }),
|
|
30
|
+
e.singleCss ? Promise.resolve() : l(i(e.cssDir, "devup-ui.css"), g(null, !1))
|
|
31
31
|
]);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const N = ({
|
|
34
34
|
include: e = [],
|
|
35
|
-
package:
|
|
35
|
+
package: u = "@devup-ui/react",
|
|
36
36
|
extractCss: s = !0,
|
|
37
37
|
distDir: r = "df",
|
|
38
|
-
cssDir:
|
|
39
|
-
devupFile:
|
|
40
|
-
debug:
|
|
41
|
-
singleCss:
|
|
38
|
+
cssDir: a = E(r, "devup-ui"),
|
|
39
|
+
devupFile: y = "devup.json",
|
|
40
|
+
debug: T = !1,
|
|
41
|
+
singleCss: v = !1
|
|
42
42
|
} = {}) => ({
|
|
43
43
|
name: "devup-ui-rsbuild-plugin",
|
|
44
44
|
async setup(o) {
|
|
45
|
-
|
|
46
|
-
package:
|
|
47
|
-
cssDir:
|
|
48
|
-
devupFile:
|
|
45
|
+
$(T), d(r) || await w(r, { recursive: !0 }), await l(i(r, ".gitignore"), "*", "utf-8"), await U({
|
|
46
|
+
package: u,
|
|
47
|
+
cssDir: a,
|
|
48
|
+
devupFile: y,
|
|
49
49
|
distDir: r,
|
|
50
|
-
singleCss:
|
|
50
|
+
singleCss: v
|
|
51
51
|
}), s && (o.transform(
|
|
52
52
|
{
|
|
53
|
-
test:
|
|
53
|
+
test: a
|
|
54
54
|
},
|
|
55
55
|
() => c
|
|
56
|
-
), o.modifyRsbuildConfig((t) => (
|
|
57
|
-
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(
|
|
56
|
+
), o.modifyRsbuildConfig((t) => (h() && (t.source ?? (t.source = {}), t.source.define = {
|
|
57
|
+
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(h()),
|
|
58
58
|
...t.source.define
|
|
59
59
|
}), t)), o.transform(
|
|
60
60
|
{
|
|
61
61
|
test: /\.(tsx|ts|js|mjs|jsx)$/
|
|
62
62
|
},
|
|
63
|
-
async ({ code: t, resourcePath:
|
|
63
|
+
async ({ code: t, resourcePath: m }) => {
|
|
64
64
|
if (new RegExp(
|
|
65
65
|
`node_modules(?!.*(${["@devup-ui", ...e].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
66
|
-
).test(
|
|
66
|
+
).test(m))
|
|
67
67
|
return t;
|
|
68
68
|
const {
|
|
69
|
-
code:
|
|
70
|
-
css:
|
|
71
|
-
map:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
code: F,
|
|
70
|
+
css: f,
|
|
71
|
+
map: j,
|
|
72
|
+
cssFile: x,
|
|
73
|
+
updatedBaseStyle: C
|
|
74
|
+
} = b(
|
|
75
|
+
m,
|
|
76
|
+
t,
|
|
77
|
+
u,
|
|
78
|
+
a,
|
|
79
|
+
v,
|
|
80
|
+
!1,
|
|
81
|
+
!0
|
|
82
|
+
), n = [];
|
|
83
|
+
return C && n.push(
|
|
84
|
+
l(
|
|
85
|
+
i(a, "devup-ui.css"),
|
|
86
|
+
g(null, !1),
|
|
87
|
+
"utf-8"
|
|
88
|
+
)
|
|
89
|
+
), f && (c.length < f.length && (c = f), n.push(
|
|
90
|
+
l(
|
|
91
|
+
i(a, _(x)),
|
|
92
|
+
`/* ${m} ${Date.now()} */`,
|
|
93
|
+
"utf-8"
|
|
94
|
+
)
|
|
95
|
+
)), await Promise.all(n), {
|
|
96
|
+
code: F,
|
|
97
|
+
map: j
|
|
81
98
|
};
|
|
82
99
|
}
|
|
83
100
|
));
|
|
84
101
|
}
|
|
85
102
|
});
|
|
86
103
|
export {
|
|
87
|
-
|
|
104
|
+
N as DevupUI
|
|
88
105
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rsbuild"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "1.0.
|
|
21
|
+
"version": "1.0.30",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@devup-ui/wasm": "1.0.
|
|
48
|
+
"@devup-ui/wasm": "1.0.34"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@devup-ui/wasm": "*",
|
|
52
52
|
"@rsbuild/core": "*"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@rsbuild/core": "^1.5.
|
|
56
|
-
"vite": "^7.1.
|
|
55
|
+
"@rsbuild/core": "^1.5.3",
|
|
56
|
+
"vite": "^7.1.4",
|
|
57
57
|
"vite-plugin-dts": "^4.5.4",
|
|
58
58
|
"vitest": "^3.2.4",
|
|
59
59
|
"typescript": "^5.9.2"
|