@devup-ui/webpack-plugin 0.1.32 → 0.1.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.
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 d=(o,e,s)=>y(o,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("node:fs"),f=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}={}){d(this,"options");this.options={package:e,cssFile:a,devupPath:s,interfacePath:n,watch:i}}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.existsSync(this.options.interfacePath)||t.mkdirSync(this.options.interfacePath),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){const s=t.existsSync(this.options.devupPath),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,m)=>{s&&t.stat(this.options.devupPath,(h,g)=>{if(h){console.error(`Error checking ${this.options.devupPath}:`,h);return}const l=g.mtimeMs;i&&i!==l&&this.writeDataFiles(),i=l}),m()})}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:/node_modules/,enforce:"pre",use:[{loader:f.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:f.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 d=(o,e,s)=>y(o,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("node:fs"),f=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}={}){d(this,"options");this.options={package:e,cssFile:a,devupPath:s,interfacePath:n,watch:i}}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){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,m)=>{s&&t.stat(this.options.devupPath,(h,g)=>{if(h){console.error(`Error checking ${this.options.devupPath}:`,h);return}const l=g.mtimeMs;i&&i!==l&&this.writeDataFiles(),i=l}),m()})}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:/node_modules/,enforce:"pre",use:[{loader:f.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:f.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 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAgBA,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;CACf;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;gBAExB,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,KAAa,GACd,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAU5C,cAAc;IA4Bd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAuFzB"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAgBA,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;CACf;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;gBAExB,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,KAAa,GACd,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAU5C,cAAc;IA2Bd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA0FzB"}
package/dist/plugin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var k = Object.defineProperty;
2
2
  var w = (i, e, t) => e in i ? k(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var f = (i, e, t) => w(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { readFileSync as n, existsSync as a, mkdirSync as F, writeFileSync as r, stat as D } from "node:fs";
4
+ import { readFileSync as n, writeFileSync as r, existsSync as a, mkdirSync as F, stat as D } from "node:fs";
5
5
  import { createRequire as d } from "node:module";
6
6
  import { resolve as m, join as c } from "node:path";
7
7
  import { registerTheme as P, getThemeInterface as y, importSheet as S, importClassMap as T } from "@devup-ui/wasm";
@@ -33,18 +33,20 @@ class I {
33
33
  "DevupThemeTypography",
34
34
  "DevupTheme"
35
35
  );
36
- e && (a(this.options.interfacePath) || F(this.options.interfacePath), r(
36
+ e && r(
37
37
  c(this.options.interfacePath, "theme.d.ts"),
38
38
  e,
39
39
  {
40
40
  encoding: "utf-8"
41
41
  }
42
- )), this.options.watch && r(this.options.cssFile, `/* ${Date.now()} */`, {
42
+ ), this.options.watch && r(this.options.cssFile, `/* ${Date.now()} */`, {
43
43
  encoding: "utf-8"
44
44
  });
45
45
  }
46
46
  apply(e) {
47
- const t = a(this.options.devupPath), o = c(this.options.interfacePath, "sheet.json"), p = c(this.options.interfacePath, "classMap.json");
47
+ const t = a(this.options.devupPath);
48
+ a(this.options.interfacePath) || F(this.options.interfacePath);
49
+ const o = c(this.options.interfacePath, "sheet.json"), p = c(this.options.interfacePath, "classMap.json");
48
50
  if (this.options.watch) {
49
51
  try {
50
52
  a(o) && S(JSON.parse(n(o, "utf-8"))), a(p) && T(JSON.parse(n(p, "utf-8")));
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.32",
4
+ "version": "0.1.34",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@devup-ui/wasm": "0.1.28"
31
+ "@devup-ui/wasm": "0.1.30"
32
32
  },
33
33
  "devDependencies": {
34
34
  "vite": "^6.0.11",