@devup-ui/rsbuild-plugin 1.0.28 → 1.0.29
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 +73 -32
- package/package.json +3 -3
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 f=require("node:fs"),i=require("node:fs/promises"),a=require("node:path"),r=require("@devup-ui/wasm");let d="";async function T(e){var n;try{const u=f.existsSync(e.devupFile)?await i.readFile(e.devupFile,"utf-8"):void 0;if(u){r.registerTheme(((n=JSON.parse(u))==null?void 0:n.theme)??{});const s=r.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");s&&await i.writeFile(a.join(e.distDir,"theme.d.ts"),s,"utf-8")}else r.registerTheme({})}catch(u){console.error(u),r.registerTheme({})}await Promise.all([f.existsSync(e.cssDir)?Promise.resolve():i.mkdir(e.cssDir,{recursive:!0}),e.singleCss?Promise.resolve():i.writeFile(a.join(e.cssDir,"devup-ui.css"),r.getCss())])}const j=({include:e=[],package:n="@devup-ui/react",extractCss:u=!0,distDir:s="df",cssDir:l=a.resolve(s,"devup-ui"),devupFile:p="devup.json",debug:h=!1,singleCss:v=!1}={})=>({name:"devup-ui-rsbuild-plugin",async setup(c){r.setDebug(h),f.existsSync(s)||await i.mkdir(s,{recursive:!0}),await i.writeFile(a.join(s,".gitignore"),"*","utf-8"),await T({package:n,cssDir:l,devupFile:p,distDir:s,singleCss:v}),u&&(c.transform({test:l},()=>d),c.modifyRsbuildConfig(t=>(r.getDefaultTheme()&&(t.source??(t.source={}),t.source.define={"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(r.getDefaultTheme()),...t.source.define}),t)),c.transform({test:/\.(tsx|ts|js|mjs|jsx)$/},async({code:t,resourcePath:o})=>{if(new RegExp(`node_modules(?!.*(${["@devup-ui",...e].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(o))return t;const{code:g,css:m,map:w,css_file:y}=r.codeExtract(o,t,n,l,v);return m&&(d.length<m.length&&(d=m),await i.writeFile(a.join(l,a.basename(y)),`/* ${o} ${Date.now()} */`,"utf-8")),{code:g,map:w}}))}});exports.DevupUI=j;
|
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,aAwE7C,CAAA"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,47 +1,88 @@
|
|
|
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 h, writeFile as m, readFile as j } from "node:fs/promises";
|
|
3
|
+
import { join as l, resolve as x, basename as C } from "node:path";
|
|
4
|
+
import { setDebug as E, getDefaultTheme as v, codeExtract as F, registerTheme as f, getThemeInterface as _, getCss as $ } from "@devup-ui/wasm";
|
|
5
|
+
let c = "";
|
|
6
|
+
async function b(e) {
|
|
7
|
+
var a;
|
|
8
|
+
try {
|
|
9
|
+
const s = d(e.devupFile) ? await j(e.devupFile, "utf-8") : void 0;
|
|
10
|
+
if (s) {
|
|
11
|
+
f(((a = JSON.parse(s)) == null ? void 0 : a.theme) ?? {});
|
|
12
|
+
const r = _(
|
|
13
|
+
e.package,
|
|
14
|
+
"DevupThemeColors",
|
|
15
|
+
"DevupThemeTypography",
|
|
16
|
+
"DevupTheme"
|
|
17
|
+
);
|
|
18
|
+
r && await m(
|
|
19
|
+
l(e.distDir, "theme.d.ts"),
|
|
20
|
+
r,
|
|
21
|
+
"utf-8"
|
|
22
|
+
);
|
|
23
|
+
} else
|
|
24
|
+
f({});
|
|
25
|
+
} catch (s) {
|
|
26
|
+
console.error(s), f({});
|
|
27
|
+
}
|
|
28
|
+
await Promise.all([
|
|
29
|
+
d(e.cssDir) ? Promise.resolve() : h(e.cssDir, { recursive: !0 }),
|
|
30
|
+
e.singleCss ? Promise.resolve() : m(l(e.cssDir, "devup-ui.css"), $())
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
const A = ({
|
|
34
|
+
include: e = [],
|
|
35
|
+
package: a = "@devup-ui/react",
|
|
36
|
+
extractCss: s = !0,
|
|
37
|
+
distDir: r = "df",
|
|
38
|
+
cssDir: u = x(r, "devup-ui"),
|
|
39
|
+
devupFile: w = "devup.json",
|
|
40
|
+
debug: g = !1,
|
|
41
|
+
singleCss: p = !1
|
|
11
42
|
} = {}) => ({
|
|
12
43
|
name: "devup-ui-rsbuild-plugin",
|
|
13
|
-
async setup(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
44
|
+
async setup(o) {
|
|
45
|
+
E(g), d(r) || await h(r, { recursive: !0 }), await m(l(r, ".gitignore"), "*", "utf-8"), await b({
|
|
46
|
+
package: a,
|
|
47
|
+
cssDir: u,
|
|
48
|
+
devupFile: w,
|
|
49
|
+
distDir: r,
|
|
50
|
+
singleCss: p
|
|
51
|
+
}), s && (o.transform(
|
|
17
52
|
{
|
|
18
|
-
test:
|
|
53
|
+
test: u
|
|
19
54
|
},
|
|
20
|
-
() =>
|
|
21
|
-
),
|
|
55
|
+
() => c
|
|
56
|
+
), o.modifyRsbuildConfig((t) => (v() && (t.source ?? (t.source = {}), t.source.define = {
|
|
57
|
+
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(v()),
|
|
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: i }) => {
|
|
64
|
+
if (new RegExp(
|
|
65
|
+
`node_modules(?!.*(${["@devup-ui", ...e].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
66
|
+
).test(i))
|
|
67
|
+
return t;
|
|
30
68
|
const {
|
|
31
|
-
code:
|
|
32
|
-
css:
|
|
33
|
-
map:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
69
|
+
code: y,
|
|
70
|
+
css: n,
|
|
71
|
+
map: T,
|
|
72
|
+
css_file: D
|
|
73
|
+
} = F(i, t, a, u, p);
|
|
74
|
+
return n && (c.length < n.length && (c = n), await m(
|
|
75
|
+
l(u, C(D)),
|
|
76
|
+
`/* ${i} ${Date.now()} */`,
|
|
77
|
+
"utf-8"
|
|
78
|
+
)), {
|
|
79
|
+
code: y,
|
|
80
|
+
map: T
|
|
40
81
|
};
|
|
41
82
|
}
|
|
42
83
|
));
|
|
43
84
|
}
|
|
44
85
|
});
|
|
45
86
|
export {
|
|
46
|
-
|
|
87
|
+
A as DevupUI
|
|
47
88
|
};
|
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.29",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@devup-ui/wasm": "1.0.
|
|
48
|
+
"@devup-ui/wasm": "1.0.33"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@devup-ui/wasm": "*",
|
|
52
52
|
"@rsbuild/core": "*"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@rsbuild/core": "^1.
|
|
55
|
+
"@rsbuild/core": "^1.5.1",
|
|
56
56
|
"vite": "^7.1.3",
|
|
57
57
|
"vite-plugin-dts": "^4.5.4",
|
|
58
58
|
"vitest": "^3.2.4",
|