@devup-ui/rsbuild-plugin 1.0.44 → 1.0.46
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 +2 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +31 -30
- package/package.json +3 -3
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("node:fs"),s=require("node:fs/promises"),u=require("node:path"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("node:fs"),s=require("node:fs/promises"),u=require("node:path"),e=require("@devup-ui/wasm");let m="";async function C(t){try{const r=d.existsSync(t.devupFile)?await s.readFile(t.devupFile,"utf-8"):void 0;if(r){e.registerTheme(JSON.parse(r)?.theme??{});const n=e.getThemeInterface(t.package,"CustomColors","DevupThemeTypography","DevupTheme");n&&await s.writeFile(u.join(t.distDir,"theme.d.ts"),n,"utf-8")}else e.registerTheme({})}catch(r){console.error(r),e.registerTheme({})}await Promise.all([d.existsSync(t.cssDir)?Promise.resolve():s.mkdir(t.cssDir,{recursive:!0}),t.singleCss?Promise.resolve():s.writeFile(u.join(t.cssDir,"devup-ui.css"),e.getCss(null,!1))])}const S=({include:t=[],package:r="@devup-ui/react",extractCss:n=!0,distDir:a="df",cssDir:l=u.resolve(a,"devup-ui"),devupFile:w="devup.json",debug:y=!1,singleCss:p=!1,prefix:v}={})=>({name:"devup-ui-rsbuild-plugin",async setup(c){e.setDebug(y),v&&e.setPrefix(v),d.existsSync(a)||await s.mkdir(a,{recursive:!0}),await s.writeFile(u.join(a,".gitignore"),"*","utf-8"),await C({package:r,cssDir:l,devupFile:w,distDir:a,singleCss:p}),n&&(c.transform({test:l},()=>m),c.modifyRsbuildConfig(i=>(e.getDefaultTheme()&&(i.source??={},i.source.define={"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(e.getDefaultTheme()),...i.source.define}),i)),c.transform({test:/\.(tsx|ts|js|mjs|jsx)$/},async({code:i,resourcePath:o})=>{if(new RegExp(`node_modules(?!.*(${["@devup-ui",...t].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(o))return i;const{code:T,css:g="",map:j,cssFile:h,updatedBaseStyle:F}=e.codeExtract(o,i,r,l,p,!1,!0),f=[];return F&&f.push(s.writeFile(u.join(l,"devup-ui.css"),e.getCss(null,!1),"utf-8")),h&&(m.length<g.length&&(m=g),f.push(s.writeFile(u.join(l,u.basename(h)),`/* ${o} ${Date.now()} */`,"utf-8"))),await Promise.all(f),{code:T,map:j}}))}});exports.DevupUI=S;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface DevupUIRsbuildPluginOptions {
|
|
|
8
8
|
debug: boolean;
|
|
9
9
|
include: string[];
|
|
10
10
|
singleCss: boolean;
|
|
11
|
+
prefix?: string;
|
|
11
12
|
}
|
|
12
|
-
export declare const DevupUI: ({ include, package: libPackage, extractCss, distDir, cssDir, devupFile, debug, singleCss, }?: Partial<DevupUIRsbuildPluginOptions>) => RsbuildPlugin;
|
|
13
|
+
export declare const DevupUI: ({ include, package: libPackage, extractCss, distDir, cssDir, devupFile, debug, singleCss, prefix, }?: Partial<DevupUIRsbuildPluginOptions>) => RsbuildPlugin;
|
|
13
14
|
//# 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":"AAaA,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;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAgDD,eAAO,MAAM,OAAO,GAAI,sGAUrB,OAAO,CAAC,2BAA2B,CAAM,KAAG,aAkG7C,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { existsSync as d } from "node:fs";
|
|
2
|
-
import { mkdir as
|
|
3
|
-
import { join as i, resolve as
|
|
4
|
-
import { setDebug as
|
|
2
|
+
import { mkdir as y, writeFile as a, readFile as D } from "node:fs/promises";
|
|
3
|
+
import { join as i, resolve as _, basename as $ } from "node:path";
|
|
4
|
+
import { setDebug as b, setPrefix as S, getDefaultTheme as w, codeExtract as U, getCss as T, registerTheme as n, getThemeInterface as k } from "@devup-ui/wasm";
|
|
5
5
|
let c = "";
|
|
6
|
-
async function
|
|
6
|
+
async function I(e) {
|
|
7
7
|
try {
|
|
8
|
-
const t = d(e.devupFile) ? await
|
|
8
|
+
const t = d(e.devupFile) ? await D(e.devupFile, "utf-8") : void 0;
|
|
9
9
|
if (t) {
|
|
10
10
|
n(JSON.parse(t)?.theme ?? {});
|
|
11
|
-
const l =
|
|
11
|
+
const l = k(
|
|
12
12
|
e.package,
|
|
13
13
|
"CustomColors",
|
|
14
14
|
"DevupThemeTypography",
|
|
@@ -25,26 +25,27 @@ async function U(e) {
|
|
|
25
25
|
console.error(t), n({});
|
|
26
26
|
}
|
|
27
27
|
await Promise.all([
|
|
28
|
-
d(e.cssDir) ? Promise.resolve() :
|
|
29
|
-
e.singleCss ? Promise.resolve() : a(i(e.cssDir, "devup-ui.css"),
|
|
28
|
+
d(e.cssDir) ? Promise.resolve() : y(e.cssDir, { recursive: !0 }),
|
|
29
|
+
e.singleCss ? Promise.resolve() : a(i(e.cssDir, "devup-ui.css"), T(null, !1))
|
|
30
30
|
]);
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const O = ({
|
|
33
33
|
include: e = [],
|
|
34
34
|
package: t = "@devup-ui/react",
|
|
35
35
|
extractCss: l = !0,
|
|
36
36
|
distDir: r = "df",
|
|
37
|
-
cssDir: u =
|
|
38
|
-
devupFile:
|
|
39
|
-
debug:
|
|
40
|
-
singleCss: p = !1
|
|
37
|
+
cssDir: u = _(r, "devup-ui"),
|
|
38
|
+
devupFile: C = "devup.json",
|
|
39
|
+
debug: F = !1,
|
|
40
|
+
singleCss: p = !1,
|
|
41
|
+
prefix: v
|
|
41
42
|
} = {}) => ({
|
|
42
43
|
name: "devup-ui-rsbuild-plugin",
|
|
43
44
|
async setup(f) {
|
|
44
|
-
|
|
45
|
+
b(F), v && S(v), d(r) || await y(r, { recursive: !0 }), await a(i(r, ".gitignore"), "*", "utf-8"), await I({
|
|
45
46
|
package: t,
|
|
46
47
|
cssDir: u,
|
|
47
|
-
devupFile:
|
|
48
|
+
devupFile: C,
|
|
48
49
|
distDir: r,
|
|
49
50
|
singleCss: p
|
|
50
51
|
}), l && (f.transform(
|
|
@@ -52,8 +53,8 @@ const N = ({
|
|
|
52
53
|
test: u
|
|
53
54
|
},
|
|
54
55
|
() => c
|
|
55
|
-
), f.modifyRsbuildConfig((s) => (
|
|
56
|
-
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(
|
|
56
|
+
), f.modifyRsbuildConfig((s) => (w() && (s.source ??= {}, s.source.define = {
|
|
57
|
+
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(w()),
|
|
57
58
|
...s.source.define
|
|
58
59
|
}), s)), f.transform(
|
|
59
60
|
{
|
|
@@ -65,12 +66,12 @@ const N = ({
|
|
|
65
66
|
).test(o))
|
|
66
67
|
return s;
|
|
67
68
|
const {
|
|
68
|
-
code:
|
|
69
|
-
css:
|
|
70
|
-
map:
|
|
71
|
-
cssFile:
|
|
72
|
-
updatedBaseStyle:
|
|
73
|
-
} =
|
|
69
|
+
code: j,
|
|
70
|
+
css: g = "",
|
|
71
|
+
map: x,
|
|
72
|
+
cssFile: h,
|
|
73
|
+
updatedBaseStyle: E
|
|
74
|
+
} = U(
|
|
74
75
|
o,
|
|
75
76
|
s,
|
|
76
77
|
t,
|
|
@@ -79,26 +80,26 @@ const N = ({
|
|
|
79
80
|
!1,
|
|
80
81
|
!0
|
|
81
82
|
), m = [];
|
|
82
|
-
return
|
|
83
|
+
return E && m.push(
|
|
83
84
|
a(
|
|
84
85
|
i(u, "devup-ui.css"),
|
|
85
|
-
|
|
86
|
+
T(null, !1),
|
|
86
87
|
"utf-8"
|
|
87
88
|
)
|
|
88
|
-
),
|
|
89
|
+
), h && (c.length < g.length && (c = g), m.push(
|
|
89
90
|
a(
|
|
90
|
-
i(u,
|
|
91
|
+
i(u, $(h)),
|
|
91
92
|
`/* ${o} ${Date.now()} */`,
|
|
92
93
|
"utf-8"
|
|
93
94
|
)
|
|
94
95
|
)), await Promise.all(m), {
|
|
95
|
-
code:
|
|
96
|
-
map:
|
|
96
|
+
code: j,
|
|
97
|
+
map: x
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
));
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
103
|
export {
|
|
103
|
-
|
|
104
|
+
O as DevupUI
|
|
104
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.46",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@devup-ui/wasm": "1.0.
|
|
48
|
+
"@devup-ui/wasm": "^1.0.54"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@devup-ui/wasm": "*",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@rsbuild/core": "^1.6",
|
|
56
|
-
"vite": "^7.
|
|
56
|
+
"vite": "^7.3",
|
|
57
57
|
"vite-plugin-dts": "^4.5",
|
|
58
58
|
"vitest": "^4.0",
|
|
59
59
|
"typescript": "^5.9"
|