@tomjs/vite-plugin-electron 1.7.0 → 1.8.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/README.md CHANGED
@@ -416,3 +416,17 @@ Run `Debug Main Process` through `vscode` to debug the main thread. For debuggin
416
416
  ### Preload process Debug
417
417
 
418
418
  Use `DevTools` to debug the `preload process`.
419
+
420
+ ## Examples
421
+
422
+ First execute the following command to install dependencies and generate library files:
423
+
424
+ ```bash
425
+ pnpm install
426
+ pnpm build
427
+ ```
428
+
429
+ Open the [examples](./examples) directory, there are `vue` and `react` examples.
430
+
431
+ - [react](./examples/react)
432
+ - [vue](./examples/vue)
package/README.zh_CN.md CHANGED
@@ -415,3 +415,17 @@ app.whenReady().then(() => {
415
415
  ### Preload Process 调试
416
416
 
417
417
  使用 `DevTools` 调试 `preload process`.
418
+
419
+ ## 示例
420
+
421
+ 先执行以下命令安装依赖,并生成库文件:
422
+
423
+ ```bash
424
+ pnpm install
425
+ pnpm build
426
+ ```
427
+
428
+ 打开 [examples](./examples) 目录,有 `vue` 和 `react` 示例。
429
+
430
+ - [react](./examples/react)
431
+ - [vue](./examples/vue)
package/dist/index.js CHANGED
@@ -395,6 +395,11 @@ function preMergeOptions(options) {
395
395
  } else if (typeof entry === "string") {
396
396
  opt.entry = [entry];
397
397
  }
398
+ if (isDev) {
399
+ opt.sourcemap ??= true;
400
+ } else {
401
+ opt.minify ??= true;
402
+ }
398
403
  const external = opt.external || opts.external || ["electron"];
399
404
  opt.external = [...new Set(["electron"].concat(external))];
400
405
  });
@@ -442,13 +447,6 @@ function useElectronPlugin(options) {
442
447
  opts.main.outDir ||= _path2.default.join("dist-electron", "main");
443
448
  opts.preload.outDir ||= _path2.default.join("dist-electron", "preload");
444
449
  }
445
- if (isDev) {
446
- opts.main.sourcemap ??= true;
447
- opts.preload.sourcemap ??= true;
448
- } else {
449
- opts.main.minify ??= true;
450
- opts.preload.minify ??= true;
451
- }
452
450
  return {
453
451
  build: {
454
452
  outDir
package/dist/index.mjs CHANGED
@@ -394,6 +394,11 @@ function preMergeOptions(options) {
394
394
  } else if (typeof entry === "string") {
395
395
  opt.entry = [entry];
396
396
  }
397
+ if (isDev) {
398
+ opt.sourcemap ??= true;
399
+ } else {
400
+ opt.minify ??= true;
401
+ }
397
402
  const external = opt.external || opts.external || ["electron"];
398
403
  opt.external = [...new Set(["electron"].concat(external))];
399
404
  });
@@ -441,13 +446,6 @@ function useElectronPlugin(options) {
441
446
  opts.main.outDir ||= path2.join("dist-electron", "main");
442
447
  opts.preload.outDir ||= path2.join("dist-electron", "preload");
443
448
  }
444
- if (isDev) {
445
- opts.main.sourcemap ??= true;
446
- opts.preload.sourcemap ??= true;
447
- } else {
448
- opts.main.minify ??= true;
449
- opts.preload.minify ??= true;
450
- }
451
449
  return {
452
450
  build: {
453
451
  outDir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomjs/vite-plugin-electron",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "A simple vite plugin for electron, supports esm/cjs, support esm in electron v28+",
5
5
  "keywords": [
6
6
  "vite",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
41
- "url": "git+https://github.com/tomgao365/vite-plugin-electron.git"
41
+ "url": "git+https://github.com/tomjs/vite-plugin-electron.git"
42
42
  },
43
43
  "dependencies": {
44
44
  "dayjs": "^1.11.10",
@@ -51,25 +51,25 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@commitlint/cli": "^18.4.3",
54
- "@tomjs/commitlint": "^2.0.5",
55
- "@tomjs/eslint": "^1.1.1",
56
- "@tomjs/prettier": "^1.0.6",
57
- "@tomjs/stylelint": "^1.1.1",
58
- "@tomjs/tsconfig": "^1.1.2",
54
+ "@tomjs/commitlint": "^2.1.1",
55
+ "@tomjs/eslint": "^1.2.1",
56
+ "@tomjs/prettier": "^1.1.1",
57
+ "@tomjs/stylelint": "^2.1.1",
58
+ "@tomjs/tsconfig": "^1.2.1",
59
59
  "@types/lodash.clonedeep": "^4.5.9",
60
60
  "@types/lodash.merge": "^4.6.9",
61
61
  "@types/node": "^18.19.3",
62
62
  "@types/shelljs": "^0.8.15",
63
- "eslint": "^8.55.0",
63
+ "eslint": "^8.56.0",
64
64
  "husky": "^8.0.3",
65
65
  "lint-staged": "^15.2.0",
66
66
  "np": "^9.2.0",
67
67
  "npm-run-all": "^4.1.5",
68
68
  "prettier": "^3.1.1",
69
69
  "rimraf": "^5.0.5",
70
- "stylelint": "^15.11.0",
71
- "tsx": "^4.6.2",
72
- "typescript": "~5.2.2"
70
+ "stylelint": "^16.0.2",
71
+ "tsx": "^4.7.0",
72
+ "typescript": "~5.3.3"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "electron": ">=12.0.0",