@devup-ui/webpack-plugin 0.1.59 → 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 +22 -23
- package/package.json +2 -4
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"),g=require("node:module"),c=require("node:path"),
|
|
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":"AAkBA,OAAO,EAAE,KAAK,QAAQ,
|
|
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,17 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (i, e, t) =>
|
|
4
|
-
import { readFileSync as c, writeFileSync as h, existsSync as
|
|
1
|
+
var w = Object.defineProperty;
|
|
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 T, importSheet as S, importClassMap as
|
|
8
|
-
|
|
9
|
-
class C {
|
|
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
|
+
class I {
|
|
10
9
|
constructor({
|
|
11
10
|
package: e = "@devup-ui/react",
|
|
12
11
|
devupPath: t = "devup.json",
|
|
13
12
|
interfacePath: o = ".df",
|
|
14
|
-
cssFile:
|
|
13
|
+
cssFile: n = g(o, "devup-ui.css"),
|
|
15
14
|
watch: s = !1,
|
|
16
15
|
debug: a = !1,
|
|
17
16
|
include: r = []
|
|
@@ -19,7 +18,7 @@ class C {
|
|
|
19
18
|
d(this, "options");
|
|
20
19
|
this.options = {
|
|
21
20
|
package: e,
|
|
22
|
-
cssFile:
|
|
21
|
+
cssFile: n,
|
|
23
22
|
devupPath: t,
|
|
24
23
|
interfacePath: o,
|
|
25
24
|
watch: s,
|
|
@@ -39,7 +38,7 @@ class C {
|
|
|
39
38
|
"DevupTheme"
|
|
40
39
|
);
|
|
41
40
|
e && h(
|
|
42
|
-
|
|
41
|
+
u(this.options.interfacePath, "theme.d.ts"),
|
|
43
42
|
e,
|
|
44
43
|
{
|
|
45
44
|
encoding: "utf-8"
|
|
@@ -50,12 +49,12 @@ class C {
|
|
|
50
49
|
}
|
|
51
50
|
apply(e) {
|
|
52
51
|
T(this.options.debug);
|
|
53
|
-
const t =
|
|
54
|
-
|
|
55
|
-
const o =
|
|
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");
|
|
56
55
|
if (this.options.watch) {
|
|
57
56
|
try {
|
|
58
|
-
|
|
57
|
+
p(o) && S(JSON.parse(c(o, "utf-8"))), p(n) && b(JSON.parse(c(n, "utf-8")));
|
|
59
58
|
} catch (a) {
|
|
60
59
|
console.error(a);
|
|
61
60
|
}
|
|
@@ -63,9 +62,9 @@ class C {
|
|
|
63
62
|
e.hooks.watchRun.tapAsync(
|
|
64
63
|
"DevupUIWebpackPlugin",
|
|
65
64
|
(a, r) => {
|
|
66
|
-
t && F(this.options.devupPath, (
|
|
67
|
-
if (
|
|
68
|
-
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);
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
71
70
|
const f = v.mtimeMs;
|
|
@@ -84,9 +83,9 @@ class C {
|
|
|
84
83
|
s.fileDependencies.add(g(this.options.devupPath));
|
|
85
84
|
});
|
|
86
85
|
}
|
|
87
|
-
|
|
88
|
-
new
|
|
89
|
-
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(
|
|
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())
|
|
90
89
|
})
|
|
91
90
|
), e.options.module.rules.push(
|
|
92
91
|
{
|
|
@@ -104,7 +103,7 @@ class C {
|
|
|
104
103
|
package: this.options.package,
|
|
105
104
|
cssFile: this.options.cssFile,
|
|
106
105
|
sheetFile: o,
|
|
107
|
-
classMapFile:
|
|
106
|
+
classMapFile: n,
|
|
108
107
|
watch: this.options.watch
|
|
109
108
|
}
|
|
110
109
|
}
|
|
@@ -128,5 +127,5 @@ class C {
|
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
export {
|
|
131
|
-
|
|
130
|
+
I as DevupUIWebpackPlugin
|
|
132
131
|
};
|
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,12 +28,10 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"webpack": "^5.98",
|
|
32
31
|
"@devup-ui/wasm": "0.1.54"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
|
-
"@devup-ui/wasm": "*"
|
|
36
|
-
"webpack": "*"
|
|
34
|
+
"@devup-ui/wasm": "*"
|
|
37
35
|
},
|
|
38
36
|
"devDependencies": {
|
|
39
37
|
"vite": "^6.2.2",
|