@xiping/vite-version 1.0.39 → 1.0.40

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.
Files changed (2) hide show
  1. package/lib/index.js +8 -1
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import dayjs from "dayjs";
4
+ import utc from "dayjs/plugin/utc";
5
+ import timezone from "dayjs/plugin/timezone";
6
+ // 扩展 dayjs 以支持时区
7
+ dayjs.extend(utc);
8
+ dayjs.extend(timezone);
4
9
  export function viteVersionPlugin(props) {
5
10
  const defaultOptions = {
6
11
  filename: "version.txt",
@@ -21,7 +26,9 @@ export function viteVersionPlugin(props) {
21
26
  // Get the output directory from Vite config
22
27
  const outDir = _outDir || "dist";
23
28
  // Create version.txt content with build time
24
- const buildTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
29
+ const now = dayjs();
30
+ const timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
31
+ const buildTime = `${now.format("YYYY-MM-DD HH:mm:ss")} (${timezoneName})`;
25
32
  let versionContent = `Build Time: ${buildTime}`;
26
33
  if (options.infoText) {
27
34
  versionContent += `\n${options.infoText}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiping/vite-version",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "type": "module",
5
5
  "description": "vite-version",
6
6
  "author": "The-End-Hero <527409987@qq.com>",
@@ -25,16 +25,16 @@
25
25
  "bugs": {
26
26
  "url": "https://github.com/The-End-Hero/wang-ping/issues"
27
27
  },
28
- "gitHead": "189a73a39a274b78c9385c52cba91a3841198cfa",
28
+ "gitHead": "e7557a98b36680d243416591410267142f2ad4e6",
29
29
  "publishConfig": {
30
30
  "access": "public",
31
31
  "registry": "https://registry.npmjs.org/"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^24.7.2",
35
- "dayjs": "^1.11.18",
34
+ "@types/node": "^24.10.1",
35
+ "dayjs": "^1.11.19",
36
36
  "typescript": "^5.9.3",
37
- "vite": "^7.1.10"
37
+ "vite": "^7.2.4"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "dayjs": "^1.0.0 || ^2.0.0",