diff options
Diffstat (limited to 'desktop/node_modules/cross-spawn-windows-exe/dist/src')
18 files changed, 406 insertions, 0 deletions
diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.d.ts b/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.d.ts new file mode 100644 index 0000000..9bccafd --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.d.ts @@ -0,0 +1,6 @@ +/** + * Determines whether the given architecture is a 64-bit arch. + * + * @param arch - a Node.js-style architecture name + */ +export declare function is64BitArch(arch: string): boolean; diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.js b/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.js new file mode 100644 index 0000000..e9ed6a3 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.is64BitArch = void 0; +// List of Node.js-formatted 64 bit arches +const SIXTY_FOUR_BIT_ARCHES = ["arm64", "x64"]; +/** + * Determines whether the given architecture is a 64-bit arch. + * + * @param arch - a Node.js-style architecture name + */ +function is64BitArch(arch) { + return SIXTY_FOUR_BIT_ARCHES.includes(arch); +} +exports.is64BitArch = is64BitArch; +//# sourceMappingURL=arch.js.map
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.js.map b/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.js.map new file mode 100644 index 0000000..4b70fd6 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/arch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arch.js","sourceRoot":"","sources":["../../src/arch.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAE/C;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,OAAO,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAFD,kCAEC"}
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.d.ts b/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.d.ts new file mode 100644 index 0000000..2d47c99 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.d.ts @@ -0,0 +1,22 @@ +import { CrossSpawnArgs } from "@malept/cross-spawn-promise"; +import { CrossSpawnExeOptions } from "./wrapper"; +/** + * Installation instructions for dependencies related to running .NET executables on the + * host platform (i.e., Mono on non-Windows platforms). + */ +export declare function dotNetDependencyInstallInstructions(): string; +/** + * Heuristically determine the path to `mono` to use. + * + * Method used to determine the path: + * + * 1. `customDotNetPath`, if provided to the function + * 2. The `MONO_BINARY` environment variable, if set and non-empty + * 3. `mono` found by searching the directories in the `PATH` environment variable + */ +export declare function determineDotNetWrapper(customDotNetPath?: string): string; +/** + * Spawn a .NET executable. On non-Windows platforms, use [Nono](https://www.mono-project.com/) + * to run it. + */ +export declare function spawnDotNet(cmd: string, args?: CrossSpawnArgs, options?: CrossSpawnExeOptions): Promise<string>; diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.js b/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.js new file mode 100644 index 0000000..ca6fc75 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spawnDotNet = exports.determineDotNetWrapper = exports.dotNetDependencyInstallInstructions = void 0; +const wrapper_1 = require("./wrapper"); +/** + * Installation instructions for dependencies related to running .NET executables on the + * host platform (i.e., Mono on non-Windows platforms). + */ +function dotNetDependencyInstallInstructions() { + switch (process.platform) { + /* istanbul ignore next */ + case "win32": + return "No wrapper necessary"; + case "darwin": + return "Run `brew install mono` to install Mono on macOS via Homebrew."; + case "linux": + return "Consult your Linux distribution's package manager to determine how to install Mono."; + /* istanbul ignore next */ + default: + return "Consult your operating system's package manager to determine how to install Mono."; + } +} +exports.dotNetDependencyInstallInstructions = dotNetDependencyInstallInstructions; +/** + * Heuristically determine the path to `mono` to use. + * + * Method used to determine the path: + * + * 1. `customDotNetPath`, if provided to the function + * 2. The `MONO_BINARY` environment variable, if set and non-empty + * 3. `mono` found by searching the directories in the `PATH` environment variable + */ +function determineDotNetWrapper(customDotNetPath) { + if (customDotNetPath) { + return customDotNetPath; + } + if (process.env.MONO_BINARY) { + return process.env.MONO_BINARY; + } + return "mono"; +} +exports.determineDotNetWrapper = determineDotNetWrapper; +/** + * Spawn a .NET executable. On non-Windows platforms, use [Nono](https://www.mono-project.com/) + * to run it. + */ +async function spawnDotNet(cmd, args, options) { + var _a; + options !== null && options !== void 0 ? options : (options = {}); + (_a = options.wrapperInstructions) !== null && _a !== void 0 ? _a : (options.wrapperInstructions = dotNetDependencyInstallInstructions()); + return wrapper_1.spawnWrapperFromFunction(determineDotNetWrapper, cmd, args, options); +} +exports.spawnDotNet = spawnDotNet; +//# sourceMappingURL=dotnet.js.map
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.js.map b/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.js.map new file mode 100644 index 0000000..cc4d3e1 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/dotnet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dotnet.js","sourceRoot":"","sources":["../../src/dotnet.ts"],"names":[],"mappings":";;;AACA,uCAA2E;AAE3E;;;GAGG;AACH,SAAgB,mCAAmC;IACjD,QAAQ,OAAO,CAAC,QAAQ,EAAE;QACxB,0BAA0B;QAC1B,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,QAAQ;YACX,OAAO,gEAAgE,CAAC;QAC1E,KAAK,OAAO;YACV,OAAO,qFAAqF,CAAC;QAC/F,0BAA0B;QAC1B;YACE,OAAO,mFAAmF,CAAC;KAC9F;AACH,CAAC;AAbD,kFAaC;AAED;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CAAC,gBAAyB;IAC9D,IAAI,gBAAgB,EAAE;QACpB,OAAO,gBAAgB,CAAC;KACzB;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;KAChC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,wDAUC;AAED;;;GAGG;AACI,KAAK,UAAU,WAAW,CAC/B,GAAW,EACX,IAAqB,EACrB,OAA8B;;IAE9B,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC;IACf,MAAA,OAAO,CAAC,mBAAmB,oCAA3B,OAAO,CAAC,mBAAmB,GAAK,mCAAmC,EAAE,EAAC;IACtE,OAAO,kCAAwB,CAAC,sBAAsB,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9E,CAAC;AARD,kCAQC"}
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.d.ts b/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.d.ts new file mode 100644 index 0000000..3c54957 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.d.ts @@ -0,0 +1,24 @@ +import { CrossSpawnArgs } from "@malept/cross-spawn-promise"; +import { CrossSpawnExeOptions } from "./wrapper"; +/** + * Installation instructions for dependencies related to running Windows executables on the + * host platform (i.e., Wine on non-Windows platforms). + */ +export declare function exeDependencyInstallInstructions(): string; +/** + * Heuristically determine the path to `wine` to use. + * + * Method used to determine the path: + * + * 1. `customWinePath`, if provided to the function + * 2. The `WINE_BINARY` environment variable, if set and non-empty + * 3. If the host architecture is x86-64, `wine64` found by searching the directories in the `PATH` + * environment variable + * 4. `wine` found by searching the directories in the `PATH` environment variable + */ +export declare function determineWineWrapper(customWinePath?: string): string; +/** + * Spawn a Windows executable. On non-Windows platforms, use [Wine](https://www.winehq.org/) + * to run it. + */ +export declare function spawnExe(cmd: string, args?: CrossSpawnArgs, options?: CrossSpawnExeOptions): Promise<string>; diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.js b/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.js new file mode 100644 index 0000000..228d860 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spawnExe = exports.determineWineWrapper = exports.exeDependencyInstallInstructions = void 0; +const wrapper_1 = require("./wrapper"); +const arch_1 = require("./arch"); +/** + * Installation instructions for dependencies related to running Windows executables on the + * host platform (i.e., Wine on non-Windows platforms). + */ +function exeDependencyInstallInstructions() { + switch (process.platform) { + /* istanbul ignore next */ + case "win32": + return "No wrapper necessary"; + case "darwin": + return "Run `brew install --cask wine-stable` to install 64-bit wine on macOS via Homebrew."; + case "linux": + return "Consult your Linux distribution's package manager to determine how to install Wine."; + /* istanbul ignore next */ + default: + return "Consult your operating system's package manager to determine how to install Wine."; + } +} +exports.exeDependencyInstallInstructions = exeDependencyInstallInstructions; +/** + * Heuristically determine the path to `wine` to use. + * + * Method used to determine the path: + * + * 1. `customWinePath`, if provided to the function + * 2. The `WINE_BINARY` environment variable, if set and non-empty + * 3. If the host architecture is x86-64, `wine64` found by searching the directories in the `PATH` + * environment variable + * 4. `wine` found by searching the directories in the `PATH` environment variable + */ +function determineWineWrapper(customWinePath) { + if (customWinePath) { + return customWinePath; + } + if (process.env.WINE_BINARY) { + return process.env.WINE_BINARY; + } + if (arch_1.is64BitArch(process.arch)) { + return "wine64"; + } + return "wine"; +} +exports.determineWineWrapper = determineWineWrapper; +/** + * Spawn a Windows executable. On non-Windows platforms, use [Wine](https://www.winehq.org/) + * to run it. + */ +async function spawnExe(cmd, args, options) { + var _a; + options !== null && options !== void 0 ? options : (options = {}); + (_a = options.wrapperInstructions) !== null && _a !== void 0 ? _a : (options.wrapperInstructions = exeDependencyInstallInstructions()); + return wrapper_1.spawnWrapperFromFunction(determineWineWrapper, cmd, args, options); +} +exports.spawnExe = spawnExe; +//# sourceMappingURL=exe.js.map
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.js.map b/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.js.map new file mode 100644 index 0000000..a79ba22 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/exe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exe.js","sourceRoot":"","sources":["../../src/exe.ts"],"names":[],"mappings":";;;AACA,uCAA2E;AAC3E,iCAAqC;AAErC;;;GAGG;AACH,SAAgB,gCAAgC;IAC9C,QAAQ,OAAO,CAAC,QAAQ,EAAE;QACxB,0BAA0B;QAC1B,KAAK,OAAO;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,QAAQ;YACX,OAAO,qFAAqF,CAAC;QAC/F,KAAK,OAAO;YACV,OAAO,qFAAqF,CAAC;QAC/F,0BAA0B;QAC1B;YACE,OAAO,mFAAmF,CAAC;KAC9F;AACH,CAAC;AAbD,4EAaC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,oBAAoB,CAAC,cAAuB;IAC1D,IAAI,cAAc,EAAE;QAClB,OAAO,cAAc,CAAC;KACvB;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;KAChC;IAED,IAAI,kBAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC7B,OAAO,QAAQ,CAAC;KACjB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAdD,oDAcC;AAED;;;GAGG;AACI,KAAK,UAAU,QAAQ,CAC5B,GAAW,EACX,IAAqB,EACrB,OAA8B;;IAE9B,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAAE,EAAC;IACf,MAAA,OAAO,CAAC,mBAAmB,oCAA3B,OAAO,CAAC,mBAAmB,GAAK,gCAAgC,EAAE,EAAC;IACnE,OAAO,kCAAwB,CAAC,oBAAoB,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5E,CAAC;AARD,4BAQC"}
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.d.ts b/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.d.ts new file mode 100644 index 0000000..d1c8b39 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.d.ts @@ -0,0 +1,5 @@ +export { canRunWindowsExeNatively, CrossSpawnExeOptions, DetermineWrapperFunction, spawnWrapper as spawn, spawnWrapperFromFunction, WrapperError, } from "./wrapper"; +export { is64BitArch } from "./arch"; +export { normalizePath } from "./normalize-path"; +export { dotNetDependencyInstallInstructions, spawnDotNet } from "./dotnet"; +export { exeDependencyInstallInstructions, spawnExe } from "./exe"; diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.js b/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.js new file mode 100644 index 0000000..d4327be --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spawnExe = exports.exeDependencyInstallInstructions = exports.spawnDotNet = exports.dotNetDependencyInstallInstructions = exports.normalizePath = exports.is64BitArch = exports.WrapperError = exports.spawnWrapperFromFunction = exports.spawn = exports.canRunWindowsExeNatively = void 0; +var wrapper_1 = require("./wrapper"); +Object.defineProperty(exports, "canRunWindowsExeNatively", { enumerable: true, get: function () { return wrapper_1.canRunWindowsExeNatively; } }); +Object.defineProperty(exports, "spawn", { enumerable: true, get: function () { return wrapper_1.spawnWrapper; } }); +Object.defineProperty(exports, "spawnWrapperFromFunction", { enumerable: true, get: function () { return wrapper_1.spawnWrapperFromFunction; } }); +Object.defineProperty(exports, "WrapperError", { enumerable: true, get: function () { return wrapper_1.WrapperError; } }); +var arch_1 = require("./arch"); +Object.defineProperty(exports, "is64BitArch", { enumerable: true, get: function () { return arch_1.is64BitArch; } }); +var normalize_path_1 = require("./normalize-path"); +Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return normalize_path_1.normalizePath; } }); +var dotnet_1 = require("./dotnet"); +Object.defineProperty(exports, "dotNetDependencyInstallInstructions", { enumerable: true, get: function () { return dotnet_1.dotNetDependencyInstallInstructions; } }); +Object.defineProperty(exports, "spawnDotNet", { enumerable: true, get: function () { return dotnet_1.spawnDotNet; } }); +var exe_1 = require("./exe"); +Object.defineProperty(exports, "exeDependencyInstallInstructions", { enumerable: true, get: function () { return exe_1.exeDependencyInstallInstructions; } }); +Object.defineProperty(exports, "spawnExe", { enumerable: true, get: function () { return exe_1.spawnExe; } }); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.js.map b/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.js.map new file mode 100644 index 0000000..dd2399a --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAOmB;AANjB,mHAAA,wBAAwB,OAAA;AAGxB,gGAAA,YAAY,OAAS;AACrB,mHAAA,wBAAwB,OAAA;AACxB,uGAAA,YAAY,OAAA;AAGd,+BAAqC;AAA5B,mGAAA,WAAW,OAAA;AACpB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAEtB,mCAA4E;AAAnE,6HAAA,mCAAmC,OAAA;AAAE,qGAAA,WAAW,OAAA;AACzD,6BAAmE;AAA1D,uHAAA,gCAAgC,OAAA;AAAE,+FAAA,QAAQ,OAAA"}
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.d.ts b/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.d.ts new file mode 100644 index 0000000..2c13c9b --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.d.ts @@ -0,0 +1,9 @@ +/** + * Converts a UNIX-style path to a Windows-style path via `wslpath`, which should come with any + * WSL distribution. + */ +export declare function convertUNIXPathToWindows(wslPath: string): Promise<string>; +/** + * Converts a UNIX-style path to a Windows-style path if run in a WSL environment. + */ +export declare function normalizePath(pathToNormalize: string): Promise<string>; diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js b/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js new file mode 100644 index 0000000..0b07b45 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js @@ -0,0 +1,38 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizePath = exports.convertUNIXPathToWindows = void 0; +const is_wsl_1 = __importDefault(require("is-wsl")); +const cross_spawn_promise_1 = require("@malept/cross-spawn-promise"); +/** + * Provides a human-friendly error message when `@malept/cross-spawn-promise` can't find `wslpath`. + */ +function updateWSLPathError(error) { + if (error.code === "ENOENT" && error.syscall === "spawn wslpath") { + error.message = `Could not find 'wslpath' in any of the directories listed in the PATH environment variable, which is needed to convert WSL paths to Windows-style paths.`; + } +} +/** + * Converts a UNIX-style path to a Windows-style path via `wslpath`, which should come with any + * WSL distribution. + */ +async function convertUNIXPathToWindows(wslPath) { + const output = await cross_spawn_promise_1.spawn("wslpath", ["-w", wslPath], { + updateErrorCallback: updateWSLPathError, + }); + return output.trim(); +} +exports.convertUNIXPathToWindows = convertUNIXPathToWindows; +/** + * Converts a UNIX-style path to a Windows-style path if run in a WSL environment. + */ +async function normalizePath(pathToNormalize) { + if (is_wsl_1.default) { + return convertUNIXPathToWindows(pathToNormalize); + } + return pathToNormalize; +} +exports.normalizePath = normalizePath; +//# sourceMappingURL=normalize-path.js.map
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js.map b/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js.map new file mode 100644 index 0000000..8f8630e --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/normalize-path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"normalize-path.js","sourceRoot":"","sources":["../../src/normalize-path.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA2B;AAC3B,qEAAoD;AAEpD;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAA4B;IACtD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,KAAK,eAAe,EAAE;QAChE,KAAK,CAAC,OAAO,GAAG,0JAA0J,CAAC;KAC5K;AACH,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC5C,OAAe;IAEf,MAAM,MAAM,GAAG,MAAM,2BAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;QACrD,mBAAmB,EAAE,kBAAkB;KACxC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAPD,4DAOC;AAED;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,eAAuB;IACzD,IAAI,gBAAK,EAAE;QACT,OAAO,wBAAwB,CAAC,eAAe,CAAC,CAAC;KAClD;IAED,OAAO,eAAe,CAAC;AACzB,CAAC;AAND,sCAMC"}
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.d.ts b/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.d.ts new file mode 100644 index 0000000..dda92f9 --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.d.ts @@ -0,0 +1,50 @@ +import { CrossSpawnArgs, CrossSpawnOptions } from "@malept/cross-spawn-promise"; +export declare function canRunWindowsExeNatively(): boolean; +/** + * The exception thrown when the wrapper command could not be found to execute. + */ +export declare class WrapperError extends Error { + /** + * @param wrapperCommand - The wrapper that tried to be executed + * @param installInstructions - Instructions on how to install the wrapper + */ + constructor(wrapperCommand: string, installInstructions?: string); +} +/** + * A function which determines the wrapper path or binary to use in [[spawnWrapper]]. + * + * @param customPath - The path specified by [[CrossSpawnExeOptions|CrossSpawnExeOptions.wrapperCommand]], usually + * prioritized over other paths/binaries in the function. + */ +export declare type DetermineWrapperFunction = (customPath?: string) => string; +/** + * An extension to `CrossSpawnOptions` to optionally specify a custom wrapper command and + * instructions to install the wrapper. + */ +export declare type CrossSpawnExeOptions = CrossSpawnOptions & { + /** + * The path to a binary that wraps the called executable. + * + * Defaults to `wine64` or `wine`, depending on the host machine's architecture. + */ + wrapperCommand?: string; + /** + * Instructions for installing the wrapper binary. + */ + wrapperInstructions?: string; +}; +/** + * Determines if the specified command exists, either in the `PATH` environment variable or if the + * absolute path exists. + */ +export declare function wrapperCommandExists(wrapperCommand: string): Promise<boolean>; +/** + * A wrapper for `cross-spawn`'s `spawn` function that wraps the `cmd` with `wrapperCommand` if it + * is specified. + */ +export declare function spawnWrapper(cmd: string, args?: CrossSpawnArgs, options?: CrossSpawnExeOptions): Promise<string>; +/** + * A helper variant of [[spawnWrapper]] which uses a [[DetermineWrapperFunction]] to + * determine `wrapperCommand`. + */ +export declare function spawnWrapperFromFunction(wrapperFunction: DetermineWrapperFunction, cmd: string, args?: CrossSpawnArgs, options?: CrossSpawnExeOptions): Promise<string>; diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js b/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js new file mode 100644 index 0000000..26154ff --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js @@ -0,0 +1,98 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spawnWrapperFromFunction = exports.spawnWrapper = exports.wrapperCommandExists = exports.WrapperError = exports.canRunWindowsExeNatively = void 0; +const cross_spawn_promise_1 = require("@malept/cross-spawn-promise"); +const fs = __importStar(require("fs")); +const is_wsl_1 = __importDefault(require("is-wsl")); +const path = __importStar(require("path")); +const which_1 = __importDefault(require("which")); +function canRunWindowsExeNatively() { + return process.platform === "win32" || is_wsl_1.default; +} +exports.canRunWindowsExeNatively = canRunWindowsExeNatively; +/** + * The exception thrown when the wrapper command could not be found to execute. + */ +class WrapperError extends Error { + /** + * @param wrapperCommand - The wrapper that tried to be executed + * @param installInstructions - Instructions on how to install the wrapper + */ + constructor(wrapperCommand, installInstructions) { + const message = `Wrapper command '${wrapperCommand}' not found on the system.${installInstructions ? " " + installInstructions : ""}`; + super(message); + } +} +exports.WrapperError = WrapperError; +/** + * Determines if the specified command exists, either in the `PATH` environment variable or if the + * absolute path exists. + */ +async function wrapperCommandExists(wrapperCommand) { + if (path.isAbsolute(wrapperCommand)) { + return fs.existsSync(wrapperCommand); + } + else { + try { + await which_1.default(wrapperCommand); + return true; + } + catch (_a) { + return false; + } + } +} +exports.wrapperCommandExists = wrapperCommandExists; +/** + * A wrapper for `cross-spawn`'s `spawn` function that wraps the `cmd` with `wrapperCommand` if it + * is specified. + */ +async function spawnWrapper(cmd, args, options) { + options !== null && options !== void 0 ? options : (options = {}); + const { wrapperCommand, wrapperInstructions, ...crossSpawnOptions } = options; + if (wrapperCommand) { + if (!(await wrapperCommandExists(wrapperCommand))) { + throw new WrapperError(wrapperCommand, wrapperInstructions); + } + const augmentedArgs = args ? [cmd, ...args] : [cmd]; + return cross_spawn_promise_1.spawn(wrapperCommand, augmentedArgs, crossSpawnOptions); + } + return cross_spawn_promise_1.spawn(cmd, args, crossSpawnOptions); +} +exports.spawnWrapper = spawnWrapper; +/** + * A helper variant of [[spawnWrapper]] which uses a [[DetermineWrapperFunction]] to + * determine `wrapperCommand`. + */ +async function spawnWrapperFromFunction(wrapperFunction, cmd, args, options) { + let exeOptions = options; + if (!canRunWindowsExeNatively()) { + const wrapperCommand = wrapperFunction(options === null || options === void 0 ? void 0 : options.wrapperCommand); + exeOptions = options ? { ...options, wrapperCommand } : { wrapperCommand }; + } + return spawnWrapper(cmd, args, exeOptions); +} +exports.spawnWrapperFromFunction = spawnWrapperFromFunction; +//# sourceMappingURL=wrapper.js.map
\ No newline at end of file diff --git a/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js.map b/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js.map new file mode 100644 index 0000000..b5cdffb --- /dev/null +++ b/desktop/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/wrapper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qEAIqC;AACrC,uCAAyB;AACzB,oDAA2B;AAC3B,2CAA6B;AAC7B,kDAA0B;AAE1B,SAAgB,wBAAwB;IACtC,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,gBAAK,CAAC;AAC/C,CAAC;AAFD,4DAEC;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC;;;OAGG;IACH,YAAY,cAAsB,EAAE,mBAA4B;QAC9D,MAAM,OAAO,GAAG,oBAAoB,cAAc,6BAChD,mBAAmB,CAAC,CAAC,CAAC,GAAG,GAAG,mBAAmB,CAAC,CAAC,CAAC,EACpD,EAAE,CAAC;QACH,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;CACF;AAXD,oCAWC;AA4BD;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CACxC,cAAsB;IAEtB,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;QACnC,OAAO,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;KACtC;SAAM;QACL,IAAI;YACF,MAAM,eAAK,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;SACb;QAAC,WAAM;YACN,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC;AAbD,oDAaC;AAED;;;GAGG;AACI,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,IAAqB,EACrB,OAA8B;IAE9B,OAAO,aAAP,OAAO,cAAP,OAAO,IAAP,OAAO,GAAK,EAA0B,EAAC;IAEvC,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,GAAG,iBAAiB,EAAE,GAAG,OAAO,CAAC;IAC9E,IAAI,cAAc,EAAE;QAClB,IAAI,CAAC,CAAC,MAAM,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE;YACjD,MAAM,IAAI,YAAY,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;SAC7D;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAEpD,OAAO,2BAAK,CAAC,cAAc,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;KAChE;IAED,OAAO,2BAAK,CAAC,GAAG,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;AAC7C,CAAC;AAnBD,oCAmBC;AAED;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC5C,eAAyC,EACzC,GAAW,EACX,IAAqB,EACrB,OAA8B;IAE9B,IAAI,UAAU,GAAG,OAAO,CAAC;IACzB,IAAI,CAAC,wBAAwB,EAAE,EAAE;QAC/B,MAAM,cAAc,GAAW,eAAe,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,CAAC,CAAC;QACxE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC;KAC5E;IACD,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC;AAZD,4DAYC"}
\ No newline at end of file |