@devup-ui/next-plugin 1.0.53 → 1.0.54
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 +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +28 -34
- package/package.json +1 -1
package/dist/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 t=require("node:fs"),i=require("node:fs/promises"),s=require("node:path"),e=require("@devup-ui/wasm");let m=!1;const J=function(F){const{watch:o,package:y,cssDir:c,sheetFile:n,classMapFile:p,fileMapFile:u,themeFile:f,singleCss:M,theme:g,defaultClassMap:w,defaultFileMap:x,defaultSheet:v}=this.getOptions(),r=[];m||(m=!0,o?(t.existsSync(n)&&e.importSheet(JSON.parse(t.readFileSync(n,"utf-8"))),t.existsSync(p)&&e.importClassMap(JSON.parse(t.readFileSync(p,"utf-8"))),t.existsSync(u)&&e.importFileMap(JSON.parse(t.readFileSync(u,"utf-8"))),t.existsSync(f)&&e.registerTheme(JSON.parse(t.readFileSync(f,"utf-8"))?.theme??{})):(e.importFileMap(x),e.importClassMap(w),e.importSheet(v),e.registerTheme(g)));const h=this.async();try{const a=this.resourcePath;let l=s.relative(s.dirname(a),c).replaceAll("\\","/");const C=s.relative(process.cwd(),a);l.startsWith("./")||(l=`./${l}`);const{code:O,map:d,cssFile:S,updatedBaseStyle:P}=e.codeExtract(C,F.toString(),y,l,M,!1,!0),b=d?JSON.parse(d):null;P&&o&&r.push(i.writeFile(s.join(c,"devup-ui.css"),e.getCss(null,!1),"utf-8")),S&&o&&r.push(i.writeFile(s.join(c,s.basename(S)),`/* ${this.resourcePath} ${Date.now()} */`),i.writeFile(n,e.exportSheet()),i.writeFile(p,e.exportClassMap()),i.writeFile(u,e.exportFileMap())),Promise.all(r).catch(console.error).finally(()=>h(null,O,b))}catch(a){Promise.all(r).catch(console.error).finally(()=>h(a))}};exports.default=J;
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAeA,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,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAElB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;CACvB;AAGD,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAeA,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,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAElB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;CACvB;AAGD,QAAA,MAAM,aAAa,EAAE,2BAA2B,CAAC,oBAAoB,CAsFlE,CAAA;AACH,eAAe,aAAa,CAAA"}
|
package/dist/loader.js
CHANGED
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
import { existsSync as r } from "node:fs";
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync as r, readFileSync as i } from "node:fs";
|
|
2
|
+
import { writeFile as e } from "node:fs/promises";
|
|
3
3
|
import { relative as d, dirname as j, join as S, basename as A } from "node:path";
|
|
4
|
-
import { importSheet as F, importClassMap as M, importFileMap as g, registerTheme as
|
|
5
|
-
let
|
|
4
|
+
import { importSheet as F, importClassMap as M, importFileMap as g, registerTheme as y, codeExtract as B, getCss as E, exportSheet as I, exportClassMap as L, exportFileMap as T } from "@devup-ui/wasm";
|
|
5
|
+
let x = !1;
|
|
6
6
|
const G = function(C) {
|
|
7
7
|
const {
|
|
8
8
|
watch: l,
|
|
9
9
|
package: O,
|
|
10
10
|
cssDir: o,
|
|
11
|
-
sheetFile:
|
|
12
|
-
classMapFile:
|
|
13
|
-
fileMapFile:
|
|
14
|
-
themeFile:
|
|
11
|
+
sheetFile: c,
|
|
12
|
+
classMapFile: p,
|
|
13
|
+
fileMapFile: f,
|
|
14
|
+
themeFile: n,
|
|
15
15
|
singleCss: P,
|
|
16
16
|
theme: J,
|
|
17
17
|
defaultClassMap: N,
|
|
18
18
|
defaultFileMap: v,
|
|
19
19
|
defaultSheet: w
|
|
20
|
-
} = this.getOptions(),
|
|
21
|
-
|
|
22
|
-
i(
|
|
23
|
-
),
|
|
24
|
-
|
|
25
|
-
), r(n) && e.push(
|
|
26
|
-
i(n, "utf-8").then(JSON.parse).then(g)
|
|
27
|
-
), r(h) && e.push(
|
|
28
|
-
i(h, "utf-8").then(JSON.parse).then((t) => t?.theme ?? {}).then(x)
|
|
29
|
-
)) : (g(v), M(N), F(w), x(J)));
|
|
30
|
-
const f = this.async();
|
|
20
|
+
} = this.getOptions(), t = [];
|
|
21
|
+
x || (x = !0, l ? (r(c) && F(JSON.parse(i(c, "utf-8"))), r(p) && M(JSON.parse(i(p, "utf-8"))), r(f) && g(JSON.parse(i(f, "utf-8"))), r(n) && y(
|
|
22
|
+
JSON.parse(i(n, "utf-8"))?.theme ?? {}
|
|
23
|
+
)) : (g(v), M(N), F(w), y(J)));
|
|
24
|
+
const u = this.async();
|
|
31
25
|
try {
|
|
32
|
-
const
|
|
33
|
-
let a = d(j(
|
|
34
|
-
const b = d(process.cwd(),
|
|
26
|
+
const s = this.resourcePath;
|
|
27
|
+
let a = d(j(s), o).replaceAll("\\", "/");
|
|
28
|
+
const b = d(process.cwd(), s);
|
|
35
29
|
a.startsWith("./") || (a = `./${a}`);
|
|
36
|
-
const { code: k, map:
|
|
30
|
+
const { code: k, map: h, cssFile: m, updatedBaseStyle: D } = B(
|
|
37
31
|
b,
|
|
38
32
|
C.toString(),
|
|
39
33
|
O,
|
|
@@ -41,20 +35,20 @@ const G = function(C) {
|
|
|
41
35
|
P,
|
|
42
36
|
!1,
|
|
43
37
|
!0
|
|
44
|
-
), $ =
|
|
45
|
-
D && l &&
|
|
46
|
-
|
|
47
|
-
), m && l &&
|
|
48
|
-
|
|
38
|
+
), $ = h ? JSON.parse(h) : null;
|
|
39
|
+
D && l && t.push(
|
|
40
|
+
e(S(o, "devup-ui.css"), E(null, !1), "utf-8")
|
|
41
|
+
), m && l && t.push(
|
|
42
|
+
e(
|
|
49
43
|
S(o, A(m)),
|
|
50
44
|
`/* ${this.resourcePath} ${Date.now()} */`
|
|
51
45
|
),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
), Promise.all(
|
|
56
|
-
} catch (
|
|
57
|
-
Promise.all(
|
|
46
|
+
e(c, I()),
|
|
47
|
+
e(p, L()),
|
|
48
|
+
e(f, T())
|
|
49
|
+
), Promise.all(t).catch(console.error).finally(() => u(null, k, $));
|
|
50
|
+
} catch (s) {
|
|
51
|
+
Promise.all(t).catch(console.error).finally(() => u(s));
|
|
58
52
|
}
|
|
59
53
|
};
|
|
60
54
|
export {
|