electron-incremental-update 2.3.1 → 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.js +29 -20
- package/package.json +1 -1
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") || source.startsWith("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;
|
|
@@ -294,9 +291,6 @@ function parseVersionPath(versionPath) {
|
|
|
294
291
|
}
|
|
295
292
|
return new URL(versionPath, "file://").pathname.slice(1);
|
|
296
293
|
}
|
|
297
|
-
var ex = startup.exit;
|
|
298
|
-
startup.exit = () => ex().catch(() => {
|
|
299
|
-
});
|
|
300
294
|
async function electronWithUpdater(options) {
|
|
301
295
|
let {
|
|
302
296
|
isBuild,
|
|
@@ -324,13 +318,16 @@ async function electronWithUpdater(options) {
|
|
|
324
318
|
);
|
|
325
319
|
bytecodeOptions = void 0;
|
|
326
320
|
}
|
|
321
|
+
const defaultExternal = (src) => {
|
|
322
|
+
return src.startsWith("node:") || Object.keys("dependencies" in pkg ? pkg.dependencies : {}).includes(src) || src === "original-fs";
|
|
323
|
+
};
|
|
327
324
|
const {
|
|
328
325
|
buildAsarOption,
|
|
329
326
|
buildEntryOption,
|
|
330
327
|
buildVersionOption,
|
|
331
328
|
postBuild,
|
|
332
329
|
cert
|
|
333
|
-
} = parseOptions(pkg, sourcemap, minify, updater);
|
|
330
|
+
} = parseOptions(pkg, defaultExternal, sourcemap, minify, updater);
|
|
334
331
|
const { entryOutputDirPath, nativeModuleEntryMap, appEntryPath } = buildEntryOption;
|
|
335
332
|
try {
|
|
336
333
|
fs2.rmSync(buildAsarOption.electronDistPath, { recursive: true, force: true });
|
|
@@ -361,9 +358,7 @@ async function electronWithUpdater(options) {
|
|
|
361
358
|
bytecodeOptions
|
|
362
359
|
);
|
|
363
360
|
log.info(`Build entry to '${entryOutputDirPath}'`, { timestamp: true });
|
|
364
|
-
|
|
365
|
-
async function _postBuild() {
|
|
366
|
-
return await postBuild?.({
|
|
361
|
+
await postBuild?.({
|
|
367
362
|
getPathFromEntryOutputDir(...paths) {
|
|
368
363
|
return path3.join(entryOutputDirPath, ...paths);
|
|
369
364
|
},
|
|
@@ -390,7 +385,7 @@ async function electronWithUpdater(options) {
|
|
|
390
385
|
}
|
|
391
386
|
let isInit = false;
|
|
392
387
|
const rollupOptions = {
|
|
393
|
-
external:
|
|
388
|
+
external: defaultExternal,
|
|
394
389
|
treeshake: true
|
|
395
390
|
};
|
|
396
391
|
const esmShimPlugin = isESM ? import('./esm-4S4XCVEW.js').then((m) => m.esm()) : void 0;
|
|
@@ -401,7 +396,6 @@ async function electronWithUpdater(options) {
|
|
|
401
396
|
if (!isInit) {
|
|
402
397
|
isInit = true;
|
|
403
398
|
await _buildEntry();
|
|
404
|
-
await _postBuild();
|
|
405
399
|
}
|
|
406
400
|
if (_main.onstart) {
|
|
407
401
|
_main.onstart(args);
|
|
@@ -443,7 +437,6 @@ async function electronWithUpdater(options) {
|
|
|
443
437
|
},
|
|
444
438
|
async closeBundle() {
|
|
445
439
|
await _buildEntry();
|
|
446
|
-
await _postBuild();
|
|
447
440
|
const buffer = await buildAsar(buildAsarOption);
|
|
448
441
|
if (!buildVersionJson && !isCI) {
|
|
449
442
|
log.warn("No `buildVersionJson` option setup, skip build version json. Only build in CI by default", { timestamp: true });
|
|
@@ -492,11 +485,27 @@ async function electronWithUpdater(options) {
|
|
|
492
485
|
configureServer(server) {
|
|
493
486
|
server.watcher.add(files).on(
|
|
494
487
|
"change",
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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
|
+
}
|
|
500
509
|
);
|
|
501
510
|
}
|
|
502
511
|
};
|
package/package.json
CHANGED