@lntvow/vite-plugin 1.3.1 → 1.4.0

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var j=Object.create;var h=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var P=(o,e)=>{for(var r in e)h(o,r,{get:e[r],enumerable:!0})},$=(o,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of k(e))!L.call(o,t)&&t!==r&&h(o,t,{get:()=>e[t],enumerable:!(n=M(e,t))||n.enumerable});return o};var z=(o,e,r)=>(r=o!=null?j(E(o)):{},$(e||!o||!o.__esModule?h(r,"default",{value:o,enumerable:!0}):r,o)),D=o=>$(h({},"__esModule",{value:!0}),o);var F={};P(F,{vitePluginEnvRibbon:()=>T,vitePluginVersionLog:()=>q});module.exports=D(F);function T(o={}){let e="vite-plugin-env-ribbon",{width:r=150,height:n=20,fontSize:t=12,backgroundColor:l="hsla(0, 100%, 33%, 0.733)",color:s="#fff",position:d="top-right",envMap:g={}}=o,c;return{name:e,transformIndexHtml(i){if(c==="production")return i;let u=g[c]||c;if(!u)return i;let p=d==="top-left",w=p?`translate(-${n/Math.sqrt(2)}px, -${n/Math.sqrt(2)}px) translate(0, ${r/Math.sqrt(2)}px) rotate(-45deg)`:`translate(${n/Math.sqrt(2)}px, -${n/Math.sqrt(2)}px) translate(0, ${r/Math.sqrt(2)}px) rotate(45deg)`,b=p?"left top":"right top",y=p?"auto":"0",O=p?"0":"auto",S=["position: fixed",`width: ${r}px`,`height: ${n}px`,`background: ${l}`,`color: ${s}`,`font-size: ${t}px`,`line-height: ${n}px`,`transform: ${w}`,`transform-origin: ${b}`,"top: 0",`right: ${y}`,`left: ${O}`,"z-index: 9999","text-align: center","pointer-events: none","user-select: none","overflow: hidden"].join(";");return{html:i,tags:[{tag:"div",attrs:{style:S,id:e},children:u,injectTo:"body"}]}},configResolved(i){c=i.mode}}}var m=require("fs"),a=require("path");var f=z(require("picocolors"),1);function x(o){let e=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),r=t=>e.format(t);return{info:t=>console.log(n("info",t)),warn:t=>console.log(n("warn",t)),error:t=>console.log(n("error",t))};function n(t,l){let s={info:f.default.cyan,warn:f.default.yellow,error:f.default.red};return`${f.default.dim(r(new Date))} ${s[t](f.default.bold(`[${o}]`))} ${s[t](l)}`}}function q(o={}){let{name:e="LNTVOW_VERSION",timezone:r=Intl.DateTimeFormat().resolvedOptions().timeZone,entry:n}=o,{version:t}=o,l="vite-plugin-version-log",s=x(l),d=["src/main.ts","src/main.js"].map(i=>(0,a.resolve)(process.cwd(),i)),g;if(n){if(g=(0,a.isAbsolute)(n)?n:(0,a.resolve)(process.cwd(),n),!(0,m.existsSync)(g)){s.error(`Entry file not found: ${g}`);return}}else if(g=d.find(i=>(0,m.existsSync)(i)),!g){s.error(`Default entry files (${d.join(", ")}) were not found.`),s.error('Specify a custom path via the "entry" option to use a different file.');return}let c=new Intl.DateTimeFormat("sv-SE",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date);if(!t)try{let i=(0,m.readFileSync)((0,a.resolve)(process.cwd(),"package.json"),"utf8");t=JSON.parse(i).version}catch(i){t="unknown",console.log("error: ",i),s.warn("Failed to read version from package.json. Using 'unknown' as version.")}return{name:l,transform(i,u){if((0,a.normalize)(u)===(0,a.normalize)(g))return{code:[i,`localStorage.setItem('${e}', JSON.stringify(['${c}', '${t}']))`,`console.log('[Log] version:', ['${c}', '${t}']);`].join(";")}}}}0&&(module.exports={vitePluginEnvRibbon,vitePluginVersionLog});
1
+ "use strict";var P=Object.create;var x=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var D=(n,o)=>{for(var e in o)x(n,e,{get:o[e],enumerable:!0})},S=(n,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of N(o))!z.call(n,t)&&t!==e&&x(n,t,{get:()=>o[t],enumerable:!(r=j(o,t))||r.enumerable});return n};var I=(n,o,e)=>(e=n!=null?P(T(n)):{},S(o||!n||!n.__esModule?x(e,"default",{value:n,enumerable:!0}):e,n)),J=n=>S(x({},"__esModule",{value:!0}),n);var C={};D(C,{vitePluginEnvRibbon:()=>R,vitePluginVersionLog:()=>F});module.exports=J(C);function R(n={}){let o="vite-plugin-env-ribbon",{width:e=150,height:r=20,fontSize:t=12,backgroundColor:l="hsla(0, 100%, 33%, 0.733)",color:a="#fff",position:v="top-right",envMap:g={}}=n,f="",y=Math.sqrt(2);return{name:o,configResolved(c){f=c.mode},transformIndexHtml(c){if(f==="production")return c;let h=g[f]||f;if(!h)return c;let i=h.replace(/[&<>"']/g,O=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[O]??O),s=v==="top-left",p=r/y,w=e/y,L=s?`translate(-${p}px, -${p}px) translate(0, ${w}px) rotate(-45deg)`:`translate(${p}px, -${p}px) translate(0, ${w}px) rotate(45deg)`,E=["position: fixed",`width: ${e}px`,`height: ${r}px`,`background: ${l}`,`color: ${a}`,`font-size: ${t}px`,`line-height: ${r}px`,`transform: ${L}`,`transform-origin: ${s?"left top":"right top"}`,"top: 0",s?"left: 0":"right: 0","z-index: 9999","text-align: center","pointer-events: none","user-select: none","overflow: hidden"].join(";");return{html:c,tags:[{tag:"div",attrs:{style:E,id:o},children:i,injectTo:"body"}]}}}}var u=require("fs"),d=require("path"),b=require("vite");var m=I(require("picocolors"),1);function k(n){let o=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),e=t=>o.format(t);return{info:t=>console.log(r("info",t)),warn:t=>console.log(r("warn",t)),error:t=>console.log(r("error",t))};function r(t,l){let a={info:m.default.cyan,warn:m.default.yellow,error:m.default.red};return`${m.default.dim(e(new Date))} ${a[t](m.default.bold(`[${n}]`))} ${a[t](l)}`}}function F(n={}){let{name:o="LNTVOW_VERSION",timezone:e=Intl.DateTimeFormat().resolvedOptions().timeZone,entry:r}=n,{version:t}=n,l="vite-plugin-version-log",a=k(l),v=["src/main.ts","src/main.js"].map(i=>(0,d.resolve)(process.cwd(),i)),g;if(r){if(g=(0,d.isAbsolute)(r)?r:(0,d.resolve)(process.cwd(),r),!(0,u.existsSync)(g)){a.error(`Entry file not found: ${g}`);return}}else{let i=v.find(s=>(0,u.existsSync)(s));if(!i){a.error(`Default entry files (${v.join(", ")}) were not found.`),a.error('Specify a custom path via the "entry" option to use a different file.');return}g=i}let f=new Intl.DateTimeFormat("sv-SE",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date);if(!t)try{let i=(0,u.readFileSync)((0,d.resolve)(process.cwd(),"package.json"),"utf8"),s=JSON.parse(i);t=typeof s.version=="string"?s.version:"unknown"}catch(i){t="unknown",a.warn(`Failed to read package.json version, fallback to 'unknown': ${String(i)}`)}let y=(0,b.normalizePath)(g),c=JSON.stringify(JSON.stringify([f,t])),h=JSON.stringify(o);return{name:l,transform(i,s){let p=s.split("?")[0];if((0,b.normalizePath)(p)===y)return{code:[i,`localStorage.setItem(${h}, ${c})`,`console.log('[Log] version:', JSON.parse(${c}));`].join(";")}}}}0&&(module.exports={vitePluginEnvRibbon,vitePluginVersionLog});
package/dist/index.d.ts CHANGED
@@ -126,6 +126,7 @@ interface VersionLogOptions {
126
126
  * If an absolute path is given it will be used directly; otherwise the path
127
127
  * is resolved relative to `process.cwd()`.
128
128
  * When omitted the plugin will look for `src/main.ts` or `src/main.js` in
129
+ * the current working directory.
129
130
  * @default auto-detected from ['src/main.ts', 'src/main.js']
130
131
  */
131
132
  entry?: string;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function k(a={}){let g="vite-plugin-env-ribbon",{width:i=150,height:o=20,fontSize:t=12,backgroundColor:c="hsla(0, 100%, 33%, 0.733)",color:n="#fff",position:p="top-right",envMap:r={}}=a,s;return{name:g,transformIndexHtml(e){if(s==="production")return e;let m=r[s]||s;if(!m)return e;let l=p==="top-left",w=l?`translate(-${o/Math.sqrt(2)}px, -${o/Math.sqrt(2)}px) translate(0, ${i/Math.sqrt(2)}px) rotate(-45deg)`:`translate(${o/Math.sqrt(2)}px, -${o/Math.sqrt(2)}px) translate(0, ${i/Math.sqrt(2)}px) rotate(45deg)`,b=l?"left top":"right top",y=l?"auto":"0",O=l?"0":"auto",S=["position: fixed",`width: ${i}px`,`height: ${o}px`,`background: ${c}`,`color: ${n}`,`font-size: ${t}px`,`line-height: ${o}px`,`transform: ${w}`,`transform-origin: ${b}`,"top: 0",`right: ${y}`,`left: ${O}`,"z-index: 9999","text-align: center","pointer-events: none","user-select: none","overflow: hidden"].join(";");return{html:e,tags:[{tag:"div",attrs:{style:S,id:g},children:m,injectTo:"body"}]}},configResolved(e){s=e.mode}}}import{existsSync as $,readFileSync as j}from"fs";import{isAbsolute as M,normalize as x,resolve as h}from"path";import f from"picocolors";function v(a){let g=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),i=t=>g.format(t);return{info:t=>console.log(o("info",t)),warn:t=>console.log(o("warn",t)),error:t=>console.log(o("error",t))};function o(t,c){let n={info:f.cyan,warn:f.yellow,error:f.red};return`${f.dim(i(new Date))} ${n[t](f.bold(`[${a}]`))} ${n[t](c)}`}}function N(a={}){let{name:g="LNTVOW_VERSION",timezone:i=Intl.DateTimeFormat().resolvedOptions().timeZone,entry:o}=a,{version:t}=a,c="vite-plugin-version-log",n=v(c),p=["src/main.ts","src/main.js"].map(e=>h(process.cwd(),e)),r;if(o){if(r=M(o)?o:h(process.cwd(),o),!$(r)){n.error(`Entry file not found: ${r}`);return}}else if(r=p.find(e=>$(e)),!r){n.error(`Default entry files (${p.join(", ")}) were not found.`),n.error('Specify a custom path via the "entry" option to use a different file.');return}let s=new Intl.DateTimeFormat("sv-SE",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date);if(!t)try{let e=j(h(process.cwd(),"package.json"),"utf8");t=JSON.parse(e).version}catch(e){t="unknown",console.log("error: ",e),n.warn("Failed to read version from package.json. Using 'unknown' as version.")}return{name:c,transform(e,m){if(x(m)===x(r))return{code:[e,`localStorage.setItem('${g}', JSON.stringify(['${s}', '${t}']))`,`console.log('[Log] version:', ['${s}', '${t}']);`].join(";")}}}}export{k as vitePluginEnvRibbon,N as vitePluginVersionLog};
1
+ function j(a={}){let c="vite-plugin-env-ribbon",{width:g=150,height:n=20,fontSize:t=12,backgroundColor:l="hsla(0, 100%, 33%, 0.733)",color:r="#fff",position:d="top-right",envMap:s={}}=a,f="",u=Math.sqrt(2);return{name:c,configResolved(i){f=i.mode},transformIndexHtml(i){if(f==="production")return i;let v=s[f]||f;if(!v)return i;let o=v.replace(/[&<>"']/g,w=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[w]??w),e=d==="top-left",p=n/u,x=g/u,k=e?`translate(-${p}px, -${p}px) translate(0, ${x}px) rotate(-45deg)`:`translate(${p}px, -${p}px) translate(0, ${x}px) rotate(45deg)`,L=["position: fixed",`width: ${g}px`,`height: ${n}px`,`background: ${l}`,`color: ${r}`,`font-size: ${t}px`,`line-height: ${n}px`,`transform: ${k}`,`transform-origin: ${e?"left top":"right top"}`,"top: 0",e?"left: 0":"right: 0","z-index: 9999","text-align: center","pointer-events: none","user-select: none","overflow: hidden"].join(";");return{html:i,tags:[{tag:"div",attrs:{style:L,id:c},children:o,injectTo:"body"}]}}}}import{existsSync as O,readFileSync as E}from"fs";import{isAbsolute as P,resolve as $}from"path";import{normalizePath as S}from"vite";import m from"picocolors";function b(a){let c=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),g=t=>c.format(t);return{info:t=>console.log(n("info",t)),warn:t=>console.log(n("warn",t)),error:t=>console.log(n("error",t))};function n(t,l){let r={info:m.cyan,warn:m.yellow,error:m.red};return`${m.dim(g(new Date))} ${r[t](m.bold(`[${a}]`))} ${r[t](l)}`}}function M(a={}){let{name:c="LNTVOW_VERSION",timezone:g=Intl.DateTimeFormat().resolvedOptions().timeZone,entry:n}=a,{version:t}=a,l="vite-plugin-version-log",r=b(l),d=["src/main.ts","src/main.js"].map(o=>$(process.cwd(),o)),s;if(n){if(s=P(n)?n:$(process.cwd(),n),!O(s)){r.error(`Entry file not found: ${s}`);return}}else{let o=d.find(e=>O(e));if(!o){r.error(`Default entry files (${d.join(", ")}) were not found.`),r.error('Specify a custom path via the "entry" option to use a different file.');return}s=o}let f=new Intl.DateTimeFormat("sv-SE",{timeZone:g,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date);if(!t)try{let o=E($(process.cwd(),"package.json"),"utf8"),e=JSON.parse(o);t=typeof e.version=="string"?e.version:"unknown"}catch(o){t="unknown",r.warn(`Failed to read package.json version, fallback to 'unknown': ${String(o)}`)}let u=S(s),i=JSON.stringify(JSON.stringify([f,t])),v=JSON.stringify(c);return{name:l,transform(o,e){let p=e.split("?")[0];if(S(p)===u)return{code:[o,`localStorage.setItem(${v}, ${i})`,`console.log('[Log] version:', JSON.parse(${i}));`].join(";")}}}}export{j as vitePluginEnvRibbon,M as vitePluginVersionLog};
package/package.json CHANGED
@@ -1,43 +1,39 @@
1
1
  {
2
2
  "name": "@lntvow/vite-plugin",
3
- "version": "1.3.1",
4
- "type": "module",
3
+ "version": "1.4.0",
5
4
  "description": "Collection of custom vite plugins",
6
5
  "keywords": [
7
6
  "vite-plugin"
8
7
  ],
9
- "license": "MIT",
10
8
  "repository": {
11
9
  "type": "git",
12
10
  "url": "https://github.com/lntvow/vite-plugin.git"
13
11
  },
12
+ "license": "MIT",
13
+ "type": "module",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "require": "./dist/index.cjs",
18
+ "import": "./dist/index.mjs",
19
+ "default": "./dist/index.cjs"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "main": "dist/index.cjs",
24
+ "module": "dist/index.mjs",
25
+ "types": "dist/index.d.ts",
14
26
  "files": [
15
27
  "dist"
16
28
  ],
17
- "types": "dist/index.d.ts",
18
- "main": "dist/index.cjs",
19
- "module": "dist/index.mjs",
20
- "exports": {
21
- "types": "./dist/index.d.ts",
22
- "require": "./dist/index.cjs",
23
- "import": "./dist/index.mjs",
24
- "default": "./dist/index.cjs"
25
- },
26
29
  "dependencies": {
27
30
  "picocolors": "^1.1.1"
28
31
  },
29
32
  "devDependencies": {
30
- "@commitlint/cli": "^20.4.3",
31
- "@commitlint/config-conventional": "^20.4.3",
32
- "@lntvow/eslint-config": "^10.1.2",
33
- "bumpp": "^10.4.1",
34
- "commitizen": "^4.3.1",
35
- "cz-conventional-changelog": "^3.3.0",
36
- "eslint": "^10.0.3",
37
- "lint-staged": "^16.3.2",
38
- "npm-run-all": "^4.1.5",
39
- "prettier": "^3.8.1",
40
- "simple-git-hooks": "^2.13.1",
33
+ "@lntvow/cli": "^0.0.6",
34
+ "@lntvow/eslint-config": "^10.2.0",
35
+ "eslint": "^10.3.0",
36
+ "prettier": "^3.8.3",
41
37
  "tsup": "^8.5.1",
42
38
  "typescript": "^5.9.3"
43
39
  },
@@ -45,13 +41,16 @@
45
41
  "vite": ">=5.0.0"
46
42
  },
47
43
  "scripts": {
48
- "rimraf": "rimraf ./node_modules/",
49
- "ncu": "ncu -u --reject @types/node && pnpm install",
50
- "commit": "git add . && git-cz && pnpm release -y",
51
- "release": "git add . && bumpp package.json --all --no-tag --no-print-commits",
44
+ "clean": "cli clean ./node_modules/",
45
+ "upgrade": "cli upgrade -u -x \"@types/node,typescript\" && pnpm install",
46
+ "tidy": "cli tidy",
47
+ "commit": "git add -A && cli commit",
48
+ "release": "pnpm lint && git add -A && cli release package.json -a",
49
+ "changelog": "cli changelog -p angular -i CHANGELOG.md -s",
50
+ "version": "pnpm changelog && git add -A",
52
51
  "lint:eslint": "eslint --fix --cache",
53
52
  "lint:tsc": "tsc --noEmit",
54
- "lint": "run-p lint:eslint lint:tsc",
53
+ "lint": "cli parallel lint:eslint lint:tsc",
55
54
  "build": "tsup"
56
55
  }
57
56
  }