@lntvow/vite-plugin 1.0.2 → 1.0.4
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 +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -5
- package/package.json +5 -6
- package/dist/index.d.mts +0 -19
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var P=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var j=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!h.call(t,r)&&r!==o&&s(t,r,{get:()=>e[r],enumerable:!(n=x(e,r))||n.enumerable});return t};var i=(t,e,o)=>(o=t!=null?P(O(t)):{},p(e||!t||!t.__esModule?s(o,"default",{value:t,enumerable:!0}):o,t)),L=t=>p(s({},"__esModule",{value:!0}),t);var S={};j(S,{vitePluginHtml:()=>w,vitePluginLogs:()=>$});module.exports=L(S);var c=i(require("path"),1),f=i(require("fs"),1),m=i(require("dayjs"),1),l=i(require("dayjs/plugin/utc"),1),u=i(require("dayjs/plugin/timezone"),1),v=require("@lntvow/utils");m.default.extend(l.default);m.default.extend(u.default);function $(t={}){let{name:e="LNTVOW_VERSION"}=t,{version:o}=t;if(!o)try{let n=f.default.readFileSync(c.default.resolve(process.cwd(),"package.json"),"utf8");o=JSON.parse(n).version}catch(n){(0,v.throwError)("vitePluginLogs","package.json not found")}return{name:"vite-plugin-logs",transform(n,r){if(r.endsWith("src/main.ts")||r.endsWith("src/main.js")){let g=(0,m.default)().tz("Asia/Shanghai").format("YYYY-MM-DD HH:mm:ss");return{code:`
|
|
2
2
|
|
|
3
3
|
import { log as vitePluginLogs } from '@lntvow/utils';
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${n}
|
|
6
6
|
|
|
7
|
-
localStorage.setItem('${
|
|
8
|
-
vitePluginLogs('version', '${
|
|
7
|
+
localStorage.setItem('${e}', JSON.stringify(['${g}', '${o}']))
|
|
8
|
+
vitePluginLogs('version', '${g}', '${o}')
|
|
9
9
|
|
|
10
|
-
`}}}}}function
|
|
10
|
+
`}}}}}var d=require("vite");function w(){let t={};return{name:"vite-plugin-html",enforce:"pre",config(e,{mode:o}){t=(0,d.loadEnv)(o,process.cwd())},transformIndexHtml(e){return Object.keys(t).forEach(o=>{let n=new RegExp(`%${o}%`,"g");e=e.replace(n,t[o])}),e}}}0&&(module.exports={vitePluginHtml,vitePluginLogs});
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import p from"path";import a from"fs";import r from"dayjs";import c from"dayjs/plugin/utc";import f from"dayjs/plugin/timezone";import{throwError as l}from"@lntvow/utils";r.extend(c);r.extend(f);function h(e={}){let{name:o="LNTVOW_VERSION"}=e,{version:t}=e;if(!t)try{let n=a.readFileSync(p.resolve(process.cwd(),"package.json"),"utf8");t=JSON.parse(n).version}catch(n){l("vitePluginLogs","package.json not found")}return{name:"vite-plugin-logs",transform(n,i){if(i.endsWith("src/main.ts")||i.endsWith("src/main.js")){let s=r().tz("Asia/Shanghai").format("YYYY-MM-DD HH:mm:ss");return{code:`
|
|
2
2
|
|
|
3
3
|
import { log as vitePluginLogs } from '@lntvow/utils';
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${n}
|
|
6
6
|
|
|
7
|
-
localStorage.setItem('${
|
|
8
|
-
vitePluginLogs('version', '${
|
|
7
|
+
localStorage.setItem('${o}', JSON.stringify(['${s}', '${t}']))
|
|
8
|
+
vitePluginLogs('version', '${s}', '${t}')
|
|
9
9
|
|
|
10
|
-
`}}}}}function
|
|
10
|
+
`}}}}}import{loadEnv as u}from"vite";function w(){let e={};return{name:"vite-plugin-html",enforce:"pre",config(o,{mode:t}){e=u(t,process.cwd())},transformIndexHtml(o){return Object.keys(e).forEach(t=>{let n=new RegExp(`%${t}%`,"g");o=o.replace(n,e[t])}),o}}}export{w as vitePluginHtml,h as vitePluginLogs};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lntvow/vite-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "vite插件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,19 +16,18 @@
|
|
|
16
16
|
"pnpm": ">=9.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@lntvow/utils": "^3.0.
|
|
19
|
+
"@lntvow/utils": "^3.0.12",
|
|
20
20
|
"dayjs": "^1.11.11"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@lntvow/dev": "^1.
|
|
24
|
-
"
|
|
25
|
-
"unbuild": "^2.0.0"
|
|
23
|
+
"@lntvow/dev": "^1.1.4",
|
|
24
|
+
"tsup": "^8.1.0"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"vite": ">=5.0.0"
|
|
29
28
|
},
|
|
30
29
|
"scripts": {
|
|
31
|
-
"build": "
|
|
30
|
+
"build": "tsup",
|
|
32
31
|
"commit": "git add . && git-cz && git push",
|
|
33
32
|
"rimraf": "rimraf ./node_modules/",
|
|
34
33
|
"release": "git add . && bumpp package.json --all --commit --no-tag --push"
|
package/dist/index.d.mts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
|
-
|
|
3
|
-
declare function vitePluginLogs(options?: VitePluginLogsOptions): Plugin;
|
|
4
|
-
interface VitePluginLogsOptions {
|
|
5
|
-
/**
|
|
6
|
-
* @description localStorage key
|
|
7
|
-
* @default LNTVOW_VERSION
|
|
8
|
-
*/
|
|
9
|
-
name?: string;
|
|
10
|
-
/**
|
|
11
|
-
* @description 版本号
|
|
12
|
-
* @default 默认读取package.json的version
|
|
13
|
-
*/
|
|
14
|
-
version?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare function vitePluginHtml(): Plugin;
|
|
18
|
-
|
|
19
|
-
export { vitePluginHtml, vitePluginLogs };
|