@tomjs/vite-plugin-electron 2.1.0 → 2.3.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.
Files changed (2) hide show
  1. package/dist/index.mjs +5 -41
  2. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -6,8 +6,7 @@ import merge from "lodash.merge";
6
6
  import os from "node:os";
7
7
  import { cwd } from "node:process";
8
8
  import { execa, execaSync } from "execa";
9
- import dayjs from "dayjs";
10
- import { blue, gray, green, red, yellow } from "kolorist";
9
+ import Logger from "@tomjs/logger";
11
10
  import cp, { spawn } from "node:child_process";
12
11
  import electron from "electron";
13
12
  import { build } from "tsdown";
@@ -17,46 +16,11 @@ const PLUGIN_NAME = "tomjs:electron";
17
16
 
18
17
  //#endregion
19
18
  //#region src/logger.ts
20
- /**
21
- * 日志
22
- */
23
- var Logger = class {
24
- constructor(tag, withTime) {
25
- this.tag = PLUGIN_NAME;
26
- this.withTime = true;
27
- this.tag = `[${tag}]`;
28
- this.withTime = withTime ?? true;
29
- }
30
- getTime() {
31
- return `${this.withTime ? dayjs().format("HH:mm:ss") : ""} `;
32
- }
33
- /**
34
- * 调试
35
- */
36
- debug(msg, ...rest) {
37
- console.log(`${this.getTime()}${gray(this.tag)}`, msg, ...rest);
38
- }
39
- /**
40
- * 调试日志 等同 debug
41
- */
42
- log(msg, ...rest) {
43
- this.debug(msg, ...rest);
44
- }
45
- info(msg, ...rest) {
46
- console.log(`${this.getTime()}${blue(this.tag)}`, msg, ...rest);
47
- }
48
- warn(msg, ...rest) {
49
- console.log(`${this.getTime()}${yellow(this.tag)}`, msg, ...rest);
50
- }
51
- error(msg, ...rest) {
52
- console.log(`${this.getTime()}${red(this.tag)}`, msg, ...rest);
53
- }
54
- success(msg, ...rest) {
55
- console.log(`${this.getTime()}${green(this.tag)}`, msg, ...rest);
56
- }
57
- };
58
19
  function createLogger(tag) {
59
- return new Logger(tag || PLUGIN_NAME, true);
20
+ return new Logger({
21
+ prefix: tag || `[${PLUGIN_NAME}]`,
22
+ time: true
23
+ });
60
24
  }
61
25
 
62
26
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tomjs/vite-plugin-electron",
3
3
  "type": "module",
4
- "version": "2.1.0",
4
+ "version": "2.3.0",
5
5
  "description": "A simple vite plugin for electron, supports esm/cjs, support esm in electron v28+",
6
6
  "author": {
7
7
  "name": "Tom Gao",
@@ -22,7 +22,8 @@
22
22
  ],
23
23
  "exports": {
24
24
  ".": "./dist/index.mjs",
25
- "./electron": "./dist/electron.mjs"
25
+ "./electron": "./dist/electron.mjs",
26
+ "./env": "./env.d.ts"
26
27
  },
27
28
  "module": "./dist/index.mjs",
28
29
  "types": "./dist/index.d.mts",
@@ -48,9 +49,8 @@
48
49
  }
49
50
  },
50
51
  "dependencies": {
51
- "dayjs": "^1.11.19",
52
+ "@tomjs/logger": "^2.0.0",
52
53
  "execa": "^9.6.1",
53
- "kolorist": "^1.8.0",
54
54
  "lodash.clonedeep": "^4.5.0",
55
55
  "lodash.merge": "^4.6.2",
56
56
  "tsdown": "~0.18.1"
@@ -58,9 +58,9 @@
58
58
  "devDependencies": {
59
59
  "@commitlint/cli": "^20.2.0",
60
60
  "@tomjs/commitlint": "^5.0.0",
61
- "@tomjs/eslint": "^6.0.0",
61
+ "@tomjs/eslint": "^6.4.0",
62
62
  "@tomjs/stylelint": "^7.0.0",
63
- "@tomjs/tsconfig": "^2.2.0",
63
+ "@tomjs/tsconfig": "^3.0.1",
64
64
  "@types/lodash.clonedeep": "^4.5.9",
65
65
  "@types/lodash.merge": "^4.6.9",
66
66
  "@types/node": "^20.19.27",