@devup-ui/webpack-plugin 1.0.31 → 1.0.33
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/css-loader.cjs +1 -1
- package/dist/css-loader.d.ts.map +1 -1
- package/dist/css-loader.js +14 -11
- package/dist/loader.cjs +1 -1
- package/dist/loader.d.ts +3 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +35 -28
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.d.ts +9 -5
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +105 -85
- package/package.json +2 -2
package/dist/css-loader.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
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;
|
package/dist/css-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.d.ts","sourceRoot":"","sources":["../src/css-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"css-loader.d.ts","sourceRoot":"","sources":["../src/css-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAU1D,QAAA,MAAM,gBAAgB,EAAE,2BAA2B,CAAC;IAClD,KAAK,EAAE,OAAO,CAAA;CACf,CAaA,CAAA;AACD,eAAe,gBAAgB,CAAA"}
|
package/dist/css-loader.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { getCss as
|
|
2
|
-
let
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { getCss as r } from "@devup-ui/wasm";
|
|
2
|
+
let u = "", c = "";
|
|
3
|
+
function a(t) {
|
|
4
|
+
return t.endsWith("devup-ui.css") ? null : parseInt(t.split("devup-ui-")[1].split(".")[0]);
|
|
5
|
+
}
|
|
6
|
+
const h = function(t, e, i) {
|
|
7
|
+
var n;
|
|
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);
|
|
10
13
|
return;
|
|
11
14
|
}
|
|
12
|
-
c =
|
|
15
|
+
c = l, this.callback(null, u = r(s), e, i);
|
|
13
16
|
};
|
|
14
17
|
export {
|
|
15
|
-
|
|
18
|
+
h as default
|
|
16
19
|
};
|
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"),
|
|
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;
|
package/dist/loader.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { RawLoaderDefinitionFunction } from 'webpack';
|
|
2
2
|
export interface DevupUILoaderOptions {
|
|
3
3
|
package: string;
|
|
4
|
-
|
|
4
|
+
cssDir: string;
|
|
5
5
|
sheetFile: string;
|
|
6
6
|
classMapFile: string;
|
|
7
|
+
fileMapFile: string;
|
|
7
8
|
watch: boolean;
|
|
9
|
+
singleCss: boolean;
|
|
8
10
|
}
|
|
9
11
|
declare const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions>;
|
|
10
12
|
export default devupUILoader;
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/loader.js
CHANGED
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
import { writeFile as r } from "node:fs/promises";
|
|
2
|
-
import { relative as
|
|
3
|
-
import { codeExtract as
|
|
4
|
-
const
|
|
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) {
|
|
5
5
|
const {
|
|
6
|
-
watch:
|
|
7
|
-
package:
|
|
8
|
-
|
|
9
|
-
sheetFile:
|
|
10
|
-
classMapFile:
|
|
11
|
-
|
|
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;
|
|
12
14
|
try {
|
|
13
|
-
let
|
|
15
|
+
let e = g(x(this.resourcePath), l).replaceAll(
|
|
14
16
|
"\\",
|
|
15
17
|
"/"
|
|
16
18
|
);
|
|
17
|
-
|
|
18
|
-
const { code:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
r(
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
e.startsWith("./") || (e = `./${e}`);
|
|
20
|
+
const { code: o, css: i, map: a, css_file: _ } = C(
|
|
21
|
+
P,
|
|
22
|
+
p.toString(),
|
|
23
|
+
h,
|
|
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));
|
|
31
38
|
return;
|
|
32
39
|
}
|
|
33
|
-
|
|
34
|
-
} catch (
|
|
35
|
-
e
|
|
40
|
+
s(null, o, c);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
s(e);
|
|
36
43
|
}
|
|
37
44
|
};
|
|
38
45
|
export {
|
|
39
|
-
|
|
46
|
+
E as default
|
|
40
47
|
};
|
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { Compiler } from 'webpack';
|
|
2
2
|
export interface DevupUIWebpackPluginOptions {
|
|
3
3
|
package: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
cssDir: string;
|
|
5
|
+
devupFile: string;
|
|
6
|
+
distDir: string;
|
|
7
7
|
watch: boolean;
|
|
8
8
|
debug: boolean;
|
|
9
9
|
include: string[];
|
|
10
|
+
singleCss: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare class DevupUIWebpackPlugin {
|
|
12
13
|
options: DevupUIWebpackPluginOptions;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
sheetFile: string;
|
|
15
|
+
classMapFile: string;
|
|
16
|
+
fileMapFile: string;
|
|
17
|
+
constructor({ package: libPackage, devupFile, distDir, cssDir, watch, debug, include, singleCss, }?: Partial<DevupUIWebpackPluginOptions>);
|
|
18
|
+
writeDataFiles(): Promise<void>;
|
|
15
19
|
apply(compiler: Compiler): void;
|
|
16
20
|
}
|
|
17
21
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,124 +1,144 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
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 {
|
|
9
10
|
constructor({
|
|
10
11
|
package: e = "@devup-ui/react",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
watch:
|
|
15
|
-
debug:
|
|
16
|
-
include:
|
|
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 = [],
|
|
18
|
+
singleCss: M = !1
|
|
17
19
|
} = {}) {
|
|
18
|
-
|
|
20
|
+
r(this, "options");
|
|
21
|
+
r(this, "sheetFile");
|
|
22
|
+
r(this, "classMapFile");
|
|
23
|
+
r(this, "fileMapFile");
|
|
19
24
|
this.options = {
|
|
20
25
|
package: e,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
watch:
|
|
25
|
-
debug:
|
|
26
|
-
include:
|
|
27
|
-
|
|
26
|
+
cssDir: s,
|
|
27
|
+
devupFile: i,
|
|
28
|
+
distDir: t,
|
|
29
|
+
watch: c,
|
|
30
|
+
debug: l,
|
|
31
|
+
include: g,
|
|
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");
|
|
28
34
|
}
|
|
29
|
-
writeDataFiles() {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
async writeDataFiles() {
|
|
36
|
+
var e;
|
|
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(
|
|
42
|
+
this.options.package,
|
|
43
|
+
"DevupThemeColors",
|
|
44
|
+
"DevupThemeTypography",
|
|
45
|
+
"DevupTheme"
|
|
46
|
+
);
|
|
47
|
+
t && await h(
|
|
48
|
+
a(this.options.distDir, "theme.d.ts"),
|
|
49
|
+
t,
|
|
50
|
+
{
|
|
51
|
+
encoding: "utf-8"
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
} else
|
|
55
|
+
u({});
|
|
56
|
+
} catch (i) {
|
|
57
|
+
console.error(i), u({});
|
|
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
|
+
]);
|
|
49
63
|
}
|
|
50
64
|
apply(e) {
|
|
51
65
|
T(this.options.debug);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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({});
|
|
71
87
|
}
|
|
72
|
-
|
|
73
|
-
s && s !== f && this.writeDataFiles(), s = f;
|
|
74
|
-
}), h();
|
|
88
|
+
await this.writeDataFiles();
|
|
75
89
|
}
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
if (t) {
|
|
79
|
-
try {
|
|
80
|
-
this.writeDataFiles();
|
|
81
|
-
} catch (s) {
|
|
82
|
-
console.error(s);
|
|
83
90
|
}
|
|
84
|
-
|
|
85
|
-
|
|
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;
|
|
97
|
+
}
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
|
-
|
|
100
|
+
t && e.hooks.afterCompile.tap("DevupUIWebpackPlugin", (s) => {
|
|
101
|
+
s.fileDependencies.add(m(this.options.devupFile));
|
|
102
|
+
}), e.options.plugins.push(
|
|
89
103
|
new e.webpack.DefinePlugin({
|
|
90
104
|
"process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(j())
|
|
91
105
|
})
|
|
92
|
-
), this.options.watch || e.hooks.done.
|
|
93
|
-
s.hasErrors() ||
|
|
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(),
|
|
110
|
+
"utf-8"
|
|
111
|
+
);
|
|
94
112
|
}), e.options.module.rules.push(
|
|
95
113
|
{
|
|
96
114
|
test: /\.(tsx|ts|js|mjs|jsx)$/,
|
|
97
115
|
exclude: new RegExp(
|
|
98
|
-
|
|
116
|
+
`node_modules(?!.*(${["@devup-ui", ...this.options.include].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
|
|
99
117
|
),
|
|
100
118
|
enforce: "pre",
|
|
101
119
|
use: [
|
|
102
120
|
{
|
|
103
|
-
loader:
|
|
121
|
+
loader: d(import.meta.url).resolve(
|
|
104
122
|
"@devup-ui/webpack-plugin/loader"
|
|
105
123
|
),
|
|
106
124
|
options: {
|
|
107
125
|
package: this.options.package,
|
|
108
|
-
|
|
109
|
-
sheetFile:
|
|
110
|
-
classMapFile:
|
|
111
|
-
|
|
126
|
+
cssDir: this.options.cssDir,
|
|
127
|
+
sheetFile: this.sheetFile,
|
|
128
|
+
classMapFile: this.classMapFile,
|
|
129
|
+
fileMapFile: this.fileMapFile,
|
|
130
|
+
watch: this.options.watch,
|
|
131
|
+
singleCss: this.options.singleCss
|
|
112
132
|
}
|
|
113
133
|
}
|
|
114
134
|
]
|
|
115
135
|
},
|
|
116
136
|
{
|
|
117
|
-
test: this.options.
|
|
137
|
+
test: this.options.cssDir,
|
|
118
138
|
enforce: "pre",
|
|
119
139
|
use: [
|
|
120
140
|
{
|
|
121
|
-
loader:
|
|
141
|
+
loader: d(import.meta.url).resolve(
|
|
122
142
|
"@devup-ui/webpack-plugin/css-loader"
|
|
123
143
|
),
|
|
124
144
|
options: {
|
|
@@ -131,5 +151,5 @@ class C {
|
|
|
131
151
|
}
|
|
132
152
|
}
|
|
133
153
|
export {
|
|
134
|
-
|
|
154
|
+
J as DevupUIWebpackPlugin
|
|
135
155
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"webpack"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "1.0.
|
|
21
|
+
"version": "1.0.33",
|
|
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.
|
|
48
|
+
"@devup-ui/wasm": "1.0.33"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@devup-ui/wasm": "*"
|