@devup-ui/webpack-plugin 0.1.46 → 0.1.48

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.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
+ "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,debug:u=!1}={}){d(this,"options");this.options={package:e,cssFile:a,devupPath:s,interfacePath:n,watch:i,debug:u}}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,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;
package/dist/plugin.d.ts CHANGED
@@ -5,10 +5,11 @@ export interface DevupUIWebpackPluginOptions {
5
5
  devupPath: string;
6
6
  interfacePath: string;
7
7
  watch: boolean;
8
+ debug: boolean;
8
9
  }
9
10
  export declare class DevupUIWebpackPlugin {
10
11
  options: DevupUIWebpackPluginOptions;
11
- constructor({ package: libPackage, devupPath, interfacePath, cssFile, watch, }?: Partial<DevupUIWebpackPluginOptions>);
12
+ constructor({ package: libPackage, devupPath, interfacePath, cssFile, watch, debug, }?: Partial<DevupUIWebpackPluginOptions>);
12
13
  writeDataFiles(): void;
13
14
  apply(compiler: Compiler): void;
14
15
  }
@@ -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;IA2Bd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA0FzB"}
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;CACf;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;gBAExB,EACV,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,KAAa,EACb,KAAa,GACd,GAAE,OAAO,CAAC,2BAA2B,CAAM;IAW5C,cAAc;IA2Bd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA2FzB"}
package/dist/plugin.js CHANGED
@@ -1,17 +1,18 @@
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, writeFileSync as r, existsSync as a, mkdirSync as F, stat as D } from "node:fs";
4
+ import { readFileSync as r, writeFileSync as c, existsSync as a, mkdirSync as D, stat as F } from "node:fs";
5
5
  import { createRequire as d } from "node:module";
6
- import { resolve as m, join as c } from "node:path";
7
- import { registerTheme as P, getThemeInterface as y, importSheet as S, importClassMap as T } from "@devup-ui/wasm";
8
- class I {
6
+ import { resolve as m, join as h } from "node:path";
7
+ import { registerTheme as P, getThemeInterface as y, setDebug as S, importSheet as T, importClassMap as b } from "@devup-ui/wasm";
8
+ class J {
9
9
  constructor({
10
10
  package: e = "@devup-ui/react",
11
11
  devupPath: t = "devup.json",
12
12
  interfacePath: o = ".df",
13
13
  cssFile: p = m(o, "devup-ui.css"),
14
- watch: s = !1
14
+ watch: s = !1,
15
+ debug: n = !1
15
16
  } = {}) {
16
17
  f(this, "options");
17
18
  this.options = {
@@ -19,13 +20,14 @@ class I {
19
20
  cssFile: p,
20
21
  devupPath: t,
21
22
  interfacePath: o,
22
- watch: s
23
+ watch: s,
24
+ debug: n
23
25
  };
24
26
  }
25
27
  writeDataFiles() {
26
28
  var t;
27
29
  P(
28
- (t = JSON.parse(n(this.options.devupPath, "utf-8"))) == null ? void 0 : t.theme
30
+ (t = JSON.parse(r(this.options.devupPath, "utf-8"))) == null ? void 0 : t.theme
29
31
  );
30
32
  const e = y(
31
33
  this.options.package,
@@ -33,31 +35,32 @@ class I {
33
35
  "DevupThemeTypography",
34
36
  "DevupTheme"
35
37
  );
36
- e && r(
37
- c(this.options.interfacePath, "theme.d.ts"),
38
+ e && c(
39
+ h(this.options.interfacePath, "theme.d.ts"),
38
40
  e,
39
41
  {
40
42
  encoding: "utf-8"
41
43
  }
42
- ), this.options.watch && r(this.options.cssFile, `/* ${Date.now()} */`, {
44
+ ), this.options.watch && c(this.options.cssFile, `/* ${Date.now()} */`, {
43
45
  encoding: "utf-8"
44
46
  });
45
47
  }
46
48
  apply(e) {
49
+ S(this.options.debug);
47
50
  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");
51
+ a(this.options.interfacePath) || D(this.options.interfacePath);
52
+ const o = h(this.options.interfacePath, "sheet.json"), p = h(this.options.interfacePath, "classMap.json");
50
53
  if (this.options.watch) {
51
54
  try {
52
- a(o) && S(JSON.parse(n(o, "utf-8"))), a(p) && T(JSON.parse(n(p, "utf-8")));
53
- } catch (h) {
54
- console.error(h);
55
+ a(o) && T(JSON.parse(r(o, "utf-8"))), a(p) && b(JSON.parse(r(p, "utf-8")));
56
+ } catch (n) {
57
+ console.error(n);
55
58
  }
56
59
  let s = null;
57
60
  e.hooks.watchRun.tapAsync(
58
61
  "DevupUIWebpackPlugin",
59
- (h, v) => {
60
- t && D(this.options.devupPath, (u, g) => {
62
+ (n, v) => {
63
+ t && F(this.options.devupPath, (u, g) => {
61
64
  if (u) {
62
65
  console.error(`Error checking ${this.options.devupPath}:`, u);
63
66
  return;
@@ -78,7 +81,7 @@ class I {
78
81
  s.fileDependencies.add(m(this.options.devupPath));
79
82
  });
80
83
  }
81
- a(this.options.cssFile) || r(this.options.cssFile, "", { encoding: "utf-8" }), e.options.module.rules.push(
84
+ a(this.options.cssFile) || c(this.options.cssFile, "", { encoding: "utf-8" }), e.options.module.rules.push(
82
85
  {
83
86
  test: /\.(tsx|ts|js|mjs|jsx)$/,
84
87
  exclude: /node_modules/,
@@ -116,5 +119,5 @@ class I {
116
119
  }
117
120
  }
118
121
  export {
119
- I as DevupUIWebpackPlugin
122
+ J as DevupUIWebpackPlugin
120
123
  };
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.46",
4
+ "version": "0.1.48",
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.42"
31
+ "@devup-ui/wasm": "0.1.44"
32
32
  },
33
33
  "devDependencies": {
34
34
  "vite": "^6.1.0",