@lntvow/vite-plugin 0.0.17 → 0.0.18
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.mjs +6 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";const m=require("node:path"),a=require("node:fs"),
|
|
1
|
+
"use strict";const m=require("node:path"),a=require("node:fs"),n=require("dayjs"),g=require("dayjs/plugin/utc"),c=require("dayjs/plugin/timezone");function _interopDefaultCompat(t){return t&&typeof t=="object"&&"default"in t?t.default:t}const m__default=_interopDefaultCompat(m),a__default=_interopDefaultCompat(a),n__default=_interopDefaultCompat(n),g__default=_interopDefaultCompat(g),c__default=_interopDefaultCompat(c);n__default.extend(g__default),n__default.extend(c__default);function vitePluginLogs(t={}){const{name:i="LNTVOW_VERSION"}=t;let e=t.version;if(!e)try{const o=a__default.readFileSync(m__default.resolve(process.cwd(),"package.json"),"utf8");e=JSON.parse(o).version}catch{throw new Error("package.json not found")}return{name:"vite-plugin-logs",transform(o,s){if(s.endsWith("src/main.ts")||s.endsWith("src/main.js")){const r=n__default().tz("Asia/Shanghai").format("YYYY-MM-DD HH:mm:ss");return{code:`
|
|
2
2
|
|
|
3
|
-
import { log } from '@lntvow/utils';
|
|
3
|
+
import { log as vitePluginLogs } from '@lntvow/utils';
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${o}
|
|
6
6
|
|
|
7
|
-
localStorage.setItem('${
|
|
8
|
-
|
|
7
|
+
localStorage.setItem('${i}', JSON.stringify(['${r}', '${e}']))
|
|
8
|
+
vitePluginLogs('version', '${r}', '${e}')
|
|
9
9
|
|
|
10
10
|
`}}}}}exports.Logs=vitePluginLogs;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import m from"node:path";import a from"node:fs";import
|
|
1
|
+
import m from"node:path";import a from"node:fs";import r from"dayjs";import c from"dayjs/plugin/utc";import g from"dayjs/plugin/timezone";r.extend(c),r.extend(g);function f(n={}){const{name:i="LNTVOW_VERSION"}=n;let o=n.version;if(!o)try{const t=a.readFileSync(m.resolve(process.cwd(),"package.json"),"utf8");o=JSON.parse(t).version}catch{throw new Error("package.json not found")}return{name:"vite-plugin-logs",transform(t,s){if(s.endsWith("src/main.ts")||s.endsWith("src/main.js")){const e=r().tz("Asia/Shanghai").format("YYYY-MM-DD HH:mm:ss");return{code:`
|
|
2
2
|
|
|
3
|
-
import { log } from '@lntvow/utils';
|
|
3
|
+
import { log as vitePluginLogs } from '@lntvow/utils';
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${t}
|
|
6
6
|
|
|
7
|
-
localStorage.setItem('${
|
|
8
|
-
|
|
7
|
+
localStorage.setItem('${i}', JSON.stringify(['${e}', '${o}']))
|
|
8
|
+
vitePluginLogs('version', '${e}', '${o}')
|
|
9
9
|
|
|
10
|
-
`}}}}}export{
|
|
10
|
+
`}}}}}export{f as Logs};
|