@devup-ui/vite-plugin 1.0.9 → 1.0.11

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"),D=require("node:fs/promises"),l=require("node:path"),c=require("@devup-ui/wasm"),h=require("vite");function m(r){var n;if(s.existsSync(r.interfacePath)||s.mkdirSync(r.interfacePath),s.existsSync(r.devupPath)){c.registerTheme((n=JSON.parse(s.readFileSync(r.devupPath,"utf-8")))==null?void 0:n.theme);const u=c.getThemeInterface(r.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");u&&s.writeFileSync(l.join(r.interfacePath,"theme.d.ts"),u,{encoding:"utf-8"})}s.existsSync(r.cssFile)||s.writeFileSync(r.cssFile,"",{encoding:"utf-8"})}let a="";function S({package:r="@devup-ui/react",devupPath:n="devup.json",interfacePath:u=".df",cssFile:o=l.resolve(u,"devup-ui.css"),extractCss:d=!0,debug:v=!1,include:p=[]}={}){c.setDebug(v);try{m({package:r,cssFile:o,devupPath:n,interfacePath:u})}catch(e){console.error(e)}return{name:"devup-ui",config(){const e={server:{watch:{ignored:[`!${n}`]}},define:{"process.env.DEVUP_UI_DEFAULT_THEME":JSON.stringify(c.getDefaultTheme())},optimizeDeps:{exclude:p}};return d&&(e.build={rollupOptions:{output:{manualChunks(t){if(t.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),e},apply(){return!0},watchChange(e){if(l.resolve(e)===l.resolve(n)&&s.existsSync(n))try{m({package:r,cssFile:o,devupPath:n,interfacePath:u})}catch(t){console.error(t)}},resolveId(e){if(h.normalizePath(e)===h.normalizePath(o))return`devup-ui.css?t=${Date.now().toString()+a.length}`},load(e){if(e.split("?")[0]==="devup-ui.css")return a=c.getCss()},enforce:"pre",async transform(e,t){if(!d)return;const i=t.split("?")[0];if((p.length?new RegExp(`node_modules(?!(${p.map(y=>`.*${y}`).join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(i):t.includes("node_modules"))||!/\.(tsx|ts|js|mjs|jsx)$/i.test(i))return;const{code:f,css:g}=c.codeExtract(i,e,r,o);return g&&a.length<g.length&&(a=g,await D.writeFile(o,`/* ${t} ${Date.now()} */`,{encoding:"utf-8"})),{code:f}},async generateBundle(e,t){if(!d)return;const i=Object.keys(t).find(f=>f.includes("devup-ui")&&f.endsWith(".css"));i&&"source"in t[i]&&(t[i].source=a)}}}exports.DevupUI=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("node:fs"),T=require("node:fs/promises"),l=require("node:path"),c=require("@devup-ui/wasm"),v=require("vite");function y(t){var n;if(s.existsSync(t.interfacePath)||s.mkdirSync(t.interfacePath),s.existsSync(t.devupPath)){c.registerTheme((n=JSON.parse(s.readFileSync(t.devupPath,"utf-8")))==null?void 0:n.theme);const u=c.getThemeInterface(t.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");u&&s.writeFileSync(l.join(t.interfacePath,"theme.d.ts"),u,{encoding:"utf-8"})}s.existsSync(t.cssFile)||s.writeFileSync(t.cssFile,"",{encoding:"utf-8"})}let a="";function _({package:t="@devup-ui/react",devupPath:n="devup.json",interfacePath:u=".df",cssFile:o=l.resolve(u,"devup-ui.css"),extractCss:d=!0,debug:D=!1,include:p=[]}={}){c.setDebug(D);try{y({package:t,cssFile:o,devupPath:n,interfacePath:u})}catch(e){console.error(e)}const m=c.getDefaultTheme(),h={};return m&&(h["process.env.DEVUP_UI_DEFAULT_THEME"]=JSON.stringify(m)),{name:"devup-ui",config(){const e={server:{watch:{ignored:[`!${n}`]}},define:h,optimizeDeps:{exclude:p}};return d&&(e.build={rollupOptions:{output:{manualChunks(r){if(r.startsWith("devup-ui.css"))return"devup-ui.css"}}}}),e},apply(){return!0},watchChange(e){if(l.resolve(e)===l.resolve(n)&&s.existsSync(n))try{y({package:t,cssFile:o,devupPath:n,interfacePath:u})}catch(r){console.error(r)}},resolveId(e){if(v.normalizePath(e)===v.normalizePath(o))return`devup-ui.css?t=${Date.now().toString()+a.length}`},load(e){if(e.split("?")[0]==="devup-ui.css")return a=c.getCss()},enforce:"pre",async transform(e,r){if(!d)return;const i=r.split("?")[0];if((p.length?new RegExp(`node_modules(?!(${p.map(w=>`.*${w}`).join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(i):r.includes("node_modules"))||!/\.(tsx|ts|js|mjs|jsx)$/i.test(i))return;const{code:f,css:g,map:S}=c.codeExtract(i,e,t,o);return g&&a.length<g.length&&(a=g,await T.writeFile(o,`/* ${r} ${Date.now()} */`,{encoding:"utf-8"})),{code:f,map:S}},async generateBundle(e,r){if(!d)return;const i=Object.keys(r).find(f=>f.includes("devup-ui")&&f.endsWith(".css"));i&&"source"in r[i]&&(r[i].source=a)}}}exports.DevupUI=_;
@@ -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,CAuHnD"}
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,CAyHnD"}
package/dist/plugin.js CHANGED
@@ -1,41 +1,41 @@
1
- import { existsSync as f, mkdirSync as D, readFileSync as w, writeFileSync as d } from "node:fs";
2
- import { writeFile as T } from "node:fs/promises";
3
- import { resolve as m, join as $ } from "node:path";
4
- import { setDebug as j, codeExtract as S, getCss as _, getDefaultTheme as E, registerTheme as k, getThemeInterface as x } from "@devup-ui/wasm";
5
- import { normalizePath as g } from "vite";
6
- function h(r) {
1
+ import { existsSync as f, mkdirSync as $, readFileSync as j, writeFileSync as h } from "node:fs";
2
+ import { writeFile as S } from "node:fs/promises";
3
+ import { resolve as l, join as _ } from "node:path";
4
+ import { setDebug as E, getDefaultTheme as k, codeExtract as x, getCss as C, registerTheme as F, getThemeInterface as I } from "@devup-ui/wasm";
5
+ import { normalizePath as v } from "vite";
6
+ function y(r) {
7
7
  var n;
8
- if (f(r.interfacePath) || D(r.interfacePath), f(r.devupPath)) {
9
- k(
10
- (n = JSON.parse(w(r.devupPath, "utf-8"))) == null ? void 0 : n.theme
8
+ if (f(r.interfacePath) || $(r.interfacePath), f(r.devupPath)) {
9
+ F(
10
+ (n = JSON.parse(j(r.devupPath, "utf-8"))) == null ? void 0 : n.theme
11
11
  );
12
- const s = x(
12
+ const s = I(
13
13
  r.package,
14
14
  "DevupThemeColors",
15
15
  "DevupThemeTypography",
16
16
  "DevupTheme"
17
17
  );
18
- s && d($(r.interfacePath, "theme.d.ts"), s, {
18
+ s && h(_(r.interfacePath, "theme.d.ts"), s, {
19
19
  encoding: "utf-8"
20
20
  });
21
21
  }
22
- f(r.cssFile) || d(r.cssFile, "", {
22
+ f(r.cssFile) || h(r.cssFile, "", {
23
23
  encoding: "utf-8"
24
24
  });
25
25
  }
26
26
  let u = "";
27
- function N({
27
+ function J({
28
28
  package: r = "@devup-ui/react",
29
29
  devupPath: n = "devup.json",
30
30
  interfacePath: s = ".df",
31
- cssFile: o = m(s, "devup-ui.css"),
31
+ cssFile: o = l(s, "devup-ui.css"),
32
32
  extractCss: a = !0,
33
- debug: v = !1,
33
+ debug: D = !1,
34
34
  include: p = []
35
35
  } = {}) {
36
- j(v);
36
+ E(D);
37
37
  try {
38
- h({
38
+ y({
39
39
  package: r,
40
40
  cssFile: o,
41
41
  devupPath: n,
@@ -44,7 +44,8 @@ function N({
44
44
  } catch (e) {
45
45
  console.error(e);
46
46
  }
47
- return {
47
+ const d = k(), g = {};
48
+ return d && (g["process.env.DEVUP_UI_DEFAULT_THEME"] = JSON.stringify(d)), {
48
49
  name: "devup-ui",
49
50
  config() {
50
51
  const e = {
@@ -53,9 +54,7 @@ function N({
53
54
  ignored: [`!${n}`]
54
55
  }
55
56
  },
56
- define: {
57
- "process.env.DEVUP_UI_DEFAULT_THEME": JSON.stringify(E())
58
- },
57
+ define: g,
59
58
  optimizeDeps: {
60
59
  exclude: p
61
60
  }
@@ -75,9 +74,9 @@ function N({
75
74
  return !0;
76
75
  },
77
76
  watchChange(e) {
78
- if (m(e) === m(n) && f(n))
77
+ if (l(e) === l(n) && f(n))
79
78
  try {
80
- h({
79
+ y({
81
80
  package: r,
82
81
  cssFile: o,
83
82
  devupPath: n,
@@ -88,30 +87,30 @@ function N({
88
87
  }
89
88
  },
90
89
  resolveId(e) {
91
- if (g(e) === g(o))
90
+ if (v(e) === v(o))
92
91
  return `devup-ui.css?t=${Date.now().toString() + u.length}`;
93
92
  },
94
93
  load(e) {
95
94
  if (e.split("?")[0] === "devup-ui.css")
96
- return u = _();
95
+ return u = C();
97
96
  },
98
97
  enforce: "pre",
99
98
  async transform(e, t) {
100
99
  if (!a) return;
101
100
  const i = t.split("?")[0];
102
101
  if ((p.length ? new RegExp(
103
- `node_modules(?!(${p.map((y) => `.*${y}`).join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
102
+ `node_modules(?!(${p.map((T) => `.*${T}`).join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
104
103
  ).test(i) : t.includes("node_modules")) || !/\.(tsx|ts|js|mjs|jsx)$/i.test(i)) return;
105
- const { code: c, css: l } = S(
106
- i,
107
- e,
108
- r,
109
- o
110
- );
111
- return l && u.length < l.length && (u = l, await T(o, `/* ${t} ${Date.now()} */`, {
104
+ const {
105
+ code: c,
106
+ css: m,
107
+ map: w
108
+ } = x(i, e, r, o);
109
+ return m && u.length < m.length && (u = m, await S(o, `/* ${t} ${Date.now()} */`, {
112
110
  encoding: "utf-8"
113
111
  })), {
114
- code: c
112
+ code: c,
113
+ map: w
115
114
  };
116
115
  },
117
116
  async generateBundle(e, t) {
@@ -124,5 +123,5 @@ function N({
124
123
  };
125
124
  }
126
125
  export {
127
- N as DevupUI
126
+ J as DevupUI
128
127
  };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "vite"
19
19
  ],
20
20
  "type": "module",
21
- "version": "1.0.9",
21
+ "version": "1.0.11",
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
@@ -36,7 +36,7 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@devup-ui/wasm": "1.0.9"
39
+ "@devup-ui/wasm": "1.0.11"
40
40
  },
41
41
  "devDependencies": {
42
42
  "vite-plugin-dts": "^4.5.4",