electron-incremental-update 2.4.1 → 2.4.2
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/vite.d.ts +74 -17
- package/dist/vite.js +13 -2
- package/package.json +1 -1
package/dist/vite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Promisable, AnyFunction } from '@subframe7536/type-utils';
|
|
2
|
-
import { InlineConfig, PluginOption } from 'vite';
|
|
3
|
-
import {
|
|
4
|
-
import { ElectronSimpleOptions
|
|
2
|
+
import { InlineConfig, PluginOption, UserConfig, UserConfigFn } from 'vite';
|
|
3
|
+
import { ElectronOptions } from 'vite-plugin-electron';
|
|
4
|
+
import { ElectronSimpleOptions } from 'vite-plugin-electron/simple';
|
|
5
5
|
export { isCI } from 'ci-info';
|
|
6
6
|
export { getPackageInfo, getPackageInfoSync, loadPackageJSON, resolveModule } from 'local-pkg';
|
|
7
7
|
|
|
@@ -81,15 +81,11 @@ interface PKG {
|
|
|
81
81
|
main: string;
|
|
82
82
|
type: 'commonjs' | 'module';
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
[
|
|
89
|
-
};
|
|
90
|
-
type MakeRequiredAndReplaceKey<T, K extends keyof T, NewKey extends string> = MakeRequired<ReplaceKey<T, K, NewKey>, NewKey>;
|
|
91
|
-
type ExcludeOutputDirOptions = {
|
|
92
|
-
vite?: {
|
|
84
|
+
interface ViteOverride {
|
|
85
|
+
/**
|
|
86
|
+
* Override vite options
|
|
87
|
+
*/
|
|
88
|
+
vite?: ElectronOptions['vite'] & {
|
|
93
89
|
build?: {
|
|
94
90
|
outDir: never;
|
|
95
91
|
rollupOptions?: {
|
|
@@ -99,7 +95,7 @@ type ExcludeOutputDirOptions = {
|
|
|
99
95
|
};
|
|
100
96
|
};
|
|
101
97
|
};
|
|
102
|
-
}
|
|
98
|
+
}
|
|
103
99
|
interface ElectronWithUpdaterOptions {
|
|
104
100
|
/**
|
|
105
101
|
* Whether is in build mode
|
|
@@ -151,13 +147,34 @@ interface ElectronWithUpdaterOptions {
|
|
|
151
147
|
*
|
|
152
148
|
* To change output directories, use `options.updater.paths.electronDistPath` instead
|
|
153
149
|
*/
|
|
154
|
-
main:
|
|
150
|
+
main: {
|
|
151
|
+
/**
|
|
152
|
+
* Shortcut of `build.rollupOptions.input`
|
|
153
|
+
*/
|
|
154
|
+
files: NonNullable<ElectronOptions['entry']>;
|
|
155
|
+
/**
|
|
156
|
+
* Electron App startup function.
|
|
157
|
+
*
|
|
158
|
+
* It will mount the Electron App child-process to `process.electronApp`.
|
|
159
|
+
* @param argv default value `['.', '--no-sandbox']`
|
|
160
|
+
* @param options options for `child_process.spawn`
|
|
161
|
+
* @param customElectronPkg custom electron package name (default: 'electron')
|
|
162
|
+
*/
|
|
163
|
+
onstart?: ElectronOptions['onstart'];
|
|
164
|
+
} & ViteOverride;
|
|
155
165
|
/**
|
|
156
166
|
* Preload process options
|
|
157
167
|
*
|
|
158
168
|
* To change output directories, use `options.updater.paths.electronDistPath` instead
|
|
159
169
|
*/
|
|
160
|
-
preload:
|
|
170
|
+
preload: {
|
|
171
|
+
/**
|
|
172
|
+
* Shortcut of `build.rollupOptions.input`.
|
|
173
|
+
*
|
|
174
|
+
* Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
|
|
175
|
+
*/
|
|
176
|
+
files: NonNullable<ElectronOptions['entry']>;
|
|
177
|
+
} & ViteOverride;
|
|
161
178
|
/**
|
|
162
179
|
* Updater options
|
|
163
180
|
*/
|
|
@@ -379,7 +396,7 @@ interface UpdaterOptions {
|
|
|
379
396
|
overrideGenerator?: GeneratorOverrideFunctions;
|
|
380
397
|
}
|
|
381
398
|
|
|
382
|
-
type StartupFn = NonNullable<NonNullable<ElectronSimpleOptions
|
|
399
|
+
type StartupFn = NonNullable<NonNullable<ElectronSimpleOptions['main']>['onstart']>;
|
|
383
400
|
/**
|
|
384
401
|
* Startup function for debug
|
|
385
402
|
* @see {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template}
|
|
@@ -473,4 +490,44 @@ declare function fixWinCharEncoding<T extends AnyFunction>(fn: T): T;
|
|
|
473
490
|
*/
|
|
474
491
|
declare function electronWithUpdater(options: ElectronWithUpdaterOptions): Promise<PluginOption[] | undefined>;
|
|
475
492
|
|
|
476
|
-
|
|
493
|
+
type MakeOptional<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
|
|
494
|
+
interface ElectronViteHelperOptions extends MakeOptional<ElectronWithUpdaterOptions, 'isBuild'> {
|
|
495
|
+
/**
|
|
496
|
+
* Config for renderer process
|
|
497
|
+
*/
|
|
498
|
+
renderer?: UserConfig;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Vite config helper
|
|
502
|
+
* @see {@link electronWithUpdater}
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* import { defineElectronConfig } from 'electron-incremental-update/vite'
|
|
506
|
+
*
|
|
507
|
+
* export default defineElectronConfig({
|
|
508
|
+
* main: {
|
|
509
|
+
* files: ['./electron/main/index.ts', './electron/main/worker.ts'],
|
|
510
|
+
* // see https://github.com/electron-vite/electron-vite-vue/blob/85ed267c4851bf59f32888d766c0071661d4b94c/vite.config.ts#L22-L28
|
|
511
|
+
* onstart: debugStartup,
|
|
512
|
+
* },
|
|
513
|
+
* preload: {
|
|
514
|
+
* files: './electron/preload/index.ts',
|
|
515
|
+
* },
|
|
516
|
+
* updater: {
|
|
517
|
+
* // options
|
|
518
|
+
* },
|
|
519
|
+
* renderer: {
|
|
520
|
+
* server: process.env.VSCODE_DEBUG && (() => {
|
|
521
|
+
* const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
|
|
522
|
+
* return {
|
|
523
|
+
* host: url.hostname,
|
|
524
|
+
* port: +url.port,
|
|
525
|
+
* }
|
|
526
|
+
* })(),
|
|
527
|
+
* }
|
|
528
|
+
* })
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
declare function defineElectronConfig(options: ElectronViteHelperOptions): UserConfigFn;
|
|
532
|
+
|
|
533
|
+
export { type ElectronViteHelperOptions, type ElectronWithUpdaterOptions, convertLiteral, debugStartup, electronWithUpdater as default, defineElectronConfig, electronWithUpdater, filterErrorMessageStartup, fixWinCharEncoding };
|
package/dist/vite.js
CHANGED
|
@@ -854,7 +854,6 @@ async function electronWithUpdater(options) {
|
|
|
854
854
|
},
|
|
855
855
|
preload: {
|
|
856
856
|
input: _preload.files,
|
|
857
|
-
onstart: _preload.onstart,
|
|
858
857
|
vite: mergeConfig(
|
|
859
858
|
{
|
|
860
859
|
plugins: [
|
|
@@ -931,4 +930,16 @@ async function electronWithUpdater(options) {
|
|
|
931
930
|
return result;
|
|
932
931
|
}
|
|
933
932
|
|
|
934
|
-
|
|
933
|
+
// src/vite/define.ts
|
|
934
|
+
function defineElectronConfig(options) {
|
|
935
|
+
return ({ command }) => {
|
|
936
|
+
options.isBuild ??= command === "build";
|
|
937
|
+
const electronPlugin = electronWithUpdater(options);
|
|
938
|
+
const result = options.renderer ?? {};
|
|
939
|
+
result.plugins ??= [];
|
|
940
|
+
result.plugins.push(electronPlugin);
|
|
941
|
+
return result;
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
export { convertLiteral, debugStartup, electronWithUpdater as default, defineElectronConfig, electronWithUpdater, filterErrorMessageStartup, fixWinCharEncoding };
|
package/package.json
CHANGED