@devup-ui/webpack-plugin 0.1.48 → 0.1.50

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/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("node:fs/promises"),a=require("node:path"),i=require("@devup-ui/wasm"),_=function(c){const{watch:n,package:u,cssFile:l,sheetFile:d,classMapFile:h}=this.getOptions(),e=this.async(),t=this.resourcePath;if(t.includes("node_modules/")||t.includes("@devup-ui/react")||!/\.[tj](s|sx)?$/.test(t)){e(null,c);return}try{const{code:r,css:p}=i.codeExtract(t,c.toString(),u,a.relative(a.dirname(this.resourcePath),l).replaceAll("\\","/"));if(p&&n){const o=`${this.resourcePath} ${Date.now()}`;this._compiler&&(this._compiler.__DEVUP_CACHE=o),Promise.all([s.writeFile(l,`/* ${o} */`),s.writeFile(d,i.exportSheet()),s.writeFile(h,i.exportClassMap())]).catch(console.error).finally(()=>e(null,r));return}e(null,r)}catch(r){e(r)}};exports.default=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("node:fs/promises"),o=require("node:path"),s=require("@devup-ui/wasm"),_=function(l){const{watch:a,package:n,cssFile:i,sheetFile:u,classMapFile:h}=this.getOptions(),t=this.async(),p=this.resourcePath;try{const{code:e,css:d}=s.codeExtract(p,l.toString(),n,o.relative(o.dirname(this.resourcePath),i).replaceAll("\\","/"));if(d&&a){const c=`${this.resourcePath} ${Date.now()}`;this._compiler&&(this._compiler.__DEVUP_CACHE=c),Promise.all([r.writeFile(i,`/* ${c} */`),r.writeFile(u,s.exportSheet()),r.writeFile(h,s.exportClassMap())]).catch(console.error).finally(()=>t(null,e));return}t(null,e)}catch(e){t(e)}};exports.default=_;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CA6ClE,CAAA;AACH,eAAe,aAAa,CAAA"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CAqClE,CAAA;AACH,eAAe,aAAa,CAAA"}
package/dist/loader.js CHANGED
@@ -1,37 +1,33 @@
1
- import { writeFile as s } from "node:fs/promises";
2
- import { relative as p, dirname as d } from "node:path";
3
- import { codeExtract as m, exportSheet as f, exportClassMap as P } from "@devup-ui/wasm";
4
- const F = function(o) {
1
+ import { writeFile as r } from "node:fs/promises";
2
+ import { relative as m, dirname as u } from "node:path";
3
+ import { codeExtract as f, exportSheet as d, exportClassMap as P } from "@devup-ui/wasm";
4
+ const F = function(s) {
5
5
  const {
6
- watch: l,
6
+ watch: i,
7
7
  package: a,
8
- cssFile: c,
9
- sheetFile: n,
10
- classMapFile: u
11
- } = this.getOptions(), e = this.async(), t = this.resourcePath;
12
- if (t.includes("node_modules/") || t.includes("@devup-ui/react") || !/\.[tj](s|sx)?$/.test(t)) {
13
- e(null, o);
14
- return;
15
- }
8
+ cssFile: o,
9
+ sheetFile: l,
10
+ classMapFile: n
11
+ } = this.getOptions(), e = this.async(), h = this.resourcePath;
16
12
  try {
17
- const { code: r, css: h } = m(
18
- t,
19
- o.toString(),
13
+ const { code: t, css: p } = f(
14
+ h,
15
+ s.toString(),
20
16
  a,
21
- p(d(this.resourcePath), c).replaceAll("\\", "/")
17
+ m(u(this.resourcePath), o).replaceAll("\\", "/")
22
18
  );
23
- if (h && l) {
24
- const i = `${this.resourcePath} ${Date.now()}`;
25
- this._compiler && (this._compiler.__DEVUP_CACHE = i), Promise.all([
26
- s(c, `/* ${i} */`),
27
- s(n, f()),
28
- s(u, P())
29
- ]).catch(console.error).finally(() => e(null, r));
19
+ if (p && i) {
20
+ const c = `${this.resourcePath} ${Date.now()}`;
21
+ this._compiler && (this._compiler.__DEVUP_CACHE = c), Promise.all([
22
+ r(o, `/* ${c} */`),
23
+ r(l, d()),
24
+ r(n, P())
25
+ ]).catch(console.error).finally(() => e(null, t));
30
26
  return;
31
27
  }
32
- e(null, r);
33
- } catch (r) {
34
- e(r);
28
+ e(null, t);
29
+ } catch (t) {
30
+ e(t);
35
31
  }
36
32
  };
37
33
  export {
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,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;
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;
package/dist/plugin.d.ts CHANGED
@@ -6,10 +6,11 @@ export interface DevupUIWebpackPluginOptions {
6
6
  interfacePath: string;
7
7
  watch: boolean;
8
8
  debug: boolean;
9
+ include: string[];
9
10
  }
10
11
  export declare class DevupUIWebpackPlugin {
11
12
  options: DevupUIWebpackPluginOptions;
12
- constructor({ package: libPackage, devupPath, interfacePath, cssFile, watch, debug, }?: Partial<DevupUIWebpackPluginOptions>);
13
+ constructor({ package: libPackage, devupPath, interfacePath, cssFile, watch, debug, include, }?: Partial<DevupUIWebpackPluginOptions>);
13
14
  writeDataFiles(): void;
14
15
  apply(compiler: Compiler): void;
15
16
  }
@@ -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;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"}
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"}
package/dist/plugin.js CHANGED
@@ -1,18 +1,19 @@
1
- var k = Object.defineProperty;
2
- var w = (i, e, t) => e in i ? k(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var f = (i, e, t) => w(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { readFileSync as r, writeFileSync as c, existsSync as a, mkdirSync as D, stat as F } from "node:fs";
5
- import { createRequire as d } from "node:module";
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 {
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";
5
+ import { createRequire as m } from "node:module";
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 {
9
9
  constructor({
10
10
  package: e = "@devup-ui/react",
11
11
  devupPath: t = "devup.json",
12
12
  interfacePath: o = ".df",
13
- cssFile: p = m(o, "devup-ui.css"),
13
+ cssFile: p = g(o, "devup-ui.css"),
14
14
  watch: s = !1,
15
- debug: n = !1
15
+ debug: a = !1,
16
+ include: r = []
16
17
  } = {}) {
17
18
  f(this, "options");
18
19
  this.options = {
@@ -21,13 +22,14 @@ class J {
21
22
  devupPath: t,
22
23
  interfacePath: o,
23
24
  watch: s,
24
- debug: n
25
+ debug: a,
26
+ include: r
25
27
  };
26
28
  }
27
29
  writeDataFiles() {
28
30
  var t;
29
31
  P(
30
- (t = JSON.parse(r(this.options.devupPath, "utf-8"))) == null ? void 0 : t.theme
32
+ (t = JSON.parse(c(this.options.devupPath, "utf-8"))) == null ? void 0 : t.theme
31
33
  );
32
34
  const e = y(
33
35
  this.options.package,
@@ -35,39 +37,39 @@ class J {
35
37
  "DevupThemeTypography",
36
38
  "DevupTheme"
37
39
  );
38
- e && c(
39
- h(this.options.interfacePath, "theme.d.ts"),
40
+ e && h(
41
+ l(this.options.interfacePath, "theme.d.ts"),
40
42
  e,
41
43
  {
42
44
  encoding: "utf-8"
43
45
  }
44
- ), this.options.watch && c(this.options.cssFile, `/* ${Date.now()} */`, {
46
+ ), this.options.watch && h(this.options.cssFile, `/* ${Date.now()} */`, {
45
47
  encoding: "utf-8"
46
48
  });
47
49
  }
48
50
  apply(e) {
49
- S(this.options.debug);
50
- const t = a(this.options.devupPath);
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");
51
+ j(this.options.debug);
52
+ const t = n(this.options.devupPath);
53
+ n(this.options.interfacePath) || D(this.options.interfacePath);
54
+ const o = l(this.options.interfacePath, "sheet.json"), p = l(this.options.interfacePath, "classMap.json");
53
55
  if (this.options.watch) {
54
56
  try {
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);
57
+ n(o) && S(JSON.parse(c(o, "utf-8"))), n(p) && T(JSON.parse(c(p, "utf-8")));
58
+ } catch (a) {
59
+ console.error(a);
58
60
  }
59
61
  let s = null;
60
62
  e.hooks.watchRun.tapAsync(
61
63
  "DevupUIWebpackPlugin",
62
- (n, v) => {
63
- t && F(this.options.devupPath, (u, g) => {
64
+ (a, r) => {
65
+ t && F(this.options.devupPath, (u, v) => {
64
66
  if (u) {
65
67
  console.error(`Error checking ${this.options.devupPath}:`, u);
66
68
  return;
67
69
  }
68
- const l = g.mtimeMs;
69
- s && s !== l && this.writeDataFiles(), s = l;
70
- }), v();
70
+ const d = v.mtimeMs;
71
+ s && s !== d && this.writeDataFiles(), s = d;
72
+ }), r();
71
73
  }
72
74
  );
73
75
  }
@@ -78,17 +80,19 @@ class J {
78
80
  console.error(s);
79
81
  }
80
82
  e.hooks.afterCompile.tap("DevupUIWebpackPlugin", (s) => {
81
- s.fileDependencies.add(m(this.options.devupPath));
83
+ s.fileDependencies.add(g(this.options.devupPath));
82
84
  });
83
85
  }
84
- a(this.options.cssFile) || c(this.options.cssFile, "", { encoding: "utf-8" }), e.options.module.rules.push(
86
+ n(this.options.cssFile) || h(this.options.cssFile, "", { encoding: "utf-8" }), e.options.module.rules.push(
85
87
  {
86
88
  test: /\.(tsx|ts|js|mjs|jsx)$/,
87
- exclude: /node_modules/,
89
+ exclude: new RegExp(
90
+ this.options.include.length ? `node_modules(?!(.*${this.options.include.join("|").replaceAll("/", "[\\/\\\\]")})([\\/\\\\]|$))` : "node_modules"
91
+ ),
88
92
  enforce: "pre",
89
93
  use: [
90
94
  {
91
- loader: d(import.meta.url).resolve(
95
+ loader: m(import.meta.url).resolve(
92
96
  "@devup-ui/webpack-plugin/loader"
93
97
  ),
94
98
  options: {
@@ -106,7 +110,7 @@ class J {
106
110
  enforce: "pre",
107
111
  use: [
108
112
  {
109
- loader: d(import.meta.url).resolve(
113
+ loader: m(import.meta.url).resolve(
110
114
  "@devup-ui/webpack-plugin/css-loader"
111
115
  ),
112
116
  options: {
@@ -119,5 +123,5 @@ class J {
119
123
  }
120
124
  }
121
125
  export {
122
- J as DevupUIWebpackPlugin
126
+ I as DevupUIWebpackPlugin
123
127
  };
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.48",
4
+ "version": "0.1.50",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -28,7 +28,10 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@devup-ui/wasm": "0.1.44"
31
+ "@devup-ui/wasm": "0.1.45"
32
+ },
33
+ "peerDependencies": {
34
+ "@devup-ui/wasm": "*"
32
35
  },
33
36
  "devDependencies": {
34
37
  "vite": "^6.1.0",