@devup-ui/webpack-plugin 1.0.33 → 1.0.34

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@devup-ui/wasm");let n="",c="";function a(t){return t.endsWith("devup-ui.css")?null:parseInt(t.split("devup-ui-")[1].split(".")[0])}const p=function(t,e,s){var u;const{watch:o}=this.getOptions(),i=a(this.resourcePath);if(!o)return this.callback(null,r.getCss(i));const l=((u=this._compiler)==null?void 0:u.__DEVUP_CACHE)||t.toString();if(c===l){this.callback(null,n,e,s);return}c=l,this.callback(null,n=r.getCss(i),e,s)};exports.default=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@devup-ui/wasm");let n="",c="";function a(t){return t.endsWith("devup-ui.css")?null:parseInt(t.split("devup-ui-")[1].split(".")[0])}const p=function(t,e,s){var l;const{watch:o}=this.getOptions(),u=a(this.resourcePath);if(!o)return this.callback(null,r.getCss(u,!0));const i=((l=this._compiler)==null?void 0:l.__DEVUP_CACHE)||t.toString();if(c===i){this.callback(null,n,e,s);return}c=i,this.callback(null,n=r.getCss(u,!0),e,s)};exports.default=p;
@@ -1,18 +1,18 @@
1
- import { getCss as r } from "@devup-ui/wasm";
2
- let u = "", c = "";
1
+ import { getCss as u } from "@devup-ui/wasm";
2
+ let n = "", c = "";
3
3
  function a(t) {
4
4
  return t.endsWith("devup-ui.css") ? null : parseInt(t.split("devup-ui-")[1].split(".")[0]);
5
5
  }
6
6
  const h = function(t, e, i) {
7
- var n;
7
+ var l;
8
8
  const { watch: o } = this.getOptions(), s = a(this.resourcePath);
9
- if (!o) return this.callback(null, r(s));
10
- const l = ((n = this._compiler) == null ? void 0 : n.__DEVUP_CACHE) || t.toString();
11
- if (c === l) {
12
- this.callback(null, u, e, i);
9
+ if (!o) return this.callback(null, u(s, !0));
10
+ const r = ((l = this._compiler) == null ? void 0 : l.__DEVUP_CACHE) || t.toString();
11
+ if (c === r) {
12
+ this.callback(null, n, e, i);
13
13
  return;
14
14
  }
15
- c = l, this.callback(null, u = r(s), e, i);
15
+ c = r, this.callback(null, n = u(s, !0), e, i);
16
16
  };
17
17
  export {
18
18
  h as default
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"),s=require("node:path"),i=require("@devup-ui/wasm"),M=function(h){const{watch:t,package:d,cssDir:o,sheetFile:f,classMapFile:m,fileMapFile:_,singleCss:F}=this.getOptions(),l=this.async(),g=this.resourcePath;try{let e=s.relative(s.dirname(this.resourcePath),o).replaceAll("\\","/");e.startsWith("./")||(e=`./${e}`);const{code:a,css:c,map:n,css_file:w}=i.codeExtract(g,h.toString(),d,e,F),u=n?JSON.parse(n):null;if(c){const p=`${this.resourcePath} ${Date.now()}`;t&&this._compiler&&(this._compiler.__DEVUP_CACHE=p),Promise.all([r.writeFile(s.join(o,s.basename(w)),t?`/* ${p} */`:c),t?r.writeFile(f,i.exportSheet()):null,t?r.writeFile(m,i.exportClassMap()):null,t?r.writeFile(_,i.exportFileMap()):null]).catch(console.error).finally(()=>l(null,a,u));return}l(null,a,u)}catch(e){l(e)}};exports.default=M;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("node:fs/promises"),s=require("node:path"),i=require("@devup-ui/wasm"),S=function(d){const{watch:l,package:f,cssDir:a,sheetFile:m,classMapFile:F,fileMapFile:g,singleCss:w}=this.getOptions(),o=this.async(),_=this.resourcePath;try{let e=s.relative(s.dirname(this.resourcePath),a).replaceAll("\\","/");e.startsWith("./")||(e=`./${e}`);const{code:c,css:n,map:u,cssFile:M,updatedBaseStyle:P}=i.codeExtract(_,d.toString(),f,e,w,!1,!0),p=u?JSON.parse(u):null,r=[];if(P&&r.push(t.writeFile(s.join(a,"devup-ui.css"),i.getCss(null,!1),"utf-8")),n){const h=`${this.resourcePath} ${Date.now()}`;l&&this._compiler&&(this._compiler.__DEVUP_CACHE=h),r.push(t.writeFile(s.join(a,s.basename(M)),l?`/* ${h} */`:n)),l&&r.push(t.writeFile(m,i.exportSheet()),t.writeFile(F,i.exportClassMap()),t.writeFile(g,i.exportFileMap())),Promise.all(r).catch(console.error).finally(()=>o(null,c,p));return}o(null,c,p)}catch(e){o(e)}};exports.default=S;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CAoDlE,CAAA;AACH,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CAkElE,CAAA;AACH,eAAe,aAAa,CAAA"}
package/dist/loader.js CHANGED
@@ -1,47 +1,52 @@
1
- import { writeFile as r } from "node:fs/promises";
2
- import { relative as g, dirname as x, join as F, basename as M } from "node:path";
3
- import { codeExtract as C, exportSheet as $, exportClassMap as b, exportFileMap as k } from "@devup-ui/wasm";
4
- const E = function(p) {
1
+ import { writeFile as t } from "node:fs/promises";
2
+ import { relative as M, dirname as _, join as u, basename as y } from "node:path";
3
+ import { codeExtract as S, getCss as $, exportSheet as b, exportClassMap as k, exportFileMap as v } from "@devup-ui/wasm";
4
+ const A = function(h) {
5
5
  const {
6
- watch: t,
7
- package: h,
8
- cssDir: l,
9
- sheetFile: u,
10
- classMapFile: m,
11
- fileMapFile: f,
12
- singleCss: d
13
- } = this.getOptions(), s = this.async(), P = this.resourcePath;
6
+ watch: r,
7
+ package: f,
8
+ cssDir: i,
9
+ sheetFile: m,
10
+ classMapFile: d,
11
+ fileMapFile: g,
12
+ singleCss: F
13
+ } = this.getOptions(), a = this.async(), P = this.resourcePath;
14
14
  try {
15
- let e = g(x(this.resourcePath), l).replaceAll(
15
+ let e = M(_(this.resourcePath), i).replaceAll(
16
16
  "\\",
17
17
  "/"
18
18
  );
19
19
  e.startsWith("./") || (e = `./${e}`);
20
- const { code: o, css: i, map: a, css_file: _ } = C(
20
+ const { code: o, css: l, map: c, cssFile: x, updatedBaseStyle: C } = S(
21
21
  P,
22
- p.toString(),
23
- h,
22
+ h.toString(),
23
+ f,
24
24
  e,
25
- d
26
- ), c = a ? JSON.parse(a) : null;
27
- if (i) {
28
- const n = `${this.resourcePath} ${Date.now()}`;
29
- t && this._compiler && (this._compiler.__DEVUP_CACHE = n), Promise.all([
30
- r(
31
- F(l, M(_)),
32
- t ? `/* ${n} */` : i
33
- ),
34
- t ? r(u, $()) : null,
35
- t ? r(m, b()) : null,
36
- t ? r(f, k()) : null
37
- ]).catch(console.error).finally(() => s(null, o, c));
25
+ F,
26
+ !1,
27
+ !0
28
+ ), n = c ? JSON.parse(c) : null, s = [];
29
+ if (C && s.push(
30
+ t(u(i, "devup-ui.css"), $(null, !1), "utf-8")
31
+ ), l) {
32
+ const p = `${this.resourcePath} ${Date.now()}`;
33
+ r && this._compiler && (this._compiler.__DEVUP_CACHE = p), s.push(
34
+ t(
35
+ u(i, y(x)),
36
+ r ? `/* ${p} */` : l
37
+ )
38
+ ), r && s.push(
39
+ t(m, b()),
40
+ t(d, k()),
41
+ t(g, v())
42
+ ), Promise.all(s).catch(console.error).finally(() => a(null, o, n));
38
43
  return;
39
44
  }
40
- s(null, o, c);
45
+ a(null, o, n);
41
46
  } catch (e) {
42
- s(e);
47
+ a(e);
43
48
  }
44
49
  };
45
50
  export {
46
- E as default
51
+ A as default
47
52
  };
package/dist/plugin.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var F=Object.defineProperty;var g=(p,e,s)=>e in p?F(p,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):p[e]=s;var c=(p,e,s)=>g(p,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("node:fs"),o=require("node:fs/promises"),d=require("node:module"),a=require("node:path"),t=require("@devup-ui/wasm");var l=typeof document<"u"?document.currentScript:null;class v{constructor({package:e="@devup-ui/react",devupFile:s="devup.json",distDir:r="df",cssDir:i=a.resolve(r,"devup-ui"),watch:h=!1,debug:u=!1,include:f=[],singleCss:m=!1}={}){c(this,"options");c(this,"sheetFile");c(this,"classMapFile");c(this,"fileMapFile");this.options={package:e,cssDir:i,devupFile:s,distDir:r,watch:h,debug:u,include:f,singleCss:m},this.sheetFile=a.join(this.options.distDir,"sheet.json"),this.classMapFile=a.join(this.options.distDir,"classMap.json"),this.fileMapFile=a.join(this.options.distDir,"fileMap.json")}async writeDataFiles(){var e;try{const s=n.existsSync(this.options.devupFile)?await o.readFile(this.options.devupFile,"utf-8"):void 0;if(s){t.registerTheme(((e=JSON.parse(s))==null?void 0:e.theme)??{});const r=t.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");r&&await o.writeFile(a.join(this.options.distDir,"theme.d.ts"),r,{encoding:"utf-8"})}else t.registerTheme({})}catch(s){console.error(s),t.registerTheme({})}await Promise.all([n.existsSync(this.options.cssDir)?Promise.resolve():o.mkdir(this.options.cssDir,{recursive:!0}),this.options.watch?o.writeFile(a.join(this.options.cssDir,"devup-ui.css"),t.getCss()):Promise.resolve()])}apply(e){t.setDebug(this.options.debug);let s=!1;const r=n.existsSync(this.options.devupFile);if(e.hooks[this.options.watch?"watchRun":"beforeRun"].tapPromise("DevupUIWebpackPlugin",async()=>{if(!s){if(s=!0,n.existsSync(this.options.distDir)||await o.mkdir(this.options.distDir,{recursive:!0}),await o.writeFile(a.join(this.options.distDir,".gitignore"),"*","utf-8"),this.options.watch)try{await Promise.all([n.existsSync(this.sheetFile)?o.readFile(this.sheetFile,"utf-8").then(i=>t.importSheet(JSON.parse(i))):Promise.resolve(),n.existsSync(this.classMapFile)?o.readFile(this.classMapFile,"utf-8").then(i=>t.importClassMap(JSON.parse(i))):Promise.resolve(),n.existsSync(this.fileMapFile)?o.readFile(this.fileMapFile,"utf-8").then(i=>t.importFileMap(JSON.parse(i))):Promise.resolve()])}catch(i){console.error(i),t.importSheet({}),t.importClassMap({}),t.importFileMap({})}await this.writeDataFiles()}}),this.options.watch){let i=null;e.hooks.watchRun.tapPromise("DevupUIWebpackPlugin",async()=>{if(r){const u=(await o.stat(this.options.devupFile)).mtimeMs;i&&i!==u&&await this.writeDataFiles(),i=u}})}r&&e.hooks.afterCompile.tap("DevupUIWebpackPlugin",i=>{i.fileDependencies.add(a.resolve(this.options.devupFile))}),e.options.plugins.push(new e.webpack.DefinePlugin({"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(t.getDefaultTheme())})),this.options.watch||e.hooks.done.tapPromise("DevupUIWebpackPlugin",async i=>{i.hasErrors()||await o.writeFile(a.join(this.options.cssDir,"devup-ui.css"),t.getCss(),"utf-8")}),e.options.module.rules.push({test:/\.(tsx|ts|js|mjs|jsx)$/,exclude:new RegExp(`node_modules(?!.*(${["@devup-ui",...this.options.include].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`),enforce:"pre",use:[{loader:d.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("plugin.cjs",document.baseURI).href).resolve("@devup-ui/webpack-plugin/loader"),options:{package:this.options.package,cssDir:this.options.cssDir,sheetFile:this.sheetFile,classMapFile:this.classMapFile,fileMapFile:this.fileMapFile,watch:this.options.watch,singleCss:this.options.singleCss}}]},{test:this.options.cssDir,enforce:"pre",use:[{loader:d.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("plugin.cjs",document.baseURI).href).resolve("@devup-ui/webpack-plugin/css-loader"),options:{watch:this.options.watch}}]})}}exports.DevupUIWebpackPlugin=v;
1
+ "use strict";var F=Object.defineProperty;var g=(p,e,t)=>e in p?F(p,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[e]=t;var a=(p,e,t)=>g(p,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node:fs"),u=require("node:fs/promises"),h=require("node:module"),n=require("node:path"),o=require("@devup-ui/wasm");var r=typeof document<"u"?document.currentScript:null;class v{constructor({package:e="@devup-ui/react",devupFile:t="devup.json",distDir:s="df",cssDir:c=n.resolve(s,"devup-ui"),watch:l=!1,debug:d=!1,include:f=[],singleCss:m=!1}={}){a(this,"options");a(this,"sheetFile");a(this,"classMapFile");a(this,"fileMapFile");this.options={package:e,cssDir:c,devupFile:t,distDir:s,watch:l,debug:d,include:f,singleCss:m},this.sheetFile=n.join(this.options.distDir,"sheet.json"),this.classMapFile=n.join(this.options.distDir,"classMap.json"),this.fileMapFile=n.join(this.options.distDir,"fileMap.json")}writeDataFiles(){var e;try{const t=i.existsSync(this.options.devupFile)?i.readFileSync(this.options.devupFile,"utf-8"):void 0;if(t){o.registerTheme(((e=JSON.parse(t))==null?void 0:e.theme)??{});const s=o.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");s&&i.writeFileSync(n.join(this.options.distDir,"theme.d.ts"),s,{encoding:"utf-8"})}else o.registerTheme({})}catch(t){console.error(t),o.registerTheme({})}i.existsSync(this.options.cssDir)||i.mkdirSync(this.options.cssDir,{recursive:!0}),this.options.watch&&i.writeFileSync(n.join(this.options.cssDir,"devup-ui.css"),o.getCss(null,!1))}apply(e){o.setDebug(this.options.debug);const t=i.existsSync(this.options.devupFile);if(i.existsSync(this.options.distDir)||i.mkdirSync(this.options.distDir,{recursive:!0}),i.writeFileSync(n.join(this.options.distDir,".gitignore"),"*","utf-8"),this.options.watch)try{i.existsSync(this.sheetFile)&&o.importSheet(JSON.parse(i.readFileSync(this.sheetFile,"utf-8"))),i.existsSync(this.classMapFile)&&o.importClassMap(JSON.parse(i.readFileSync(this.classMapFile,"utf-8"))),i.existsSync(this.fileMapFile)&&o.importFileMap(JSON.parse(i.readFileSync(this.fileMapFile,"utf-8")))}catch(s){console.error(s),o.importSheet({}),o.importClassMap({}),o.importFileMap({})}if(this.writeDataFiles(),this.options.watch){let s=null;e.hooks.watchRun.tapPromise("DevupUIWebpackPlugin",async()=>{if(t){const l=(await u.stat(this.options.devupFile)).mtimeMs;s&&s!==l&&this.writeDataFiles(),s=l}})}t&&e.hooks.afterCompile.tap("DevupUIWebpackPlugin",s=>{s.fileDependencies.add(n.resolve(this.options.devupFile))}),e.options.plugins.push(new e.webpack.DefinePlugin({"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(o.getDefaultTheme())})),this.options.watch||e.hooks.done.tapPromise("DevupUIWebpackPlugin",async s=>{s.hasErrors()||await u.writeFile(n.join(this.options.cssDir,"devup-ui.css"),o.getCss(null,!1),"utf-8")}),e.options.module.rules.push({test:/\.(tsx|ts|js|mjs|jsx)$/,exclude:new RegExp(`node_modules(?!.*(${["@devup-ui",...this.options.include].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`),enforce:"pre",use:[{loader:h.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,cssDir:this.options.cssDir,sheetFile:this.sheetFile,classMapFile:this.classMapFile,fileMapFile:this.fileMapFile,watch:this.options.watch,singleCss:this.options.singleCss}}]},{test:this.options.cssDir,enforce:"pre",use:[{loader:h.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=v;
package/dist/plugin.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class DevupUIWebpackPlugin {
15
15
  classMapFile: string;
16
16
  fileMapFile: string;
17
17
  constructor({ package: libPackage, devupFile, distDir, cssDir, watch, debug, include, singleCss, }?: Partial<DevupUIWebpackPluginOptions>);
18
- writeDataFiles(): Promise<void>;
18
+ writeDataFiles(): void;
19
19
  apply(compiler: Compiler): void;
20
20
  }
21
21
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;gBAEP,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,OAAc,EACd,MAAqC,EACrC,KAAa,EACb,KAAa,EACb,OAAY,EACZ,SAAiB,GAClB,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAiBtC,cAAc;IA0CpB,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA4HzB"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;gBAEP,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,OAAc,EACd,MAAqC,EACrC,KAAa,EACb,KAAa,EACb,OAAY,EACZ,SAAiB,GAClB,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAiB5C,cAAc;IAwCd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAyGzB"}
package/dist/plugin.js CHANGED
@@ -1,115 +1,97 @@
1
1
  var k = Object.defineProperty;
2
- var P = (p, e, i) => e in p ? k(p, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : p[e] = i;
3
- var r = (p, e, i) => P(p, typeof e != "symbol" ? e + "" : e, i);
4
- import { existsSync as o } from "node:fs";
5
- import { readFile as n, writeFile as h, mkdir as f, stat as b } from "node:fs/promises";
6
- import { createRequire as d } from "node:module";
7
- import { resolve as m, join as a } from "node:path";
8
- import { registerTheme as u, getThemeInterface as y, getCss as v, setDebug as T, importSheet as D, importClassMap as w, importFileMap as F, getDefaultTheme as j } from "@devup-ui/wasm";
9
- class J {
2
+ var y = (p, s, e) => s in p ? k(p, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : p[s] = e;
3
+ var a = (p, s, e) => y(p, typeof s != "symbol" ? s + "" : s, e);
4
+ import { existsSync as t, readFileSync as l, writeFileSync as n, mkdirSync as u } from "node:fs";
5
+ import { stat as T, writeFile as S } from "node:fs/promises";
6
+ import { createRequire as f } from "node:module";
7
+ import { resolve as d, join as o } from "node:path";
8
+ import { registerTheme as h, getThemeInterface as b, getCss as m, setDebug as j, importSheet as F, importClassMap as D, importFileMap as v, getDefaultTheme as P } from "@devup-ui/wasm";
9
+ class N {
10
10
  constructor({
11
- package: e = "@devup-ui/react",
12
- devupFile: i = "devup.json",
13
- distDir: t = "df",
14
- cssDir: s = m(t, "devup-ui"),
15
- watch: c = !1,
16
- debug: l = !1,
17
- include: g = [],
11
+ package: s = "@devup-ui/react",
12
+ devupFile: e = "devup.json",
13
+ distDir: i = "df",
14
+ cssDir: c = d(i, "devup-ui"),
15
+ watch: r = !1,
16
+ debug: g = !1,
17
+ include: w = [],
18
18
  singleCss: M = !1
19
19
  } = {}) {
20
- r(this, "options");
21
- r(this, "sheetFile");
22
- r(this, "classMapFile");
23
- r(this, "fileMapFile");
20
+ a(this, "options");
21
+ a(this, "sheetFile");
22
+ a(this, "classMapFile");
23
+ a(this, "fileMapFile");
24
24
  this.options = {
25
- package: e,
26
- cssDir: s,
27
- devupFile: i,
28
- distDir: t,
29
- watch: c,
30
- debug: l,
31
- include: g,
25
+ package: s,
26
+ cssDir: c,
27
+ devupFile: e,
28
+ distDir: i,
29
+ watch: r,
30
+ debug: g,
31
+ include: w,
32
32
  singleCss: M
33
- }, this.sheetFile = a(this.options.distDir, "sheet.json"), this.classMapFile = a(this.options.distDir, "classMap.json"), this.fileMapFile = a(this.options.distDir, "fileMap.json");
33
+ }, this.sheetFile = o(this.options.distDir, "sheet.json"), this.classMapFile = o(this.options.distDir, "classMap.json"), this.fileMapFile = o(this.options.distDir, "fileMap.json");
34
34
  }
35
- async writeDataFiles() {
36
- var e;
35
+ writeDataFiles() {
36
+ var s;
37
37
  try {
38
- const i = o(this.options.devupFile) ? await n(this.options.devupFile, "utf-8") : void 0;
39
- if (i) {
40
- u(((e = JSON.parse(i)) == null ? void 0 : e.theme) ?? {});
41
- const t = y(
38
+ const e = t(this.options.devupFile) ? l(this.options.devupFile, "utf-8") : void 0;
39
+ if (e) {
40
+ h(((s = JSON.parse(e)) == null ? void 0 : s.theme) ?? {});
41
+ const i = b(
42
42
  this.options.package,
43
43
  "DevupThemeColors",
44
44
  "DevupThemeTypography",
45
45
  "DevupTheme"
46
46
  );
47
- t && await h(
48
- a(this.options.distDir, "theme.d.ts"),
49
- t,
47
+ i && n(
48
+ o(this.options.distDir, "theme.d.ts"),
49
+ i,
50
50
  {
51
51
  encoding: "utf-8"
52
52
  }
53
53
  );
54
54
  } else
55
- u({});
56
- } catch (i) {
57
- console.error(i), u({});
55
+ h({});
56
+ } catch (e) {
57
+ console.error(e), h({});
58
58
  }
59
- await Promise.all([
60
- o(this.options.cssDir) ? Promise.resolve() : f(this.options.cssDir, { recursive: !0 }),
61
- this.options.watch ? h(a(this.options.cssDir, "devup-ui.css"), v()) : Promise.resolve()
62
- ]);
59
+ t(this.options.cssDir) || u(this.options.cssDir, { recursive: !0 }), this.options.watch && n(
60
+ o(this.options.cssDir, "devup-ui.css"),
61
+ m(null, !1)
62
+ );
63
63
  }
64
- apply(e) {
65
- T(this.options.debug);
66
- let i = !1;
67
- const t = o(this.options.devupFile);
68
- if (e.hooks[this.options.watch ? "watchRun" : "beforeRun"].tapPromise(
69
- "DevupUIWebpackPlugin",
70
- async () => {
71
- if (!i) {
72
- if (i = !0, o(this.options.distDir) || await f(this.options.distDir, { recursive: !0 }), await h(a(this.options.distDir, ".gitignore"), "*", "utf-8"), this.options.watch)
73
- try {
74
- await Promise.all([
75
- o(this.sheetFile) ? n(this.sheetFile, "utf-8").then(
76
- (s) => D(JSON.parse(s))
77
- ) : Promise.resolve(),
78
- o(this.classMapFile) ? n(this.classMapFile, "utf-8").then(
79
- (s) => w(JSON.parse(s))
80
- ) : Promise.resolve(),
81
- o(this.fileMapFile) ? n(this.fileMapFile, "utf-8").then(
82
- (s) => F(JSON.parse(s))
83
- ) : Promise.resolve()
84
- ]);
85
- } catch (s) {
86
- console.error(s), D({}), w({}), F({});
87
- }
88
- await this.writeDataFiles();
89
- }
64
+ apply(s) {
65
+ j(this.options.debug);
66
+ const e = t(this.options.devupFile);
67
+ if (t(this.options.distDir) || u(this.options.distDir, { recursive: !0 }), n(o(this.options.distDir, ".gitignore"), "*", "utf-8"), this.options.watch)
68
+ try {
69
+ t(this.sheetFile) && F(JSON.parse(l(this.sheetFile, "utf-8"))), t(this.classMapFile) && D(JSON.parse(l(this.classMapFile, "utf-8"))), t(this.fileMapFile) && v(JSON.parse(l(this.fileMapFile, "utf-8")));
70
+ } catch (i) {
71
+ console.error(i), F({}), D({}), v({});
90
72
  }
91
- ), this.options.watch) {
92
- let s = null;
93
- e.hooks.watchRun.tapPromise("DevupUIWebpackPlugin", async () => {
94
- if (t) {
95
- const l = (await b(this.options.devupFile)).mtimeMs;
96
- s && s !== l && await this.writeDataFiles(), s = l;
73
+ if (this.writeDataFiles(), this.options.watch) {
74
+ let i = null;
75
+ s.hooks.watchRun.tapPromise("DevupUIWebpackPlugin", async () => {
76
+ if (e) {
77
+ const r = (await T(this.options.devupFile)).mtimeMs;
78
+ i && i !== r && this.writeDataFiles(), i = r;
97
79
  }
98
80
  });
99
81
  }
100
- t && e.hooks.afterCompile.tap("DevupUIWebpackPlugin", (s) => {
101
- s.fileDependencies.add(m(this.options.devupFile));
102
- }), e.options.plugins.push(
103
- new e.webpack.DefinePlugin({
104
- "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(j())
82
+ e && s.hooks.afterCompile.tap("DevupUIWebpackPlugin", (i) => {
83
+ i.fileDependencies.add(d(this.options.devupFile));
84
+ }), s.options.plugins.push(
85
+ new s.webpack.DefinePlugin({
86
+ "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(P())
105
87
  })
106
- ), this.options.watch || e.hooks.done.tapPromise("DevupUIWebpackPlugin", async (s) => {
107
- s.hasErrors() || await h(
108
- a(this.options.cssDir, "devup-ui.css"),
109
- v(),
88
+ ), this.options.watch || s.hooks.done.tapPromise("DevupUIWebpackPlugin", async (i) => {
89
+ i.hasErrors() || await S(
90
+ o(this.options.cssDir, "devup-ui.css"),
91
+ m(null, !1),
110
92
  "utf-8"
111
93
  );
112
- }), e.options.module.rules.push(
94
+ }), s.options.module.rules.push(
113
95
  {
114
96
  test: /\.(tsx|ts|js|mjs|jsx)$/,
115
97
  exclude: new RegExp(
@@ -118,7 +100,7 @@ class J {
118
100
  enforce: "pre",
119
101
  use: [
120
102
  {
121
- loader: d(import.meta.url).resolve(
103
+ loader: f(import.meta.url).resolve(
122
104
  "@devup-ui/webpack-plugin/loader"
123
105
  ),
124
106
  options: {
@@ -138,7 +120,7 @@ class J {
138
120
  enforce: "pre",
139
121
  use: [
140
122
  {
141
- loader: d(import.meta.url).resolve(
123
+ loader: f(import.meta.url).resolve(
142
124
  "@devup-ui/webpack-plugin/css-loader"
143
125
  ),
144
126
  options: {
@@ -151,5 +133,5 @@ class J {
151
133
  }
152
134
  }
153
135
  export {
154
- J as DevupUIWebpackPlugin
136
+ N as DevupUIWebpackPlugin
155
137
  };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "webpack"
19
19
  ],
20
20
  "type": "module",
21
- "version": "1.0.33",
21
+ "version": "1.0.34",
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.33"
48
+ "@devup-ui/wasm": "1.0.34"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@devup-ui/wasm": "*"
52
52
  },
53
53
  "devDependencies": {
54
- "vite": "^7.1.3",
54
+ "vite": "^7.1.4",
55
55
  "@types/webpack": "^5.28.5",
56
56
  "vite-plugin-dts": "^4.5.4",
57
57
  "vitest": "^3.2.4",