@devup-ui/webpack-plugin 0.1.58 → 0.1.60
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 +25 -21
- package/package.json +6 -6
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var y=(o,e,s)=>e in o?v(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s;var f=(o,e,s)=>y(o,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("node:fs"),
|
|
1
|
+
"use strict";var v=Object.defineProperty;var y=(o,e,s)=>e in o?v(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s;var f=(o,e,s)=>y(o,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("node:fs"),g=require("node:module"),c=require("node:path"),a=require("@devup-ui/wasm");var p=typeof document<"u"?document.currentScript:null;class S{constructor({package:e="@devup-ui/react",devupPath:s="devup.json",interfacePath:n=".df",cssFile:r=c.resolve(n,"devup-ui.css"),watch:i=!1,debug:u=!1,include:h=[]}={}){f(this,"options");this.options={package:e,cssFile:r,devupPath:s,interfacePath:n,watch:i,debug:u,include:h}}writeDataFiles(){var s;a.registerTheme((s=JSON.parse(t.readFileSync(this.options.devupPath,"utf-8")))==null?void 0:s.theme);const e=a.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");e&&t.writeFileSync(c.join(this.options.interfacePath,"theme.d.ts"),e,{encoding:"utf-8"}),this.options.watch&&t.writeFileSync(this.options.cssFile,`/* ${Date.now()} */`,{encoding:"utf-8"})}apply(e){a.setDebug(this.options.debug);const s=t.existsSync(this.options.devupPath);t.existsSync(this.options.interfacePath)||t.mkdirSync(this.options.interfacePath);const n=c.join(this.options.interfacePath,"sheet.json"),r=c.join(this.options.interfacePath,"classMap.json");if(this.options.watch){try{t.existsSync(n)&&a.importSheet(JSON.parse(t.readFileSync(n,"utf-8"))),t.existsSync(r)&&a.importClassMap(JSON.parse(t.readFileSync(r,"utf-8")))}catch(u){console.error(u)}let i=null;e.hooks.watchRun.tapAsync("DevupUIWebpackPlugin",(u,h)=>{s&&t.stat(this.options.devupPath,(l,m)=>{if(l){console.error(`Error checking ${this.options.devupPath}:`,l);return}const d=m.mtimeMs;i&&i!==d&&this.writeDataFiles(),i=d}),h()})}if(s){try{this.writeDataFiles()}catch(i){console.error(i)}e.hooks.afterCompile.tap("DevupUIWebpackPlugin",i=>{i.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(a.getDefaultTheme())})),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:n,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=S;
|
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":"AAkBA,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,aAAqB,EACrB,OAAgD,EAChD,KAAa,EACb,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAY5C,cAAc;IA2Bd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAqGzB"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var w = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { readFileSync as c, writeFileSync as h, existsSync as
|
|
2
|
+
var D = (i, e, t) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var d = (i, e, t) => D(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { readFileSync as c, writeFileSync as h, existsSync as p, mkdirSync as k, stat as F } from "node:fs";
|
|
5
5
|
import { createRequire as m } from "node:module";
|
|
6
|
-
import { resolve as g, join as
|
|
7
|
-
import { registerTheme as P, getThemeInterface as y, setDebug as
|
|
6
|
+
import { resolve as g, join as u } from "node:path";
|
|
7
|
+
import { registerTheme as P, getThemeInterface as y, setDebug as T, importSheet as S, importClassMap as b, getDefaultTheme as j } from "@devup-ui/wasm";
|
|
8
8
|
class I {
|
|
9
9
|
constructor({
|
|
10
10
|
package: e = "@devup-ui/react",
|
|
11
11
|
devupPath: t = "devup.json",
|
|
12
12
|
interfacePath: o = ".df",
|
|
13
|
-
cssFile:
|
|
13
|
+
cssFile: n = g(o, "devup-ui.css"),
|
|
14
14
|
watch: s = !1,
|
|
15
15
|
debug: a = !1,
|
|
16
16
|
include: r = []
|
|
17
17
|
} = {}) {
|
|
18
|
-
|
|
18
|
+
d(this, "options");
|
|
19
19
|
this.options = {
|
|
20
20
|
package: e,
|
|
21
|
-
cssFile:
|
|
21
|
+
cssFile: n,
|
|
22
22
|
devupPath: t,
|
|
23
23
|
interfacePath: o,
|
|
24
24
|
watch: s,
|
|
@@ -38,7 +38,7 @@ class I {
|
|
|
38
38
|
"DevupTheme"
|
|
39
39
|
);
|
|
40
40
|
e && h(
|
|
41
|
-
|
|
41
|
+
u(this.options.interfacePath, "theme.d.ts"),
|
|
42
42
|
e,
|
|
43
43
|
{
|
|
44
44
|
encoding: "utf-8"
|
|
@@ -48,13 +48,13 @@ class I {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
apply(e) {
|
|
51
|
-
|
|
52
|
-
const t =
|
|
53
|
-
|
|
54
|
-
const o =
|
|
51
|
+
T(this.options.debug);
|
|
52
|
+
const t = p(this.options.devupPath);
|
|
53
|
+
p(this.options.interfacePath) || k(this.options.interfacePath);
|
|
54
|
+
const o = u(this.options.interfacePath, "sheet.json"), n = u(this.options.interfacePath, "classMap.json");
|
|
55
55
|
if (this.options.watch) {
|
|
56
56
|
try {
|
|
57
|
-
|
|
57
|
+
p(o) && S(JSON.parse(c(o, "utf-8"))), p(n) && b(JSON.parse(c(n, "utf-8")));
|
|
58
58
|
} catch (a) {
|
|
59
59
|
console.error(a);
|
|
60
60
|
}
|
|
@@ -62,13 +62,13 @@ class I {
|
|
|
62
62
|
e.hooks.watchRun.tapAsync(
|
|
63
63
|
"DevupUIWebpackPlugin",
|
|
64
64
|
(a, r) => {
|
|
65
|
-
t && F(this.options.devupPath, (
|
|
66
|
-
if (
|
|
67
|
-
console.error(`Error checking ${this.options.devupPath}:`,
|
|
65
|
+
t && F(this.options.devupPath, (l, v) => {
|
|
66
|
+
if (l) {
|
|
67
|
+
console.error(`Error checking ${this.options.devupPath}:`, l);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
s && s !==
|
|
70
|
+
const f = v.mtimeMs;
|
|
71
|
+
s && s !== f && this.writeDataFiles(), s = f;
|
|
72
72
|
}), r();
|
|
73
73
|
}
|
|
74
74
|
);
|
|
@@ -83,7 +83,11 @@ class I {
|
|
|
83
83
|
s.fileDependencies.add(g(this.options.devupPath));
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
p(this.options.cssFile) || h(this.options.cssFile, "", { encoding: "utf-8" }), e.options.plugins.push(
|
|
87
|
+
new e.webpack.DefinePlugin({
|
|
88
|
+
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(j())
|
|
89
|
+
})
|
|
90
|
+
), e.options.module.rules.push(
|
|
87
91
|
{
|
|
88
92
|
test: /\.(tsx|ts|js|mjs|jsx)$/,
|
|
89
93
|
exclude: new RegExp(
|
|
@@ -99,7 +103,7 @@ class I {
|
|
|
99
103
|
package: this.options.package,
|
|
100
104
|
cssFile: this.options.cssFile,
|
|
101
105
|
sheetFile: o,
|
|
102
|
-
classMapFile:
|
|
106
|
+
classMapFile: n,
|
|
103
107
|
watch: this.options.watch
|
|
104
108
|
}
|
|
105
109
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devup-ui/webpack-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.60",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@devup-ui/wasm": "0.1.
|
|
31
|
+
"@devup-ui/wasm": "0.1.54"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@devup-ui/wasm": "*"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"vite": "^6.
|
|
37
|
+
"vite": "^6.2.2",
|
|
38
38
|
"@types/webpack": "^5.28.5",
|
|
39
|
-
"vite-plugin-dts": "^4.5.
|
|
40
|
-
"vitest": "^3.0.
|
|
41
|
-
"typescript": "^5.
|
|
39
|
+
"vite-plugin-dts": "^4.5.3",
|
|
40
|
+
"vitest": "^3.0.9",
|
|
41
|
+
"typescript": "^5.8.2"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"lint": "eslint",
|