@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 +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/package.json +27 -28
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
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=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[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
|
|
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=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[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.
|
|
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
|
-
"@
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
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
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
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": "
|
|
53
|
+
"lint": "cli parallel lint:eslint lint:tsc",
|
|
55
54
|
"build": "tsup"
|
|
56
55
|
}
|
|
57
56
|
}
|