@devup-ui/vite-plugin 0.1.59 → 0.1.60

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/plugin.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),v=require("node:fs/promises"),a=require("node:path"),u=require("@devup-ui/wasm"),p=require("vite");function g(e){var n;if(s.existsSync(e.interfacePath)||s.mkdirSync(e.interfacePath),s.existsSync(e.devupPath)){u.registerTheme((n=JSON.parse(s.readFileSync(e.devupPath,"utf-8")))==null?void 0:n.theme);const i=u.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");i&&s.writeFileSync(a.join(e.interfacePath,"theme.d.ts"),i,{encoding:"utf-8"})}s.existsSync(e.cssFile)||s.writeFileSync(e.cssFile,"",{encoding:"utf-8"})}let o="";function y({package:e="@devup-ui/react",devupPath:n="devup.json",interfacePath:i=".df",cssFile:c=a.resolve(i,"devup-ui.css"),extractCss:f=!0,debug:h=!1,include:d=[]}={}){u.setDebug(h);try{g({package:e,cssFile:c,devupPath:n,interfacePath:i})}catch(r){console.error(r)}return{name:"devup-ui",config(){const r={server:{watch:{ignored:[`!${n}`]}},define:{"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(u.getDefaultTheme())}};return f&&(r.build={rollupOptions:{output:{manualChunks(t){if(t.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),r},apply(){return!0},watchChange(r){if(a.resolve(r)===a.resolve(n)&&s.existsSync(n))try{g({package:e,cssFile:c,devupPath:n,interfacePath:i})}catch(t){console.error(t)}},resolveId(r){if(p.normalizePath(r)===p.normalizePath(c))return`devup-ui.css?t=${Date.now().toString()+o.length}`},load(r){if(r.split("?")[0]==="devup-ui.css")return o=u.getCss()},enforce:"pre",async transform(r,t){if(!f||(d.length?new RegExp(`node_modules(?!(.*${d.join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(t):t.includes("node_modules"))||!/\.(tsx|ts|js|mjs|jsx)$/i.test(t.split("?")[0]))return;const{code:m,css:l}=u.codeExtract(t,r,e,c);return l&&o.length<l.length&&(o=l,await v.writeFile(c,`/* ${t} ${Date.now()} */`,{encoding:"utf-8"})),{code:m}}}}exports.DevupUI=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("node:fs"),D=require("node:fs/promises"),a=require("node:path"),u=require("@devup-ui/wasm"),g=require("vite");function m(e){var t;if(n.existsSync(e.interfacePath)||n.mkdirSync(e.interfacePath),n.existsSync(e.devupPath)){u.registerTheme((t=JSON.parse(n.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const i=u.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");i&&n.writeFileSync(a.join(e.interfacePath,"theme.d.ts"),i,{encoding:"utf-8"})}n.existsSync(e.cssFile)||n.writeFileSync(e.cssFile,"",{encoding:"utf-8"})}let o="";function S({package:e="@devup-ui/react",devupPath:t="devup.json",interfacePath:i=".df",cssFile:c=a.resolve(i,"devup-ui.css"),extractCss:p=!0,debug:h=!1,include:l=[]}={}){u.setDebug(h);try{m({package:e,cssFile:c,devupPath:t,interfacePath:i})}catch(r){console.error(r)}return{name:"devup-ui",config(){const r={server:{watch:{ignored:[`!${t}`]}},define:{"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(u.getDefaultTheme())},optimizeDeps:{exclude:l}};return p&&(r.build={rollupOptions:{output:{manualChunks(s){if(s.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),r},apply(){return!0},watchChange(r){if(a.resolve(r)===a.resolve(t)&&n.existsSync(t))try{m({package:e,cssFile:c,devupPath:t,interfacePath:i})}catch(s){console.error(s)}},resolveId(r){if(g.normalizePath(r)===g.normalizePath(c))return`devup-ui.css?t=${Date.now().toString()+o.length}`},load(r){if(r.split("?")[0]==="devup-ui.css")return o=u.getCss()},enforce:"pre",async transform(r,s){if(!p)return;const f=s.split("?")[0];if((l.length?new RegExp(`node_modules(?!(${l.map(y=>`.*${y}`).join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(f):s.includes("node_modules"))||!/\.(tsx|ts|js|mjs|jsx)$/i.test(f))return;const{code:v,css:d}=u.codeExtract(f,r,e,c);return d&&o.length<d.length&&(o=d,await D.writeFile(c,`/* ${s} ${Date.now()} */`,{encoding:"utf-8"})),{code:v}}}}exports.DevupUI=S;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,YAAY,EAAmB,MAAM,MAAM,CAAA;AAExE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AA8BD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,UAAiB,EACjB,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CAiGnD"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,YAAY,EAAmB,MAAM,MAAM,CAAA;AAExE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AA8BD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,UAAiB,EACjB,KAAa,EACb,OAAY,GACb,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA6GnD"}
package/dist/plugin.js CHANGED
@@ -1,45 +1,45 @@
1
- import { existsSync as s, mkdirSync as v, readFileSync as y, writeFileSync as p } from "node:fs";
2
- import { writeFile as D } from "node:fs/promises";
3
- import { resolve as f, join as w } from "node:path";
4
- import { setDebug as T, codeExtract as S, getCss as $, getDefaultTheme as j, registerTheme as C, getThemeInterface as E } from "@devup-ui/wasm";
5
- import { normalizePath as m } from "vite";
6
- function d(e) {
7
- var n;
8
- if (s(e.interfacePath) || v(e.interfacePath), s(e.devupPath)) {
9
- C(
10
- (n = JSON.parse(y(e.devupPath, "utf-8"))) == null ? void 0 : n.theme
1
+ import { existsSync as s, mkdirSync as y, readFileSync as w, writeFileSync as m } from "node:fs";
2
+ import { writeFile as T } from "node:fs/promises";
3
+ import { resolve as p, join as $ } from "node:path";
4
+ import { setDebug as S, codeExtract as j, getCss as x, getDefaultTheme as C, registerTheme as E, getThemeInterface as _ } from "@devup-ui/wasm";
5
+ import { normalizePath as d } from "vite";
6
+ function g(e) {
7
+ var t;
8
+ if (s(e.interfacePath) || y(e.interfacePath), s(e.devupPath)) {
9
+ E(
10
+ (t = JSON.parse(w(e.devupPath, "utf-8"))) == null ? void 0 : t.theme
11
11
  );
12
- const u = E(
12
+ const i = _(
13
13
  e.package,
14
14
  "DevupThemeColors",
15
15
  "DevupThemeTypography",
16
16
  "DevupTheme"
17
17
  );
18
- u && p(w(e.interfacePath, "theme.d.ts"), u, {
18
+ i && m($(e.interfacePath, "theme.d.ts"), i, {
19
19
  encoding: "utf-8"
20
20
  });
21
21
  }
22
- s(e.cssFile) || p(e.cssFile, "", {
22
+ s(e.cssFile) || m(e.cssFile, "", {
23
23
  encoding: "utf-8"
24
24
  });
25
25
  }
26
- let o = "";
27
- function F({
26
+ let u = "";
27
+ function O({
28
28
  package: e = "@devup-ui/react",
29
- devupPath: n = "devup.json",
30
- interfacePath: u = ".df",
31
- cssFile: i = f(u, "devup-ui.css"),
32
- extractCss: a = !0,
33
- debug: g = !1,
34
- include: l = []
29
+ devupPath: t = "devup.json",
30
+ interfacePath: i = ".df",
31
+ cssFile: o = p(i, "devup-ui.css"),
32
+ extractCss: l = !0,
33
+ debug: h = !1,
34
+ include: c = []
35
35
  } = {}) {
36
- T(g);
36
+ S(h);
37
37
  try {
38
- d({
38
+ g({
39
39
  package: e,
40
- cssFile: i,
41
- devupPath: n,
42
- interfacePath: u
40
+ cssFile: o,
41
+ devupPath: t,
42
+ interfacePath: i
43
43
  });
44
44
  } catch (r) {
45
45
  console.error(r);
@@ -50,18 +50,21 @@ function F({
50
50
  const r = {
51
51
  server: {
52
52
  watch: {
53
- ignored: [`!${n}`]
53
+ ignored: [`!${t}`]
54
54
  }
55
55
  },
56
56
  define: {
57
- "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(j())
57
+ "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(C())
58
+ },
59
+ optimizeDeps: {
60
+ exclude: c
58
61
  }
59
62
  };
60
- return a && (r.build = {
63
+ return l && (r.build = {
61
64
  rollupOptions: {
62
65
  output: {
63
- manualChunks(t) {
64
- if (t.startsWith("devup-ui.css"))
66
+ manualChunks(n) {
67
+ if (n.startsWith("devup-ui.css"))
65
68
  return "devup-ui.css";
66
69
  }
67
70
  }
@@ -72,40 +75,47 @@ function F({
72
75
  return !0;
73
76
  },
74
77
  watchChange(r) {
75
- if (f(r) === f(n) && s(n))
78
+ if (p(r) === p(t) && s(t))
76
79
  try {
77
- d({
80
+ g({
78
81
  package: e,
79
- cssFile: i,
80
- devupPath: n,
81
- interfacePath: u
82
+ cssFile: o,
83
+ devupPath: t,
84
+ interfacePath: i
82
85
  });
83
- } catch (t) {
84
- console.error(t);
86
+ } catch (n) {
87
+ console.error(n);
85
88
  }
86
89
  },
87
90
  resolveId(r) {
88
- if (m(r) === m(i))
89
- return `devup-ui.css?t=${Date.now().toString() + o.length}`;
91
+ if (d(r) === d(o))
92
+ return `devup-ui.css?t=${Date.now().toString() + u.length}`;
90
93
  },
91
94
  load(r) {
92
95
  if (r.split("?")[0] === "devup-ui.css")
93
- return o = $();
96
+ return u = x();
94
97
  },
95
98
  enforce: "pre",
96
- async transform(r, t) {
97
- if (!a || (l.length ? new RegExp(
98
- `node_modules(?!(.*${l.join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
99
- ).test(t) : t.includes("node_modules")) || !/\.(tsx|ts|js|mjs|jsx)$/i.test(t.split("?")[0])) return;
100
- const { code: h, css: c } = S(t, r, e, i);
101
- return c && o.length < c.length && (o = c, await D(i, `/* ${t} ${Date.now()} */`, {
99
+ async transform(r, n) {
100
+ if (!l) return;
101
+ const a = n.split("?")[0];
102
+ if ((c.length ? new RegExp(
103
+ `node_modules(?!(${c.map((D) => `.*${D}`).join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
104
+ ).test(a) : n.includes("node_modules")) || !/\.(tsx|ts|js|mjs|jsx)$/i.test(a)) return;
105
+ const { code: v, css: f } = j(
106
+ a,
107
+ r,
108
+ e,
109
+ o
110
+ );
111
+ return f && u.length < f.length && (u = f, await T(o, `/* ${n} ${Date.now()} */`, {
102
112
  encoding: "utf-8"
103
113
  })), {
104
- code: h
114
+ code: v
105
115
  };
106
116
  }
107
117
  };
108
118
  }
109
119
  export {
110
- F as DevupUI
120
+ O as DevupUI
111
121
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devup-ui/vite-plugin",
3
3
  "type": "module",
4
- "version": "0.1.59",
4
+ "version": "0.1.60",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },