@devup-ui/webpack-plugin 0.1.0 → 0.1.2
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/devup-ui.css +2 -2
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +26 -23
- package/package.json +2 -2
package/dist/devup-ui.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:root{--text:green;}
|
|
2
2
|
:root[data-theme=dark]{--text:#fff;}
|
|
3
3
|
.typo-bold{font-family:Freesentation;font-size:14px;font-weight:800;line-height:120%;letter-spacing:-0.28px}.typo-header{font-family:Freesentation;font-size:12px;font-weight:600;line-height:120%;letter-spacing:-0.24px}
|
|
4
|
-
@media (min-width:1280px){.typo-header{font-family:Freesentation;font-size:16px;font-weight:600;line-height:120%;letter-spacing:-0.32px}}.
|
|
5
|
-
@media (min-width:480px){.
|
|
4
|
+
@media (min-width:1280px){.typo-header{font-family:Freesentation;font-size:16px;font-weight:600;line-height:120%;letter-spacing:-0.32px}}.d15544298694588338936{color:green}.d12529347886882223583{position:relative}.d2683505337015604167{padding-right:20px}.d17565952947812156497{background:var(--text)}.d6188083034562313614{padding-top:28px;padding-bottom:28px;}.d7673073962820674314{font-size:48px}.d18131660931022743310{color:blue}.d8530366258308820036{cursor:pointer}.d5660377212820351369{font-size:128px}.d3005003370393598714{color:var(--d7726768185092795896)}.d9699708075224169605{color:var(--text)}.d3476602810702122842{color:grey}.d1370288632191954504:hover{cursor:cell}.d9474678031423794435:hover{background:yellow}
|
|
5
|
+
@media (min-width:480px){.d322777003817739426{font-size:128px}}.d1474934651398901479{background: red;
|
|
6
6
|
color: blue;}
|
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var f=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var d=(s,e,t)=>f(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node:fs"),m=require("node:module"),c=require("node:path"),g=require("node:url"),a=require("@devup-ui/wasm");var n=typeof document<"u"?document.currentScript:null;const v=g.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("plugin.cjs",document.baseURI).href),y=c.dirname(v);class P{constructor({package:e="@devup-ui/react",cssFile:t=c.join(y,"devup-ui.css"),devupPath:o="devup.json",interfacePath:r=".df"}){d(this,"options");this.options={package:e,cssFile:t,devupPath:o,interfacePath:r}}writeDataFiles(){var t;a.registerTheme((t=JSON.parse(i.readFileSync(this.options.devupPath,"utf-8")))==null?void 0:t.theme);const e=a.getThemeInterface(this.options.package,"DevupThemeColors","DevupThemeTypography");e&&(i.existsSync(this.options.interfacePath)||i.mkdirSync(this.options.interfacePath),i.writeFileSync(c.join(this.options.interfacePath,"theme.d.ts"),e,{encoding:"utf-8"})),i.writeFileSync(this.options.cssFile,a.getCss(),{encoding:"utf-8"})}apply(e){if(i.existsSync(this.options.devupPath)){try{this.writeDataFiles()}catch(o){console.error(o)}let t=null;e.hooks.afterCompile.tap("DevupUIWebpackPlugin",o=>{o.fileDependencies.add(this.options.devupPath)}),e.hooks.watchRun.tapAsync("DevupUIWebpackPlugin",(o,r)=>{i.stat(this.options.devupPath,(p,h)=>{if(p)return console.error(`Error checking ${this.options.devupPath}:`,p),r();const u=h.mtimeMs;t&&t!==u&&this.writeDataFiles(),t=u,r()})})}i.existsSync(this.options.cssFile)||i.writeFileSync(this.options.cssFile,"",{encoding:"utf-8"}),e.options.module.rules.push({test:/\.(tsx|ts|js|mjs|jsx)$/,exclude:/node_modules/,use:[{loader:m.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("plugin.cjs",document.baseURI).href).resolve("@devup-ui/webpack-plugin/loader"),options:{package:this.options.package,cssFile:this.options.cssFile}}]})}}exports.DevupUIWebpackPlugin=P;
|
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":"AAYA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAKvC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,2BAA2B,CAAA;gBAExB,EACV,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,GACtB,EAAE,OAAO,CAAC,2BAA2B,CAAC;IASvC,cAAc;IAyBd,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAsDzB"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { readFileSync as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var l = (i, e, t) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var c = (i, e, t) => l(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { readFileSync as m, existsSync as p, mkdirSync as f, writeFileSync as n, stat as g } from "node:fs";
|
|
5
|
+
import { createRequire as v } from "node:module";
|
|
6
|
+
import { dirname as k, join as h } from "node:path";
|
|
7
|
+
import { fileURLToPath as P } from "node:url";
|
|
7
8
|
import { registerTheme as F, getThemeInterface as y, getCss as D } from "@devup-ui/wasm";
|
|
8
|
-
const T =
|
|
9
|
-
class
|
|
9
|
+
const T = P(import.meta.url), w = k(T);
|
|
10
|
+
class _ {
|
|
10
11
|
constructor({
|
|
11
12
|
package: e = "@devup-ui/react",
|
|
12
|
-
cssFile: t =
|
|
13
|
+
cssFile: t = h(w, "devup-ui.css"),
|
|
13
14
|
devupPath: s = "devup.json",
|
|
14
15
|
interfacePath: o = ".df"
|
|
15
16
|
}) {
|
|
16
|
-
|
|
17
|
+
c(this, "options");
|
|
17
18
|
this.options = {
|
|
18
19
|
package: e,
|
|
19
20
|
cssFile: t,
|
|
@@ -24,25 +25,25 @@ class I {
|
|
|
24
25
|
writeDataFiles() {
|
|
25
26
|
var t;
|
|
26
27
|
F(
|
|
27
|
-
(t = JSON.parse(
|
|
28
|
+
(t = JSON.parse(m(this.options.devupPath, "utf-8"))) == null ? void 0 : t.theme
|
|
28
29
|
);
|
|
29
30
|
const e = y(
|
|
30
31
|
this.options.package,
|
|
31
32
|
"DevupThemeColors",
|
|
32
33
|
"DevupThemeTypography"
|
|
33
34
|
);
|
|
34
|
-
e && (
|
|
35
|
-
|
|
35
|
+
e && (p(this.options.interfacePath) || f(this.options.interfacePath), n(
|
|
36
|
+
h(this.options.interfacePath, "theme.d.ts"),
|
|
36
37
|
e,
|
|
37
38
|
{
|
|
38
39
|
encoding: "utf-8"
|
|
39
40
|
}
|
|
40
|
-
)),
|
|
41
|
+
)), n(this.options.cssFile, D(), {
|
|
41
42
|
encoding: "utf-8"
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
apply(e) {
|
|
45
|
-
if (
|
|
46
|
+
if (p(this.options.devupPath)) {
|
|
46
47
|
try {
|
|
47
48
|
this.writeDataFiles();
|
|
48
49
|
} catch (s) {
|
|
@@ -54,21 +55,23 @@ class I {
|
|
|
54
55
|
}), e.hooks.watchRun.tapAsync(
|
|
55
56
|
"DevupUIWebpackPlugin",
|
|
56
57
|
(s, o) => {
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
return console.error(`Error checking ${this.options.devupPath}:`,
|
|
60
|
-
const
|
|
61
|
-
t && t !==
|
|
58
|
+
g(this.options.devupPath, (a, u) => {
|
|
59
|
+
if (a)
|
|
60
|
+
return console.error(`Error checking ${this.options.devupPath}:`, a), o();
|
|
61
|
+
const r = u.mtimeMs;
|
|
62
|
+
t && t !== r && this.writeDataFiles(), t = r, o();
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
p(this.options.cssFile) || n(this.options.cssFile, "", { encoding: "utf-8" }), e.options.module.rules.push({
|
|
67
68
|
test: /\.(tsx|ts|js|mjs|jsx)$/,
|
|
68
69
|
exclude: /node_modules/,
|
|
69
70
|
use: [
|
|
70
71
|
{
|
|
71
|
-
loader:
|
|
72
|
+
loader: v(import.meta.url).resolve(
|
|
73
|
+
"@devup-ui/webpack-plugin/loader"
|
|
74
|
+
),
|
|
72
75
|
options: {
|
|
73
76
|
package: this.options.package,
|
|
74
77
|
cssFile: this.options.cssFile
|
|
@@ -79,5 +82,5 @@ class I {
|
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
export {
|
|
82
|
-
|
|
85
|
+
_ as DevupUIWebpackPlugin
|
|
83
86
|
};
|
package/package.json
CHANGED