electron-incremental-update 3.0.0 → 3.1.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
@@ -242,7 +242,8 @@ Common options overview:
242
242
  - `sourcemap`: defaults to development or `VSCODE_DEBUG`.
243
243
  - `minify`: defaults to production builds.
244
244
  - `bytecode`: `true` or bytecode options.
245
- - `notBundle`: externalizes Node modules in development. Defaults to `true`.
245
+ - `bundleDeps`: controls dependency bundling. Defaults to Vite's server-environment behavior.
246
+ `electron-incremental-update` is always bundled.
246
247
  - `external`: additional Vite/Rolldown externals. Use `true` to externalize `dependencies`.
247
248
  - `buildVersionJson`: generates update JSON. Defaults to CI only.
248
249
  - `localDevUpdate`: generates and serves a local update package during dev startup. Use `true`
@@ -565,13 +566,21 @@ Notes:
565
566
  - To include preload scripts, use `bytecode: { enablePreload: true }`.
566
567
  - If preload bytecode is enabled, create the `BrowserWindow` with `sandbox: false`.
567
568
 
568
- ## Development Bundling
569
+ ## Dependency Bundling
569
570
 
570
- `notBundle` is enabled by default in development. It externalizes Node modules in entry and main builds to improve startup speed.
571
+ `bundleDeps` controls dependency handling for entry, main, and preload environments. It defaults to
572
+ `'vite'`, which preserves Vite's server-environment behavior.
571
573
 
572
574
  ```ts
573
575
  electronWithUpdater({
574
- notBundle: false,
576
+ bundleDeps: {
577
+ dev: {
578
+ exclude: true,
579
+ },
580
+ build: {
581
+ include: ['some-dependency'],
582
+ },
583
+ },
575
584
  entry: {
576
585
  files: './electron/entry.ts',
577
586
  },
@@ -581,6 +590,12 @@ electronWithUpdater({
581
590
  })
582
591
  ```
583
592
 
593
+ Use `'auto'` to bundle all dependencies except package.json dependencies, `true` to bundle all
594
+ dependencies, or `false` to externalize all dependencies. `both` applies a policy in both modes
595
+ and is merged with the active `dev` or `build` policy. `include` maps to Vite's
596
+ `resolve.noExternal`; `exclude` maps to `resolve.external`. `electron-incremental-update` and its
597
+ subpath imports are always bundled.
598
+
584
599
  ## Utilities
585
600
 
586
601
  Import from `electron-incremental-update/utils` for path helpers, platform checks, native module loading, crypto, compression, download, and version parsing utilities.
package/dist/vite.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Plugin, UserConfig } from "vite";
2
2
  import { MultiEnvElectronOptions } from "vite-plugin-electron/multi-env";
3
- import { RolldownOrRollupOptions } from "vite-plugin-electron";
4
3
 
5
4
  //#region src/utils/type.d.ts
6
5
  type Promisable<T> = T | Promise<T>;
@@ -124,7 +123,12 @@ interface CommonBuildOption {
124
123
  };
125
124
  };
126
125
  }
127
- interface ElectronWithUpdaterOptions {
126
+ interface ElectronWithUpdaterOptions extends Pick<MultiEnvElectronOptions, "bundleDeps"> {
127
+ /**
128
+ * `electron-incremental-update` and its subpath imports are always bundled,
129
+ * regardless of this dependency policy.
130
+ */
131
+ bundleDeps?: MultiEnvElectronOptions["bundleDeps"];
128
132
  /**
129
133
  * Whether to generate sourcemap
130
134
  * @default !isBuild || !!process.env.VSCODE_DEBUG
@@ -144,17 +148,6 @@ interface ElectronWithUpdaterOptions {
144
148
  */
145
149
  bytecode?: boolean | BytecodeOptions;
146
150
  /**
147
- * Faster dev startup by externalize all node modules in entry and main.
148
- *
149
- * Only works in development (`isBuild === false`).
150
- * @default true
151
- */
152
- notBundle?: boolean | RolldownOrRollupOptions["external"];
153
- /**
154
- * @deprecated use `notBundle` instead
155
- */
156
- useNotBundle?: boolean;
157
- /**
158
151
  * Whether to generate version json
159
152
  * @default isCI
160
153
  */
package/dist/vite.mjs CHANGED
@@ -41,6 +41,9 @@ function fixWinCharEncoding(fn) {
41
41
  });
42
42
  }
43
43
  //#endregion
44
+ //#region package.json
45
+ var name = "electron-incremental-update";
46
+ //#endregion
44
47
  //#region src/utils/compress.ts
45
48
  /**
46
49
  * Default function to compress file using brotli
@@ -736,7 +739,7 @@ function normalizeVersionPath(versionPath) {
736
739
  return new URL(versionPath, "file://").pathname.slice(1);
737
740
  }
738
741
  async function createElectronOptions(options, context) {
739
- const { entry, main, preload, sourcemap = context.isDev || !!process.env.VSCODE_DEBUG, minify = !context.isDev, buildVersionJson, notBundle = true, external, updater, bytecode, localDevUpdate } = options;
742
+ const { entry, main, preload, sourcemap = context.isDev || !!process.env.VSCODE_DEBUG, minify = !context.isDev, buildVersionJson, bundleDeps, external, updater, bytecode, localDevUpdate } = options;
740
743
  const pkg = context.packageJson;
741
744
  if (!pkg || !pkg.version || !pkg.name || !pkg.main) throw new Error("package.json not found or invalid, must contains version, name and main field");
742
745
  const isESM = pkg.type === "module";
@@ -796,13 +799,14 @@ async function createElectronOptions(options, context) {
796
799
  name: "main",
797
800
  input: main.files,
798
801
  onstart: mainOnstart,
799
- notBundle,
802
+ bundleDeps,
800
803
  plugins: [isESM && esmShim(), bytecodeOptions && bytecodePlugin("main", minify, isESM, bytecodeOptions)],
801
804
  options: mergeConfig({
802
805
  build: {
803
806
  sourcemap,
804
807
  minify,
805
808
  outDir: `${buildAsarOption.electronDistPath}/main`,
809
+ reportCompressedSize: false,
806
810
  rolldownOptions: {
807
811
  external: finalExternal,
808
812
  output: {
@@ -812,6 +816,7 @@ async function createElectronOptions(options, context) {
812
816
  }
813
817
  }
814
818
  },
819
+ resolve: { noExternal: [name] },
815
820
  define
816
821
  }, main.options ?? {})
817
822
  }];
@@ -820,13 +825,14 @@ async function createElectronOptions(options, context) {
820
825
  onstart(args) {
821
826
  args.reload();
822
827
  },
823
- notBundle,
828
+ bundleDeps,
824
829
  input: preload.files,
825
830
  plugins: [isESM && esmShim(), bytecodeOptions && bytecodePlugin("preload", minify, isESM, bytecodeOptions)],
826
831
  options: mergeConfig({
827
832
  build: {
828
- sourcemap: sourcemap ? "inline" : void 0,
829
833
  minify,
834
+ sourcemap: sourcemap ? "inline" : void 0,
835
+ reportCompressedSize: false,
830
836
  outDir: `${buildAsarOption.electronDistPath}/preload`,
831
837
  rolldownOptions: {
832
838
  external: finalExternal,
@@ -838,6 +844,7 @@ async function createElectronOptions(options, context) {
838
844
  }
839
845
  }
840
846
  },
847
+ resolve: { noExternal: [name] },
841
848
  define
842
849
  }, preload?.options ?? {})
843
850
  });
@@ -848,7 +855,7 @@ async function createElectronOptions(options, context) {
848
855
  if (mainOnstart) await mainOnstart(args);
849
856
  else await args.startup();
850
857
  },
851
- notBundle,
858
+ bundleDeps,
852
859
  plugins: [
853
860
  isESM && esmShim(),
854
861
  bytecodeOptions && bytecodePlugin("entry", minify, isESM, bytecodeOptions),
@@ -884,6 +891,7 @@ async function createElectronOptions(options, context) {
884
891
  sourcemap,
885
892
  minify,
886
893
  outDir: entryOutDir,
894
+ reportCompressedSize: false,
887
895
  rolldownOptions: {
888
896
  external: finalExternal,
889
897
  output: {
@@ -893,6 +901,7 @@ async function createElectronOptions(options, context) {
893
901
  }
894
902
  }
895
903
  },
904
+ resolve: { noExternal: [name] },
896
905
  define
897
906
  }, entry.options || {})
898
907
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-incremental-update",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Electron incremental update tools with Vite plugin, support bytecode protection",
5
5
  "keywords": [
6
6
  "bytecode",
@@ -56,19 +56,17 @@
56
56
  "build": "tsdown",
57
57
  "play": "bun run build && vite",
58
58
  "play:build": "vite build",
59
- "release": "bun run format && bun run lint && bun run test && bun run build && bumpp --all",
59
+ "release": "bun run qa && bun run test && bun run build && bumpp --all",
60
60
  "test": "bun test --preload ./tests/setup.ts",
61
61
  "test:dev": "bun test --watch",
62
- "format": "oxfmt",
63
- "lint": "oxlint --fix",
64
- "qa": "bun run lint && bun run format && tsc --noEmit"
62
+ "qa": "oxlint --fix && oxfmt && tsc --noEmit"
65
63
  },
66
64
  "dependencies": {
67
65
  "@babel/plugin-transform-arrow-functions": "^7.29.7",
68
66
  "@babel/plugin-transform-template-literals": "^7.29.7",
69
67
  "ci-info": "^4.4.0",
70
68
  "selfsigned": "^5.5.0",
71
- "vite-plugin-electron": "~1.0.4"
69
+ "vite-plugin-electron": "^1.1.0"
72
70
  },
73
71
  "devDependencies": {
74
72
  "@subf/config": "^0.2.1",