electron-incremental-update 2.3.0 → 2.3.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 +1 -1
- package/dist/vite.js +29 -17
- package/package.json +1 -1
package/dist/vite.d.ts
CHANGED
|
@@ -295,7 +295,7 @@ type ReplaceKey<T, Key extends keyof T, NewKey extends string> = Omit<T, Key> &
|
|
|
295
295
|
[P in NewKey]: T[Key];
|
|
296
296
|
};
|
|
297
297
|
type MakeRequiredAndReplaceKey<T, K extends keyof T, NewKey extends string> = MakeRequired<ReplaceKey<T, K, NewKey>, NewKey>;
|
|
298
|
-
type StartupFn = NonNullable<NonNullable<ElectronSimpleOptions['
|
|
298
|
+
type StartupFn = NonNullable<NonNullable<ElectronSimpleOptions['main']>['onstart']>;
|
|
299
299
|
/**
|
|
300
300
|
* Startup function for debug (see {@link https://github.com/electron-vite/electron-vite-vue/blob/main/vite.config.ts electron-vite-vue template})
|
|
301
301
|
* @example
|
package/dist/vite.js
CHANGED
|
@@ -166,7 +166,7 @@ function parseSubjects(subject) {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
// src/vite/option.ts
|
|
169
|
-
function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
|
|
169
|
+
function parseOptions(pkg, defaultExternal, sourcemap = false, minify = false, options = {}) {
|
|
170
170
|
const {
|
|
171
171
|
minimumVersion = "0.0.0",
|
|
172
172
|
entry: {
|
|
@@ -222,11 +222,8 @@ function parseOptions(pkg, sourcemap = false, minify = false, options = {}) {
|
|
|
222
222
|
overrideViteOptions,
|
|
223
223
|
ignoreDynamicRequires,
|
|
224
224
|
external: (source, importer, isResolved) => {
|
|
225
|
-
if (source.endsWith(".node")) {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
225
|
if (!external) {
|
|
229
|
-
return
|
|
226
|
+
return defaultExternal(source);
|
|
230
227
|
}
|
|
231
228
|
if (typeof external === "string") {
|
|
232
229
|
return source === external;
|
|
@@ -321,13 +318,16 @@ async function electronWithUpdater(options) {
|
|
|
321
318
|
);
|
|
322
319
|
bytecodeOptions = void 0;
|
|
323
320
|
}
|
|
321
|
+
const defaultExternal = (src) => {
|
|
322
|
+
return src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs";
|
|
323
|
+
};
|
|
324
324
|
const {
|
|
325
325
|
buildAsarOption,
|
|
326
326
|
buildEntryOption,
|
|
327
327
|
buildVersionOption,
|
|
328
328
|
postBuild,
|
|
329
329
|
cert
|
|
330
|
-
} = parseOptions(pkg, sourcemap, minify, updater);
|
|
330
|
+
} = parseOptions(pkg, defaultExternal, sourcemap, minify, updater);
|
|
331
331
|
const { entryOutputDirPath, nativeModuleEntryMap, appEntryPath } = buildEntryOption;
|
|
332
332
|
try {
|
|
333
333
|
fs2.rmSync(buildAsarOption.electronDistPath, { recursive: true, force: true });
|
|
@@ -358,9 +358,7 @@ async function electronWithUpdater(options) {
|
|
|
358
358
|
bytecodeOptions
|
|
359
359
|
);
|
|
360
360
|
log.info(`Build entry to '${entryOutputDirPath}'`, { timestamp: true });
|
|
361
|
-
|
|
362
|
-
async function _postBuild() {
|
|
363
|
-
return await postBuild?.({
|
|
361
|
+
await postBuild?.({
|
|
364
362
|
getPathFromEntryOutputDir(...paths) {
|
|
365
363
|
return path3.join(entryOutputDirPath, ...paths);
|
|
366
364
|
},
|
|
@@ -387,7 +385,7 @@ async function electronWithUpdater(options) {
|
|
|
387
385
|
}
|
|
388
386
|
let isInit = false;
|
|
389
387
|
const rollupOptions = {
|
|
390
|
-
external:
|
|
388
|
+
external: defaultExternal,
|
|
391
389
|
treeshake: true
|
|
392
390
|
};
|
|
393
391
|
const esmShimPlugin = isESM ? import('./esm-4S4XCVEW.js').then((m) => m.esm()) : void 0;
|
|
@@ -398,7 +396,6 @@ async function electronWithUpdater(options) {
|
|
|
398
396
|
if (!isInit) {
|
|
399
397
|
isInit = true;
|
|
400
398
|
await _buildEntry();
|
|
401
|
-
await _postBuild();
|
|
402
399
|
}
|
|
403
400
|
if (_main.onstart) {
|
|
404
401
|
_main.onstart(args);
|
|
@@ -440,7 +437,6 @@ async function electronWithUpdater(options) {
|
|
|
440
437
|
},
|
|
441
438
|
async closeBundle() {
|
|
442
439
|
await _buildEntry();
|
|
443
|
-
await _postBuild();
|
|
444
440
|
const buffer = await buildAsar(buildAsarOption);
|
|
445
441
|
if (!buildVersionJson && !isCI) {
|
|
446
442
|
log.warn("No `buildVersionJson` option setup, skip build version json. Only build in CI by default", { timestamp: true });
|
|
@@ -489,11 +485,27 @@ async function electronWithUpdater(options) {
|
|
|
489
485
|
configureServer(server) {
|
|
490
486
|
server.watcher.add(files).on(
|
|
491
487
|
"change",
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
488
|
+
async (p) => {
|
|
489
|
+
if (!files.includes(p)) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
await _buildEntry();
|
|
493
|
+
if (_main.onstart) {
|
|
494
|
+
await _main.onstart({
|
|
495
|
+
startup,
|
|
496
|
+
reload: () => {
|
|
497
|
+
if (process.electronApp) {
|
|
498
|
+
(server.hot || server.ws).send({ type: "full-reload" });
|
|
499
|
+
startup.send("electron-vite&type=hot-reload");
|
|
500
|
+
} else {
|
|
501
|
+
startup();
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
} else {
|
|
506
|
+
await startup();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
497
509
|
);
|
|
498
510
|
}
|
|
499
511
|
};
|
package/package.json
CHANGED