@devup-ui/webpack-plugin 1.0.12 → 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/css-loader.cjs +1 -1
- package/dist/css-loader.js +11 -11
- package/dist/loader.cjs +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +27 -22
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +27 -25
- package/package.json +3 -3
package/dist/css-loader.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@devup-ui/wasm");let r="",c="";const o=function(n,t,e){var l;const{watch:u}=this.getOptions();if(!u)return this.callback(null,i.getCss());const s=((l=this._compiler)==null?void 0:l.__DEVUP_CACHE)||n.toString();if(c===s){this.callback(null,r,t,e);return}c=s,this.callback(null,r=i.getCss(),t,e)};exports.default=o;
|
package/dist/css-loader.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getCss as
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
var
|
|
5
|
-
const { watch:
|
|
6
|
-
if (!
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
this.callback(null,
|
|
1
|
+
import { getCss as i } from "@devup-ui/wasm";
|
|
2
|
+
let r = "", c = "";
|
|
3
|
+
const u = function(n, t, l) {
|
|
4
|
+
var e;
|
|
5
|
+
const { watch: o } = this.getOptions();
|
|
6
|
+
if (!o) return this.callback(null, i());
|
|
7
|
+
const s = ((e = this._compiler) == null ? void 0 : e.__DEVUP_CACHE) || n.toString();
|
|
8
|
+
if (c === s) {
|
|
9
|
+
this.callback(null, r, t, l);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
c = s, this.callback(null, r = i(), t, l);
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
u as default
|
|
16
16
|
};
|
package/dist/loader.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("node:fs/promises"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("node:fs/promises"),n=require("node:path"),s=require("@devup-ui/wasm"),P=function(u){const{watch:h,package:p,cssFile:i,sheetFile:d,classMapFile:m}=this.getOptions(),t=this.async(),_=this.resourcePath;try{let e=n.relative(n.dirname(this.resourcePath),i).replaceAll("\\","/");e.startsWith("./")||(e=`./${e}`);const{code:c,css:f,map:o}=s.codeExtract(_,u.toString(),p,e),l=o?JSON.parse(o):null;if(f&&h){const a=`${this.resourcePath} ${Date.now()}`;this._compiler&&(this._compiler.__DEVUP_CACHE=a),Promise.all([r.writeFile(i,`/* ${a} */`),r.writeFile(d,s.exportSheet()),r.writeFile(m,s.exportClassMap())]).catch(console.error).finally(()=>t(null,c,l));return}t(null,c,l)}catch(e){t(e)}};exports.default=P;
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CA2ClE,CAAA;AACH,eAAe,aAAa,CAAA"}
|
package/dist/loader.js
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import { writeFile as r } from "node:fs/promises";
|
|
2
|
-
import { relative as
|
|
3
|
-
import { codeExtract as
|
|
4
|
-
const w = function(
|
|
2
|
+
import { relative as d, dirname as P } from "node:path";
|
|
3
|
+
import { codeExtract as _, exportSheet as g, exportClassMap as x } from "@devup-ui/wasm";
|
|
4
|
+
const w = function(l) {
|
|
5
5
|
const {
|
|
6
|
-
watch:
|
|
7
|
-
package:
|
|
6
|
+
watch: n,
|
|
7
|
+
package: p,
|
|
8
8
|
cssFile: o,
|
|
9
|
-
sheetFile:
|
|
10
|
-
classMapFile:
|
|
11
|
-
} = this.getOptions(), e = this.async(),
|
|
9
|
+
sheetFile: h,
|
|
10
|
+
classMapFile: u
|
|
11
|
+
} = this.getOptions(), e = this.async(), m = this.resourcePath;
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
let t = d(P(this.resourcePath), o).replaceAll(
|
|
14
|
+
"\\",
|
|
15
|
+
"/"
|
|
16
|
+
);
|
|
17
|
+
t.startsWith("./") || (t = `./${t}`);
|
|
18
|
+
const { code: s, css: f, map: c } = _(
|
|
19
|
+
m,
|
|
20
|
+
l.toString(),
|
|
21
|
+
p,
|
|
22
|
+
t
|
|
23
|
+
), a = c ? JSON.parse(c) : null;
|
|
24
|
+
if (f && n) {
|
|
25
|
+
const i = `${this.resourcePath} ${Date.now()}`;
|
|
26
|
+
this._compiler && (this._compiler.__DEVUP_CACHE = i), Promise.all([
|
|
27
|
+
r(o, `/* ${i} */`),
|
|
28
|
+
r(h, g()),
|
|
29
|
+
r(u, x())
|
|
30
|
+
]).catch(console.error).finally(() => e(null, s, a));
|
|
26
31
|
return;
|
|
27
32
|
}
|
|
28
|
-
e(null,
|
|
33
|
+
e(null, s, a);
|
|
29
34
|
} catch (t) {
|
|
30
35
|
e(t);
|
|
31
36
|
}
|
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var y=(n,e,
|
|
1
|
+
"use strict";var v=Object.defineProperty;var y=(n,e,i)=>e in n?v(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var f=(n,e,i)=>y(n,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("node:fs"),g=require("node:module"),c=require("node:path"),o=require("@devup-ui/wasm");var p=typeof document<"u"?document.currentScript:null;class w{constructor({package:e="@devup-ui/react",devupPath:i="devup.json",interfacePath:a="df",cssFile:r=c.resolve(a,"devup-ui.css"),watch:s=!1,debug:u=!1,include:h=[]}={}){f(this,"options");this.options={package:e,cssFile:r,devupPath:i,interfacePath:a,watch:s,debug:u,include:h}}writeDataFiles(){var i;o.registerTheme((i=JSON.parse(t.readFileSync(this.options.devupPath,"utf-8")))==null?void 0:i.theme);const e=o.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");e&&t.writeFileSync(c.join(this.options.interfacePath,"theme.d.ts"),e,{encoding:"utf-8"}),t.writeFileSync(c.join(this.options.interfacePath,".gitignore"),"*",{encoding:"utf-8"}),this.options.watch&&t.writeFileSync(this.options.cssFile,`/* ${Date.now()} */`,{encoding:"utf-8"})}apply(e){o.setDebug(this.options.debug);const i=t.existsSync(this.options.devupPath);t.existsSync(this.options.interfacePath)||t.mkdirSync(this.options.interfacePath);const a=c.join(this.options.interfacePath,"sheet.json"),r=c.join(this.options.interfacePath,"classMap.json");if(this.options.watch){try{t.existsSync(a)&&o.importSheet(JSON.parse(t.readFileSync(a,"utf-8"))),t.existsSync(r)&&o.importClassMap(JSON.parse(t.readFileSync(r,"utf-8")))}catch(u){console.error(u)}let s=null;e.hooks.watchRun.tapAsync("DevupUIWebpackPlugin",(u,h)=>{i&&t.stat(this.options.devupPath,(l,m)=>{if(l){console.error(`Error checking ${this.options.devupPath}:`,l);return}const d=m.mtimeMs;s&&s!==d&&this.writeDataFiles(),s=d}),h()})}if(i){try{this.writeDataFiles()}catch(s){console.error(s)}e.hooks.afterCompile.tap("DevupUIWebpackPlugin",s=>{s.fileDependencies.add(c.resolve(this.options.devupPath))})}t.existsSync(this.options.cssFile)||t.writeFileSync(this.options.cssFile,"",{encoding:"utf-8"}),e.options.plugins.push(new e.webpack.DefinePlugin({"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(o.getDefaultTheme())})),this.options.watch||e.hooks.done.tap("DevupUIWebpackPlugin",s=>{s.hasErrors()||t.writeFileSync(this.options.cssFile,o.getCss(),{encoding:"utf-8"})}),e.options.module.rules.push({test:/\.(tsx|ts|js|mjs|jsx)$/,exclude:new RegExp(this.options.include.length?`node_modules(?!.*(${this.options.include.join("|").replaceAll("/","[\\/\\\\]")})([\\/\\\\]|$))`:"node_modules"),enforce:"pre",use:[{loader:g.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("plugin.cjs",document.baseURI).href).resolve("@devup-ui/webpack-plugin/loader"),options:{package:this.options.package,cssFile:this.options.cssFile,sheetFile:a,classMapFile:r,watch:this.options.watch}}]},{test:this.options.cssFile,enforce:"pre",use:[{loader:g.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("plugin.cjs",document.baseURI).href).resolve("@devup-ui/webpack-plugin/css-loader"),options:{watch:this.options.watch}}]})}}exports.DevupUIWebpackPlugin=w;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;gBAExB,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;gBAExB,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAoB,EACpB,OAAgD,EAChD,KAAa,EACb,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAY5C,cAAc;IA+Bd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA6GzB"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var w = Object.defineProperty;
|
|
2
2
|
var D = (i, e, t) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var d = (i, e, t) => D(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { readFileSync as
|
|
4
|
+
import { readFileSync as u, writeFileSync as p, existsSync as a, mkdirSync as k, stat as P } from "node:fs";
|
|
5
5
|
import { createRequire as g } from "node:module";
|
|
6
|
-
import { resolve as m, join as
|
|
7
|
-
import { registerTheme as
|
|
6
|
+
import { resolve as m, join as c } from "node:path";
|
|
7
|
+
import { registerTheme as F, getThemeInterface as y, setDebug as T, importSheet as b, importClassMap as S, getDefaultTheme as j, getCss as x } from "@devup-ui/wasm";
|
|
8
8
|
class C {
|
|
9
9
|
constructor({
|
|
10
10
|
package: e = "@devup-ui/react",
|
|
11
11
|
devupPath: t = "devup.json",
|
|
12
|
-
interfacePath: o = "
|
|
12
|
+
interfacePath: o = "df",
|
|
13
13
|
cssFile: n = m(o, "devup-ui.css"),
|
|
14
14
|
watch: s = !1,
|
|
15
|
-
debug:
|
|
16
|
-
include:
|
|
15
|
+
debug: r = !1,
|
|
16
|
+
include: h = []
|
|
17
17
|
} = {}) {
|
|
18
18
|
d(this, "options");
|
|
19
19
|
this.options = {
|
|
@@ -22,14 +22,14 @@ class C {
|
|
|
22
22
|
devupPath: t,
|
|
23
23
|
interfacePath: o,
|
|
24
24
|
watch: s,
|
|
25
|
-
debug:
|
|
26
|
-
include:
|
|
25
|
+
debug: r,
|
|
26
|
+
include: h
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
writeDataFiles() {
|
|
30
30
|
var t;
|
|
31
|
-
|
|
32
|
-
(t = JSON.parse(
|
|
31
|
+
F(
|
|
32
|
+
(t = JSON.parse(u(this.options.devupPath, "utf-8"))) == null ? void 0 : t.theme
|
|
33
33
|
);
|
|
34
34
|
const e = y(
|
|
35
35
|
this.options.package,
|
|
@@ -37,39 +37,41 @@ class C {
|
|
|
37
37
|
"DevupThemeTypography",
|
|
38
38
|
"DevupTheme"
|
|
39
39
|
);
|
|
40
|
-
e &&
|
|
41
|
-
|
|
40
|
+
e && p(
|
|
41
|
+
c(this.options.interfacePath, "theme.d.ts"),
|
|
42
42
|
e,
|
|
43
43
|
{
|
|
44
44
|
encoding: "utf-8"
|
|
45
45
|
}
|
|
46
|
-
),
|
|
46
|
+
), p(c(this.options.interfacePath, ".gitignore"), "*", {
|
|
47
|
+
encoding: "utf-8"
|
|
48
|
+
}), this.options.watch && p(this.options.cssFile, `/* ${Date.now()} */`, {
|
|
47
49
|
encoding: "utf-8"
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
52
|
apply(e) {
|
|
51
53
|
T(this.options.debug);
|
|
52
|
-
const t =
|
|
53
|
-
|
|
54
|
-
const o =
|
|
54
|
+
const t = a(this.options.devupPath);
|
|
55
|
+
a(this.options.interfacePath) || k(this.options.interfacePath);
|
|
56
|
+
const o = c(this.options.interfacePath, "sheet.json"), n = c(this.options.interfacePath, "classMap.json");
|
|
55
57
|
if (this.options.watch) {
|
|
56
58
|
try {
|
|
57
|
-
|
|
58
|
-
} catch (
|
|
59
|
-
console.error(
|
|
59
|
+
a(o) && b(JSON.parse(u(o, "utf-8"))), a(n) && S(JSON.parse(u(n, "utf-8")));
|
|
60
|
+
} catch (r) {
|
|
61
|
+
console.error(r);
|
|
60
62
|
}
|
|
61
63
|
let s = null;
|
|
62
64
|
e.hooks.watchRun.tapAsync(
|
|
63
65
|
"DevupUIWebpackPlugin",
|
|
64
|
-
(
|
|
65
|
-
t &&
|
|
66
|
+
(r, h) => {
|
|
67
|
+
t && P(this.options.devupPath, (l, v) => {
|
|
66
68
|
if (l) {
|
|
67
69
|
console.error(`Error checking ${this.options.devupPath}:`, l);
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
const f = v.mtimeMs;
|
|
71
73
|
s && s !== f && this.writeDataFiles(), s = f;
|
|
72
|
-
}),
|
|
74
|
+
}), h();
|
|
73
75
|
}
|
|
74
76
|
);
|
|
75
77
|
}
|
|
@@ -83,17 +85,17 @@ class C {
|
|
|
83
85
|
s.fileDependencies.add(m(this.options.devupPath));
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
a(this.options.cssFile) || p(this.options.cssFile, "", { encoding: "utf-8" }), e.options.plugins.push(
|
|
87
89
|
new e.webpack.DefinePlugin({
|
|
88
90
|
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(j())
|
|
89
91
|
})
|
|
90
92
|
), this.options.watch || e.hooks.done.tap("DevupUIWebpackPlugin", (s) => {
|
|
91
|
-
s.hasErrors() ||
|
|
93
|
+
s.hasErrors() || p(this.options.cssFile, x(), { encoding: "utf-8" });
|
|
92
94
|
}), e.options.module.rules.push(
|
|
93
95
|
{
|
|
94
96
|
test: /\.(tsx|ts|js|mjs|jsx)$/,
|
|
95
97
|
exclude: new RegExp(
|
|
96
|
-
this.options.include.length ? `node_modules(
|
|
98
|
+
this.options.include.length ? `node_modules(?!.*(${this.options.include.join("|").replaceAll("/", "[\\/\\\\]")})([\\/\\\\]|$))` : "node_modules"
|
|
97
99
|
),
|
|
98
100
|
enforce: "pre",
|
|
99
101
|
use: [
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"webpack"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "1.0.
|
|
21
|
+
"version": "1.0.14",
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@devup-ui/wasm": "1.0.
|
|
48
|
+
"@devup-ui/wasm": "1.0.14"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@devup-ui/wasm": "*"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"vite": "^7.0.
|
|
54
|
+
"vite": "^7.0.3",
|
|
55
55
|
"@types/webpack": "^5.28.5",
|
|
56
56
|
"vite-plugin-dts": "^4.5.4",
|
|
57
57
|
"vitest": "^3.2.4",
|