@devup-ui/vite-plugin 1.0.48 → 1.0.50

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 m=require("node:fs"),c=require("node:fs/promises"),e=require("node:path"),u=require("@devup-ui/wasm");function y(r){return r.endsWith("devup-ui.css")?null:parseInt(r.split("devup-ui-")[1].split(".")[0])}async function F(r){try{const a=m.existsSync(r.devupFile)?await c.readFile(r.devupFile,"utf-8"):void 0;if(a){u.registerTheme(JSON.parse(a)?.theme??{});const o=u.getThemeInterface(r.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");o&&await c.writeFile(e.join(r.distDir,"theme.d.ts"),o,"utf-8")}else u.registerTheme({})}catch(a){console.error(a),u.registerTheme({})}await Promise.all([m.existsSync(r.cssDir)?Promise.resolve():c.mkdir(r.cssDir,{recursive:!0}),r.singleCss?Promise.resolve():c.writeFile(e.join(r.cssDir,"devup-ui.css"),u.getCss(null,!1))])}function _({package:r="@devup-ui/react",devupFile:a="devup.json",distDir:o="df",cssDir:l=e.resolve(o,"devup-ui"),extractCss:v=!0,debug:S=!1,include:d=[],singleCss:g=!1}={}){u.setDebug(S);const f=new Map;return{name:"devup-ui",async configResolved(){m.existsSync(o)||await c.mkdir(o,{recursive:!0}),await c.writeFile(e.join(o,".gitignore"),"*","utf-8"),await F({package:r,cssDir:l,devupFile:a,distDir:o,singleCss:g})},config(){const n=u.getDefaultTheme(),t={};n&&(t["process.env.DEVUP_UI_DEFAULT_THEME"]=JSON.stringify(n));const s={server:{watch:{ignored:[`!${a}`]}},define:t,optimizeDeps:{exclude:[...d,"@devup-ui/components"]},ssr:{noExternal:[...d,/@devup-ui/]}};return v&&(s.build={rollupOptions:{output:{manualChunks(i){const p=e.basename(i).split("?")[0];if(/devup-ui(-\d+)?\.css$/.test(p))return p}}}}),s},apply(){return!0},async watchChange(n){if(e.resolve(n)===e.resolve(a)&&m.existsSync(a))try{await F({package:r,cssDir:l,devupFile:a,distDir:o,singleCss:g})}catch(t){console.error(t)}},resolveId(n,t){const s=e.basename(n).split("?")[0];if(/devup-ui(-\d+)?\.css$/.test(s)&&e.resolve(t?e.join(e.dirname(t),n):n)===e.resolve(e.join(l,s)))return e.join(l,`${s}?t=${Date.now().toString()+(f.get(y(s))?.length??0)}`)},load(n){const t=e.basename(n).split("?")[0];if(/devup-ui(-\d+)?\.css$/.test(t)){const s=y(t),i=u.getCss(s,!1);return f.set(s,i),i}},enforce:"pre",async transform(n,t){if(!v)return;const s=t.split("?")[0];if(!/\.(tsx|ts|js|mjs|jsx)$/i.test(s)||new RegExp(`node_modules(?!.*(${["@devup-ui",...d].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(s))return;let i=e.relative(e.dirname(t),l).replaceAll("\\","/");i.startsWith("./")||(i=`./${i}`);const{code:p,css:j="",map:N,cssFile:h,updatedBaseStyle:x}=u.codeExtract(s,n,r,i,g,!0,!1),w=[];if(x&&w.push(c.writeFile(e.join(l,"devup-ui.css"),u.getCss(null,!1),"utf-8")),h){const $=y(h),T=f.get($);T&&T.length<j.length&&f.set($,j),w.push(c.writeFile(e.join(l,e.basename(h)),`/* ${t} ${Date.now()} */`,"utf-8"))}return await Promise.all(w),{code:p,map:N}},async generateBundle(n,t){if(!v)return;const s=Object.keys(t).find(i=>t[i].name==="devup-ui.css");s&&"source"in t[s]&&(t[s].source=f.get(null))}}}exports.DevupUI=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("node:fs"),c=require("node:fs/promises"),e=require("node:path"),u=require("@devup-ui/wasm");function y(r){return r.endsWith("devup-ui.css")?null:parseInt(r.split("devup-ui-")[1].split(".")[0])}async function F(r){try{const a=m.existsSync(r.devupFile)?await c.readFile(r.devupFile,"utf-8"):void 0;if(a){u.registerTheme(JSON.parse(a)?.theme??{});const o=u.getThemeInterface(r.package,"CustomColors","DevupThemeTypography","DevupTheme");o&&await c.writeFile(e.join(r.distDir,"theme.d.ts"),o,"utf-8")}else u.registerTheme({})}catch(a){console.error(a),u.registerTheme({})}await Promise.all([m.existsSync(r.cssDir)?Promise.resolve():c.mkdir(r.cssDir,{recursive:!0}),r.singleCss?Promise.resolve():c.writeFile(e.join(r.cssDir,"devup-ui.css"),u.getCss(null,!1))])}function _({package:r="@devup-ui/react",devupFile:a="devup.json",distDir:o="df",cssDir:l=e.resolve(o,"devup-ui"),extractCss:d=!0,debug:S=!1,include:v=[],singleCss:g=!1}={}){u.setDebug(S);const f=new Map;return{name:"devup-ui",async configResolved(){m.existsSync(o)||await c.mkdir(o,{recursive:!0}),await c.writeFile(e.join(o,".gitignore"),"*","utf-8"),await F({package:r,cssDir:l,devupFile:a,distDir:o,singleCss:g})},config(){const n=u.getDefaultTheme(),t={};n&&(t["process.env.DEVUP_UI_DEFAULT_THEME"]=JSON.stringify(n));const s={server:{watch:{ignored:[`!${a}`]}},define:t,optimizeDeps:{exclude:[...v,"@devup-ui/components"]},ssr:{noExternal:[...v,/@devup-ui/]}};return d&&(s.build={rollupOptions:{output:{manualChunks(i){const p=e.basename(i).split("?")[0];if(/devup-ui(-\d+)?\.css$/.test(p))return p}}}}),s},apply(){return!0},async watchChange(n){if(e.resolve(n)===e.resolve(a)&&m.existsSync(a))try{await F({package:r,cssDir:l,devupFile:a,distDir:o,singleCss:g})}catch(t){console.error(t)}},resolveId(n,t){const s=e.basename(n).split("?")[0];if(/devup-ui(-\d+)?\.css$/.test(s)&&e.resolve(t?e.join(e.dirname(t),n):n)===e.resolve(e.join(l,s)))return e.join(l,`${s}?t=${Date.now().toString()+(f.get(y(s))?.length??0)}`)},load(n){const t=e.basename(n).split("?")[0];if(/devup-ui(-\d+)?\.css$/.test(t)){const s=y(t),i=u.getCss(s,!1);return f.set(s,i),i}},enforce:"pre",async transform(n,t){if(!d)return;const s=t.split("?")[0];if(!/\.(tsx|ts|js|mjs|jsx)$/i.test(s)||new RegExp(`node_modules(?!.*(${["@devup-ui",...v].join("|").replaceAll("/","[\\/\\\\_]")})([\\/\\\\.]|$))`).test(s))return;let i=e.relative(e.dirname(t),l).replaceAll("\\","/");i.startsWith("./")||(i=`./${i}`);const{code:p,css:j="",map:N,cssFile:h,updatedBaseStyle:x}=u.codeExtract(s,n,r,i,g,!0,!1),w=[];if(x&&w.push(c.writeFile(e.join(l,"devup-ui.css"),u.getCss(null,!1),"utf-8")),h){const $=y(h),T=f.get($);T&&T.length<j.length&&f.set($,j),w.push(c.writeFile(e.join(l,e.basename(h)),`/* ${t} ${Date.now()} */`,"utf-8"))}return await Promise.all(w),{code:p,map:N}},async generateBundle(n,t){if(!d)return;const s=Object.keys(t).find(i=>t[i].name==="devup-ui.css");s&&"source"in t[s]&&(t[s].source=f.get(null))}}}exports.DevupUI=_;
package/dist/plugin.js CHANGED
@@ -1,5 +1,5 @@
1
- import { existsSync as v } from "node:fs";
2
- import { writeFile as f, mkdir as k, readFile as C } from "node:fs/promises";
1
+ import { existsSync as d } from "node:fs";
2
+ import { writeFile as f, mkdir as k, readFile as D } from "node:fs/promises";
3
3
  import { relative as O, dirname as F, resolve as l, join as i, basename as m } from "node:path";
4
4
  import { setDebug as U, codeExtract as A, getCss as T, getDefaultTheme as B, registerTheme as $, getThemeInterface as M } from "@devup-ui/wasm";
5
5
  function N(s) {
@@ -7,12 +7,12 @@ function N(s) {
7
7
  }
8
8
  async function _(s) {
9
9
  try {
10
- const u = v(s.devupFile) ? await C(s.devupFile, "utf-8") : void 0;
10
+ const u = d(s.devupFile) ? await D(s.devupFile, "utf-8") : void 0;
11
11
  if (u) {
12
12
  $(JSON.parse(u)?.theme ?? {});
13
13
  const a = M(
14
14
  s.package,
15
- "DevupThemeColors",
15
+ "CustomColors",
16
16
  "DevupThemeTypography",
17
17
  "DevupTheme"
18
18
  );
@@ -27,7 +27,7 @@ async function _(s) {
27
27
  console.error(u), $({});
28
28
  }
29
29
  await Promise.all([
30
- v(s.cssDir) ? Promise.resolve() : k(s.cssDir, { recursive: !0 }),
30
+ d(s.cssDir) ? Promise.resolve() : k(s.cssDir, { recursive: !0 }),
31
31
  s.singleCss ? Promise.resolve() : f(i(s.cssDir, "devup-ui.css"), T(null, !1))
32
32
  ]);
33
33
  }
@@ -36,17 +36,17 @@ function z({
36
36
  devupFile: u = "devup.json",
37
37
  distDir: a = "df",
38
38
  cssDir: o = l(a, "devup-ui"),
39
- extractCss: d = !0,
40
- debug: D = !1,
39
+ extractCss: v = !0,
40
+ debug: C = !1,
41
41
  include: g = [],
42
42
  singleCss: h = !1
43
43
  } = {}) {
44
- U(D);
44
+ U(C);
45
45
  const c = /* @__PURE__ */ new Map();
46
46
  return {
47
47
  name: "devup-ui",
48
48
  async configResolved() {
49
- v(a) || await k(a, { recursive: !0 }), await f(i(a, ".gitignore"), "*", "utf-8"), await _({
49
+ d(a) || await k(a, { recursive: !0 }), await f(i(a, ".gitignore"), "*", "utf-8"), await _({
50
50
  package: s,
51
51
  cssDir: o,
52
52
  devupFile: u,
@@ -71,7 +71,7 @@ function z({
71
71
  noExternal: [...g, /@devup-ui/]
72
72
  }
73
73
  };
74
- return d && (t.build = {
74
+ return v && (t.build = {
75
75
  rollupOptions: {
76
76
  output: {
77
77
  manualChunks(n) {
@@ -87,7 +87,7 @@ function z({
87
87
  return !0;
88
88
  },
89
89
  async watchChange(r) {
90
- if (l(r) === l(u) && v(u))
90
+ if (l(r) === l(u) && d(u))
91
91
  try {
92
92
  await _({
93
93
  package: s,
@@ -117,7 +117,7 @@ function z({
117
117
  },
118
118
  enforce: "pre",
119
119
  async transform(r, e) {
120
- if (!d) return;
120
+ if (!v) return;
121
121
  const t = e.split("?")[0];
122
122
  if (!/\.(tsx|ts|js|mjs|jsx)$/i.test(t) || new RegExp(
123
123
  `node_modules(?!.*(${["@devup-ui", ...g].join("|").replaceAll("/", "[\\/\\\\_]")})([\\/\\\\.]|$))`
@@ -151,7 +151,7 @@ function z({
151
151
  };
152
152
  },
153
153
  async generateBundle(r, e) {
154
- if (!d) return;
154
+ if (!v) return;
155
155
  const t = Object.keys(e).find(
156
156
  (n) => e[n].name === "devup-ui.css"
157
157
  );
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "vite"
19
19
  ],
20
20
  "type": "module",
21
- "version": "1.0.48",
21
+ "version": "1.0.50",
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.45"
39
+ "@devup-ui/wasm": "^1.0.53"
40
40
  },
41
41
  "devDependencies": {
42
42
  "vite-plugin-dts": "^4.5.4",