update electron to v43
All checks were successful
Android Build / publish (push) Successful in 55s
Linux Build / publish (push) Successful in 1m6s

This commit is contained in:
olcxja 2026-07-09 22:38:33 +02:00
commit fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions

View file

@ -1,6 +1,5 @@
/// <reference types="node" />
import { SpawnOptions, ExecFileOptions } from "child_process";
import { ExtraSpawnOptions } from "builder-util";
import { ExecFileOptions, SpawnOptions } from "child_process";
import { VmManager } from "./vm";
export declare class MonoVmManager extends VmManager {
constructor();

View file

@ -8,12 +8,12 @@ class MonoVmManager extends vm_1.VmManager {
super();
}
exec(file, args, options, isLogOutIfDebug = true) {
return builder_util_1.exec("mono", [file].concat(args), {
return (0, builder_util_1.exec)("mono", [file].concat(args), {
...options,
}, isLogOutIfDebug);
}
spawn(file, args, options, extraOptions) {
return builder_util_1.spawn("mono", [file].concat(args), options, extraOptions);
return (0, builder_util_1.spawn)("mono", [file].concat(args), options, extraOptions);
}
}
exports.MonoVmManager = MonoVmManager;

View file

@ -1 +1 @@
{"version":3,"file":"MonoVm.js","sourceRoot":"","sources":["../../src/vm/MonoVm.ts"],"names":[],"mappings":";;;AACA,+CAA6D;AAC7D,6BAAgC;AAEhC,MAAa,aAAc,SAAQ,cAAS;IAC1C;QACE,KAAK,EAAE,CAAA;IACT,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,eAAe,GAAG,IAAI;QACvF,OAAO,mBAAI,CACT,MAAM,EACN,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EACnB;YACE,GAAG,OAAO;SACX,EACD,eAAe,CAChB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,OAAO,oBAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;IAClE,CAAC;CACF;AAnBD,sCAmBC","sourcesContent":["import { SpawnOptions, ExecFileOptions } from \"child_process\"\nimport { exec, ExtraSpawnOptions, spawn } from \"builder-util\"\nimport { VmManager } from \"./vm\"\n\nexport class MonoVmManager extends VmManager {\n constructor() {\n super()\n }\n\n exec(file: string, args: Array<string>, options?: ExecFileOptions, isLogOutIfDebug = true): Promise<string> {\n return exec(\n \"mono\",\n [file].concat(args),\n {\n ...options,\n },\n isLogOutIfDebug\n )\n }\n\n spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any> {\n return spawn(\"mono\", [file].concat(args), options, extraOptions)\n }\n}\n"]}
{"version":3,"file":"MonoVm.js","sourceRoot":"","sources":["../../src/vm/MonoVm.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAE7D,6BAAgC;AAEhC,MAAa,aAAc,SAAQ,cAAS;IAC1C;QACE,KAAK,EAAE,CAAA;IACT,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,eAAe,GAAG,IAAI;QACvF,OAAO,IAAA,mBAAI,EACT,MAAM,EACN,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EACnB;YACE,GAAG,OAAO;SACX,EACD,eAAe,CAChB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,OAAO,IAAA,oBAAK,EAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;IAClE,CAAC;CACF;AAnBD,sCAmBC","sourcesContent":["import { exec, ExtraSpawnOptions, spawn } from \"builder-util\"\nimport { ExecFileOptions, SpawnOptions } from \"child_process\"\nimport { VmManager } from \"./vm\"\n\nexport class MonoVmManager extends VmManager {\n constructor() {\n super()\n }\n\n exec(file: string, args: Array<string>, options?: ExecFileOptions, isLogOutIfDebug = true): Promise<string> {\n return exec(\n \"mono\",\n [file].concat(args),\n {\n ...options,\n },\n isLogOutIfDebug\n )\n }\n\n spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any> {\n return spawn(\"mono\", [file].concat(args), options, extraOptions)\n }\n}\n"]}

View file

@ -1,3 +1,19 @@
import { ExtraSpawnOptions } from "builder-util";
import { ExecFileOptions, SpawnOptions } from "child_process";
import { VmManager } from "./vm";
export declare class ParallelsVmManager extends VmManager {
private readonly vm;
private startPromise;
private isExitHookAdded;
constructor(vm: ParallelsVm);
get pathSep(): string;
private handleExecuteError;
exec(file: string, args: Array<string>, options?: ExecFileOptions): Promise<string>;
spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any>;
private doStartVm;
private ensureThatVmStarted;
toVmFile(file: string): string;
}
export declare function macPathToParallelsWindows(file: string): string;
export interface ParallelsVm {
id: string;

View file

@ -1,13 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.macPathToParallelsWindows = exports.ParallelsVmManager = exports.parseVmList = void 0;
exports.ParallelsVmManager = void 0;
exports.parseVmList = parseVmList;
exports.macPathToParallelsWindows = macPathToParallelsWindows;
const builder_util_1 = require("builder-util");
const child_process_1 = require("child_process");
const vm_1 = require("./vm");
/** @internal */
async function parseVmList(debugLogger) {
// do not log output if debug - it is huge, logged using debugLogger
let rawList = await builder_util_1.exec("prlctl", ["list", "-i", "-s", "name"], undefined, false);
let rawList = await (0, builder_util_1.exec)("prlctl", ["list", "-i", "-s", "name"], undefined, false);
debugLogger.add("parallels.list", rawList);
rawList = rawList.substring(rawList.indexOf("ID:"));
// let match: Array<string> | null
@ -31,8 +33,6 @@ async function parseVmList(debugLogger) {
}
return result;
}
exports.parseVmList = parseVmList;
/** @internal */
class ParallelsVmManager extends vm_1.VmManager {
constructor(vm) {
super();
@ -53,11 +53,11 @@ class ParallelsVmManager extends vm_1.VmManager {
async exec(file, args, options) {
await this.ensureThatVmStarted();
// it is important to use "--current-user" to execute command under logged in user - to access certs.
return await builder_util_1.exec("prlctl", ["exec", this.vm.id, "--current-user", file.startsWith("/") ? macPathToParallelsWindows(file) : file].concat(args), options).catch(error => this.handleExecuteError(error));
return await (0, builder_util_1.exec)("prlctl", ["exec", this.vm.id, "--current-user", file.startsWith("/") ? macPathToParallelsWindows(file) : file].concat(args), options).catch(error => this.handleExecuteError(error));
}
async spawn(file, args, options, extraOptions) {
await this.ensureThatVmStarted();
return await builder_util_1.spawn("prlctl", ["exec", this.vm.id, file].concat(args), options, extraOptions).catch(error => this.handleExecuteError(error));
return await (0, builder_util_1.spawn)("prlctl", ["exec", this.vm.id, file].concat(args), options, extraOptions).catch(error => this.handleExecuteError(error));
}
async doStartVm() {
const vmId = this.vm.id;
@ -67,18 +67,17 @@ class ParallelsVmManager extends vm_1.VmManager {
}
if (!this.isExitHookAdded) {
this.isExitHookAdded = true;
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("async-exit-hook")((callback) => {
const stopArgs = ["suspend", vmId];
if (callback == null) {
child_process_1.execFileSync("prlctl", stopArgs);
(0, child_process_1.execFileSync)("prlctl", stopArgs);
}
else {
builder_util_1.exec("prlctl", stopArgs).then(callback).catch(callback);
(0, builder_util_1.exec)("prlctl", stopArgs).then(callback).catch(callback);
}
});
}
await builder_util_1.exec("prlctl", ["start", vmId]);
await (0, builder_util_1.exec)("prlctl", ["start", vmId]);
}
ensureThatVmStarted() {
let startPromise = this.startPromise;
@ -100,5 +99,4 @@ function macPathToParallelsWindows(file) {
}
return "\\\\Mac\\Host\\" + file.replace(/\//g, "\\");
}
exports.macPathToParallelsWindows = macPathToParallelsWindows;
//# sourceMappingURL=ParallelsVm.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,6 @@
import { Lazy } from "lazy-val";
import { VmManager } from "./vm";
export declare class PwshVmManager extends VmManager {
constructor();
readonly powershellCommand: Lazy<string>;
}

25
electron/node_modules/app-builder-lib/out/vm/PwshVm.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PwshVmManager = void 0;
const builder_util_1 = require("builder-util");
const lazy_val_1 = require("lazy-val");
const vm_1 = require("./vm");
class PwshVmManager extends vm_1.VmManager {
constructor() {
super();
this.powershellCommand = new lazy_val_1.Lazy(async () => {
builder_util_1.log.info(null, "checking for `pwsh` for powershell");
if (await vm_1.isPwshAvailable.value) {
return "pwsh";
}
const errorMessage = `unable to find \`pwsh\`, please install per instructions linked in logs`;
builder_util_1.log.error({
mac: "https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos",
linux: "https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux",
}, errorMessage);
throw new Error(errorMessage);
});
}
}
exports.PwshVmManager = PwshVmManager;
//# sourceMappingURL=PwshVm.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"PwshVm.js","sourceRoot":"","sources":["../../src/vm/PwshVm.ts"],"names":[],"mappings":";;;AAAA,+CAAkC;AAClC,uCAA+B;AAC/B,6BAAiD;AAEjD,MAAa,aAAc,SAAQ,cAAS;IAC1C;QACE,KAAK,EAAE,CAAA;QAGA,sBAAiB,GAAG,IAAI,eAAI,CAAS,KAAK,IAAI,EAAE;YACvD,kBAAG,CAAC,IAAI,CAAC,IAAI,EAAE,oCAAoC,CAAC,CAAA;YACpD,IAAI,MAAM,oBAAe,CAAC,KAAK,EAAE,CAAC;gBAChC,OAAO,MAAM,CAAA;YACf,CAAC;YACD,MAAM,YAAY,GAAG,yEAAyE,CAAA;YAC9F,kBAAG,CAAC,KAAK,CACP;gBACE,GAAG,EAAE,+FAA+F;gBACpG,KAAK,EAAE,+FAA+F;aACvG,EACD,YAAY,CACb,CAAA;YACD,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;IAhBF,CAAC;CAiBF;AApBD,sCAoBC","sourcesContent":["import { log } from \"builder-util\"\nimport { Lazy } from \"lazy-val\"\nimport { isPwshAvailable, VmManager } from \"./vm\"\n\nexport class PwshVmManager extends VmManager {\n constructor() {\n super()\n }\n\n readonly powershellCommand = new Lazy<string>(async () => {\n log.info(null, \"checking for `pwsh` for powershell\")\n if (await isPwshAvailable.value) {\n return \"pwsh\"\n }\n const errorMessage = `unable to find \\`pwsh\\`, please install per instructions linked in logs`\n log.error(\n {\n mac: \"https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos\",\n linux: \"https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux\",\n },\n errorMessage\n )\n throw new Error(errorMessage)\n })\n}\n"]}

View file

@ -1,10 +1,12 @@
/// <reference types="node" />
import { SpawnOptions, ExecFileOptions } from "child_process";
import { ExtraSpawnOptions } from "builder-util";
import { ExecFileOptions, SpawnOptions } from "child_process";
import { ToolsetConfig } from "../configuration";
import { VmManager } from "./vm";
export declare class WineVmManager extends VmManager {
constructor();
exec(file: string, args: Array<string>, options?: ExecFileOptions, isLogOutIfDebug?: boolean): Promise<string>;
private readonly wineToolset;
constructor(wineToolset: ToolsetConfig["wine"]);
exec(file: string, args: Array<string>, options?: ExecFileOptions, _isLogOutIfDebug?: boolean): Promise<string>;
spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any>;
toVmFile(file: string): string;
private execWine;
}

View file

@ -1,16 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WineVmManager = void 0;
const wine_1 = require("../wine");
const vm_1 = require("./vm");
const builder_util_1 = require("builder-util");
const path = require("path");
const wine_1 = require("../toolsets/wine");
const vm_1 = require("./vm");
class WineVmManager extends vm_1.VmManager {
constructor() {
constructor(wineToolset) {
super();
this.wineToolset = wineToolset;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
exec(file, args, options, isLogOutIfDebug = true) {
return wine_1.execWine(file, null, args, options);
exec(file, args, options, _isLogOutIfDebug = true) {
return this.execWine({ file, appArgs: args, options, toolset: this.wineToolset });
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
spawn(file, args, options, extraOptions) {
@ -19,6 +20,19 @@ class WineVmManager extends vm_1.VmManager {
toVmFile(file) {
return path.win32.join("Z:", file);
}
async execWine({ file: target, appArgs = [], options = {}, toolset }) {
if (options.timeout == null) {
// 2 minutes
options.timeout = 120 * 1000;
}
if (process.platform === "win32") {
return (0, builder_util_1.exec)(target, appArgs, options);
}
const { execPath: wineExe, env: wineEnv } = await (0, wine_1.getWineToolset)(toolset);
// Preserve the base process environment (PATH, HOME, TMPDIR, etc.) so Wine and child
// tools start correctly. Wine env vars override the base; caller options.env wins last.
return (0, builder_util_1.exec)(wineExe, [target, ...appArgs], { ...options, env: { ...process.env, ...wineEnv, ...options.env } });
}
}
exports.WineVmManager = WineVmManager;
//# sourceMappingURL=WineVm.js.map

View file

@ -1 +1 @@
{"version":3,"file":"WineVm.js","sourceRoot":"","sources":["../../src/vm/WineVm.ts"],"names":[],"mappings":";;;AAEA,kCAAkC;AAClC,6BAAgC;AAChC,6BAA4B;AAE5B,MAAa,aAAc,SAAQ,cAAS;IAC1C;QACE,KAAK,EAAE,CAAA;IACT,CAAC;IAED,6DAA6D;IAC7D,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,eAAe,GAAG,IAAI;QACvF,OAAO,eAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;CACF;AAlBD,sCAkBC","sourcesContent":["import { SpawnOptions, ExecFileOptions } from \"child_process\"\nimport { ExtraSpawnOptions } from \"builder-util\"\nimport { execWine } from \"../wine\"\nimport { VmManager } from \"./vm\"\nimport * as path from \"path\"\n\nexport class WineVmManager extends VmManager {\n constructor() {\n super()\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n exec(file: string, args: Array<string>, options?: ExecFileOptions, isLogOutIfDebug = true): Promise<string> {\n return execWine(file, null, args, options)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any> {\n throw new Error(\"Unsupported\")\n }\n\n toVmFile(file: string): string {\n return path.win32.join(\"Z:\", file)\n }\n}\n"]}
{"version":3,"file":"WineVm.js","sourceRoot":"","sources":["../../src/vm/WineVm.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AAGtD,6BAA4B;AAE5B,2CAAiD;AACjD,6BAAgC;AAShC,MAAa,aAAc,SAAQ,cAAS;IAC1C,YAA6B,WAAkC;QAC7D,KAAK,EAAE,CAAA;QADoB,gBAAW,GAAX,WAAW,CAAuB;IAE/D,CAAC;IAED,IAAI,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAyB,EAAE,gBAAgB,GAAG,IAAI;QACxF,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;IACnF,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,IAAY,EAAE,IAAmB,EAAE,OAAsB,EAAE,YAAgC;QAC/F,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAChC,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACpC,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,OAAO,EAAe;QACvF,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;YAC5B,YAAY;YACZ,OAAO,CAAC,OAAO,GAAG,GAAG,GAAG,IAAI,CAAA;QAC9B,CAAC;QACD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,OAAO,IAAA,mBAAI,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QACvC,CAAC;QACD,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,CAAA;QACzE,qFAAqF;QACrF,wFAAwF;QACxF,OAAO,IAAA,mBAAI,EAAC,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACjH,CAAC;CACF;AA/BD,sCA+BC","sourcesContent":["import { exec, ExtraSpawnOptions } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { ExecFileOptions, SpawnOptions } from \"child_process\"\nimport * as path from \"path\"\nimport { ToolsetConfig } from \"../configuration\"\nimport { getWineToolset } from \"../toolsets/wine\"\nimport { VmManager } from \"./vm\"\n\ntype WineOptions = {\n file: string\n appArgs?: Array<string>\n options?: ExecFileOptions\n toolset: ToolsetConfig[\"wine\"] | Nullish\n}\n\nexport class WineVmManager extends VmManager {\n constructor(private readonly wineToolset: ToolsetConfig[\"wine\"]) {\n super()\n }\n\n exec(file: string, args: Array<string>, options?: ExecFileOptions, _isLogOutIfDebug = true): Promise<string> {\n return this.execWine({ file, appArgs: args, options, toolset: this.wineToolset })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any> {\n throw new Error(\"Unsupported\")\n }\n\n toVmFile(file: string): string {\n return path.win32.join(\"Z:\", file)\n }\n\n private async execWine({ file: target, appArgs = [], options = {}, toolset }: WineOptions): Promise<string> {\n if (options.timeout == null) {\n // 2 minutes\n options.timeout = 120 * 1000\n }\n if (process.platform === \"win32\") {\n return exec(target, appArgs, options)\n }\n const { execPath: wineExe, env: wineEnv } = await getWineToolset(toolset)\n // Preserve the base process environment (PATH, HOME, TMPDIR, etc.) so Wine and child\n // tools start correctly. Wine env vars override the base; caller options.env wins last.\n return exec(wineExe, [target, ...appArgs], { ...options, env: { ...process.env, ...wineEnv, ...options.env } })\n }\n}\n"]}

View file

@ -1,10 +1,14 @@
/// <reference types="node" />
import { DebugLogger, ExtraSpawnOptions } from "builder-util";
import { ExecFileOptions, SpawnOptions } from "child_process";
import { Lazy } from "lazy-val";
export declare class VmManager {
get pathSep(): string;
exec(file: string, args: Array<string>, options?: ExecFileOptions, isLogOutIfDebug?: boolean): Promise<string>;
spawn(file: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any>;
toVmFile(file: string): string;
readonly powershellCommand: Lazy<string>;
}
export declare function getWindowsVm(debugLogger: DebugLogger): Promise<VmManager>;
export declare function getLinuxVm(debugLogger: DebugLogger): Promise<VmManager | undefined>;
export declare const isPwshAvailable: Lazy<boolean>;
export declare const isCommandAvailable: (command: string, args: string[]) => Promise<boolean>;

View file

@ -1,17 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWindowsVm = exports.VmManager = void 0;
exports.isCommandAvailable = exports.isPwshAvailable = exports.VmManager = void 0;
exports.getWindowsVm = getWindowsVm;
exports.getLinuxVm = getLinuxVm;
const builder_util_1 = require("builder-util");
const lazy_val_1 = require("lazy-val");
const path = require("path");
class VmManager {
constructor() {
this.powershellCommand = new lazy_val_1.Lazy(() => {
return this.exec("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", `Get-Command pwsh.exe`])
.then(() => {
builder_util_1.log.info(null, "identified pwsh.exe");
return "pwsh.exe";
})
.catch(() => {
builder_util_1.log.info(null, "unable to find pwsh.exe, falling back to powershell.exe");
return "powershell.exe";
});
});
}
get pathSep() {
return path.sep;
}
exec(file, args, options, isLogOutIfDebug = true) {
return builder_util_1.exec(file, args, options, isLogOutIfDebug);
return (0, builder_util_1.exec)(file, args, options, isLogOutIfDebug);
}
spawn(file, args, options, extraOptions) {
return builder_util_1.spawn(file, args, options, extraOptions);
return (0, builder_util_1.spawn)(file, args, options, extraOptions);
}
toVmFile(file) {
return file;
@ -20,12 +36,53 @@ class VmManager {
exports.VmManager = VmManager;
async function getWindowsVm(debugLogger) {
const parallelsVmModule = await Promise.resolve().then(() => require("./ParallelsVm"));
const vmList = (await parallelsVmModule.parseVmList(debugLogger)).filter(it => ["win-10", "win-11"].includes(it.os));
let vmList = [];
try {
vmList = (await parallelsVmModule.parseVmList(debugLogger)).filter(it => ["win-10", "win-11"].includes(it.os));
}
catch (_error) {
if ((await exports.isPwshAvailable.value) && (await isWineAvailable.value)) {
const vmModule = await Promise.resolve().then(() => require("./PwshVm"));
return new vmModule.PwshVmManager();
}
}
if (vmList.length === 0) {
throw new builder_util_1.InvalidConfigurationError("Cannot find suitable Parallels Desktop virtual machine (Windows 10 is required)");
throw new builder_util_1.InvalidConfigurationError("Cannot find suitable Parallels Desktop virtual machine (Windows 10 is required) and cannot access `pwsh` and `wine` locally");
}
// prefer running or suspended vm
return new parallelsVmModule.ParallelsVmManager(vmList.find(it => it.state === "running") || vmList.find(it => it.state === "suspended") || vmList[0]);
}
exports.getWindowsVm = getWindowsVm;
async function getLinuxVm(debugLogger) {
if (process.platform !== "darwin") {
return undefined;
}
try {
const parallelsVmModule = await Promise.resolve().then(() => require("./ParallelsVm"));
const vmList = (await parallelsVmModule.parseVmList(debugLogger)).filter(it => it.os === "ubuntu");
if (vmList.length === 0) {
return undefined;
}
const vm = vmList.find(it => it.state === "running") || vmList.find(it => it.state === "suspended") || vmList[0];
return new parallelsVmModule.ParallelsVmManager(vm);
}
catch {
return undefined;
}
}
const isWineAvailable = new lazy_val_1.Lazy(async () => {
return (0, exports.isCommandAvailable)("wine", ["--version"]);
});
exports.isPwshAvailable = new lazy_val_1.Lazy(async () => {
return (0, exports.isCommandAvailable)("pwsh", ["--version"]);
});
const isCommandAvailable = async (command, args) => {
try {
await (0, builder_util_1.exec)(command, args);
return true;
}
catch {
return false;
}
};
exports.isCommandAvailable = isCommandAvailable;
//# sourceMappingURL=vm.js.map

File diff suppressed because one or more lines are too long