@devup-ui/webpack-plugin 0.1.57 → 0.1.59

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 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"),m=require("node:module"),c=require("node:path"),p=require("@devup-ui/wasm");var r=typeof document<"u"?document.currentScript:null;class S{constructor({package:e="@devup-ui/react",devupPath:s="devup.json",interfacePath:n=".df",cssFile:a=c.resolve(n,"devup-ui.css"),watch:i=!1,debug:u=!1,include:l=[]}={}){f(this,"options");this.options={package:e,cssFile:a,devupPath:s,interfacePath:n,watch:i,debug:u,include:l}}writeDataFiles(){var s;p.registerTheme((s=JSON.parse(t.readFileSync(this.options.devupPath,"utf-8")))==null?void 0:s.theme);const e=p.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){p.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"),a=c.join(this.options.interfacePath,"classMap.json");if(this.options.watch){try{t.existsSync(n)&&p.importSheet(JSON.parse(t.readFileSync(n,"utf-8"))),t.existsSync(a)&&p.importClassMap(JSON.parse(t.readFileSync(a,"utf-8")))}catch(u){console.error(u)}let i=null;e.hooks.watchRun.tapAsync("DevupUIWebpackPlugin",(u,l)=>{s&&t.stat(this.options.devupPath,(h,g)=>{if(h){console.error(`Error checking ${this.options.devupPath}:`,h);return}const d=g.mtimeMs;i&&i!==d&&this.writeDataFiles(),i=d}),l()})}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.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:m.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:r&&r.tagName.toUpperCase()==="SCRIPT"&&r.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:a,watch:this.options.watch}}]},{test:this.options.cssFile,enforce:"pre",use:[{loader:m.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:r&&r.tagName.toUpperCase()==="SCRIPT"&&r.src||new URL("plugin.cjs",document.baseURI).href).resolve("@devup-ui/webpack-plugin/css-loader"),options:{watch:this.options.watch}}]})}}exports.DevupUIWebpackPlugin=S;
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"),r=require("@devup-ui/wasm"),S=require("webpack");var p=typeof document<"u"?document.currentScript:null;class w{constructor({package:e="@devup-ui/react",devupPath:s="devup.json",interfacePath:n=".df",cssFile:a=c.resolve(n,"devup-ui.css"),watch:i=!1,debug:u=!1,include:l=[]}={}){f(this,"options");this.options={package:e,cssFile:a,devupPath:s,interfacePath:n,watch:i,debug:u,include:l}}writeDataFiles(){var s;r.registerTheme((s=JSON.parse(t.readFileSync(this.options.devupPath,"utf-8")))==null?void 0:s.theme);const e=r.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){r.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"),a=c.join(this.options.interfacePath,"classMap.json");if(this.options.watch){try{t.existsSync(n)&&r.importSheet(JSON.parse(t.readFileSync(n,"utf-8"))),t.existsSync(a)&&r.importClassMap(JSON.parse(t.readFileSync(a,"utf-8")))}catch(u){console.error(u)}let i=null;e.hooks.watchRun.tapAsync("DevupUIWebpackPlugin",(u,l)=>{s&&t.stat(this.options.devupPath,(h,m)=>{if(h){console.error(`Error checking ${this.options.devupPath}:`,h);return}const d=m.mtimeMs;i&&i!==d&&this.writeDataFiles(),i=d}),l()})}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 S.DefinePlugin({"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(r.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:a,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;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAiBA,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;CA+FzB"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,SAAS,CAAA;AAErD,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,11 +1,12 @@
1
- var w = Object.defineProperty;
2
- var k = (i, e, t) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var f = (i, e, t) => k(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { readFileSync as c, writeFileSync as h, existsSync as n, mkdirSync as D, stat as F } from "node:fs";
1
+ var D = Object.defineProperty;
2
+ var w = (i, e, t) => e in i ? D(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var d = (i, e, t) => w(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { readFileSync as c, writeFileSync as h, existsSync as n, mkdirSync as k, stat as F } from "node:fs";
5
5
  import { createRequire as m } from "node:module";
6
6
  import { resolve as g, join as l } from "node:path";
7
- import { registerTheme as P, getThemeInterface as y, setDebug as j, importSheet as S, importClassMap as T } from "@devup-ui/wasm";
8
- class I {
7
+ import { registerTheme as P, getThemeInterface as y, setDebug as T, importSheet as S, importClassMap as j, getDefaultTheme as b } from "@devup-ui/wasm";
8
+ import { DefinePlugin as x } from "webpack";
9
+ class C {
9
10
  constructor({
10
11
  package: e = "@devup-ui/react",
11
12
  devupPath: t = "devup.json",
@@ -15,7 +16,7 @@ class I {
15
16
  debug: a = !1,
16
17
  include: r = []
17
18
  } = {}) {
18
- f(this, "options");
19
+ d(this, "options");
19
20
  this.options = {
20
21
  package: e,
21
22
  cssFile: p,
@@ -48,13 +49,13 @@ class I {
48
49
  });
49
50
  }
50
51
  apply(e) {
51
- j(this.options.debug);
52
+ T(this.options.debug);
52
53
  const t = n(this.options.devupPath);
53
- n(this.options.interfacePath) || D(this.options.interfacePath);
54
+ n(this.options.interfacePath) || k(this.options.interfacePath);
54
55
  const o = l(this.options.interfacePath, "sheet.json"), p = l(this.options.interfacePath, "classMap.json");
55
56
  if (this.options.watch) {
56
57
  try {
57
- n(o) && S(JSON.parse(c(o, "utf-8"))), n(p) && T(JSON.parse(c(p, "utf-8")));
58
+ n(o) && S(JSON.parse(c(o, "utf-8"))), n(p) && j(JSON.parse(c(p, "utf-8")));
58
59
  } catch (a) {
59
60
  console.error(a);
60
61
  }
@@ -67,8 +68,8 @@ class I {
67
68
  console.error(`Error checking ${this.options.devupPath}:`, u);
68
69
  return;
69
70
  }
70
- const d = v.mtimeMs;
71
- s && s !== d && this.writeDataFiles(), s = d;
71
+ const f = v.mtimeMs;
72
+ s && s !== f && this.writeDataFiles(), s = f;
72
73
  }), r();
73
74
  }
74
75
  );
@@ -83,7 +84,11 @@ class I {
83
84
  s.fileDependencies.add(g(this.options.devupPath));
84
85
  });
85
86
  }
86
- n(this.options.cssFile) || h(this.options.cssFile, "", { encoding: "utf-8" }), e.options.module.rules.push(
87
+ n(this.options.cssFile) || h(this.options.cssFile, "", { encoding: "utf-8" }), e.options.plugins.push(
88
+ new x({
89
+ "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(b())
90
+ })
91
+ ), e.options.module.rules.push(
87
92
  {
88
93
  test: /\.(tsx|ts|js|mjs|jsx)$/,
89
94
  exclude: new RegExp(
@@ -123,5 +128,5 @@ class I {
123
128
  }
124
129
  }
125
130
  export {
126
- I as DevupUIWebpackPlugin
131
+ C as DevupUIWebpackPlugin
127
132
  };
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.57",
4
+ "version": "0.1.59",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -28,17 +28,19 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@devup-ui/wasm": "0.1.52"
31
+ "webpack": "^5.98",
32
+ "@devup-ui/wasm": "0.1.54"
32
33
  },
33
34
  "peerDependencies": {
34
- "@devup-ui/wasm": "*"
35
+ "@devup-ui/wasm": "*",
36
+ "webpack": "*"
35
37
  },
36
38
  "devDependencies": {
37
- "vite": "^6.1.0",
39
+ "vite": "^6.2.2",
38
40
  "@types/webpack": "^5.28.5",
39
- "vite-plugin-dts": "^4.5.0",
40
- "vitest": "^3.0.5",
41
- "typescript": "^5.7.3"
41
+ "vite-plugin-dts": "^4.5.3",
42
+ "vitest": "^3.0.9",
43
+ "typescript": "^5.8.2"
42
44
  },
43
45
  "scripts": {
44
46
  "lint": "eslint",