@devup-ui/webpack-plugin 1.0.44 → 1.0.46

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"),r=require("node:path"),t=require("@devup-ui/wasm");let d=!1;const y=function(f){const{watch:o,package:m,cssDir:l,sheetFile:F,classMapFile:g,fileMapFile:w,singleCss:M,theme:c}=this.getOptions(),a=this.async(),P=this.resourcePath;c&&!d&&(d=!0,t.registerTheme(c));try{let e=r.relative(r.dirname(this.resourcePath),l).replaceAll("\\","/");e.startsWith("./")||(e=`./${e}`);const{code:n,css:S="",map:u,cssFile:p,updatedBaseStyle:b}=t.codeExtract(P,f.toString(),m,e,M,!1,!0),h=u?JSON.parse(u):null,i=[];if(b&&i.push(s.writeFile(r.join(l,"devup-ui.css"),t.getCss(null,!1),"utf-8")),p){const v=`${this.resourcePath} ${Date.now()}`;i.push(s.writeFile(r.join(l,r.basename(p)),o?`/* ${v} */`:S)),o&&i.push(s.writeFile(F,t.exportSheet()),s.writeFile(g,t.exportClassMap()),s.writeFile(w,t.exportFileMap())),Promise.all(i).catch(console.error).finally(()=>a(null,n,h));return}a(null,n,h)}catch(e){a(e)}};exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("node:fs/promises"),t=require("node:path"),i=require("@devup-ui/wasm"),b=function(p){const{watch:l,package:h,cssDir:a,sheetFile:d,classMapFile:f,fileMapFile:F,singleCss:w}=this.getOptions(),o=this.async(),c=this.resourcePath;try{let e=t.relative(t.dirname(c),a).replaceAll("\\","/");const g=t.relative(process.cwd(),c);e.startsWith("./")||(e=`./${e}`);const{code:m,css:v="",map:n,cssFile:u,updatedBaseStyle:M}=i.codeExtract(g,p.toString(),h,e,w,!1,!0),P=n?JSON.parse(n):null,r=[];if(M&&r.push(s.writeFile(t.join(a,"devup-ui.css"),i.getCss(null,!1),"utf-8")),u){const S=`${this.resourcePath} ${Date.now()}`;r.push(s.writeFile(t.join(a,t.basename(u)),l?`/* ${S} */`:v)),l&&r.push(s.writeFile(d,i.exportSheet()),s.writeFile(f,i.exportClassMap()),s.writeFile(F,i.exportFileMap()))}Promise.all(r).catch(console.error).finally(()=>o(null,m,P))}catch(e){o(e)}};exports.default=b;
package/dist/loader.d.ts CHANGED
@@ -7,7 +7,6 @@ export interface DevupUILoaderOptions {
7
7
  fileMapFile: string;
8
8
  watch: boolean;
9
9
  singleCss: boolean;
10
- theme?: object;
11
10
  }
12
11
  declare const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions>;
13
12
  export default devupUILoader;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAWA,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;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CA2ElE,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,CAmElE,CAAA;AACH,eAAe,aAAa,CAAA"}
package/dist/loader.js CHANGED
@@ -1,61 +1,55 @@
1
- import { writeFile as t } from "node:fs/promises";
2
- import { relative as $, dirname as b, join as u, basename as k } from "node:path";
3
- import { registerTheme as v, codeExtract as w, getCss as C, exportSheet as D, exportClassMap as O, exportFileMap as j } from "@devup-ui/wasm";
4
- let h = !1;
5
- const I = function(f) {
1
+ import { writeFile as s } from "node:fs/promises";
2
+ import { relative as n, dirname as y, join as p, basename as C } from "node:path";
3
+ import { codeExtract as S, getCss as $, exportSheet as b, exportClassMap as k, exportFileMap as D } from "@devup-ui/wasm";
4
+ const B = function(u) {
6
5
  const {
7
- watch: i,
8
- package: m,
6
+ watch: a,
7
+ package: h,
9
8
  cssDir: r,
10
- sheetFile: d,
11
- classMapFile: g,
12
- fileMapFile: F,
13
- singleCss: x,
14
- theme: l
15
- } = this.getOptions(), a = this.async(), M = this.resourcePath;
16
- l && !h && (h = !0, v(l));
9
+ sheetFile: f,
10
+ classMapFile: d,
11
+ fileMapFile: m,
12
+ singleCss: g
13
+ } = this.getOptions(), o = this.async(), c = this.resourcePath;
17
14
  try {
18
- let e = $(b(this.resourcePath), r).replaceAll(
19
- "\\",
20
- "/"
21
- );
15
+ let e = n(y(c), r).replaceAll("\\", "/");
16
+ const F = n(process.cwd(), c);
22
17
  e.startsWith("./") || (e = `./${e}`);
23
18
  const {
24
- code: o,
25
- css: P = "",
26
- map: c,
27
- cssFile: n,
28
- updatedBaseStyle: y
29
- } = w(
30
- M,
31
- f.toString(),
32
- m,
19
+ code: x,
20
+ css: M = "",
21
+ map: i,
22
+ cssFile: l,
23
+ updatedBaseStyle: P
24
+ } = S(
25
+ F,
26
+ u.toString(),
27
+ h,
33
28
  e,
34
- x,
29
+ g,
35
30
  !1,
36
31
  !0
37
- ), p = c ? JSON.parse(c) : null, s = [];
38
- if (y && s.push(
39
- t(u(r, "devup-ui.css"), C(null, !1), "utf-8")
40
- ), n) {
41
- const S = `${this.resourcePath} ${Date.now()}`;
42
- s.push(
43
- t(
44
- u(r, k(n)),
45
- i ? `/* ${S} */` : P
32
+ ), v = i ? JSON.parse(i) : null, t = [];
33
+ if (P && t.push(
34
+ s(p(r, "devup-ui.css"), $(null, !1), "utf-8")
35
+ ), l) {
36
+ const w = `${this.resourcePath} ${Date.now()}`;
37
+ t.push(
38
+ s(
39
+ p(r, C(l)),
40
+ a ? `/* ${w} */` : M
46
41
  )
47
- ), i && s.push(
48
- t(d, D()),
49
- t(g, O()),
50
- t(F, j())
51
- ), Promise.all(s).catch(console.error).finally(() => a(null, o, p));
52
- return;
42
+ ), a && t.push(
43
+ s(f, b()),
44
+ s(d, k()),
45
+ s(m, D())
46
+ );
53
47
  }
54
- a(null, o, p);
48
+ Promise.all(t).catch(console.error).finally(() => o(null, x, v));
55
49
  } catch (e) {
56
- a(e);
50
+ o(e);
57
51
  }
58
52
  };
59
53
  export {
60
- I as default
54
+ B as default
61
55
  };
package/dist/plugin.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:fs"),l=require("node:fs/promises"),c=require("node:module"),o=require("node:path"),i=require("@devup-ui/wasm");var p=typeof document<"u"?document.currentScript:null;class f{options;sheetFile;classMapFile;fileMapFile;constructor({package:s="@devup-ui/react",devupFile:n="devup.json",distDir:t="df",cssDir:a=o.resolve(t,"devup-ui"),watch:r=!1,debug:u=!1,include:h=[],singleCss:d=!1}={}){this.options={package:s,cssDir:a,devupFile:n,distDir:t,watch:r,debug:u,include:h,singleCss:d},this.sheetFile=o.join(this.options.distDir,"sheet.json"),this.classMapFile=o.join(this.options.distDir,"classMap.json"),this.fileMapFile=o.join(this.options.distDir,"fileMap.json")}writeDataFiles(){try{const s=e.existsSync(this.options.devupFile)?e.readFileSync(this.options.devupFile,"utf-8"):void 0;if(s){i.registerTheme(JSON.parse(s)?.theme??{});const n=i.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&e.writeFileSync(o.join(this.options.distDir,"theme.d.ts"),n,{encoding:"utf-8"})}else i.registerTheme({})}catch(s){console.error(s),i.registerTheme({})}e.existsSync(this.options.cssDir)||e.mkdirSync(this.options.cssDir,{recursive:!0}),this.options.watch&&e.writeFileSync(o.join(this.options.cssDir,"devup-ui.css"),i.getCss(null,!1))}apply(s){i.setDebug(this.options.debug);const n=e.existsSync(this.options.devupFile);if(e.existsSync(this.options.distDir)||e.mkdirSync(this.options.distDir,{recursive:!0}),e.writeFileSync(o.join(this.options.distDir,".gitignore"),"*","utf-8"),this.options.watch)try{e.existsSync(this.sheetFile)&&i.importSheet(JSON.parse(e.readFileSync(this.sheetFile,"utf-8"))),e.existsSync(this.classMapFile)&&i.importClassMap(JSON.parse(e.readFileSync(this.classMapFile,"utf-8"))),e.existsSync(this.fileMapFile)&&i.importFileMap(JSON.parse(e.readFileSync(this.fileMapFile,"utf-8")))}catch(t){console.error(t),i.importSheet({}),i.importClassMap({}),i.importFileMap({})}if(this.writeDataFiles(),this.options.watch){let t=null;s.hooks.watchRun.tapPromise("DevupUIWebpackPlugin",async()=>{if(n){const r=(await l.stat(this.options.devupFile)).mtimeMs;t&&t!==r&&this.writeDataFiles(),t=r}})}n&&s.hooks.afterCompile.tap("DevupUIWebpackPlugin",t=>{t.fileDependencies.add(o.resolve(this.options.devupFile))}),s.options.plugins.push(new s.webpack.DefinePlugin({"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(i.getDefaultTheme())})),this.options.watch||s.hooks.done.tapPromise("DevupUIWebpackPlugin",async t=>{t.hasErrors()||await l.writeFile(o.join(this.options.cssDir,"devup-ui.css"),i.getCss(null,!1),"utf-8")}),s.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:c.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,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:c.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=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:fs"),l=require("node:fs/promises"),c=require("node:module"),o=require("node:path"),i=require("@devup-ui/wasm");var p=typeof document<"u"?document.currentScript:null;class f{options;sheetFile;classMapFile;fileMapFile;constructor({package:s="@devup-ui/react",devupFile:n="devup.json",distDir:t="df",cssDir:a=o.resolve(t,"devup-ui"),watch:r=!1,debug:u=!1,include:h=[],singleCss:d=!1}={}){this.options={package:s,cssDir:a,devupFile:n,distDir:t,watch:r,debug:u,include:h,singleCss:d},this.sheetFile=o.join(this.options.distDir,"sheet.json"),this.classMapFile=o.join(this.options.distDir,"classMap.json"),this.fileMapFile=o.join(this.options.distDir,"fileMap.json")}writeDataFiles(){try{const s=e.existsSync(this.options.devupFile)?e.readFileSync(this.options.devupFile,"utf-8"):void 0;if(s){i.registerTheme(JSON.parse(s)?.theme??{});const n=i.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&e.writeFileSync(o.join(this.options.distDir,"theme.d.ts"),n,{encoding:"utf-8"})}else i.registerTheme({})}catch(s){console.error(s),i.registerTheme({})}e.existsSync(this.options.cssDir)||e.mkdirSync(this.options.cssDir,{recursive:!0}),this.options.watch&&e.writeFileSync(o.join(this.options.cssDir,"devup-ui.css"),i.getCss(null,!1))}apply(s){i.setDebug(this.options.debug);const n=e.existsSync(this.options.devupFile);if(e.existsSync(this.options.distDir)||e.mkdirSync(this.options.distDir,{recursive:!0}),e.writeFileSync(o.join(this.options.distDir,".gitignore"),"*","utf-8"),this.options.watch)try{e.existsSync(this.sheetFile)&&i.importSheet(JSON.parse(e.readFileSync(this.sheetFile,"utf-8"))),e.existsSync(this.classMapFile)&&i.importClassMap(JSON.parse(e.readFileSync(this.classMapFile,"utf-8"))),e.existsSync(this.fileMapFile)&&i.importFileMap(JSON.parse(e.readFileSync(this.fileMapFile,"utf-8")))}catch(t){console.error(t),i.importSheet({}),i.importClassMap({}),i.importFileMap({})}if(this.writeDataFiles(),this.options.watch){let t=null;s.hooks.watchRun.tapPromise("DevupUIWebpackPlugin",async()=>{if(n){const r=(await l.stat(this.options.devupFile)).mtimeMs;t&&t!==r&&this.writeDataFiles(),t=r}})}n&&s.hooks.afterCompile.tap("DevupUIWebpackPlugin",t=>{t.fileDependencies.add(o.resolve(this.options.devupFile))}),s.options.plugins.push(new s.webpack.DefinePlugin({"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(i.getDefaultTheme())})),this.options.watch||s.hooks.done.tapPromise("DevupUIWebpackPlugin",async t=>{t.hasErrors()||await l.writeFile(o.join(this.options.cssDir,"devup-ui.css"),i.getCss(null,!1),"utf-8")}),s.options.module.rules.push({test:/\.(tsx|ts|js|mjs|jsx)$/,exclude:new RegExp(`(node_modules(?!.*(${["@devup-ui",...this.options.include].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$)))|(.mdx.[tj]sx?$)`),enforce:"pre",use:[{loader:c.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,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:c.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=f;
package/dist/plugin.js CHANGED
@@ -91,7 +91,7 @@ class U {
91
91
  {
92
92
  test: /\.(tsx|ts|js|mjs|jsx)$/,
93
93
  exclude: new RegExp(
94
- `node_modules(?!.*(${["@devup-ui", ...this.options.include].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
94
+ `(node_modules(?!.*(${["@devup-ui", ...this.options.include].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$)))|(.mdx.[tj]sx?$)`
95
95
  ),
96
96
  enforce: "pre",
97
97
  use: [
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "webpack"
19
19
  ],
20
20
  "type": "module",
21
- "version": "1.0.44",
21
+ "version": "1.0.46",
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
@@ -45,7 +45,7 @@
45
45
  "dist"
46
46
  ],
47
47
  "dependencies": {
48
- "@devup-ui/wasm": "1.0.43"
48
+ "@devup-ui/wasm": "1.0.44"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@devup-ui/wasm": "*"