@devup-ui/vite-plugin 0.1.57 → 0.1.59

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"),m=require("node:fs/promises"),a=require("node:path"),c=require("@devup-ui/wasm"),d=require("vite");function p(e){var t;if(s.existsSync(e.interfacePath)||s.mkdirSync(e.interfacePath),s.existsSync(e.devupPath)){c.registerTheme((t=JSON.parse(s.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const u=c.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");u&&s.writeFileSync(a.join(e.interfacePath,"theme.d.ts"),u,{encoding:"utf-8"})}s.existsSync(e.cssFile)||s.writeFileSync(e.cssFile,"",{encoding:"utf-8"})}let o="";function v({package:e="@devup-ui/react",devupPath:t="devup.json",interfacePath:u=".df",cssFile:i=a.resolve(u,"devup-ui.css"),extractCss:l=!0,debug:g=!1}={}){c.setDebug(g);try{p({package:e,cssFile:i,devupPath:t,interfacePath:u})}catch(r){console.error(r)}return{name:"devup-ui",config(){const r={server:{watch:{ignored:[`!${t}`]}}};return l&&(r.build={rollupOptions:{output:{manualChunks(n){if(n.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),r},apply(){return!0},watchChange(r){if(a.resolve(r)===a.resolve(t)&&s.existsSync(t))try{p({package:e,cssFile:i,devupPath:t,interfacePath:u})}catch(n){console.error(n)}},resolveId(r){if(d.normalizePath(r)===d.normalizePath(i))return`devup-ui.css?t=${Date.now().toString()+o.length}`},load(r){if(r.split("?")[0]==="devup-ui.css")return o=c.getCss()},enforce:"pre",async transform(r,n){if(!l||n.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(n))return;const{code:h,css:f}=c.codeExtract(n,r,e,i);return f&&o.length<f.length&&(o=f,await m.writeFile(i,`/* ${n} ${Date.now()} */`,{encoding:"utf-8"})),{code:h}}}}exports.DevupUI=v;
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;
package/dist/plugin.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface DevupUIPluginOptions {
6
6
  interfacePath: string;
7
7
  extractCss: boolean;
8
8
  debug: boolean;
9
+ include: string[];
9
10
  }
10
- export declare function DevupUI({ package: libPackage, devupPath, interfacePath, cssFile, extractCss, debug, }?: Partial<DevupUIPluginOptions>): PluginOption;
11
+ export declare function DevupUI({ package: libPackage, devupPath, interfacePath, cssFile, extractCss, debug, include, }?: Partial<DevupUIPluginOptions>): PluginOption;
11
12
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,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;CACf;AA8BD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,SAAwB,EACxB,aAAqB,EACrB,OAAgD,EAChD,UAAiB,EACjB,KAAa,GACd,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CAoFnD"}
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"}
package/dist/plugin.js CHANGED
@@ -1,43 +1,44 @@
1
- import { existsSync as c, mkdirSync as h, readFileSync as v, writeFileSync as m } from "node:fs";
2
- import { writeFile as y } from "node:fs/promises";
3
- import { resolve as a, join as w } from "node:path";
4
- import { setDebug as D, codeExtract as C, getCss as S, registerTheme as T, getThemeInterface as j } from "@devup-ui/wasm";
5
- import { normalizePath as p } from "vite";
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
6
  function d(e) {
7
- var t;
8
- if (c(e.interfacePath) || h(e.interfacePath), c(e.devupPath)) {
9
- T(
10
- (t = JSON.parse(v(e.devupPath, "utf-8"))) == null ? void 0 : t.theme
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
11
11
  );
12
- const u = j(
12
+ const u = E(
13
13
  e.package,
14
14
  "DevupThemeColors",
15
15
  "DevupThemeTypography",
16
16
  "DevupTheme"
17
17
  );
18
- u && m(w(e.interfacePath, "theme.d.ts"), u, {
18
+ u && p(w(e.interfacePath, "theme.d.ts"), u, {
19
19
  encoding: "utf-8"
20
20
  });
21
21
  }
22
- c(e.cssFile) || m(e.cssFile, "", {
22
+ s(e.cssFile) || p(e.cssFile, "", {
23
23
  encoding: "utf-8"
24
24
  });
25
25
  }
26
26
  let o = "";
27
- function O({
27
+ function F({
28
28
  package: e = "@devup-ui/react",
29
- devupPath: t = "devup.json",
29
+ devupPath: n = "devup.json",
30
30
  interfacePath: u = ".df",
31
- cssFile: i = a(u, "devup-ui.css"),
32
- extractCss: f = !0,
33
- debug: l = !1
31
+ cssFile: i = f(u, "devup-ui.css"),
32
+ extractCss: a = !0,
33
+ debug: g = !1,
34
+ include: l = []
34
35
  } = {}) {
35
- D(l);
36
+ T(g);
36
37
  try {
37
38
  d({
38
39
  package: e,
39
40
  cssFile: i,
40
- devupPath: t,
41
+ devupPath: n,
41
42
  interfacePath: u
42
43
  });
43
44
  } catch (r) {
@@ -49,15 +50,18 @@ function O({
49
50
  const r = {
50
51
  server: {
51
52
  watch: {
52
- ignored: [`!${t}`]
53
+ ignored: [`!${n}`]
53
54
  }
55
+ },
56
+ define: {
57
+ "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(j())
54
58
  }
55
59
  };
56
- return f && (r.build = {
60
+ return a && (r.build = {
57
61
  rollupOptions: {
58
62
  output: {
59
- manualChunks(n) {
60
- if (n.startsWith("devup-ui.css"))
63
+ manualChunks(t) {
64
+ if (t.startsWith("devup-ui.css"))
61
65
  return "devup-ui.css";
62
66
  }
63
67
  }
@@ -68,38 +72,40 @@ function O({
68
72
  return !0;
69
73
  },
70
74
  watchChange(r) {
71
- if (a(r) === a(t) && c(t))
75
+ if (f(r) === f(n) && s(n))
72
76
  try {
73
77
  d({
74
78
  package: e,
75
79
  cssFile: i,
76
- devupPath: t,
80
+ devupPath: n,
77
81
  interfacePath: u
78
82
  });
79
- } catch (n) {
80
- console.error(n);
83
+ } catch (t) {
84
+ console.error(t);
81
85
  }
82
86
  },
83
87
  resolveId(r) {
84
- if (p(r) === p(i))
88
+ if (m(r) === m(i))
85
89
  return `devup-ui.css?t=${Date.now().toString() + o.length}`;
86
90
  },
87
91
  load(r) {
88
92
  if (r.split("?")[0] === "devup-ui.css")
89
- return o = S();
93
+ return o = $();
90
94
  },
91
95
  enforce: "pre",
92
- async transform(r, n) {
93
- if (!f || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
94
- const { code: g, css: s } = C(n, r, e, i);
95
- return s && o.length < s.length && (o = s, await y(i, `/* ${n} ${Date.now()} */`, {
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()} */`, {
96
102
  encoding: "utf-8"
97
103
  })), {
98
- code: g
104
+ code: h
99
105
  };
100
106
  }
101
107
  };
102
108
  }
103
109
  export {
104
- O as DevupUI
110
+ F as DevupUI
105
111
  };
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.57",
4
+ "version": "0.1.59",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -19,11 +19,11 @@
19
19
  "dist"
20
20
  ],
21
21
  "dependencies": {
22
- "@devup-ui/wasm": "0.1.53"
22
+ "@devup-ui/wasm": "0.1.54"
23
23
  },
24
24
  "devDependencies": {
25
- "vite-plugin-dts": "^4.5.0",
26
- "typescript": "^5.7.3"
25
+ "vite-plugin-dts": "^4.5.3",
26
+ "typescript": "^5.8.2"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vite": "*",