@devup-ui/vite-plugin 0.1.42 → 0.1.43

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,9 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),i=require("node:path"),g=require("node:url"),o=require("@devup-ui/wasm");var d=typeof document<"u"?document.currentScript:null;const h=g.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.tagName.toUpperCase()==="SCRIPT"&&d.src||new URL("plugin.cjs",document.baseURI).href),v=i.dirname(h);function l(e){var t;o.registerTheme((t=JSON.parse(r.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const n=o.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&(r.existsSync(e.interfacePath)||r.mkdirSync(e.interfacePath),r.writeFileSync(i.join(e.interfacePath,"theme.d.ts"),n,{encoding:"utf-8"})),r.writeFileSync(e.cssFile,o.getCss(),{encoding:"utf-8"})}function S({package:e="@devup-ui/react",cssFile:n=i.join(v,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:p=!0,debug:y=!1}={}){if(o.setDebug(y),r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(u){console.error(u)}let f=null;return{name:"devup-ui",config(){return{server:{watch:{ignored:[`!${t}`]}}}},apply(u,c){return f=c.command,!0},watchChange(u){if(i.resolve(u)===i.resolve(t)&&r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(c){console.error(c)}},enforce:"pre",transform(u,c){if(!p||c.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(c))return;const{code:m,css:s}=o.codeExtract(c,u,e,n);return s&&(r.writeFileSync(n,s,{encoding:"utf-8"}),f==="serve")?{code:`${m}
2
- const exists = !!document.getElementById('devup-ui');
3
- const style = document.getElementById('devup-ui') || document.createElement('style');
4
- style.id = 'devup-ui';
5
- style.textContent = \`
6
- ${s}
7
- \`;
8
- if (!exists) document.head.appendChild(style);
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("node:fs"),u=require("node:path"),g=require("node:url"),o=require("@devup-ui/wasm");var d=typeof document<"u"?document.currentScript:null;const h=g.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:d&&d.tagName.toUpperCase()==="SCRIPT"&&d.src||new URL("plugin.cjs",document.baseURI).href),v=u.dirname(h);function l(e){var t;o.registerTheme((t=JSON.parse(r.readFileSync(e.devupPath,"utf-8")))==null?void 0:t.theme);const n=o.getThemeInterface(e.package,"DevupThemeColors","DevupThemeTypography","DevupTheme");n&&(r.existsSync(e.interfacePath)||r.mkdirSync(e.interfacePath),r.writeFileSync(u.join(e.interfacePath,"theme.d.ts"),n,{encoding:"utf-8"})),r.writeFileSync(e.cssFile,o.getCss(),{encoding:"utf-8"})}function S({package:e="@devup-ui/react",cssFile:n=u.join(v,"devup-ui.css"),devupPath:t="devup.json",interfacePath:a=".df",extractCss:p=!0,debug:y=!1}={}){if(o.setDebug(y),r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(i){console.error(i)}let f=null;return{name:"devup-ui",config(){return{server:{watch:{ignored:[`!${t}`]}}}},apply(i,c){return f=c.command,!0},watchChange(i){if(u.resolve(i)===u.resolve(t)&&r.existsSync(t))try{l({package:e,cssFile:n,devupPath:t,interfacePath:a})}catch(c){console.error(c)}},enforce:"pre",transform(i,c){if(!p||c.includes("node_modules")||!/\.(tsx|ts|js|mjs|jsx)$/i.test(c))return;const{code:m,css:s}=o.codeExtract(c,i,e,n);return s&&(r.writeFileSync(n,s,{encoding:"utf-8"}),f==="serve")?{code:`${m}
2
+ if(typeof window !== 'undefined'){
3
+ const exists = !!document.getElementById('devup-ui');
4
+ const style = document.getElementById('devup-ui') || document.createElement('style');
5
+ style.id = 'devup-ui';
6
+ style.textContent = \`
7
+ ${s}
8
+ \`;
9
+ if (!exists) document.head.appendChild(style);
10
+ }
9
11
  `}:{code:m}}}}exports.DevupUI=S;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC,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;AAuBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,EACjB,KAAa,GACd,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA4EnD"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAKxC,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;AAuBD,wBAAgB,OAAO,CAAC,EACtB,OAAO,EAAE,UAA8B,EACvC,OAAwC,EACxC,SAAwB,EACxB,aAAqB,EACrB,UAAiB,EACjB,KAAa,GACd,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAAG,YAAY,CA8EnD"}
package/dist/plugin.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { existsSync as i, writeFileSync as u, readFileSync as g, mkdirSync as h } from "node:fs";
2
- import { dirname as v, join as l, resolve as d } from "node:path";
2
+ import { dirname as v, join as l, resolve as f } from "node:path";
3
3
  import { fileURLToPath as x } from "node:url";
4
- import { setDebug as C, codeExtract as T, registerTheme as D, getThemeInterface as j, getCss as S } from "@devup-ui/wasm";
5
- const w = x(import.meta.url), E = v(w);
6
- function f(e) {
4
+ import { setDebug as C, codeExtract as T, registerTheme as w, getThemeInterface as D, getCss as j } from "@devup-ui/wasm";
5
+ const S = x(import.meta.url), E = v(S);
6
+ function a(e) {
7
7
  var t;
8
- D((t = JSON.parse(g(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
9
- const r = j(
8
+ w((t = JSON.parse(g(e.devupPath, "utf-8"))) == null ? void 0 : t.theme);
9
+ const r = D(
10
10
  e.package,
11
11
  "DevupThemeColors",
12
12
  "DevupThemeTypography",
@@ -14,7 +14,7 @@ function f(e) {
14
14
  );
15
15
  r && (i(e.interfacePath) || h(e.interfacePath), u(l(e.interfacePath, "theme.d.ts"), r, {
16
16
  encoding: "utf-8"
17
- })), u(e.cssFile, S(), {
17
+ })), u(e.cssFile, j(), {
18
18
  encoding: "utf-8"
19
19
  });
20
20
  }
@@ -28,14 +28,14 @@ function B({
28
28
  } = {}) {
29
29
  if (C(y), i(t))
30
30
  try {
31
- f({
31
+ a({
32
32
  package: e,
33
33
  cssFile: r,
34
34
  devupPath: t,
35
35
  interfacePath: m
36
36
  });
37
- } catch (c) {
38
- console.error(c);
37
+ } catch (o) {
38
+ console.error(o);
39
39
  }
40
40
  let s = null;
41
41
  return {
@@ -49,13 +49,13 @@ function B({
49
49
  }
50
50
  };
51
51
  },
52
- apply(c, n) {
52
+ apply(o, n) {
53
53
  return s = n.command, !0;
54
54
  },
55
- watchChange(c) {
56
- if (d(c) === d(t) && i(t))
55
+ watchChange(o) {
56
+ if (f(o) === f(t) && i(t))
57
57
  try {
58
- f({
58
+ a({
59
59
  package: e,
60
60
  cssFile: r,
61
61
  devupPath: t,
@@ -66,23 +66,25 @@ function B({
66
66
  }
67
67
  },
68
68
  enforce: "pre",
69
- transform(c, n) {
69
+ transform(o, n) {
70
70
  if (!p || n.includes("node_modules") || !/\.(tsx|ts|js|mjs|jsx)$/i.test(n)) return;
71
- const { code: a, css: o } = T(n, c, e, r);
72
- return o && (u(r, o, {
71
+ const { code: d, css: c } = T(n, o, e, r);
72
+ return c && (u(r, c, {
73
73
  encoding: "utf-8"
74
74
  }), s === "serve") ? {
75
- code: `${a}
76
- const exists = !!document.getElementById('devup-ui');
77
- const style = document.getElementById('devup-ui') || document.createElement('style');
78
- style.id = 'devup-ui';
79
- style.textContent = \`
80
- ${o}
81
- \`;
82
- if (!exists) document.head.appendChild(style);
75
+ code: `${d}
76
+ if(typeof window !== 'undefined'){
77
+ const exists = !!document.getElementById('devup-ui');
78
+ const style = document.getElementById('devup-ui') || document.createElement('style');
79
+ style.id = 'devup-ui';
80
+ style.textContent = \`
81
+ ${c}
82
+ \`;
83
+ if (!exists) document.head.appendChild(style);
84
+ }
83
85
  `
84
86
  } : {
85
- code: a
87
+ code: d
86
88
  };
87
89
  }
88
90
  };
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.42",
4
+ "version": "0.1.43",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },