@devup-ui/rsbuild-plugin 1.0.28 → 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/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.d.ts +5 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +90 -32
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./plugin.cjs");exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./plugin.cjs");exports.DevupUI=e.DevupUI;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DevupUI, type DevupUIRsbuildPluginOptions } from './plugin';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node:fs/promises"),
|
|
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
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
export interface DevupUIRsbuildPluginOptions {
|
|
3
3
|
package: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
cssDir: string;
|
|
5
|
+
devupFile: string;
|
|
6
|
+
distDir: string;
|
|
7
7
|
extractCss: boolean;
|
|
8
8
|
debug: boolean;
|
|
9
9
|
include: string[];
|
|
10
|
+
singleCss: boolean;
|
|
10
11
|
}
|
|
11
|
-
export declare const
|
|
12
|
+
export declare const DevupUI: ({ include, package: libPackage, extractCss, distDir, cssDir, devupFile, debug, singleCss, }?: Partial<DevupUIRsbuildPluginOptions>) => RsbuildPlugin;
|
|
12
13
|
//# 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":"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,47 +1,105 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { existsSync as d } from "node:fs";
|
|
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
|
+
let c = "";
|
|
6
|
+
async function U(e) {
|
|
7
|
+
var u;
|
|
8
|
+
try {
|
|
9
|
+
const s = d(e.devupFile) ? await D(e.devupFile, "utf-8") : void 0;
|
|
10
|
+
if (s) {
|
|
11
|
+
p(((u = JSON.parse(s)) == null ? void 0 : u.theme) ?? {});
|
|
12
|
+
const r = S(
|
|
13
|
+
e.package,
|
|
14
|
+
"DevupThemeColors",
|
|
15
|
+
"DevupThemeTypography",
|
|
16
|
+
"DevupTheme"
|
|
17
|
+
);
|
|
18
|
+
r && await l(
|
|
19
|
+
i(e.distDir, "theme.d.ts"),
|
|
20
|
+
r,
|
|
21
|
+
"utf-8"
|
|
22
|
+
);
|
|
23
|
+
} else
|
|
24
|
+
p({});
|
|
25
|
+
} catch (s) {
|
|
26
|
+
console.error(s), p({});
|
|
27
|
+
}
|
|
28
|
+
await Promise.all([
|
|
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
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
const N = ({
|
|
34
|
+
include: e = [],
|
|
35
|
+
package: u = "@devup-ui/react",
|
|
36
|
+
extractCss: s = !0,
|
|
37
|
+
distDir: r = "df",
|
|
38
|
+
cssDir: a = E(r, "devup-ui"),
|
|
39
|
+
devupFile: y = "devup.json",
|
|
40
|
+
debug: T = !1,
|
|
41
|
+
singleCss: v = !1
|
|
11
42
|
} = {}) => ({
|
|
12
43
|
name: "devup-ui-rsbuild-plugin",
|
|
13
|
-
async setup(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
44
|
+
async setup(o) {
|
|
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
|
+
distDir: r,
|
|
50
|
+
singleCss: v
|
|
51
|
+
}), s && (o.transform(
|
|
17
52
|
{
|
|
18
|
-
test:
|
|
53
|
+
test: a
|
|
19
54
|
},
|
|
20
|
-
() =>
|
|
21
|
-
),
|
|
55
|
+
() => c
|
|
56
|
+
), o.modifyRsbuildConfig((t) => (h() && (t.source ?? (t.source = {}), t.source.define = {
|
|
57
|
+
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(h()),
|
|
58
|
+
...t.source.define
|
|
59
|
+
}), t)), o.transform(
|
|
22
60
|
{
|
|
23
61
|
test: /\.(tsx|ts|js|mjs|jsx)$/
|
|
24
62
|
},
|
|
25
|
-
async ({ code:
|
|
26
|
-
if (
|
|
27
|
-
`node_modules(
|
|
28
|
-
).test(
|
|
29
|
-
return
|
|
63
|
+
async ({ code: t, resourcePath: m }) => {
|
|
64
|
+
if (new RegExp(
|
|
65
|
+
`node_modules(?!.*(${["@devup-ui", ...e].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
66
|
+
).test(m))
|
|
67
|
+
return t;
|
|
30
68
|
const {
|
|
31
|
-
code:
|
|
32
|
-
css:
|
|
33
|
-
map:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
|
40
98
|
};
|
|
41
99
|
}
|
|
42
100
|
));
|
|
43
101
|
}
|
|
44
102
|
});
|
|
45
103
|
export {
|
|
46
|
-
|
|
104
|
+
N as DevupUI
|
|
47
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.
|
|
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"
|